/* Spot Hunt — game UI */
:root {
  --bg: #101223;
  --bg2: #171a2f;
  --surface: #1c2038;
  --line: #2b3052;
  --text: #f4f5fa;
  --muted: #9aa0bd;
  --grad: linear-gradient(135deg, #ff5a5f, #ffb03a);
  --good: #34d399;
  --bad: #ff4d5e;
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.safe-top { padding-top: max(10px, env(safe-area-inset-top)); }
.safe-bottom { padding-bottom: max(10px, env(safe-area-inset-bottom)); }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ---------- home ---------- */
.glow {
  position: absolute; left: 50%; top: 12%;
  width: 130vmin; height: 130vmin; transform: translateX(-50%);
  background: radial-gradient(circle at center, rgba(255, 106, 80, 0.22), rgba(255, 176, 58, 0.06) 42%, transparent 68%);
  pointer-events: none;
}
.home-top { display: flex; gap: 10px; padding: 12px 16px 0; z-index: 2; }
.icon-btn {
  min-width: 42px; height: 42px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 1.05rem; padding: 0 12px;
  transition: transform .1s, background .15s;
}
.icon-btn:active { transform: scale(0.93); }

.home-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 12px 22px calc(24px + env(safe-area-inset-bottom)); z-index: 1;
  max-width: 430px; margin: 0 auto; width: 100%;
}
.logo-mark { width: 88px; height: 88px; filter: drop-shadow(0 8px 24px rgba(255, 90, 95, 0.45)); }
.wordmark { font-size: 2.7rem; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.wordmark em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); font-size: 0.98rem; margin-bottom: 6px; }

.chips { display: flex; gap: 8px; }
.chip {
  padding: 9px 15px; border-radius: 99px; font-weight: 700; font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  transition: all .16s;
}
.chip.active { color: #fff; border-color: #ff7a52; background: rgba(255, 106, 80, 0.16); }
.chip:active { transform: scale(0.95); }

.play-btn {
  width: 100%; max-width: 320px;
  padding: 16px 20px; border-radius: 22px;
  background: var(--grad);
  color: #fff; text-align: center;
  box-shadow: 0 10px 30px rgba(255, 106, 80, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: flex; flex-direction: column; gap: 2px;
  transition: transform .12s, box-shadow .2s;
  margin-top: 8px;
}
.play-btn:active { transform: scale(0.97); box-shadow: 0 4px 14px rgba(255, 106, 80, 0.4); }
.play-main { font-size: 1.5rem; font-weight: 800; letter-spacing: 3px; }
.play-sub { font-size: 0.82rem; opacity: 0.9; font-weight: 600; }
.play-btn.small { padding: 13px 26px; border-radius: 16px; width: auto; }
.play-btn.small { font-size: 1.02rem; font-weight: 800; }

.stats-row { display: flex; gap: 10px; width: 100%; max-width: 320px; margin-top: 10px; }
.stat {
  flex: 1; background: var(--surface); border: 1px solid var(--line);
  border-radius: 15px; padding: 11px 6px; text-align: center;
  display: flex; flex-direction: column; gap: 1px;
}
.stat b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }

.home-foot { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; margin-top: 6px; }
.ghost-btn {
  padding: 12px; border-radius: 15px; font-weight: 700; font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.09);
  transition: transform .1s;
}
.ghost-btn:active { transform: scale(0.97); }
.ghost-btn.soon { opacity: 0.45; cursor: default; }

