/* ============================================================
   QUACK SHOT ARCADE — NNPlays
   Bright marshland shooting gallery. Mobile-first portrait stage.
   ============================================================ */
:root {
  --bg0: #0f3a52;
  --sky: #6fd3ff;
  --green: #46d36a;
  --leaf: #1f9d57;
  --gold: #ffd34d;
  --orange: #ff9f3d;
  --pink: #ff5d8f;
  --red: #ff4d5e;
  --cyan: #29e7ff;
  --ink: #f4fbff;
  --panel: rgba(8, 38, 54, 0.94);
  --font: 'Baloo 2', system-ui, sans-serif;
  --mono: 'Share Tech Mono', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 0%, #18617f 0%, var(--bg0) 60%, #052230 100%);
  color: var(--ink); font-family: var(--font); overflow: hidden;
  display: flex; align-items: center; justify-content: center; height: 100vh; height: 100dvh;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#stage { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bg-glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 40% at 50% 18%, rgba(255,211,77,0.22), transparent 70%), radial-gradient(50% 30% at 18% 82%, rgba(70,211,106,0.16), transparent 70%);
  animation: glowDrift 14s ease-in-out infinite alternate; }
@keyframes glowDrift { from { transform: translateY(0); } to { transform: translateY(-12px); } }
.bg-vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 100% at 50% 50%, transparent 58%, rgba(0,0,0,0.45) 100%); }

#frame { position: relative; height: 100%; aspect-ratio: 540 / 960; max-width: 100%; max-height: 100%;
  border-radius: 18px; overflow: hidden; box-shadow: 0 0 0 2px rgba(111,211,255,0.18), 0 24px 80px rgba(0,0,0,0.6); }
canvas#game { display: block; width: 100%; height: 100%; background: #8fd9f2; touch-action: none; cursor: none; }

.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 6; padding: 10px 12px 8px;
  background: linear-gradient(180deg, rgba(5,28,40,0.82) 0%, rgba(5,28,40,0) 100%); pointer-events: none; transition: opacity .3s; }
