/* ═══════════════════════════════════════════════════════════════════
   GT200 · The Gem Identification Challenge — gem.jdmis.edu.sg/play
   Design system: "the dark laboratory".
   A gem lab is a dark room where light IS the instrument. Colour enters
   only as measured light: stone colours, spectrum bands, UV glow.
   Accent is brass (instrument metal), never neon.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --ink:        #0e0a13;   /* lab dark, faintly violet */
  --ink-2:      #151020;   /* raised panel */
  --ink-3:      #1d1629;   /* hover panel */
  --line:       #2c2340;   /* hairlines */
  --line-soft:  #231b33;
  --lamp:       #f3ead7;   /* warm lamplight text */
  --lamp-dim:   #b9aec6;   /* secondary text */
  --lamp-faint: #8b7fa0;   /* tertiary */
  --brass:      #d9a441;   /* instrument brass */
  --brass-soft: #a97f2f;
  --ok:         #7fd8a4;
  --bad:        #e26d7e;
  --paper:      #f7f1e4;   /* notebook paper (lab book) */
  --paper-ink:  #2a2418;

  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "Spline Sans Mono", ui-monospace, Consolas, monospace;

  --r: 14px;
  --shadow: 0 18px 50px rgba(0,0,0,.55);
  --glow-brass: 0 0 24px rgba(217,164,65,.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(1200px 700px at 70% -10%, #1c1430 0%, transparent 60%),
    radial-gradient(900px 600px at 10% 110%, #171028 0%, transparent 55%),
    var(--ink);
  color: var(--lamp);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
::selection { background: rgba(217,164,65,.35); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 4px; }

/* ── spectrum hairline: the page's signature rule. Real spectrum order,
      used only where light is being measured. ─────────────────────── */
.spec-rule {
  height: 3px; border-radius: 2px; border: 0;
  background: linear-gradient(90deg,
    #3b1f5e 0%, #4b2f9e 12%, #2f6bd8 26%, #2fb3c9 38%, #3fae62 50%,
    #c9c33f 62%, #d9822f 74%, #c93b3b 86%, #8e2f52 100%);
  opacity: .85;
}

/* ── header ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px clamp(14px, 3vw, 28px);
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .brand {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.topbar .logo { height: 30px; width: auto; }
.topbar .brand .mark {
  font-family: var(--font-display);
  font-weight: 900; font-size: 20px; letter-spacing: .02em;
  color: var(--lamp); white-space: nowrap;
}
.topbar .brand .mark em { font-style: normal; color: var(--brass); }
.topbar .brand .sub {
  font-family: var(--font-mono); font-size: 11px; color: var(--lamp-faint);
  letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.topbar .spacer { flex: 1; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
  color: var(--lamp-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; background: var(--ink-2);
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.chip-btn:hover { color: var(--lamp); border-color: var(--brass-soft); }
.chip-btn[aria-pressed="true"] { color: var(--brass); border-color: var(--brass-soft); background: rgba(217,164,65,.08); }
.chip-btn .ic { width: 15px; height: 15px; flex: none; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .topbar .brand .sub { display: none; }
  .chip-btn { padding: 7px 11px; font-size: 11.5px; }
}

.date-cell .soon { color: var(--brass); font-style: normal; font-weight: 600; margin-left: 2px; }
.win-cta-line { margin: 2px 0 6px; font-size: 14px; color: var(--lamp-dim); }
.win-cta-line a { color: var(--brass); font-weight: 600; }

/* ── screens ────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; animation: screenIn .45s cubic-bezier(.2,.7,.2,1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── intro ──────────────────────────────────────────────────────── */
.intro { position: relative; min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 8px 20px 40px; }
.intro .stage { position: relative; width: min(680px, 94vw); text-align: center; }
.intro canvas { margin: 0 auto; width: min(280px, 52vw, 34vh); aspect-ratio: 1; height: auto; touch-action: none; }
.intro-cut {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--brass); opacity: 0; transform: translateY(4px); transition: opacity .5s, transform .5s;
  min-height: 18px; margin-top: -6px;
}
.intro-cut.in { opacity: .92; transform: none; }
.intro .eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .35em;
  text-transform: uppercase; color: var(--brass); margin-bottom: 8px;
}
.intro h1 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144, "WONK" 1, "SOFT" 40;
  font-size: clamp(38px, 7.2vw, 68px); line-height: .98; font-weight: 640;
  letter-spacing: -.015em; margin: 4px 0 2px;
}
.intro h1 .accent { color: var(--brass); font-style: italic; }
.intro .lede { color: var(--lamp-dim); max-width: 52ch; margin: 10px auto 0; font-size: clamp(14.5px, 2.2vw, 16.5px); }
.intro .stats {
  display: flex; justify-content: center; gap: clamp(14px, 4vw, 40px); flex-wrap: wrap;
  margin: 14px 0 18px; font-family: var(--font-mono); font-size: 12.5px; color: var(--lamp-faint);
  letter-spacing: .06em;
}
.intro .stats b { display: block; font-size: 24px; color: var(--lamp); font-weight: 500; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 700; letter-spacing: .02em;
  color: #241a08; background: linear-gradient(180deg, #ecc46a, var(--brass) 55%, #b9862f);
  border-radius: 999px; padding: 15px 34px;
  box-shadow: var(--glow-brass), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .16s cubic-bezier(.2,.8,.3,1.4), box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); text-decoration: none; }
