body {
  display: grid;
  place-items: center;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 34%, #10244b 0, transparent 34%),
    linear-gradient(145deg, #02030a, #080d21 60%, #120622);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  position: relative;
  width: min(100vw, calc(100vh * 420 / 780));
  height: min(100vh, calc(100vw * 780 / 420));
  max-width: 520px;
  max-height: calc(520px * 780 / 420);
  overflow: hidden;
  isolation: isolate;
  background: var(--background);
  box-shadow: 0 0 80px rgba(46, 110, 255, .2), 0 0 0 1px rgba(255,255,255,.06);
}

.splash, .game-screen { position: absolute; inset: 0; }
.splash { background: #02040f; }
.splash img { width: 100%; height: 100%; display: block; object-fit: cover; }
.hotspot {
  position: absolute;
  z-index: 2;
  cursor: pointer;
  color: transparent;
  background: transparent;
  border-radius: 16px;
}
.hotspot span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.hotspot:focus-visible { outline: 4px solid white; outline-offset: 3px; }
.hotspot-play { left: 18%; top: 63.4%; width: 64%; height: 8.4%; animation: pulseHotspot 1.8s ease-in-out infinite; }
.hotspot-tutorial { left: 17%; top: 72.1%; width: 32%; height: 5.3%; }
.hotspot-settings { left: 51%; top: 72.1%; width: 32%; height: 5.3%; }
.hotspot-sound { left: 87%; top: 18.5%; width: 11%; height: 7%; }
@keyframes pulseHotspot { 50% { filter: drop-shadow(0 0 15px rgba(69,220,255,.8)); } }
.live-best {
  position: absolute; z-index: 3; top: 21.9%; left: 1.5%; width: 23%; height: 9.8%;
  display: grid; place-content: center; padding: 6px; border-radius: 13px; text-align: center;
  color: var(--circle); background: #020714; border: 1px solid rgba(69,220,255,.24);
  font-size: clamp(7px, 1.9vw, 10px); font-weight: 800; letter-spacing: .1em;
}
.live-best strong { display: block; margin-top: 2px; color: white; font-size: clamp(15px, 4vw, 23px); letter-spacing: 0; }

.game-screen {
  overflow: hidden;
  user-select: none;
  background:
    radial-gradient(circle at center, rgba(20, 55, 110, .24), transparent 45%),
    #030612;
}
#gameCanvas {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 100%; aspect-ratio: 1; height: auto; display: block;
  touch-action: none; cursor: pointer;
}
#gameCanvas:focus { outline: none; }
.hud {
  position: absolute; z-index: 3; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: start;
  padding: max(15px, env(safe-area-inset-top)) 18px 0;
  pointer-events: none;
}
.hud-item { display: flex; flex-direction: column; gap: 1px; }
.hud-center { align-items: center; }
.hud-item span, .secondary-hud { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.hud-item strong { font-size: 25px; line-height: 1; text-shadow: 0 0 15px rgba(69,220,255,.6); }
.icon-button {
  justify-self: end; width: 44px; height: 44px; border-radius: 14px;
  pointer-events: auto; cursor: pointer; color: white; background: rgba(8,15,36,.72);
  border: 1px solid rgba(69,220,255,.34); font-size: 18px; font-weight: 900;
}
.secondary-hud {
  position: absolute; z-index: 3; top: max(63px, calc(env(safe-area-inset-top) + 52px)); left: 18px; right: 18px;
  display: flex; justify-content: space-between; pointer-events: none;
}
.action-prompt {
  position: absolute; z-index: 3; left: 50%; bottom: max(34px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: 100%; text-align: center; pointer-events: none; color: white;
  font-size: 11px; font-weight: 900; letter-spacing: .2em; text-shadow: 0 0 12px var(--circle);
  animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .38; transform: translate(-50%, 3px); } }
.floating-message {
  position: absolute; z-index: 4; left: 50%; top: 27%; transform: translateX(-50%);
  width: 90%; text-align: center; color: var(--warning); font-size: 19px; font-weight: 900;
  letter-spacing: .08em; text-shadow: 0 0 16px currentColor;
  animation: messagePop .7s ease both;
}
@keyframes messagePop { 0% { opacity: 0; transform: translate(-50%, 15px) scale(.8); } 25% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 100% { opacity: 0; transform: translate(-50%, -14px) scale(1); } }
.countdown {
  position: absolute; z-index: 6; inset: 0; display: grid; place-items: center;
  background: rgba(2,5,18,.2); color: white; font-size: 92px; font-weight: 900;
  text-shadow: 0 0 36px var(--circle);
}

.overlay {
  position: absolute; z-index: 8; inset: 0; display: grid; place-items: center;
  padding: 22px; background: rgba(1,4,16,.62); backdrop-filter: blur(9px);
}
.global-overlay { z-index: 12; }
.panel {
  width: min(100%, 350px); max-height: calc(100% - 16px); overflow: auto;
  padding: 28px 23px 23px; text-align: center; border-radius: 25px;
  border: 1px solid rgba(69,220,255,.3);
  background: linear-gradient(155deg, rgba(13,26,56,.97), rgba(7,8,27,.98));
  box-shadow: 0 26px 80px rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.08);
}
.panel h2 { margin: 5px 0 22px; font-size: 27px; line-height: 1.04; font-weight: 900; }
.eyebrow { margin: 0; color: var(--circle); font-size: 11px; font-weight: 900; letter-spacing: .2em; }
.eyebrow.danger { color: var(--danger); }
.primary-button, .secondary-button, .text-button, .setting-row {
  width: 100%; cursor: pointer; font-weight: 900; letter-spacing: .08em;
}
.primary-button { min-height: 54px; border-radius: 15px; color: #03101a; background: linear-gradient(135deg, #65efff, #4c80ff); box-shadow: 0 10px 26px rgba(69,220,255,.24); }
.secondary-button { min-height: 48px; margin-top: 10px; border-radius: 14px; color: white; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
.text-button { min-height: 42px; margin-top: 5px; color: var(--muted); background: transparent; font-size: 11px; }
button:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.tutorial-list { display: grid; gap: 10px; margin: 0 0 21px; padding: 0; list-style: none; text-align: left; }
.tutorial-list li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; color: #dbe7fa; font-size: 13px; line-height: 1.35; }
.tutorial-list b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #041321; background: var(--circle); }
.setting-row { display: flex; justify-content: space-between; margin-bottom: 10px; padding: 16px; border-radius: 13px; color: white; background: rgba(255,255,255,.055); font-size: 11px; }
.setting-row strong { color: var(--energy); }
.settings-panel .primary-button { margin-top: 10px; }
.final-score span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.final-score strong { display: block; color: white; font-size: 66px; line-height: 1; text-shadow: 0 0 25px rgba(69,220,255,.45); }
.new-best { margin: 7px 0 -5px; color: var(--warning); font-size: 13px; font-weight: 900; letter-spacing: .14em; }
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.results-grid div { padding: 11px 7px; border-radius: 12px; background: rgba(255,255,255,.05); }
.results-grid div:last-child { grid-column: 1 / -1; }
.results-grid span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.results-grid strong { display: block; margin-top: 3px; font-size: 20px; }
.toast { position: absolute; z-index: 20; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 12px 18px; border-radius: 99px; color: #04131b; background: var(--energy); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