/* ---------- versus lobby ---------- */
.vs-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 26px calc(30px + env(safe-area-inset-bottom));
  max-width: 400px; margin: 0 auto; width: 100%;
}
.vs-step { display: none; width: 100%; flex-direction: column; align-items: center; gap: 13px; }
.vs-step.on { display: flex; }
.vs-label { color: var(--muted); font-size: 0.88rem; font-weight: 700; align-self: flex-start; }
.vs-input {
  width: 100%; padding: 13px 16px; border-radius: 15px;
  background: var(--surface); border: 1.5px solid var(--line);
  color: var(--text); font: inherit; font-weight: 700; font-size: 1rem;
}
.vs-input:focus { outline: none; border-color: #ff7a52; }
.vs-input.code {
  text-align: center; font-size: 1.5rem; letter-spacing: 8px; font-weight: 800;
  text-transform: uppercase;
}
.vs-join-row { display: flex; gap: 10px; width: 100%; }
.vs-join-row .vs-input { flex: 1; min-width: 0; }
.vs-divider {
  width: 100%; display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 0.8rem; margin: 6px 0;
}
.vs-divider::before, .vs-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.vs-msg { color: var(--bad); font-size: 0.85rem; min-height: 1.2em; font-weight: 600; }
.vs-code-big {
  font-size: 3.4rem; font-weight: 800; letter-spacing: 14px; padding: 10px 10px 10px 24px;
  background: var(--surface); border: 1.5px dashed #ff7a52; border-radius: 20px;
  background-clip: padding-box;
}
.vs-status { color: var(--muted); font-size: 0.92rem; font-weight: 600; min-height: 1.3em; }
.vs-spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3.5px solid var(--line); border-top-color: #ff7a52;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.play-btn.wide { width: 100%; }
.play-btn:disabled { opacity: 0.4; pointer-events: none; }
.vs-cta { border-color: rgba(255, 122, 82, 0.4); }

/* versus in-game additions */
.vs-only { display: none !important; }
body.versus .vs-only { display: flex !important; }
body.versus #btn-hint { display: none; }

.vs-players { width: 100%; }
.vs-player-list {
  width: 100%; display: flex; flex-wrap: wrap; gap: 7px; justify-content: center;
}
.vs-player {
  background: var(--surface); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 99px; font-size: 0.85rem; font-weight: 700;
}
.vs-player.me { border-color: #ff7a52; }
.vs-player-count { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 7px; font-weight: 600; }

.opp-list {
  margin-left: auto; display: flex; gap: 6px; overflow-x: auto;
  max-width: 62%; scrollbar-width: none;
}
.opp-list::-webkit-scrollbar { display: none; }
.opp-pill {
  flex: none; background: var(--surface); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 99px; font-size: 0.76rem; font-weight: 700;
  color: var(--muted); white-space: nowrap;
}
.opp-pill b { color: #ffb03a; font-variant-numeric: tabular-nums; }
.opp-pill.finished { border-color: var(--good); color: var(--good); }
.opp-pill.finished b { color: var(--good); }

/* feature 1: personal timeout — grey out the boards (markers/rings keep their color) */
body.player-done .inner img { filter: grayscale(0.85) brightness(0.72); transition: filter .4s; }
body.player-done .panel { border-color: rgba(255, 255, 255, 0.05); }

/* revealed answers (timeout / review) */
.reveal-ring {
  position: absolute; transform: translate(-50%, -50%);
  border: 3.5px dashed var(--bad); border-radius: 50%;
  box-shadow: 0 0 14px rgba(255, 77, 94, 0.55);
  animation: reveal-in .45s cubic-bezier(.2, 1.4, .4, 1), reveal-breathe 1.6s ease-in-out .45s infinite;
  pointer-events: none;
}
@keyframes reveal-in { 0% { scale: 1.8; opacity: 0; } 100% { scale: 1; opacity: 1; } }
@keyframes reveal-breathe { 50% { opacity: 0.6; } }

/* feature 2: hurry-up siren */
.hurry {
  position: absolute; inset: 0; z-index: 25; pointer-events: none;
  animation: hurry-vignette 0.65s ease-in-out 4;
}
@keyframes hurry-vignette {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(255, 40, 60, 0); }
  50% { box-shadow: inset 0 0 68px 12px rgba(255, 40, 60, 0.55); }
}
.hurry-label {
  position: absolute; top: 14%; left: 50%; transform: translateX(-50%);
  background: rgba(200, 20, 40, 0.92); color: #fff;
  padding: 10px 18px; border-radius: 99px; font-weight: 800; font-size: 0.95rem;
  white-space: nowrap; box-shadow: 0 6px 24px rgba(200, 20, 40, 0.5);
  animation: hurry-label-pop .4s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes hurry-label-pop { 0% { transform: translateX(-50%) scale(0.4); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }

/* done / review banner */
#done-banner {
  position: absolute; left: 50%; bottom: calc(58px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--surface); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 99px; font-weight: 700; font-size: 0.88rem;
  z-index: 26; opacity: 0; transition: all .3s; white-space: nowrap; max-width: 94vw;
  overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; /* informational only — must never swallow taps */
}
#done-banner.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- chat ---------- */
.vs-chat-box {
  display: none; width: 100%; margin-top: 14px;
  flex-direction: column; gap: 8px;
}
#screen-versus.in-room .vs-chat-box { display: flex; }
.chat-msgs {
  height: 130px; overflow-y: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  scrollbar-width: thin;
}
.chat-m { font-size: 0.86rem; line-height: 1.35; word-break: break-word; }
.chat-m .chat-name { font-weight: 800; color: #ffb03a; margin-right: 6px; }
.chat-m.me .chat-name { color: #ff7a52; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 13px;
  background: var(--surface); border: 1.5px solid var(--line);
  color: var(--text); font: inherit; font-size: 0.92rem;
}
.chat-input-row input:focus { outline: none; border-color: #ff7a52; }
.chat-send {
  width: 46px; border-radius: 13px; background: var(--grad); color: #fff;
  font-size: 1rem; font-weight: 800; flex: none;
  transition: transform .1s;
}
.chat-send:active { transform: scale(0.92); }

.chat-btn { position: relative; }
#chat-badge {
  display: none; position: absolute; top: -5px; right: -5px;
  min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--bad); color: #fff; border-radius: 99px;
  font-size: 0.68rem; font-weight: 800;
  align-items: center; justify-content: center;
}
#chat-badge.on { display: flex; }

#chat-panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, 1.1, .4, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}
#chat-panel.on { transform: translateY(0); }
#chat-panel .chat-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; }
#chat-panel .chat-msgs { height: 180px; }

/* live chat feed — bottom-left over the puzzle images, game-overlay style */
#chat-feed {
  position: absolute; left: 10px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 74%; z-index: 24;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  pointer-events: none;
}
.feed-line {
  /* plain text only — no bubble; layered shadow keeps it readable on bright art */
  padding: 0 2px;
  font-size: 0.86rem; font-weight: 700; line-height: 1.3; color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.95), 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 0, 0, 0.7);
  word-break: break-word;
  animation: feed-in .25s cubic-bezier(.2, 1.4, .4, 1);
  transition: opacity .4s, transform .4s;
}
.feed-line b { color: #ffb03a; margin-right: 6px; font-weight: 800; }
.feed-line.me b { color: #ff7a52; }
.feed-line.out { opacity: 0; transform: translateX(-10px); }
@keyframes feed-in { 0% { opacity: 0; transform: translateX(-14px); } 100% { opacity: 1; } }

/* round / final rankings */
#result-list { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.rank-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 13px; font-size: 0.9rem; font-weight: 700;
}
.rank-row.me { border-color: #ff7a52; background: rgba(255, 106, 80, 0.1); }
.rank-row .rk { width: 26px; text-align: center; font-size: 1rem; }
.rank-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .sc { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }

/* ---------- game hud (kept slim so the puzzle images get the space) ---------- */
.hud { display: flex; align-items: center; gap: 8px; padding: 6px 10px 5px; }
#screen-game .icon-btn { min-width: 38px; height: 38px; }
.hud-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; }
#game-level { font-weight: 800; font-size: 0.92rem; }
.timer-pill {
  background: var(--surface); border: 1px solid var(--line);
  padding: 4px 11px; border-radius: 99px;
  font-weight: 800; font-variant-numeric: tabular-nums; font-size: 0.9rem;
}
.timer-track { height: 4px; background: rgba(255, 255, 255, 0.08); margin: 0 12px; border-radius: 2px; overflow: hidden; }
#timer-bar {
  height: 100%; width: 100%;
  background: var(--grad);
  transform-origin: left; transform: scaleX(1);
  border-radius: 2px;
}
#timer-bar.low { background: var(--bad); animation: pulse-bar 0.8s infinite; }
@keyframes pulse-bar { 50% { opacity: 0.55; } }

