/* Where's Rocko? — Find the Way Home (procedural maze).
   Loaded by /maze/ on TOP of the shared /styles.css design tokens — same
   pattern as /spot/spot.css and /reveal/reveal.css. Uses the warm "Creative
   Library" system (paper / surface / ink / brand #F04E37), NOT the old navy
   game chrome. Category is SEEK, so accents use the seek hue.
   The maze board itself is drawn on a <canvas> in maze.js; these styles are the
   page chrome (hero, HUD, board frame, d-pad, win modal). */
:root {
  /* seek-category hue, mirrored from home.css so /maze/ can use it standalone */
  --c-seek: #2E74E8;
}
@media (prefers-color-scheme: dark) {
  :root { --c-seek: #5C9BFF; }
}

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

/* ============ size select ============ */
.maze-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-seek) 16%, var(--surface)) 0%, var(--surface) 60%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.maze-hero-art {
  flex: 0 0 auto; width: 116px; height: 116px;
  filter: drop-shadow(0 10px 20px rgba(30,22,14,.18));
}
.maze-hero-copy { flex: 1 1 300px; min-width: 0; }
.maze-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-seek); padding: 4px 11px; border-radius: 999px; margin: 0 0 12px;
}
.maze-hero h1 { font-size: clamp(1.9rem, 4.8vw, 3rem); margin: 0 0 .26em; }
.maze-hero h1 .accent { color: var(--brand); }
.maze-hero .lede { font-size: 1.06rem; font-weight: 700; color: var(--ink-soft); margin: 0; max-width: 54ch; }
.maze-hero .lede strong { color: var(--ink); }

.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 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; cursor: pointer; font: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
.level-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.level-thumb {
  position: relative; height: 148px; padding: 12px; background: var(--surface-2);
  display: grid; place-items: center;
}
.level-thumb .maze-svg { width: 100%; height: 100%; display: block; }
/* locked look: shared styles.css greys a .level-thumb img; our thumb is inline SVG */
.level-card.locked .level-thumb .maze-svg { filter: grayscale(1) brightness(.72); opacity: .92; }
.level-thumb .thumb-size {
  position: absolute; right: 12px; bottom: 10px;
  font-family: var(--font-body); font-size: .66rem; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: rgba(33,30,26,.72); padding: 3px 9px; border-radius: 999px;
}
.level-meta { padding: 13px 16px 6px; display: flex; flex-direction: column; gap: 2px; }
.level-name { font-family: var(--font-display); font-weight: 700; font-size: 1.16rem; }
.level-tag { color: var(--ink-soft); font-size: .88rem; font-weight: 700; }
.level-best {
  display: flex; align-items: center; gap: 6px; padding: 4px 16px 16px; margin-top: auto;
  font-size: .84rem; font-weight: 800; color: var(--ink-soft);
}
.level-best .star { color: var(--brand-ink); }
.level-best.has { color: var(--brand-ink); }

.maze-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(--c-seek) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c-seek) 40%, var(--line));
  font-weight: 800; color: var(--c-seek);
}
.hud-count b { font-size: 1.15rem; 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; }
.hud-hint {
  font: inherit; font-family: var(--font-display); font-weight: 600; cursor: pointer; color: #fff;
  background: var(--brand); border: 0; border-radius: 999px; padding: 9px 16px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 38%, transparent);
}
.hud-hint:hover:not(:disabled) { transform: translateY(-1px); }
.hud-hint:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ============ board ============ */
.maze-caption { text-align: center; color: var(--ink-soft); font-weight: 800; margin: 0 0 12px; font-size: .96rem; }
.maze-caption b { color: var(--brand-ink); }

.maze-wrap { display: flex; justify-content: center; }
.maze-board {
  position: relative; width: 520px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow);
  touch-action: none;                 /* we handle dragging ourselves */
  -webkit-user-select: none; user-select: none;
}
#maze-canvas { width: 100%; height: 100%; display: block; }

/* Rocko glides cell-to-cell; positioned by % so he stays aligned as the board
   scales down on small screens. */
.rocko-mover {
  position: absolute; left: 0; top: 0; width: 12%; height: auto;
  transform: translate(-50%, -50%);
  transform-origin: center; pointer-events: none; will-change: left, top;
  filter: drop-shadow(0 4px 6px rgba(30,22,14,.28));
  transition: left .09s linear, top .09s linear;
}
.rocko-mover.no-anim { transition: none; }
.rocko-mover.cheer { animation: rockoHop .5s ease; }
@keyframes rockoHop {
  0% { transform: translate(-50%, -50%) scale(1); }
  40% { transform: translate(-50%, -78%) scale(1.12); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* ============ d-pad ============ */
.dpad {
  display: grid; justify-content: center; gap: 8px; margin: 18px auto 0;
  grid-template-columns: repeat(3, 58px);
  grid-template-areas: ".  up  ." "lt hub rt" ".  dn  .";
}
.dbtn {
  width: 58px; height: 58px; display: grid; place-items: center;
  font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--c-seek);
  background: var(--surface); border: 2px solid color-mix(in srgb, var(--c-seek) 45%, var(--line));
  border-radius: 16px; box-shadow: var(--shadow);
  transition: transform .07s ease, background .1s ease, color .1s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.dbtn:hover { background: color-mix(in srgb, var(--c-seek) 12%, var(--surface)); }
.dbtn:active { transform: scale(.92); background: var(--c-seek); color: #fff; }
.d-up { grid-area: up; } .d-left { grid-area: lt; } .d-right { grid-area: rt; } .d-down { grid-area: dn; }
.dpad-hub {
  grid-area: hub; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); border: 2px dashed var(--line);
}
.dpad-hub img { width: 30px; height: 30px; opacity: .85; }

/* ============ 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; } }

/* Rocko & Me: the kid walks the maze; Rocko waits at his doghouse */
.rocko-home {
  position: absolute; height: auto; transform: translate(-50%, -50%);
  pointer-events: none; filter: drop-shadow(0 3px 4px rgba(30,22,14,.28));
}
.rocko-home.cheer { animation: rockoHop .5s ease 3; }