.btn-primary:active { transform: translateY(0) scale(.99); }
.btn-primary .ic { width: 18px; height: 18px; }

.audio-chip {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 20px;
  border: 1px solid var(--line); background: var(--ink-2);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; color: var(--lamp-dim);
}
.audio-chip.playing { color: var(--brass); border-color: var(--brass-soft); }
.audio-chip .eq { display: inline-flex; gap: 2.5px; align-items: flex-end; height: 14px; }
.audio-chip .eq i { width: 3px; background: currentColor; border-radius: 2px; height: 5px; }
.audio-chip.playing .eq i { animation: eq 1s infinite ease-in-out; }
.audio-chip.playing .eq i:nth-child(2) { animation-delay: .18s; }
.audio-chip.playing .eq i:nth-child(3) { animation-delay: .36s; }
.audio-chip.playing .eq i:nth-child(4) { animation-delay: .1s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 13px; } }

.intro .footnote { margin-top: 34px; font-size: 12.5px; color: var(--lamp-faint); }
.intro .footnote a { color: var(--lamp-dim); }


/* leaderboard/voucher hook on the intro */
.compete {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  margin: 2px auto 16px; max-width: 52ch;
  font-size: 13.5px; color: var(--lamp-dim);
  border: 1px dashed rgba(217, 164, 65, .45); border-radius: 999px;
  padding: 8px 18px; background: rgba(217, 164, 65, .06);
}
.compete svg { width: 17px; height: 17px; flex: none; color: var(--brass); }
.compete b { color: var(--brass); }

/* ── tray (stone selection) ─────────────────────────────────────── */
.wrap { max-width: 1180px; margin: 0 auto; padding: clamp(16px, 3vw, 34px); }
.tray-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.tray-head h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 4.4vw, 40px); letter-spacing: -.01em; }
.tray-head .hint { color: var(--lamp-faint); font-size: 13.5px; max-width: 44ch; }
.tray-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px;
}
.stone-card {
  position: relative; text-align: left;
  background: linear-gradient(180deg, var(--ink-2), #120d1c);
  border: 1px solid var(--line-soft); border-radius: var(--r);
  padding: 16px 14px 14px;
  transition: transform .18s cubic-bezier(.2,.8,.3,1.3), border-color .18s, box-shadow .18s;
  overflow: hidden;
}
.stone-card:hover:not(:disabled) { transform: translateY(-4px); border-color: var(--brass-soft); box-shadow: var(--shadow); }
.stone-card:disabled { opacity: .85; cursor: default; }
.stone-card.solved { border-color: rgba(127,216,164,.4); }
.stone-card canvas { width: 100%; height: auto; aspect-ratio: 1.55; }
.stone-card img { width: 100%; height: auto; aspect-ratio: 1.55; object-fit: cover; user-select: none; }
.stone-card .no {
  position: absolute; top: 10px; left: 12px;
  font-family: var(--font-mono); font-size: 11px; color: var(--lamp-faint); letter-spacing: .12em;
}
.stone-card .diff { position: absolute; top: 10px; right: 12px; color: var(--brass); font-size: 11px; letter-spacing: 2px; }
.stone-card .nm { font-family: var(--font-display); font-size: 17px; font-weight: 560; margin-top: 4px; letter-spacing: .005em; }
.stone-card .lbl { color: var(--lamp-dim); font-size: 12.5px; margin-top: 2px; min-height: 2.6em; }
.stone-card .best { margin-top: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--ok); }
.stone-card .nm .s { display: none; }
.stone-card.solved .nm .q { display: none; }
.stone-card.solved .nm .s { display: inline; }