.found-row { display: flex; align-items: center; gap: 10px; padding: 4px 12px 2px; min-height: 38px; }
/* found-progress pill: big green count / total — the round's centerpiece */
.found-label {
  display: inline-flex; align-items: baseline; gap: 1px;
  background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 11px; padding: 2px 9px 3px;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.found-label b { font-size: 1.3rem; font-weight: 900; color: var(--good); }
.found-label i { font-style: normal; font-size: 0.88rem; font-weight: 800; color: var(--muted); }
.strip-spacer { flex: 1; }
.strip-btn {
  position: relative; flex: none;
  width: 40px; height: 34px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.95rem; transition: transform .1s, opacity .2s;
  display: flex; align-items: center; justify-content: center;
}
.strip-btn:active { transform: scale(0.92); }
.strip-btn b { color: #ffb03a; font-size: 0.62rem; margin-left: 2px; }
.strip-btn.used { opacity: 0.35; pointer-events: none; }
.strip-btn.ad { border-color: #ffb03a; box-shadow: 0 0 10px rgba(255, 176, 58, 0.35); }
#btn-hint {
  width: auto; padding: 0 11px;
  font-weight: 800; font-size: 0.72rem; letter-spacing: 0.6px; color: #e8eaf6;
}
/* tablets/desktop: the coach bubbles sit center-screen, so the progress pill
   and HINT belong front-and-center at the top, not split across corners */
@media (min-width: 700px) {
  .found-row { justify-content: center; }
  .found-row .strip-spacer { flex: 0 0 14px; }
  .opp-list { margin-left: 0; }
}
#found-dots { display: flex; gap: 6px; }
.dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: transparent; border: 2px solid rgba(255, 255, 255, 0.22);
  transition: all .25s;
}
.dot.on {
  background: var(--good); border-color: var(--good);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.85);
  animation: dot-pop 0.4s cubic-bezier(.2, 1.7, .4, 1);
}
@keyframes dot-pop {
  0% { transform: scale(0.3); }
  60% { transform: scale(1.55); }
  100% { transform: scale(1); }
}

