/* Where's Rocko? — Reveal Rocko (connect-the-dots).
   Loaded by /reveal/ on TOP of the shared /styles.css design tokens — same
   pattern as /spot/spot.css. Uses the warm "Creative Library" system
   (paper / surface / ink / brand #F04E37), NOT the old navy game chrome.
   Category is MATH, so accents use the math hue. */
:root {
  /* math-category hue, mirrored from home.css so /reveal/ can use it standalone */
  --c-math: #DD8E06;
  --dot-done: #F04E37;   /* connected dot + line (brand) */
}
@media (prefers-color-scheme: dark) {
  :root { --c-math: #F0B23C; }
}

body.reveal main { max-width: 1000px; margin: 0 auto; padding: 0 20px 64px; }

/* ============ picture select ============ */
.reveal-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 30px; flex-wrap: wrap;
  margin: 26px 0 30px; padding: 34px 36px; border-radius: 26px;
  background: radial-gradient(120% 150% at 100% 0%,
    color-mix(in srgb, var(--c-math) 18%, var(--surface)) 0%, var(--surface) 60%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.reveal-hero-art {
  flex: 0 0 auto; width: 116px; height: 116px;
  filter: drop-shadow(0 10px 20px rgba(30,22,14,.18));
}
.reveal-hero-copy { flex: 1 1 300px; min-width: 0; }
.reveal-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--c-math); padding: 4px 11px; border-radius: 999px; margin: 0 0 12px;
}
.reveal-hero h1 { font-size: clamp(1.9rem, 4.8vw, 3rem); margin: 0 0 .26em; }
.reveal-hero h1 .accent { color: var(--brand); }
.reveal-hero .lede { font-size: 1.06rem; font-weight: 700; color: var(--ink-soft); margin: 0; max-width: 52ch; }
.reveal-hero .lede strong { color: var(--ink); }

.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.level-card {
  display: flex; flex-direction: column; text-align: left; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
.level-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.level-thumb {
  position: relative; display: grid; place-items: center;
  height: 150px; padding: 10px; background: var(--surface-2);
}
.level-thumb .thumb-svg { width: 100%; height: 100%; display: block; }
.level-meta { padding: 13px 16px 4px; display: flex; flex-direction: column; gap: 2px; }
.level-name { font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; }
.level-tag { color: var(--ink-soft); font-size: .88rem; font-weight: 700; }

/* difficulty chips (mirrors /spot/) */
.diff-row { display: flex; gap: 8px; padding: 8px 16px 16px; margin-top: auto; }
.diff-btn {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font: inherit; cursor: pointer; padding: 8px 4px; border-radius: 12px;
  background: var(--surface-2); border: 1.5px solid var(--line); color: var(--ink);
  transition: border-color .12s ease, color .12s ease, transform .08s ease;
}
.diff-btn:hover { border-color: var(--c-math); color: var(--c-math); transform: translateY(-1px); }
.diff-btn .dn { font-family: var(--font-display); font-weight: 600; font-size: .92rem; }
.diff-btn .db { font-size: .66rem; font-weight: 800; color: var(--ink-soft); }
.diff-btn .db.has { color: var(--brand-ink); }

/* locked pictures: shared lock chrome (badge/outline/shake) lives in styles.css.
   Reveal's thumb is an inline SVG + difficulty chips, so dim those here too — the
   chips stay clickable so a tap still shakes the card. */
.level-card.locked .thumb-svg { filter: grayscale(1) brightness(.72); opacity: .9; }
.level-card.locked .diff-btn { opacity: .5; cursor: default; }
.level-card.locked .diff-btn:hover { border-color: var(--line); color: var(--ink); transform: none; }

.reveal-fine { margin-top: 24px; }

/* ============ HUD ============ */
.hud { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 12px; }
.hud-back {
  font: inherit; font-weight: 800; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 15px;
}
.hud-back:hover { border-color: var(--brand); color: var(--brand-ink); }
.hud-scene { font-family: var(--font-display); font-weight: 700; font-size: 1.16rem; }
.hud-count {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 5px 13px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 36%, var(--line));
  font-weight: 800; color: var(--brand-ink);
}
.hud-count b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.hud-next {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 14px; border-radius: 999px;
  background: var(--c-math); color: #fff; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--c-math) 40%, transparent);
}
.hud-next b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.hud-spacer { flex: 1 1 auto; }
.hud-stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-width: 56px; }
.hud-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 800; }
.hud-value { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.02rem; }