/* ── round (the bench) ──────────────────────────────────────────── */
.round-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.back-link { color: var(--lamp-faint); font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 8px; }
.back-link:hover { color: var(--lamp); background: var(--ink-2); text-decoration: none; }
.round-title { font-family: var(--font-display); font-size: clamp(20px,3.4vw,30px); font-weight: 600; }
.observed { font-family: var(--font-mono); color: var(--lamp-dim); font-size: 12.5px; letter-spacing: .04em; }

.bench {
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
}
.bench > div { min-width: 0; }
@media (max-width: 900px) { .bench { grid-template-columns: minmax(0, 1fr); } }

/* specimen stage */
.stage-panel {
  position: relative; border: 1px solid var(--line-soft); border-radius: var(--r);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(243,234,215,.05), transparent 55%),
    linear-gradient(180deg, var(--ink-2), #110c1a);
  padding: 18px 18px 14px; overflow: hidden;
}
.stage-panel .plate-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--lamp-faint); text-align: center; margin-bottom: 2px;
}
.stage-panel canvas { width: 100%; height: auto; aspect-ratio: 1.15; touch-action: none; cursor: grab; }
.stage-panel canvas:active { cursor: grabbing; }
.stage-panel .drag-hint { text-align: center; font-size: 11.5px; color: var(--lamp-faint); margin-top: 2px; }

.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.meter {
  border: 1px solid var(--line-soft); background: rgba(0,0,0,.25); border-radius: 10px;
  padding: 9px 12px;
}
.meter .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--lamp-faint); }
.meter .v { font-family: var(--font-mono); font-size: 21px; color: var(--lamp); margin-top: 2px; }
.meter .v small { font-size: 12px; color: var(--lamp-faint); }
.meter.time .v { color: var(--brass); }