/* ---------- panels ---------- */
.panels {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 2px 2px calc(4px + env(safe-area-inset-bottom));
}
.panel {
  width: min(100vw - 4px, calc((100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) / 2));
  aspect-ratio: 1 / 1;
  position: relative; overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg2);
  touch-action: none;
  transition: box-shadow .2s;
}
@media (orientation: landscape) {
  .panels { flex-direction: row; gap: 8px; }
  .panel { width: auto; height: min(calc(100dvh - 116px), calc((100vw - 26px) / 2)); }
}
.flash-miss .panel { box-shadow: inset 0 0 0 3px var(--bad); }
.inner { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.inner img { width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }

.marker {
  position: absolute; width: 28px; height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--good);
  border: 2.5px solid #fff;
  color: #063; font-weight: 800; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  animation: marker-pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes marker-pop { 0% { scale: 0; } 100% { scale: 1; } }

.miss-x {
  position: absolute; transform: translate(-50%, -50%);
  color: var(--bad); font-weight: 800; font-size: 1.6rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  animation: miss-shake .55s cubic-bezier(.3, .1, .3, 1) forwards;
  pointer-events: none;
}
/* wrong! — the X rattles hard, then fades */
@keyframes miss-shake {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.5) rotate(0deg); }
  12% { transform: translate(calc(-50% - 7px), -50%) scale(1.35) rotate(-14deg); }
  24% { transform: translate(calc(-50% + 7px), -50%) scale(1.3) rotate(13deg); }
  36% { transform: translate(calc(-50% - 6px), -50%) scale(1.25) rotate(-10deg); }
  48% { transform: translate(calc(-50% + 5px), -50%) scale(1.2) rotate(8deg); }
  60% { transform: translate(calc(-50% - 3px), -50%) scale(1.15) rotate(-5deg); }
  72% { transform: translate(calc(-50% + 2px), -50%) scale(1.1) rotate(3deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.85) rotate(0deg); }
}

/* correct! — star sparkles fly out from the tap point */
.burst { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 5; }
.burst span {
  position: absolute; left: 0; top: 0; font-size: 15px; opacity: 0;
  animation: burst-fly 0.8s cubic-bezier(.15, .8, .3, 1) forwards;
}
@keyframes burst-fly {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.4) rotate(0deg); }
  65% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(150deg); }
}

/* all found: Congratulations! */
.congrats-banner {
  position: absolute; left: 50%; top: 32%;
  transform: translate(-50%, -50%);
  z-index: 32; pointer-events: none; white-space: nowrap;
  font-size: clamp(1.7rem, 8.5vw, 2.7rem); font-weight: 900; letter-spacing: 0.5px;
  background: linear-gradient(92deg, #ff5a5f, #ffb03a 45%, #34d399);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.55));
  animation: congrats-pop 0.55s cubic-bezier(.2, 1.7, .4, 1), congrats-out 0.4s ease 1.6s forwards;
}
@keyframes congrats-pop {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(-5deg); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes congrats-out {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.25); opacity: 0; }
}

/* portal chat kill-switch (CrazyGames disableChat setting) */
body.no-chat .vs-chat-box,
body.no-chat #btn-chat,
body.no-chat #chat-panel,
body.no-chat #chat-feed { display: none !important; }

