/* Where's Rocko? — game styles.
   Loaded by /play/ on TOP of the shared /styles.css design tokens.
   Owned by the game thread; site chrome/landing CSS stays in /styles.css. */
/* =====================================================================
   Where's Rocko? — game
   ===================================================================== */
:root { --rocko: #d83a34; --rocko-deep: #b62d28; }

body.play main { max-width: 1080px; padding: 0 20px 56px; }

/* ---------- level select ---------- */
.levels-head {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  background: #1c2434; color: #fff; border-radius: 24px;
  padding: 30px 34px; margin: 24px 0 26px;
}
.rocko-badge { flex: 0 0 auto; filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
.levels-head h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); margin: 0 0 .28em; color: #fff; }
.levels-head .lede { color: #cbd2e6; font-size: 1.06rem; margin: 0; max-width: 52ch; }
.levels-head .lede strong { color: #fff; }
.find-note { margin: .9em 0 0; color: #aeb6d2; font-size: .92rem; }
.find-inline {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  padding: 3px 10px 3px 6px; border-radius: 999px; color: #fff; font-weight: 600;
}
.find-inline img { display: block; }

.level-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px;
}
@media (max-width: 620px) { .level-grid { grid-template-columns: 1fr; } }
.level-card {
  display: block; text-align: left; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); font: inherit; color: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
.level-card:hover { transform: translateY(-3px); box-shadow: 0 16px 44px rgba(28,36,52,.16); }
.level-thumb { height: 150px; overflow: hidden; background: #0d1020; }
.level-thumb .scene-svg { width: 100%; height: 100%; display: block; }
.level-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.level-meta { padding: 12px 16px 15px; display: flex; flex-direction: column; gap: 2px; }
.level-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.level-tag { color: var(--ink-soft); font-size: .88rem; }
.level-best { color: var(--rocko-deep); font-weight: 700; font-size: .82rem; margin-top: 4px; }
/* Endless Hunt card */
.endless-card { outline: 2px solid var(--rocko); outline-offset: -2px; }
.endless-thumb { display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rocko), var(--accent-deep)); }
.endless-thumb span { font-size: 72px; font-weight: 800; color: #fff; line-height: 1;
  text-shadow: 0 3px 10px rgba(0,0,0,.35); }

/* ---------- level ladder: locked / done / progress ---------- */
.level-thumb { position: relative; }         /* anchor for the corner badge */
.level-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.level-badge.lock  { background: rgba(13,16,32,.82); }
.level-badge.check { background: var(--rocko); font-weight: 900; }
.level-card.locked { cursor: default; }
.level-card.locked .level-thumb img { filter: grayscale(1) brightness(.66); }
.level-card.locked .level-tag { color: var(--ink-soft); font-style: italic; }
.level-card.locked:hover { transform: none; box-shadow: var(--shadow); }
.level-card.done { outline: 2px solid var(--rocko); outline-offset: -2px; }
.level-card.nudge { animation: cardNudge .4s ease; }
@keyframes cardNudge {
  0%, 100% { transform: none; }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.level-progress {
  grid-column: 1 / -1; text-align: center; margin: 2px 0 0;
  color: var(--ink-soft); font-weight: 700; font-size: .9rem;
}

.levels .fine { margin-top: 22px; }

/* ---------- HUD ---------- */
.hud {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 20px 0 12px;
}
.hud-back {
  font: inherit; font-weight: 700; cursor: pointer; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 15px;
}
.hud-back:hover { border-color: var(--accent); color: var(--accent-deep); }
.hud-scene { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
.hud-target {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 6px;
  background: var(--rocko); color: #fff; border-radius: 999px;
  font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
}
.hud-target img { display: block; }
.hud-rocko { position: relative; display: inline-block; width: 34px; height: 34px; vertical-align: middle; }
.hud-rocko img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.hud-spacer { flex: 1 1 auto; }
.hud-stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-width: 58px; }
.hud-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.hud-value { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.02rem; }
.hud-hint {
  font: inherit; font-weight: 700; cursor: pointer; color: #fff;
  background: var(--accent); border: 1px solid var(--accent-deep); border-radius: 999px;
  padding: 8px 15px;
}
.hud-hint:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- viewport / stage ---------- */
.viewport {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 74vh;
  overflow: hidden; border-radius: 18px; border: 1px solid var(--line);
  background: #0d1020; box-shadow: var(--shadow);
  cursor: grab; touch-action: none; user-select: none;
}
.viewport:active { cursor: grabbing; }
/* Safari/Chrome: stop dragging the scene from ripping the <img> out to the desktop */
.viewport img { -webkit-user-drag: none; -khtml-user-drag: none; user-drag: none; }
.stage { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.scene-layer { position: absolute; inset: 0; }
.scene-layer .scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* occluder: same image, same box as .scene-img, laid over Rocko and clipped to a
   band so it hides part of him (peek-behind). clip-path is set per round in JS. */
.scene-occ { position: absolute; inset: 0; z-index: 4; pointer-events: none;
  -webkit-clip-path: inset(50%); clip-path: inset(50%); }
.scene-occ img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.rocko-sprite {
  position: absolute; width: 5.4%; z-index: 3;
  transform: translate(-50%, -50%); transform-origin: center;
}
.rocko-sprite img { width: 100%; height: auto; display: block; pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.rocko-sprite.found { animation: rockoFound .6s ease both; }
@keyframes rockoFound {
  0% { filter: none; } 30% { transform: translate(-50%,-50%) scale(1.5); }
  100% { transform: translate(-50%,-50%) scale(1.25); }
}
.rocko-sprite.found img { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 14px var(--rocko)); }

.zoom-controls {
  position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px;
}
.zoom-controls button {
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: rgba(20,24,36,.82); color: #fff; border: 1px solid rgba(255,255,255,.18);
  font-size: 1.2rem; font-weight: 700; line-height: 1;
}
.zoom-controls button:hover { background: rgba(20,24,36,.98); }
.viewport-hint {
  position: absolute; left: 12px; bottom: 12px; margin: 0; pointer-events: none;
  color: #fff; background: rgba(20,24,36,.6); padding: 4px 10px; border-radius: 999px;
  font-size: .76rem;
}
@media (max-width: 520px) { .viewport-hint { display: none; } }

/* ---------- feedback ---------- */
.streak-toast {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: var(--rocko); color: #fff; font-weight: 700; font-size: .95rem;
  padding: 8px 18px; border-radius: 999px; z-index: 7; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); white-space: nowrap;
  animation: streakPop .9s ease forwards;
}
.streak-toast b { font-weight: 800; }
@keyframes streakPop {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.9); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}
.miss-ping {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; z-index: 6;
  border: 3px solid var(--rocko); border-radius: 50%; pointer-events: none;
  animation: missPing .6s ease-out forwards;
}
@keyframes missPing {
  0% { transform: scale(.4); opacity: 1; }
  100% { transform: scale(3.4); opacity: 0; }
}
.hint-ring {
  position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; z-index: 6;
  border: 4px solid #ffd166; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10,12,20,.28);
  animation: hintRing 1.4s ease-out forwards;
}
@keyframes hintRing {
  0% { transform: scale(9); opacity: 0; }
  25% { opacity: 1; } 100% { transform: scale(1); opacity: .9; }
}

/* ---------- win ---------- */
.win {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(10,12,20,.55); backdrop-filter: blur(3px); padding: 20px;
}
.win[hidden] { display: none; }   /* class display must not beat the hidden attr */
.win-card {
  background: var(--card); 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 { 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); margin: 0 0 2px; }
.win-time strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.win-best { font-weight: 700; color: var(--rocko-deep); margin: 4px 0 18px; min-height: 1.2em; }
.win-actions { display: flex; flex-direction: column; gap: 10px; }
.win-actions .btn { border-radius: 12px; }
.win-actions .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }

/* theme-song toggle — matches the hub's control; sits on the dark .levels-head */
.play-song { margin: .95em 0 0; }
.song-toggle {
  display: inline-flex; align-items: center; gap: .55em;
  padding: 11px 18px; border-radius: 999px;
  font: inherit; font-weight: 600; font-size: .98rem;
  background: rgba(255,255,255,.12); color: #fff; border: 1.5px solid rgba(255,255,255,.3);
  cursor: pointer; backdrop-filter: blur(4px);
  transition: border-color .12s ease, color .12s ease, transform .08s ease, background .12s ease;
}
.song-toggle:hover { border-color: #FFC93C; color: #FFC93C; transform: translateY(-1px); background: rgba(255,255,255,.18); }
.song-toggle .eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 15px; }
.song-toggle .eq i { width: 3px; height: 5px; border-radius: 2px; background: currentColor; }
.song-toggle[aria-pressed="true"] { border-color: #FFC93C; color: #FFC93C; }
.song-toggle[aria-pressed="true"] .eq i { animation: eq 900ms ease-in-out infinite; }
.song-toggle[aria-pressed="true"] .eq i:nth-child(2) { animation-delay: .15s; }
.song-toggle[aria-pressed="true"] .eq i:nth-child(3) { animation-delay: .30s; }
.song-toggle[aria-pressed="true"] .eq i:nth-child(4) { animation-delay: .45s; }
@keyframes eq { 0%,100% { height: 5px; } 50% { height: 15px; } }