/* lab notebook */
.notebook {
  border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden;
  background: var(--paper); color: var(--paper-ink);
}
.notebook .nb-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .26em; text-transform: uppercase;
  background: #efe6d0; border-bottom: 1px dashed #d8ccb0; color: #6b5d3f;
}
.notebook table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.notebook th, .notebook td { padding: 7px 10px; text-align: left; border-bottom: 1px dashed #ddd2b8; vertical-align: top; }
.notebook th { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #857550; font-weight: 600; }
.notebook td.empty { color: #b3a887; }
.notebook tr:last-child td { border-bottom: 0; }

/* suspects cloud */
.cloud-panel { border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--ink-2); padding: 16px 18px; }
.cloud-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cloud-head h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.cloud-head .count { font-family: var(--font-mono); font-size: 12px; color: var(--lamp-faint); }
.cloud-head .count b { color: var(--brass); font-size: 15px; }
.cloud { position: relative; display: flex; flex-wrap: wrap; gap: 7px 9px; align-content: flex-start; min-height: 90px; }
.suspect {
  --sz: 13px;
  font-family: var(--font-display); font-weight: 540;
  font-size: var(--sz); line-height: 1.15; letter-spacing: .01em;
  color: var(--lamp);
  border: 1px solid var(--line); background: rgba(255,255,255,.025);
  border-radius: 9px; padding: 5px 10px;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .5s;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.suspect.lead { color: var(--brass); border-color: var(--brass-soft); box-shadow: 0 0 14px rgba(217,164,65,.15); }
.suspect.gone {
  color: var(--lamp-faint); border-color: transparent; background: transparent;
  text-decoration: line-through; text-decoration-color: rgba(226,109,126,.6);
  opacity: .32; transform: translateY(9px) rotate(-1.2deg) scale(.92);
  pointer-events: none;
}
.suspect.gone { font-size: 11px !important; }
.suspect.gone.fall { animation: chipFall .8s cubic-bezier(.3,.7,.4,1) both; }
.suspect:not(.gone) { animation: chipAlive .5s ease both; }
@keyframes chipFall { 0% { opacity: 1; transform: none; } 100% { opacity: .32; transform: translateY(9px) rotate(-1.2deg) scale(.92); } }
@keyframes chipAlive { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.cloud-empty { color: var(--lamp-faint); font-size: 13px; font-style: italic; }
.one-left-note {
  margin-top: 12px; color: var(--brass); font-size: 13.5px; font-weight: 600;
  display: flex; gap: 8px; align-items: center; min-height: 20px;
}
.one-left-note .ic { width: 16px; height: 16px; flex: none; animation: pulseStar 1.6s infinite; }
@keyframes pulseStar { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: .7; } }

/* tool bench */
.toolbelt-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--lamp-faint); margin: 22px 0 10px; display: flex; align-items: center; gap: 12px;
}
.toolbelt-label::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.tools-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-width: 0; max-width: 100%;
}
@media (min-width: 1021px) { .tools-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1020px) { .tools-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .tools-row { grid-template-columns: repeat(2, 1fr); gap: 8px; } .tool-card .ticon { height: 92px; } }
.tool-card {
  position: relative; text-align: left; width: auto; min-width: 0;
  border: 1px solid var(--line-soft); border-radius: var(--r);
  background: linear-gradient(180deg, var(--ink-2), #120d1c);
  padding: 13px 13px 12px;
  transition: transform .16s cubic-bezier(.2,.8,.3,1.3), border-color .16s, opacity .3s, box-shadow .2s;
}
.tool-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--brass-soft); box-shadow: var(--shadow); }
.tool-card:disabled { opacity: .45; cursor: not-allowed; }
.tool-card.done { opacity: .5; }
.tool-card .ticon {
  position: relative; height: 108px; margin-bottom: 9px;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #0a0712;
}
.tool-card .ticon::before {
  content: ""; position: absolute; inset: -55%;
  background: conic-gradient(from 0deg,
    rgba(217,164,65,.14), rgba(79,143,224,.10), rgba(79,187,122,.10),
    rgba(138,111,224,.14), rgba(226,109,126,.10), rgba(217,164,65,.14));
  animation: iconSwirl 16s linear infinite;
}
.tool-card .ticon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 6px; }
@keyframes iconSwirl { to { transform: rotate(360deg); } }
.tool-card .tname { font-family: var(--font-display); font-size: 16.5px; font-weight: 600; letter-spacing: .005em; }
.tool-card .tmeasures { color: var(--lamp-dim); font-size: 12px; margin-top: 3px; min-height: 2.7em; }
.tool-card .tmeta { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.tool-card .tmin {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--brass);
  border: 1px solid rgba(217,164,65,.35); border-radius: 999px; padding: 2px 9px;
}
.tool-card .tstate { font-family: var(--font-mono); font-size: 10.5px; color: var(--ok); letter-spacing: .08em; }
.tool-card.blocked .tmin { color: var(--bad); border-color: rgba(226,109,126,.4); }

/* identify bar */
.identify-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border: 1px solid rgba(217,164,65,.4); border-radius: var(--r);
  background: linear-gradient(180deg, rgba(217,164,65,.09), rgba(217,164,65,.03));
  padding: 13px 18px; margin-top: 16px;
}
.identify-bar .txt { font-size: 14px; color: var(--lamp-dim); }
.identify-bar .txt b { color: var(--lamp); }

