/* texture-eyes. One hue (glacier teal), two faces: Bricolage Grotesque for words, DM Mono for readings.
   One motif: a lens full of grain points. When two reads are the same object, the points lock. */
:root {
  --bg: #eef6f8;
  --panel: #ffffff;
  --ink: #0a2530;
  --muted: #46646f;
  --line: #cfe1e6;
  --grain: #a6cfd9;
  --accent: #00788f;
  --accent-soft: #d9f0f5;
  --on-accent: #ffffff;
  --glow: rgba(0, 120, 143, 0.28);
  --display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #061317;
    --panel: #0d1f25;
    --ink: #e6f6f9;
    --muted: #8fb4bf;
    --line: #1d3640;
    --grain: #2f5a68;
    --accent: #4fd8ee;
    --accent-soft: #12323b;
    --on-accent: #061317;
    --glow: rgba(79, 216, 238, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #061317; --panel: #0d1f25; --ink: #e6f6f9; --muted: #8fb4bf; --line: #1d3640;
  --grain: #2f5a68; --accent: #4fd8ee; --accent-soft: #12323b; --on-accent: #061317;
  --glow: rgba(79, 216, 238, 0.35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font-family: var(--display); font-size: 16px; line-height: 1.45;
  padding: 0 max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-x: hidden;
}
/* paper grain, a few specks, not a texture pack */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5;
  background-image: radial-gradient(var(--line) 1px, transparent 1.2px);
  background-size: 22px 22px; mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 72%);
}
.app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 14px; }
.app > * { min-width: 0; }

.top { display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; min-height: 44px; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand .ring { fill: none; stroke: var(--grain); stroke-width: 1.2; }
.brand .d { fill: var(--grain); }
.brand .a { fill: var(--accent); }
.brand .ln { fill: none; stroke: var(--accent); stroke-width: .5; opacity: .6; }
.brand span { font-weight: 700; font-size: 21px; letter-spacing: -0.02em; font-variation-settings: 'wdth' 90; }

h1 {
  margin: 4px 0 0; font-weight: 800; font-size: clamp(34px, 9.4vw, 52px); line-height: 0.98; letter-spacing: -0.035em;
  text-wrap: balance;
}
.lede { margin: 8px 0 0; color: var(--muted); font-size: 16px; max-width: 34ch; text-wrap: pretty; }

.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; justify-items: center; }
.scope-wrap { width: 100%; aspect-ratio: 1.95 / 1; border-radius: 16px; }
#scope { width: 100%; height: 100%; display: block; max-width: 100%; }
.stage-wrap { position: relative; width: min(100%, 29vh); aspect-ratio: 1 / 1; border-radius: 50%; }
#stage { width: 100%; height: 100%; display: block; touch-action: manipulation; }

.result { display: grid; gap: 6px; min-height: 78px; align-content: start; }
.verdict { margin: 0; font-weight: 800; font-size: clamp(25px, 7vw, 32px); line-height: 1.08; letter-spacing: -0.03em; text-wrap: balance; }
.verdict.lock { color: var(--accent); }
.detail { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: 0; min-height: 1.4em; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.actions.away { visibility: hidden; }
.started .lede { display: none; }
@media (max-width: 899px) { .started .hero { display: none; } }
.started h1 { font-size: 26px; margin-top: 0; letter-spacing: -0.03em; }
.started .hero { margin-bottom: -2px; }
.btn {
  appearance: none; font: inherit; font-weight: 700; font-size: 14px; min-height: 46px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer;
  transition: transform .12s ease, background .12s ease, color .12s ease;
}
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 22px -8px var(--glow); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.quiet { border-color: transparent; color: var(--muted); font-weight: 600; padding: 0 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.tray { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; }
.obj {
  appearance: none; font: inherit; cursor: pointer; display: grid; justify-items: center; gap: 2px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 8px 2px 6px; min-height: 76px; color: var(--ink);
  transition: border-color .15s ease, transform .15s ease, opacity .2s ease;
}
.obj canvas { width: 100%; max-width: 64px; aspect-ratio: 1; display: block; }
.obj span { font-size: 12px; font-weight: 600; color: var(--muted); }
.obj:hover { border-color: var(--accent); transform: translateY(-2px); }
.obj[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.obj[aria-pressed="true"] span { color: var(--ink); }
.obj:disabled { opacity: .45; cursor: default; transform: none; }
.tray-hint { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.foot { margin: 6px 0 0; font-size: 13px; color: var(--muted); font-family: var(--mono); }

@media (min-width: 900px) {
  body { padding-top: 12px; }
  .app { max-width: 1120px; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); grid-template-areas: "top bench" "hero bench" "result bench" "tray bench"; column-gap: 56px; align-content: center; min-height: calc(100vh - 32px); row-gap: 14px; padding-top: 0; }
  .top { grid-area: top; align-self: end; }
  .hero { grid-area: hero; }
  .bench { grid-area: bench; align-self: center; }
  .scope-wrap { width: min(560px, 100%); aspect-ratio: 1.9 / 1; }
  .stage-wrap { width: min(400px, 46vh); }
  .result { grid-area: result; }
  .tray { grid-area: tray; max-width: 520px; }
  h1 { font-size: 64px; }
  .started h1 { font-size: 44px; }
  .started .lede { display: block; }
  .obj canvas { max-width: 76px; }
  .obj { min-height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* link to the real-card results */
.real { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 16px; max-width: 430px;
  border: 1.5px solid var(--accent); border-radius: var(--r); background: var(--accent-soft); color: var(--ink); text-decoration: none; transition: transform .12s ease; }
.real b { display: block; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.real small { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.real em { font-style: normal; font-size: 22px; color: var(--accent); }
.real:hover { transform: translateY(-1px); }
.started .real { display: none; }

.footlink { color: var(--accent); text-decoration: none; font-weight: 500; }
.footlink:hover { text-decoration: underline; }
