:root {
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #05070f;
  color: #e8ecf7;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
}
h1 {
  font-size: 1.6rem;
  margin: 4px 0 2px;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #7ee8fa, #eec0c6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  color: #9aa5c0;
  font-size: 0.85rem;
  margin-bottom: 6px;
  text-align: center;
}
/* min-height is a thin 22px strip (not the real 90px leaderboard-ad height)
   until AdSense is approved — a full-height empty placeholder wastes space
   that's better spent on the game board. Bump back to 90px and restore the
   old padding/margin once real ads go live to avoid layout shift. */
.ad-slot {
  width: 100%;
  max-width: 728px;
  min-height: 22px;
  margin: 4px auto;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5170;
  font-size: 0.68rem;
  border: 1px dashed #2a3050;
  border-radius: 8px;
  background: #0a0e1c;
}
.game-grid {
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin: 12px 0;
}
.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 20px 12px;
  border-radius: 14px;
  border: 1px solid #232a4d;
  background: #0a0e1c;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: #4f8cff;
}
.game-card-thumb {
  font-size: 2.2rem;
}
.game-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}
.game-card-desc {
  font-size: 0.75rem;
  color: #9aa5c0;
}
.game-card-best {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, rgba(255,209,102,0.16), rgba(255,169,77,0.08));
  border: 1px solid rgba(255,209,102,0.4);
  color: #ffd166;
  box-shadow: 0 0 12px rgba(255,209,102,0.15);
}
.game-card-best.no-record {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.1);
  color: #6b7391;
  box-shadow: none;
}
.game-card-soon {
  opacity: 0.5;
  cursor: default;
}
.game-card-soon:hover {
  transform: none;
  border-color: #232a4d;
}
.game-wrap {
  position: relative;
  width: min(720px, 100%);
  aspect-ratio: 480 / 720;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 2px #232a4d, 0 20px 60px rgba(0,0,0,0.6);
  background: #000;
}
/* Desktop only: also cap width by the height left over after the rest of the
   page (header/ads/footer, ~250px now that the ad placeholders are thin), so
   the whole game fits in one screen instead of forcing a scroll on shorter
   laptop viewports. On narrow/mobile screens this is skipped — scrolling
   there is normal and shrinking further would make the game needlessly tiny. */
@media (min-width: 700px) {
  .game-wrap {
    width: min(720px, 100%, calc((100dvh - 250px) * 480 / 720));
  }
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.hud {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
  pointer-events: none;
}
.hud #weapon {
  color: #ffd166;
  font-size: 0.78rem;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(5,7,15,0.86);
  text-align: center;
  padding: 24px;
}
.overlay h2 {
  margin: 0;
  font-size: 1.4rem;
}
.overlay p {
  margin: 0;
  color: #a7b0cc;
  font-size: 0.85rem;
  line-height: 1.5;
}
button.primary {
  background: linear-gradient(90deg, #4f8cff, #7ee8fa);
  color: #06101f;
  border: none;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(79,140,255,0.35);
}
button.primary:active { transform: scale(0.97); }
button.secondary {
  background: transparent;
  color: #7ee8fa;
  border: 1px solid #2a3050;
  padding: 9px 22px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
}
button.secondary:active { transform: scale(0.97); }
.hidden { display: none !important; }
.controls-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #6b7391;
  text-align: center;
  max-width: 480px;
}
footer {
  margin-top: 12px;
  font-size: 0.7rem;
  color: #4a5170;
  text-align: center;
}
footer a {
  color: #6b7391;
  text-decoration: none;
  margin: 0 6px;
}
footer a:hover {
  color: #9aa5c0;
  text-decoration: underline;
}

/* Content pages (about / privacy) */
.content {
  width: 100%;
  max-width: 640px;
  margin: 8px auto 0;
}
.content h2 {
  font-size: 1.15rem;
  color: #cfe8ff;
  margin: 28px 0 8px;
}
.content h2:first-child {
  margin-top: 0;
}
.content p, .content li {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #c3cae0;
}
.content ul {
  padding-left: 20px;
  margin: 8px 0;
}
.content .updated {
  color: #6b7391;
  font-size: 0.78rem;
  margin-top: -4px;
}
.back-link {
  display: inline-block;
  margin: 4px 0 16px;
  color: #7ee8fa;
  text-decoration: none;
  font-size: 0.85rem;
}
.back-link:hover { text-decoration: underline; }