.hud.hidden { opacity: 0; }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-group { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.hud-group.right { gap: 6px; }
.hud-cell { display: flex; flex-direction: column; line-height: 1; }
.hud-center { align-items: center; }
.hud-label { font-size: 9px; letter-spacing: 2px; color: rgba(244,251,255,0.6); font-weight: 700; }
.hud-value { font-family: var(--mono); font-size: 22px; color: var(--gold); text-shadow: 0 0 12px rgba(255,211,77,0.5); }
.hud-value.time { color: var(--ink); text-shadow: 0 0 12px rgba(111,211,255,0.5); }
.hud-value.acc { font-size: 16px; color: var(--green); text-shadow: 0 0 12px rgba(70,211,106,0.5); }
.hud-value.flash { animation: pop .4s ease; }
.hud-value.low { color: var(--red); animation: lowblink .6s steps(2) infinite; }
@keyframes lowblink { 50% { opacity: 0.4; } }
@keyframes pop { 0% { transform: scale(1.35); color: #fff; } 100% { transform: scale(1); } }
.combo-chip { font-family: var(--mono); font-size: 16px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: linear-gradient(135deg, var(--pink), var(--orange)); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.4); box-shadow: 0 0 16px rgba(255,93,143,0.5); transition: transform .12s; }
.combo-chip.bump { transform: scale(1.25); }
.hud-btn { pointer-events: auto; width: 36px; height: 36px; border: none; border-radius: 11px; background: rgba(255,255,255,0.12); color: var(--ink); font-size: 15px; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(6px); transition: background .15s, transform .1s; }
.hud-btn:hover { background: rgba(255,255,255,0.22); }
.hud-btn:active { transform: scale(0.92); }
.power-bar { display: flex; gap: 6px; margin-top: 8px; pointer-events: none; min-height: 0; }
.power-pill { display: flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; font-family: var(--mono);
  background: rgba(8,38,54,0.72); border: 1px solid rgba(255,255,255,0.18); color: var(--ink); animation: pillIn .2s ease; }
.power-pill .pt { font-family: var(--mono); color: var(--gold); }
@keyframes pillIn { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

.flash { position: absolute; inset: 0; z-index: 7; opacity: 0; pointer-events: none; mix-blend-mode: screen; background: #fff; }
.flash.hit { animation: flashHit .25s ease; }
.flash.bad { background: #ff4d5e; }
.flash.bad.hit { animation: flashHit .3s ease; }
@keyframes flashHit { 0% { opacity: .28; } 100% { opacity: 0; } }

.screen { position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(24,97,127,0.55), rgba(5,34,48,0.84) 75%); backdrop-filter: blur(2px); }
.screen.active { display: flex; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.panel { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid rgba(111,211,255,0.2); border-radius: 22px; padding: 26px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.07); max-height: 94%; overflow-y: auto; }
.panel.wide { max-width: 420px; }
.tag { display: inline-block; font-size: 11px; letter-spacing: 4px; font-weight: 800; color: var(--green); padding: 4px 12px; margin-bottom: 14px; border: 1px solid rgba(70,211,106,0.4); border-radius: 999px; text-shadow: 0 0 12px rgba(70,211,106,0.5); }
.logo { font-size: clamp(28px, 9vw, 46px); line-height: 0.92; font-weight: 800; letter-spacing: 1px; margin-bottom: 12px; color: var(--gold); text-shadow: 0 3px 0 rgba(0,0,0,0.18), 0 0 22px rgba(255,211,77,0.45); }
.logo span { display: block; color: var(--orange); text-shadow: 0 3px 0 rgba(0,0,0,0.18), 0 0 22px rgba(255,159,61,0.5); }
.logo em { display: block; font-style: normal; font-size: 0.42em; letter-spacing: 7px; color: var(--cyan); text-shadow: 0 0 18px rgba(41,231,255,0.6); margin-top: 2px; }
.subtitle { font-size: 14px; color: rgba(244,251,255,0.78); margin-bottom: 20px; line-height: 1.5; font-weight: 600; }
.screen-title { font-size: 27px; font-weight: 800; letter-spacing: 1px; margin-bottom: 16px; color: var(--ink); }
.screen-title.gold { color: var(--gold); text-shadow: 0 0 20px rgba(255,211,77,0.5); }
.btn { display: block; width: 100%; border: none; border-radius: 14px; padding: 14px; font-family: var(--font); font-size: 16px; font-weight: 800; letter-spacing: 1.5px; cursor: pointer; margin-bottom: 10px; transition: transform .1s, filter .15s, box-shadow .15s; }
.btn:active { transform: scale(0.97); }
.btn.small { padding: 10px; font-size: 13px; }
.btn.primary { background: linear-gradient(135deg, var(--green), var(--leaf)); color: #05281a; box-shadow: 0 8px 24px rgba(70,211,106,0.32); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 10px 30px rgba(70,211,106,0.5); }
.btn.ghost { background: rgba(255,255,255,0.07); color: var(--ink); border: 1px solid rgba(255,255,255,0.13); }
.btn.ghost:hover { background: rgba(255,255,255,0.14); }
.best-line { margin-top: 10px; font-family: var(--mono); font-size: 13px; letter-spacing: 1px; color: rgba(244,251,255,0.65); }
.best-line span { color: var(--gold); }
.how-list { text-align: left; margin-bottom: 18px; font-size: 13.5px; line-height: 1.55; color: rgba(244,251,255,0.88); font-weight: 600; }
.how-list li { margin-bottom: 8px; list-style: none; padding-left: 18px; position: relative; }
.how-list li::before { content: '▸'; position: absolute; left: 0; color: var(--green); }
.how-list b { color: var(--ink); }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 14px; }
.stat-row span { color: rgba(244,251,255,0.62); letter-spacing: 1px; font-size: 12px; font-weight: 700; }
.stat-row b { font-family: var(--mono); font-size: 18px; color: var(--gold); }
.new-best { margin: 12px 0; font-weight: 800; letter-spacing: 3px; color: var(--green); text-shadow: 0 0 16px rgba(70,211,106,0.6); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.4; } }
.rank-badge { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 800; font-family: var(--mono);
  background: radial-gradient(circle at 35% 30%, #fff, var(--gold)); color: #5a3c00; box-shadow: 0 0 28px rgba(255,211,77,0.6); }
.auth-row { margin-top: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth-status { font-size: 12px; color: rgba(244,251,255,0.62); }
.auth-status b { color: var(--green); }
.auth-link { background: none; border: none; color: var(--pink); font-size: 12px; cursor: pointer; text-decoration: underline; }
.hidden { display: none !important; }
.controls-hint { margin-top: 16px; font-size: 11px; color: rgba(244,251,255,0.55); line-height: 1.8; }
.controls-hint span { display: block; }
kbd { display: inline-block; padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18); font-family: var(--mono); font-size: 11px; }
.touch-only { display: none; }

/* Mode select */
.mode-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.mode-card { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 16px; text-align: left; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); transition: transform .1s, background .15s, border-color .15s; }
.mode-card:hover { background: rgba(255,255,255,0.1); border-color: rgba(70,211,106,0.5); }
.mode-card:active { transform: scale(0.98); }
.mode-ico { font-size: 30px; width: 44px; text-align: center; flex-shrink: 0; }
.mode-info { flex: 1; }
.mode-name { font-size: 16px; font-weight: 800; color: var(--ink); }
.mode-desc { font-size: 12px; color: rgba(244,251,255,0.65); font-weight: 600; line-height: 1.3; }
.mode-best { font-family: var(--mono); font-size: 12px; color: var(--gold); flex-shrink: 0; text-align: right; }

/* Shop */
.shop-coins { font-family: var(--mono); font-size: 18px; color: var(--gold); margin-bottom: 14px; }
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.shop-item { padding: 12px 8px 10px; border-radius: 14px; cursor: pointer; text-align: center;
  background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.12); transition: transform .1s, border-color .15s, background .15s; }
.shop-item:hover { background: rgba(255,255,255,0.1); }
.shop-item:active { transform: scale(0.97); }
.shop-item.equipped { border-color: var(--green); background: rgba(70,211,106,0.12); }
.shop-item.locked { opacity: 0.85; }
.shop-preview { width: 48px; height: 48px; margin: 0 auto 8px; }
.shop-name { font-size: 12px; font-weight: 700; color: var(--ink); }
.shop-price { font-size: 12px; font-family: var(--mono); margin-top: 3px; }
.shop-price.owned { color: var(--green); }
.shop-price.cost { color: var(--gold); }
.shop-price.cant { color: var(--red); }

.leaderboard { margin: 16px 0 4px; text-align: left; position: relative; }
.lb-title { font-size: 11px; letter-spacing: 3px; color: rgba(244,251,255,0.55); margin-bottom: 8px; text-align: center; }
.lb-list { list-style: none; }
.lb-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.lb-list li.me { background: rgba(70,211,106,0.12); }
.lb-rank { font-family: var(--mono); color: var(--gold); width: 22px; }
.lb-name { flex: 1; color: rgba(244,251,255,0.85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pts { font-family: var(--mono); color: var(--green); }
.lb-loading, .lb-empty { color: rgba(244,251,255,0.45); font-size: 12px; text-align: center; padding: 10px; }
.lb-source { position: absolute; top: 0; right: 0; font-size: 9px; letter-spacing: 1px; color: rgba(244,251,255,0.35); }
.nn-score-nudge { margin: 14px 0; padding: 14px; border-radius: 14px; background: rgba(70,211,106,0.08); border: 1px solid rgba(70,211,106,0.25); }
.nn-score-nudge p { font-size: 13px; margin-bottom: 10px; }
.nn-nudge-btns { display: flex; gap: 8px; }
.nn-nudge-signup { flex: 1; text-decoration: none; text-align: center; padding: 10px; border-radius: 10px; background: linear-gradient(135deg, var(--green), var(--leaf)); color: #05281a; font-weight: 800; font-size: 13px; }
.nn-nudge-later { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); background: transparent; color: rgba(244,251,255,0.7); font-size: 13px; cursor: pointer; }
.fb-btn:empty { display: none; }
@media (pointer: coarse) { .touch-only { display: block; } .controls-hint span:first-child { display: none; } canvas#game { cursor: auto; } }
@media (max-height: 600px) { .panel { padding: 18px 16px; } .logo { font-size: clamp(22px, 7vw, 34px); } .subtitle { margin-bottom: 14px; } .leaderboard { display: none; } }
