/* The atlas board and the pieces of the game played on it (grew out of the QA prototypes /atlas1/ –
   /atlas8/). Layered on /css/app.css; /css/play.css places the pieces on the board. */

html, body { height: 100%; }
body.lab-body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
/* The masthead: the emblem beside two lines, GUESSMINT #N over the tagline, at every width. The
   help button spans both lines; the guess pips stay on the first, so on phones the tagline runs on
   under them and the header keeps its one-row height. */
.lab-top {
  position: relative; flex: none;
  display: grid; align-items: center; column-gap: 10px; row-gap: 4px;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "emb word day tag pips tools"
    "emb line line line line tools";
}
.lab-top .mast-emblem { grid-area: emb; display: block; line-height: 0; }
.lab-top .mast-emblem .emblem { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.lab-top h1.wordmark { grid-area: word; align-self: end; line-height: 1; }
.lab-top .dayno { grid-area: day; align-self: end; line-height: 1; margin-left: -2px; }
.lab-top .lab-tag { grid-area: tag; justify-self: start; align-self: end; max-width: 100%; }
.lab-top .tagline {
  grid-area: line; align-self: start; margin: 0; white-space: nowrap;
  font-size: 11.5px; line-height: 1; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #CFC6B2;
}
.lab-top .lab-pips { grid-area: pips; align-self: end; margin-bottom: 4px; }
.lab-top .tools { grid-area: tools; }
.lab-tag {
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold);
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}
.lab-pips { display: inline-flex; gap: 5px; align-items: center; margin-right: 4px; }
.lab-pips i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #5E6B72; box-sizing: border-box; }
.lab-pips i.used { background: var(--gold); border-color: var(--gold); }
.lab-pips i.now { border: 2px solid var(--gold); }
@media (max-width: 599px) {
  /* phones hide the preview tag, so its column goes and the day number takes the free space */
  .lab-top {
    padding-top: 6px; padding-bottom: 6px; column-gap: 8px; row-gap: 3px;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "emb word day pips tools"
      "emb line line line tools";
  }
  .lab-top .mast-emblem .emblem { width: 31px; height: 31px; }
  .lab-top h1.wordmark { font-size: 17px; }
  .lab-top .dayno { font-size: 16px; justify-self: start; }
  .lab-top .lab-tag { display: none; }
  .lab-top .tagline { font-size: 9.5px; letter-spacing: .12em; }
  .lab-top .lab-pips { margin-bottom: 3px; }
}
/* the smallest phones (320 px): tighter spacing so the first line fits without a sideways scroll */
@media (max-width: 349px) {
  .lab-top { column-gap: 6px; padding-left: 12px; padding-right: 12px; }
  .lab-top .mast-emblem .emblem { width: 28px; height: 28px; }
  .lab-top .wordmark { letter-spacing: .09em; }
  .lab-top .lab-pips { gap: 3px; margin-right: 0; }
  .lab-top .tagline { font-size: 8.5px; letter-spacing: .09em; }
}
#app.lab { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lab-loading { padding: 24px; }