/* ── tool sheet (bottom sheet / dialog) ─────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8,5,14,.72); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.sheet {
  width: min(760px, 100%); max-height: 92dvh; overflow-y: auto;
  background: linear-gradient(180deg, #191325, var(--ink-2) 120px);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 22px clamp(16px, 4vw, 30px) 30px;
  box-shadow: var(--shadow);
  animation: sheetUp .34s cubic-bezier(.2,.8,.25,1);
}
@media (min-width: 900px) {
  .sheet-backdrop { align-items: center; padding: 20px; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--line); }
  @keyframes sheetUp { from { opacity: 0; transform: translateY(24px) scale(.98); } }
}
@keyframes sheetUp { from { transform: translateY(60px); } }
.sheet .grab { width: 44px; height: 4px; border-radius: 4px; background: var(--line); margin: -8px auto 16px; }
@media (min-width: 900px) { .sheet .grab { visibility: hidden; margin-bottom: 6px; } }
.sheet-head { display: flex; align-items: start; gap: 14px; }
.sheet-head .ticon-big {
  position: relative; width: 104px; height: 104px; flex: none;
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0a0712;
}
.sheet-head .ticon-big::before {
  content: ""; position: absolute; inset: -55%;
  background: conic-gradient(from 0deg,
    rgba(217,164,65,.14), rgba(79,143,224,.10), rgba(79,187,122,.10),
    rgba(138,111,224,.14), rgba(226,109,126,.10), rgba(217,164,65,.14));
  animation: iconSwirl 16s linear infinite;
}
.sheet-head .ticon-big img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 7px; }
.sheet-head h3 { font-family: var(--font-display); font-size: clamp(22px, 4vw, 30px); font-weight: 640; letter-spacing: -.01em; }
.sheet-head .tdoes { color: var(--lamp-dim); font-size: 14px; margin-top: 4px; max-width: 46ch; }
.sheet-head .tmin-big {
  margin-left: auto; flex: none; text-align: right;
  font-family: var(--font-mono); font-size: 12px; color: var(--brass);
}
.sheet-head .tmin-big b { display: block; font-size: 22px; }
.sheet-close { position: absolute; top: 14px; right: 14px; color: var(--lamp-faint); font-size: 22px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.sheet-close:hover { color: var(--lamp); background: var(--ink-3); }

.instrument-view {
  margin: 18px 0 6px; border: 1px solid var(--line-soft); border-radius: var(--r);
  background: #0a0712; overflow: hidden; position: relative;
}
.instrument-view svg { width: 100%; height: auto; display: block; }

.result-card {
  border: 1px solid rgba(217,164,65,.4); border-radius: var(--r);
  background: rgba(217,164,65,.06); padding: 14px 16px; margin-top: 14px;
}
.result-card .rc-eyebrow { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--brass); margin-bottom: 6px; }
.result-card .rc-main { font-family: var(--font-display); font-size: clamp(19px, 3.6vw, 26px); font-weight: 600; }
.result-card .rc-why { color: var(--lamp-dim); font-size: 13.5px; margin-top: 6px; }
.result-card .rc-quote {
  margin-top: 10px; padding-left: 12px; border-left: 2px solid var(--line);
  font-size: 12.5px; color: var(--lamp-faint); font-style: italic;
}
.result-card .rc-narrow { margin-top: 10px; font-size: 13px; color: var(--ok); font-weight: 600; }

.sheet-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.btn-secondary {
  border: 1px solid var(--line); border-radius: 999px; padding: 11px 22px;
  font-size: 14.5px; font-weight: 600; color: var(--lamp-dim);
}
.btn-secondary:hover { color: var(--lamp); border-color: var(--brass-soft); }
.btn-primary.small { padding: 12px 24px; font-size: 15px; }
.btn-run { width: 100%; justify-content: center; }

/* running state animation text */
.running-note { text-align: center; color: var(--lamp-faint); font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; margin: 10px 0 2px; min-height: 18px; }

/* ── identify modal ─────────────────────────────────────────────── */
.guess-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 9px; margin-top: 16px; max-height: 46dvh; overflow-y: auto; }
.guess-btn {
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; text-align: left;
  font-family: var(--font-display); font-size: 16px; font-weight: 560;
  background: var(--ink-2); transition: border-color .15s, transform .15s;
}
.guess-btn:hover { border-color: var(--brass); transform: translateY(-2px); }
.guess-btn.all { color: var(--lamp-faint); font-size: 13.5px; font-family: var(--font-body); }
.shake { animation: shake .5s; }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

/* ── win overlay ────────────────────────────────────────────────── */
.win-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(8,5,14,.9); display: grid; place-items: center; padding: 18px; overflow-y: auto; animation: fadeIn .4s; }
.win-card { width: min(680px, 100%); text-align: center; position: relative; }
.win-card canvas { width: min(300px, 70vw); height: min(300px, 70vw); margin: 0 auto; }
.win-card .ribbon { font-family: var(--font-mono); letter-spacing: .34em; text-transform: uppercase; font-size: 12px; color: var(--brass); }
.win-card h2 { font-family: var(--font-display); font-variation-settings: "opsz" 144, "WONK" 1; font-size: clamp(38px, 9vw, 66px); font-weight: 680; letter-spacing: -.02em; margin: 6px 0 2px; }
.win-card .sub { color: var(--lamp-dim); }
.win-stats { display: flex; justify-content: center; gap: 34px; margin: 20px 0; flex-wrap: wrap; }
.win-stats .ws { font-family: var(--font-mono); }
.win-stats .ws .k { font-size: 10.5px; letter-spacing: .22em; color: var(--lamp-faint); text-transform: uppercase; }
.win-stats .ws .v { font-size: 30px; color: var(--brass); }
.win-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0 4px; }
.win-form input {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--lamp);
  border-radius: 999px; padding: 13px 20px; font: inherit; width: min(280px, 70vw); text-align: center;
}
.win-form input:focus { outline: none; border-color: var(--brass); }
.board-mini { margin: 16px auto 0; max-width: 380px; text-align: left; }
.board-mini table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12.5px; }
.board-mini td { padding: 5px 8px; border-bottom: 1px dashed var(--line-soft); }
.board-mini td.m { color: var(--brass); text-align: right; }
.board-mini tr.you td { color: var(--ok); }