/* ============ stage ============ */
.reveal-caption { text-align: center; color: var(--ink-soft); font-weight: 800; margin: 0 0 10px; font-size: .96rem; }
.reveal-caption b { color: var(--c-math); font-variant-numeric: tabular-nums; }
.viewport {
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 72vh;
  margin: 0 auto; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow); touch-action: none; user-select: none;
}
.stage { position: absolute; inset: 0; }
.dot-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* the hidden picture that pops in on completion */
.reveal-art {
  opacity: 0; transform-box: fill-box; transform-origin: center;
  transition: opacity .5s ease;
}
.reveal-art.show { opacity: 1; animation: revealPop .65s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes revealPop {
  0% { transform: scale(.55); } 60% { transform: scale(1.08); } 100% { transform: scale(1); }
}

/* the line the player draws */
.drawn {
  fill: none; stroke: var(--dot-done); stroke-width: 1.9;
  stroke-linejoin: round; stroke-linecap: round;
}
.drawn.complete { animation: drawnPulse .5s ease; }
@keyframes drawnPulse { 50% { stroke-width: 3; } }

/* dots + numbers */
.dot-mark {
  fill: var(--surface); stroke: var(--ink-soft); stroke-width: 1.2;
  transform-box: fill-box; transform-origin: center;   /* so scale/shake anchor at the dot */
}
.dot-num {
  font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums;
  fill: var(--ink); text-anchor: middle; dominant-baseline: central;
}
.dot.done .dot-mark { fill: var(--dot-done); stroke: var(--dot-done); }
.dot.done .dot-num { fill: var(--brand-ink); }
.dot.next .dot-mark { fill: var(--surface); stroke: var(--c-math); stroke-width: 2; }
.dot.next .dot-num { fill: var(--c-math); }
.dot.pop .dot-mark { animation: dotPop .35s cubic-bezier(.3,1.5,.5,1); }
@keyframes dotPop { 0% { transform: scale(.2); } 100% { transform: scale(1); } }

/* the pulsing "tap me next" ring, only shown on the next dot */
.dot-pulse { fill: none; stroke: var(--c-math); stroke-width: 1.4; opacity: 0; transform-box: fill-box; transform-origin: center; }
.dot.next .dot-pulse { animation: dotPulse 1.25s ease-out infinite; }
@keyframes dotPulse {
  0% { transform: scale(.7); opacity: .9; } 80% { transform: scale(3.2); opacity: 0; } 100% { opacity: 0; }
}

/* wrong-dot nudge */
.dot.nudge .dot-mark { animation: dotNudge .32s ease; }
@keyframes dotNudge {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-1.6px); } 75% { transform: translateX(1.6px); }
}

/* ============ win modal (reused pattern) ============ */
.win { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(10,12,20,.5); backdrop-filter: blur(3px); padding: 20px; }
.win[hidden] { display: none; }   /* class display must not beat the hidden attr */
.win-card {
  background: var(--surface); color: var(--ink); border-radius: 22px; padding: 30px 30px 26px;
  text-align: center; max-width: 400px; width: 100%; box-shadow: 0 24px 70px rgba(0,0,0,.4);
  animation: winPop .35s ease both;
}
@keyframes winPop { 0% { transform: scale(.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.win-rocko { width: 116px; height: 116px; animation: rockoWag 1s ease-in-out infinite alternate; }
@keyframes rockoWag { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
.win-card h2 { font-size: 1.9rem; margin: 6px 0 4px; }
.win-time { font-size: 1.05rem; color: var(--ink-soft); font-weight: 700; margin: 0 0 2px; }
.win-time strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.win-best { font-weight: 800; color: var(--brand-ink); margin: 4px 0 18px; min-height: 1.2em; }
.win-actions { display: flex; flex-direction: column; gap: 10px; }
.win-actions .btn { justify-content: center; border-radius: 14px; }

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