/* ---------------------------------------------------------------- map board */
.lab-board { position: relative; overflow: hidden; background: #D9E3E0; min-height: 0; }
.lab-map { position: absolute; inset: 0; }
.bm { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.bm.panning { cursor: grabbing; }
.bm.over-dot { cursor: pointer; }
.bm-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bm .grat { fill: none; stroke: #C4D3CF; stroke-width: .6; vector-effect: non-scaling-stroke; }
.bm .land { fill: #FBF7EC; stroke: #8C9A90; stroke-width: 1; vector-effect: non-scaling-stroke; }
.bm .borders { fill: none; stroke: #ABB6AC; stroke-width: .7; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.bm-dots circle { stroke: #fff; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.bm-dots circle.used { opacity: .3; }
.bm-dots circle.sel { stroke: var(--slate); stroke-width: 3.5; }
.bm-links line { stroke: var(--slate); stroke-width: 1.6; stroke-dasharray: 6 5; opacity: .65; vector-effect: non-scaling-stroke; }
.bm-pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pin { position: absolute; width: 0; height: 0; }
.pin-dot {
  position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%;
  background: var(--slate); border: 3px solid #FFFDF8; box-shadow: 0 2px 6px rgba(27, 42, 52, .35);
}
.pin.right .pin-dot { background: var(--forest); }
.pin-arrow { position: absolute; left: 0; top: -1.5px; width: 40px; height: 3px; background: var(--slate); transform-origin: 0 50%; }
.pin-arrow::after {
  content: ""; position: absolute; right: -3px; top: -4.5px;
  border-left: 10px solid var(--slate); border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.pin-tag {
  position: absolute; left: 10px; top: -32px; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 10px 2px 3px; border-radius: 999px; background: #FFFDF8; border: 2px solid var(--slate);
  font-size: 13px; font-weight: 500; color: var(--slate); box-shadow: 0 2px 8px rgba(27, 42, 52, .2);
}
.pin-tag b {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 4px; border-radius: 999px;
  background: var(--slate); color: var(--ivory); font-size: 12px;
}
.pin.right .pin-tag { border-color: var(--forest); }
.pin.right .pin-tag b { background: var(--forest); }
.pin.best .pin-tag b { background: var(--gold-deep); }
.pin.latest .pin-tag { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(198, 154, 69, .4), 0 2px 8px rgba(27, 42, 52, .2); }
.pin.answer .pin-star {
  position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; background: var(--gold);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 2px 3px rgba(27, 42, 52, .5));
}
.pin.answer .pin-tag {
  left: 16px; top: -14px; padding: 3px 10px; background: var(--slate); color: var(--ivory); border-color: var(--gold);
  font-family: var(--display); font-size: 15px; letter-spacing: .03em;
}
.bm-tip {
  position: absolute; z-index: 5; max-width: 260px; padding: 8px 12px; border-radius: 8px;
  background: var(--slate); color: var(--ivory); box-shadow: 0 8px 22px rgba(27, 42, 52, .35); pointer-events: none;
}
.bm-tip.off { display: none; }
.bm-tip .tip-name { font-weight: 600; font-size: 15px; }
.bm-tip .tip-meta { font-size: 12px; color: #CFC6B2; }
.bm-tip .tip-act { margin-top: 2px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--gold); }
.bm-tip .tip-act.chosen { color: #9FD3C7; }
.bm-tip .tip-act.used { color: #CFC6B2; font-weight: 400; }

.lab-ctl { position: absolute; z-index: 6; display: flex; gap: 8px; align-items: center; }
.lab-round {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--slate);
  display: inline-grid; place-items: center; font-size: 20px; line-height: 1; box-shadow: 0 4px 12px rgba(27, 42, 52, .12);
}
.lab-round svg { width: 20px; height: 20px; }
.lab-round:hover { border-color: var(--gold); }
.lab-yearbox { position: absolute; z-index: 4; display: grid; gap: 6px; pointer-events: none; }
.lab-yearchip {
  justify-self: start; padding: 6px 12px; border-radius: 999px; background: rgba(255, 253, 248, .95);
  border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--slate);
}
.lab-legend {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 10px; border-radius: 8px; background: rgba(255, 253, 248, .85);
  font-size: 12px; color: var(--muted);
}
.lab-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.lab-board .toast { position: absolute; top: auto; bottom: 56px; z-index: 9; width: max-content; max-width: calc(100% - 24px); }

/* ---------------------------------------------------------------- coin card */
.lab-coin {
  box-sizing: border-box; padding: 10px; display: grid; gap: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
}
.lab-face .face { border-radius: 8px; }
.lab-clue { aspect-ratio: 1 / 1; box-sizing: border-box; padding: 16px; border-radius: 8px; background: var(--amber); overflow: auto; }
.lab-clue h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lab-clue p { margin: 0; }
.lab-coinrow { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.lab-faceseg { display: inline-flex; border: 1px solid var(--silver); border-radius: 999px; overflow: hidden; background: var(--card); }
.lab-faceseg button {
  border: 0; background: transparent; padding: 0 12px; min-height: 34px; font-size: 12px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--slate);
}
.lab-faceseg button[aria-pressed="true"] { background: var(--slate); color: var(--ivory); }
.lab-faceseg button:disabled { color: #9AA19A; cursor: not-allowed; }
.lab-seglock { font-size: 12px; color: var(--muted); }
.lab-coin details.credit { font-size: 12px; }

/* ---------------------------------------------------------------- composer */
.lab-count { margin: 0; font-family: var(--display); font-size: 19px; }
.lab-issuer { min-width: 0; }
.lab-guess { padding: 0 26px; }
.lab-when { gap: 0; min-width: 0; }
.lab-whenhead { display: flex; align-items: baseline; gap: 12px; }
.lab-whenhead .fieldlabel { flex: none; }
.lab-ro { flex: 1; }
.lab-ro .readout { font-size: 20px; white-space: nowrap; }
.lab-tipsbtn { height: 34px; padding: 0 12px; font-size: 13px; }
.lab-sliderslot .slider { margin-top: 2px; }
.lab-ticks { position: absolute; left: 0; right: 0; top: 0; height: 0; pointer-events: none; }
.lab-tick {
  position: absolute; top: -4px; transform: translateX(-50%); width: 20px; height: 20px; box-sizing: border-box;
  border-radius: 50%; background: var(--card); border: 2px solid var(--muted); color: var(--slate);
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.lab-issuer .lockchip.cheer { min-height: 48px; }
.lab-latest {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 7px 12px; border-radius: 8px;
  background: var(--amber); border: 1px solid #DCC48E;
}
.lab-latest .lbl { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #6E4B18; }
.lab-latest .who { font-weight: 600; }
.lab-latest .pct { margin-left: auto; font-family: var(--display); font-size: 19px; }
.flash { animation: lab-flash 1.2s ease-out; }
@keyframes lab-flash { 0% { box-shadow: 0 0 0 0 rgba(198, 154, 69, .75); } 100% { box-shadow: 0 0 0 12px rgba(198, 154, 69, 0); } }

/* ---------------------------------------------------------------- history */
.lab-history { display: grid; gap: 8px; align-content: start; min-height: 0; }
.lab-hhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lab-htitle { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lab-hcount { color: var(--slate); }
.lab-hctl { display: inline-flex; gap: 6px; }
.lab-seg-sm { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.lab-seg-sm button { border: 0; background: transparent; padding: 3px 10px; min-height: 28px; font-size: 12px; color: var(--muted); }
.lab-seg-sm button[aria-pressed="true"] { background: var(--slate); color: var(--ivory); font-weight: 600; }
.lab-rows { display: grid; gap: 6px; }
.lab-row {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "n what pct" "n res pct"; gap: 4px 10px;
  align-items: center; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; font: inherit; color: inherit;
  background: var(--plate); border: 1px solid var(--line); cursor: pointer;
}
.lab-row:hover { border-color: var(--gold); }
.lab-row .gn {
  grid-area: n; display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px;
  background: var(--parchment); border: 1px solid #DCC48E; font-size: 12px; font-weight: 700; color: #6E4B18;
}
.lab-row.is-best .gn { background: var(--gold-deep); border-color: var(--gold-deep); color: var(--ivory); }
.lab-row.is-latest { border-color: var(--gold); background: #FBF2DA; }
.lab-what { grid-area: what; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-width: 0; }
.lab-what small { color: var(--muted); }
.lab-res { grid-area: res; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.lab-res .chip { font-size: 13px; padding: 2px 9px; }
.lab-row .pct { grid-area: pct; font-family: var(--display); font-size: 18px; }
.lab-tag { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; }
.lab-tag.latest { background: var(--gold); color: #3A2A0E; }
.lab-tag.best { background: var(--gold-deep); color: var(--ivory); }
.lab-empty { margin: 0; }
.lab-tips { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }

/* compact strip of tries */
.lab-chips { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lab-chips.empty .lab-seg-sm { display: none; }
.lab-chiplist { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; padding: 2px; }
.lab-chiplist::-webkit-scrollbar { display: none; }
.lab-trychip {
  flex: none; display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px 0 4px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font: inherit; font-size: 13px; color: var(--slate); white-space: nowrap;
  box-shadow: 0 2px 8px rgba(27, 42, 52, .12);
}
.lab-trychip b {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--slate);
  color: var(--ivory); font-size: 12px;
}
.lab-trychip.is-best b { background: var(--gold-deep); }
.lab-trychip.is-latest { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(198, 154, 69, .45); }

/* ---------------------------------------------------------------- end of round */
.lab-after { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lab-verdict { margin: 0; font-family: var(--display); font-size: 22px; }
.lab-reveal .reveal { display: grid; gap: 12px; }
body.lab-finished .lab-composer-live { display: none !important; }

/* the Back button pulses when the back unlocks, so it is not missed */
.lab-faceseg button.lab-unlock { animation: lab-unlock .6s ease-in-out 6; }
@keyframes lab-unlock {
  0%, 100% { background: transparent; color: var(--slate); box-shadow: none; }
  50% { background: var(--gold); color: #3A2A0E; box-shadow: inset 0 0 0 2px #E7C46F; }
}
@media (prefers-reduced-motion: reduce) {
  .lab-faceseg button.lab-unlock { animation: none; background: var(--gold); color: #3A2A0E; }
}

/* one-line rows (opts.compactRows) */
.lab-rows:has(.compact) { gap: 4px; container-type: inline-size; }
.lab-row.compact {
  grid-template-columns: 22px minmax(0, 1fr) auto auto; grid-template-areas: none;
  gap: 5px; height: 30px; padding: 0 5px 0 4px; font-size: 13px; white-space: nowrap;
}
.lab-row.compact .gn { grid-area: auto; min-width: 22px; height: 22px; padding: 0; font-size: 11px; }
.lab-row.compact .lab-name { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.lab-row.compact .lab-cell {
  padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.lab-row.compact .lab-cell.ok { background: var(--tint); border-color: #BCD0CB; color: var(--deep); }
.lab-row.compact .lab-cell.near { background: var(--amber); border-color: #DCC48E; color: #6E4B18; }
.lab-row.compact .lab-cell.far { background: var(--slate); border-color: var(--slate); color: var(--ivory); }
.lab-row.compact .pct { display: none; grid-area: auto; font-size: 14px; text-align: right; min-width: 34px; }
@container (min-width: 330px) {
  .lab-row.compact { grid-template-columns: 22px minmax(0, 1fr) auto auto auto; }
  .lab-row.compact .pct { display: block; }
}

/* names cut short in a one-line row scroll left and right under the mouse */
.lab-row.compact .lab-name-in { white-space: nowrap; }
.lab-row.compact.marquee .lab-name { text-overflow: clip; }
.lab-row.compact.marquee .lab-name-in { display: inline-block; width: max-content; animation: lab-marquee 3s ease-in-out infinite alternate; }
@keyframes lab-marquee { 0%, 12% { transform: translateX(0); } 88%, 100% { transform: translateX(var(--shift, 0)); } }
@media (prefers-reduced-motion: reduce) { .lab-row.compact.marquee .lab-name-in { animation: none; } }

/* the festive reveal (opts.festive, when the coin was solved) */
.lab-festive {
  position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; padding: 16px 18px;
  border-radius: 12px; border: 2px solid var(--gold); overflow: hidden;
  background: linear-gradient(135deg, #FBF2DA 0%, #F3E4BD 55%, #EAD39C 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 253, 248, .7), 0 8px 22px rgba(143, 106, 44, .22);
}
.lab-medal {
  width: 64px; height: 64px; background: url("/brand/emblem-v1.svg") center / contain no-repeat;
  filter: drop-shadow(0 3px 4px rgba(110, 75, 24, .35)); animation: lab-medal 1.1s cubic-bezier(.2, .9, .3, 1.4) both;
}
@keyframes lab-medal { 0% { transform: scale(.4) rotate(-25deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.lab-festive-text p { margin: 0; }
.lab-festive-title { font-family: var(--display); font-size: 28px; line-height: 1.1; letter-spacing: .03em; color: var(--slate); }
.lab-festive-praise { margin-top: 2px !important; font-size: 17px; font-weight: 600; color: #6E4B18; }
.lab-festive-sub { margin-top: 2px !important; font-size: 14px; color: var(--slate); }
.reveal.is-festive .line { margin-top: 2px; }
.lab-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.lab-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: lab-fall 2.4s cubic-bezier(.25, .6, .45, 1) forwards; }
@keyframes lab-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--dx, 0), 520px, 0) rotate(var(--rot, 540deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .lab-medal, .lab-confetti i { animation: none; } .lab-confetti { display: none; } }
