/* Where's Rocko? — Word Hunt.
   Loaded by /hunt/ 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: Reading (green). */
:root {
  /* reading-category hue, mirrored from home.css so /hunt/ works standalone */
  --c-read: #2FA24B;
  --hunt-ok: #2FA24B;   /* "found word" green */
}
@media (prefers-color-scheme: dark) {
  :root { --c-read: #56C878; --hunt-ok: #56C878; }
}

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

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

.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 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; height: 132px; padding: 8px; background: var(--surface-2);
}
.mini-board {
  display: grid; grid-auto-rows: 1fr; gap: 3px; width: 100%; height: 100%;
}
.mini-board span {
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--font-display); font-weight: 600; font-size: .66rem;
  color: var(--ink-soft); background: var(--surface); border-radius: 5px;
}
.mini-board span.hot {
  color: #fff; background: var(--hunt-ok);
}
.level-thumb .thumb-count {
  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 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: .84rem; font-weight: 700; letter-spacing: .02em; }

/* difficulty chips */
.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-read); color: var(--c-read); 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); }

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

/* ============ HUD ============ */
.hud { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 14px; }
.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-read) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c-read) 40%, var(--line));
  font-weight: 800; color: var(--c-read);
}
.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; }

/* ============ stage: board + word list ============ */
.hunt-stage { display: flex; gap: 20px; align-items: flex-start; }
.board-wrap { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.board {
  --n: 8;
  width: min(100%, 520px); aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  gap: clamp(2px, 0.8vmin, 5px);
  padding: clamp(6px, 1.6vmin, 12px);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
  font-size: 1rem;   /* replaced with a px size by JS to fit the cell */
}
.cell {
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--font-display); font-weight: 600; font-size: inherit; line-height: 1;
  color: var(--ink); background: var(--surface);
  border-radius: clamp(4px, 1.4vmin, 10px);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .1s ease, color .1s ease, transform .06s ease;
}
.cell.sel { background: var(--brand); color: #fff; transform: scale(.94); }
.cell.found { background: color-mix(in srgb, var(--hunt-ok) 24%, var(--surface)); color: var(--hunt-ok); }
.cell.found.sel { background: var(--brand); color: #fff; }
.cell.wrong { background: var(--brand-ink); color: #fff; animation: cellShake .32s ease; }
@keyframes cellShake {
  0%,100% { transform: translateX(0); } 20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); }
}
.cell.hint { animation: cellHint 1.2s ease; }
@keyframes cellHint {
  0% { box-shadow: 0 0 0 0 rgba(255,209,102,0); }
  25% { box-shadow: 0 0 0 3px #ffd166 inset, 0 0 10px 2px rgba(255,209,102,.7); }
  100% { box-shadow: 0 0 0 0 rgba(255,209,102,0); }
}

/* ---- word list (body font, per spec) ---- */
.word-panel {
  flex: 0 0 216px; align-self: stretch;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
}
.word-panel-title {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  margin: 0 0 12px; color: var(--ink);
}
.word-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.word-list li {
  font-family: var(--font-body); font-weight: 800; font-size: .96rem; letter-spacing: .05em;
  color: var(--ink); background: var(--surface-2); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; transition: background-color .2s ease, color .2s ease;
}
.word-list li.done {
  color: #fff; background: var(--hunt-ok); border-color: var(--hunt-ok);
  text-decoration: line-through; text-decoration-thickness: 2px;
}

/* stacked on narrow screens: board on top, list below */
@media (max-width: 720px) {
  .hunt-stage { flex-direction: column; align-items: stretch; }
  .board-wrap { width: 100%; }
  .word-panel { flex: none; width: 100%; }
}

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