:root {
  --bg: #09111e;
  --panel: rgba(15, 26, 44, .88);
  --panel-2: rgba(24, 39, 62, .78);
  --line: rgba(255,255,255,.12);
  --text: #f6fbff;
  --muted: #a7bdd4;
  --accent: #63e6be;
  --accent-2: #7dd3fc;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(0,0,0,.36);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 20% 0%, #173455 0, #0d1a2b 36%, #08111e 100%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100dvh; overscroll-behavior: none; }
button { font: inherit; }
.app-shell { min-height: 100dvh; display: grid; place-items: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
.game-card { width: min(100%, 650px); background: linear-gradient(180deg, rgba(15,30,50,.95), rgba(8,17,30,.96)); border: 1px solid rgba(255,255,255,.09); box-shadow: var(--shadow); border-radius: 28px; padding: 18px; backdrop-filter: blur(18px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.eyebrow { margin: 0 0 3px; font-size: 10px; letter-spacing: .24em; color: var(--accent); font-weight: 800; }
h1 { margin: 0; font-size: clamp(22px, 5vw, 34px); line-height: 1; letter-spacing: .04em; }
h1 span { color: var(--accent-2); }
.icon-btn, .mini-btn { color: white; border: 1px solid var(--line); background: rgba(255,255,255,.07); border-radius: 14px; min-width: 46px; height: 46px; cursor: pointer; }
.icon-btn:active, .mini-btn:active { transform: scale(.96); }
.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.hud-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 15px; padding: 9px 10px; text-align: center; }
.hud-item span { display: block; font-size: 9px; color: var(--muted); letter-spacing: .18em; font-weight: 800; margin-bottom: 3px; }
.hud-item strong { font-variant-numeric: tabular-nums; font-size: 18px; letter-spacing: .06em; }
#misses { color: var(--danger); font-size: 15px; }
.screen-wrap { position: relative; overflow: hidden; border-radius: 22px; border: 1px solid rgba(255,255,255,.16); background: #84d8ff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), 0 12px 30px rgba(0,0,0,.22); aspect-ratio: 5 / 6; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(5,13,23,.34); backdrop-filter: blur(8px); opacity: 0; visibility: hidden; transition: .18s ease; }
.overlay.show { opacity: 1; visibility: visible; }
.overlay-card { max-width: 430px; text-align: center; background: rgba(8,18,31,.88); border: 1px solid rgba(255,255,255,.12); padding: 22px; border-radius: 22px; box-shadow: 0 16px 40px rgba(0,0,0,.28); }
.overlay-kicker { margin: 0 0 5px; color: var(--accent); font-weight: 900; letter-spacing: .22em; font-size: 11px; }
.overlay h2 { margin: 0 0 9px; font-size: clamp(22px, 5vw, 30px); }
.overlay p { color: #d6e6f5; line-height: 1.65; margin: 0 0 16px; font-size: 14px; }
.primary-btn { border: 0; cursor: pointer; border-radius: 15px; padding: 13px 20px; color: #05241f; font-weight: 900; background: linear-gradient(135deg, #74f0c5, #68cfff); box-shadow: 0 10px 24px rgba(54,211,180,.22); }
.primary-btn:active { transform: translateY(1px) scale(.99); }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-top: 13px; }
.control-btn { border: 1px solid rgba(255,255,255,.12); background: linear-gradient(180deg, rgba(83,160,222,.28), rgba(28,62,95,.54)); color: white; border-radius: 19px; min-height: 70px; cursor: pointer; display: grid; place-items: center; align-content: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.12); user-select: none; touch-action: manipulation; }
.control-btn span { font-size: 27px; line-height: 1; }
.control-btn small { margin-top: 3px; font-size: 9px; letter-spacing: .18em; color: #cfeafa; font-weight: 800; }
.control-btn:active, .control-btn.pressed { transform: translateY(1px); background: linear-gradient(180deg, rgba(75,230,191,.35), rgba(29,104,98,.52)); }
.mini-btn { align-self: stretch; height: auto; width: 50px; font-weight: 900; }
.hint { margin: 11px 0 0; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.5; }
@media (max-width: 520px) {
  .app-shell { padding-left: 8px; padding-right: 8px; }
  .game-card { padding: 12px; border-radius: 21px; }
  .hud-item { padding: 7px 5px; }
  .hud-item strong { font-size: 16px; }
  .controls { margin-top: 9px; }
  .control-btn { min-height: 62px; border-radius: 17px; }
  .hint { font-size: 10px; }
}
@media (orientation: landscape) and (max-height: 620px) {
  .app-shell { place-items: start center; }
  .game-card { width: min(94vw, 760px); display: grid; grid-template-columns: minmax(280px, 1fr) 210px; gap: 10px 14px; }
  .topbar, .hud, .hint { grid-column: 2; }
  .topbar { margin: 0; }
  .hud { grid-template-columns: 1fr; align-content: start; }
  .screen-wrap { grid-column: 1; grid-row: 1 / span 4; max-height: calc(100dvh - 28px); }
  .controls { grid-column: 2; margin: 0; grid-template-columns: 1fr 1fr; }
  .mini-btn { grid-column: 1 / span 2; min-height: 42px; }
  .hint { margin: 0; }
}