/* gem profile flip */
.profile { text-align: left; background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 16px 18px; margin-top: 18px; }
.profile .pv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 8px; }
.profile .pv { border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 11px; }
.profile .pv .k { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--lamp-faint); }
.profile .pv .v { font-family: var(--font-mono); font-size: 13.5px; margin-top: 3px; }
.profile .pv .v.long { font-family: var(--font-body); font-size: 12.5px; color: var(--lamp-dim); line-height: 1.4; }
.profile h4 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--brass); }

/* ── confetti ───────────────────────────────────────────────────── */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }

/* ── sell panel ─────────────────────────────────────────────────── */
.sell {
  border: 1px solid rgba(217,164,65,.5); border-radius: var(--r);
  background:
    radial-gradient(90% 140% at 100% 0%, rgba(217,164,65,.14), transparent 60%),
    linear-gradient(180deg, #1a1426, var(--ink-2));
  padding: clamp(18px, 3.4vw, 30px); margin-top: 26px; position: relative; overflow: hidden;
}
.sell .close-x { position: absolute; top: 10px; right: 12px; color: var(--lamp-faint); font-size: 20px; padding: 6px; border-radius: 50%; }
.sell .close-x:hover { color: var(--lamp); background: var(--ink-3); }
.sell .eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--brass); }
.sell h3 { font-family: var(--font-display); font-size: clamp(22px, 4.2vw, 34px); font-weight: 640; letter-spacing: -.01em; margin: 6px 0 4px; }
.sell h3 em { font-style: italic; color: var(--brass); }
.sell .lede { color: var(--lamp-dim); font-size: 14.5px; max-width: 60ch; }
.sell-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0 6px; }
.price-cell { border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: rgba(0,0,0,.28); }
.price-cell .pn { font-size: 12.5px; font-weight: 600; color: var(--lamp); }
.price-cell .pp { font-family: var(--font-display); font-size: 23px; font-weight: 640; color: var(--brass); margin-top: 3px; }
.price-cell .pp small { font-size: 12px; color: var(--lamp-faint); font-weight: 400; }
.price-cell .ph { font-family: var(--font-mono); font-size: 10.5px; color: var(--lamp-faint); margin-top: 3px; }
.price-cell.best { border-color: var(--brass); box-shadow: var(--glow-brass); }
.sell .dates { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 2px; }
.date-cell { display: inline-flex; gap: 8px; align-items: center; border: 1px dashed var(--brass-soft); border-radius: 10px; padding: 8px 13px; font-size: 13px; }
.date-cell b { color: var(--brass); }
.sell .fineprint { font-size: 11.5px; color: var(--lamp-faint); margin-top: 10px; }
.sell-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

/* ── leaderboard screen ─────────────────────────────────────────── */
.board-gems { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.board-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 14px; }
.board-table th { text-align: left; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--lamp-faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.board-table td { padding: 9px 10px; border-bottom: 1px dashed var(--line-soft); }
.board-table td.m, .board-table th.m { text-align: right; }
.board-table td.m { color: var(--brass); }
.board-table tr.top1 td { font-size: 15px; }
.board-empty { color: var(--lamp-faint); font-style: italic; padding: 18px 4px; }

/* ── footer ─────────────────────────────────────────────────────── */
.sitefoot { border-top: 1px solid var(--line-soft); margin-top: 40px; padding: 22px clamp(16px, 3vw, 30px) 30px; color: var(--lamp-faint); font-size: 12.5px; }
.sitefoot .cols { display: flex; gap: 24px; flex-wrap: wrap; justify-content: space-between; max-width: 1180px; margin: 0 auto; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); z-index: 90; background: var(--ink-3); color: var(--lamp); border: 1px solid var(--line); border-radius: 999px; padding: 11px 20px; font-size: 13.5px; opacity: 0; transition: .3s; pointer-events: none; max-width: 88vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  .tool-card .ticon::before, .sheet-head .ticon-big::before { animation: none; opacity: .5; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