/* ---------- onboarding tour ---------- */
#tour { position: fixed; inset: 0; z-index: 80; }
.tour-spot {
  position: fixed; border-radius: 18px;
  box-shadow: 0 0 0 200vmax rgba(5, 6, 15, 0.74);
  border: 2px dashed rgba(255, 176, 58, 0.9);
  animation: tour-pulse 1.5s ease-in-out infinite;
}
.tour-spot.free { left: 0; top: 0; width: 100%; height: 0; border: 0; border-radius: 0; }
@keyframes tour-pulse {
  0%, 100% { border-color: rgba(255, 176, 58, 0.9); }
  50% { border-color: rgba(255, 90, 95, 0.95); }
}
.tour-bubble {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: min(330px, 88vw);
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 16px 14px;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  text-align: center; font-size: 0.95rem; line-height: 1.5;
}
.tour-arrow { font-size: 1.7rem; line-height: 1; animation: tour-bounce 0.9s ease-in-out infinite; }
.tour-arrow.down { order: 3; }
@keyframes tour-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.tour-text .dim { color: var(--muted); font-size: 0.85rem; }
.tour-btns { display: flex; gap: 12px; align-items: center; }
.tour-btns .play-btn.small { padding: 10px 22px; }

/* blink-comparator hint: the other picture strobes on top, A·B·A·B (파바박) */
.blink-img {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; z-index: 3;
}
.blink-img.strobe { animation: blink-strobe 1.5s steps(1, end); }
@keyframes blink-strobe {
  0%, 20%, 40%, 60%, 80% { opacity: 1; }
  10%, 30%, 50%, 70%, 90%, 100% { opacity: 0; }
}

/* hint pre-roll: frozen clock + focus countdown */
.hint-count {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%);
  z-index: 30; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.hint-count b {
  font-size: 4.4rem; font-weight: 900; color: #ffb03a; line-height: 1;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.65);
}
.hint-count b.pop { animation: hintnum-pop 0.5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes hintnum-pop { 0% { transform: scale(0.3); opacity: 0.3; } 100% { transform: scale(1); opacity: 1; } }
.hint-count span {
  background: rgba(16, 18, 35, 0.88); border: 1px solid var(--line);
  padding: 8px 15px; border-radius: 99px; font-weight: 700; font-size: 0.88rem;
}

/* tutorial: answer spotlight mask + coaching tip bar */
.tut-mask { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.tut-mask .tut-ring { stroke: #ffb03a; stroke-width: 1.4; animation: tut-ring-pulse 1.1s ease-in-out infinite; }
@keyframes tut-ring-pulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.4; } }
#tut-tip {
  position: absolute; left: 50%; bottom: calc(64px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(14px);
  width: min(370px, 93vw);
  background: var(--surface); border: 1px solid rgba(255, 176, 58, 0.55); border-radius: 16px;
  padding: 12px 16px; text-align: center; font-size: 0.93rem; line-height: 1.45;
  z-index: 27; opacity: 0; transition: all 0.3s; pointer-events: none;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
}
#tut-tip.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.hint-ring {
  position: absolute; transform: translate(-50%, -50%);
  border: 3.5px solid #ffb03a; border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 176, 58, 0.8);
  animation: hint-pulse 0.6s ease-in-out 3;
  pointer-events: none;
}
@keyframes hint-pulse { 50% { scale: 1.18; opacity: 0.6; } }

/* ---------- floating zoom reset (only while zoomed) ---------- */
.action-btn {
  padding: 11px 20px; border-radius: 15px; font-weight: 700; font-size: 0.92rem;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .1s, opacity .2s;
}
.action-btn:active { transform: scale(0.95); }
.zoom-only { display: none; }
body.zoomed .zoom-only { display: block; }
#btn-zoom-reset {
  position: absolute; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 23; opacity: 0.92; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

/* ---------- veil / countdown ---------- */
#veil {
  position: absolute; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  background: rgba(13, 15, 30, 0.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
#veil.on { display: flex; }
#veil-num {
  font-size: 7rem; font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#veil-num.pop { animation: veil-pop .55s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes veil-pop { 0% { scale: 0.3; opacity: 0; } 100% { scale: 1; opacity: 1; } }

/* ---------- result ---------- */
#result {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 12, 24, 0.6);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
#result.on { opacity: 1; pointer-events: auto; }
.result-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 26px 24px calc(26px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transform: translateY(40px); transition: transform .3s cubic-bezier(.2, 1.2, .4, 1);
}
#result.on .result-card { transform: translateY(0); }
#result-stars { display: flex; gap: 8px; font-size: 2.6rem; }
#result-stars span { color: rgba(255, 255, 255, 0.12); transition: color .2s; }
#result-stars span.on {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 10px rgba(255, 150, 60, 0.5));
}
#result-stars span.pop { animation: star-pop .4s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes star-pop { 0% { scale: 0.2; } 100% { scale: 1; } }
.fail-ico { font-size: 3rem; }
#result h2 { font-size: 1.5rem; font-weight: 800; }
#result p { color: var(--muted); font-size: 0.92rem; margin-bottom: 8px; }
