@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: #f5f7ff;
  background: #080d24;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --cyan: #82f2f4;
  --muted: #9cacc9;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -30%, #29356c 0, transparent 62%),
    #080d24;
}
button, a { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.shell { width: min(1240px, 100%); margin: 0 auto; padding: 18px 26px 14px; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 62px; margin-bottom: 12px; }
.back-link { color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.back-link:hover { color: white; }
.brand { display: flex; align-items: center; gap: 10px; color: #e8edff; font-size: 9px; font-weight: 600; letter-spacing: 2px; line-height: 1.4; text-decoration: none; }
.brand b { color: var(--cyan); font-size: 13px; letter-spacing: 2.5px; }
.brand-icon { display: grid; width: 37px; height: 37px; place-items: center; border: 1px solid #7693e7; border-radius: 12px; color: #ffe28c; background: #17224c; font-size: 22px; }
.menu-button { justify-self: end; border: 1px solid #637198; border-radius: 10px; padding: 9px 13px; color: #e7edff; background: #141d3c; font-size: 12px; font-weight: 700; }
.game-frame { position: relative; overflow: hidden; border: 1px solid #475b91; border-radius: 20px; background: #111a3b; box-shadow: 0 25px 90px #0007, 0 0 55px #788aff19; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 1100 / 620; touch-action: none; }
.hidden { display: none !important; }
.hud { position: absolute; inset: 14px 18px auto; display: flex; align-items: center; gap: 20px; pointer-events: none; }
.hud-world { display: grid; gap: 2px; min-width: 140px; padding: 9px 14px; border: 1px solid #c1eaff44; border-radius: 12px; background: #0c143abf; backdrop-filter: blur(8px); }
.hud-world span, .boss-title span { color: var(--cyan); font-size: 9px; font-weight: 700; letter-spacing: 2px; }
.hud-world b { font-size: 13px; }
.hud-health { color: #ff8296; font-size: 22px; letter-spacing: 4px; text-shadow: 0 0 16px #ff5f87aa; }
.hud-stars { margin-left: auto; padding: 9px 14px; border: 1px solid #ffe69b44; border-radius: 12px; color: #ffe28c; background: #0c143abf; font-size: 16px; }
.boss-hud { position: absolute; bottom: 20px; left: 50%; width: min(420px, 72%); transform: translateX(-50%); padding: 10px 14px; border: 1px solid #ffaaa455; border-radius: 12px; background: #10152edb; }
.boss-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.boss-title b { font-size: 12px; }
.boss-track { height: 10px; overflow: hidden; border: 1px solid #ffffff3b; border-radius: 10px; background: #3a2845; }
.boss-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff6d8d, #ffcc78); transition: width 120ms linear; }
.overlay, .message-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 28px; background: linear-gradient(90deg, #090e27ed 0%, #090e27bb 51%, #090e2733 100%); }
.menu-card { width: min(540px, 100%); }
.eyebrow { margin: 0 0 13px; color: var(--cyan); font: 700 10px ui-monospace, Consolas, monospace; letter-spacing: 2.3px; }
h1 { margin: 0; font-size: clamp(36px, 5vw, 58px); line-height: .99; letter-spacing: -3px; }
h1 span { color: #ffd879; }
.intro { max-width: 420px; margin: 15px 0 18px; color: #c4cce1; font-size: 13px; line-height: 1.65; }
.world-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.world-card { min-width: 0; min-height: 78px; border: 1px solid #8490b055; border-radius: 12px; padding: 8px 4px; color: #e8ecfa; background: #171d3ebf; text-align: center; }
.world-card:hover:not(:disabled), .world-card.selected { border-color: var(--world); background: color-mix(in srgb, var(--world) 18%, #171d3e); }
.world-card:disabled { filter: grayscale(1); opacity: .43; cursor: not-allowed; }
.world-card .planet { display: block; color: var(--world); font-size: 20px; line-height: 1.2; }
.world-card b { display: block; margin-top: 5px; font-size: 9px; }
.world-card small { display: block; margin-top: 3px; color: #aab4ce; font-size: 8px; }
.menu-bottom { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
.controls-copy { max-width: 225px; margin: 0; color: #a9b5d1; font-size: 10px; line-height: 1.6; }
.play-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 46px; border: 1px solid #ffdda0; border-radius: 12px; padding: 0 16px; color: #25203b; background: linear-gradient(135deg, #ffe58d, #ffab83); box-shadow: 0 8px 26px #ffb76836; font-size: 11px; font-weight: 800; letter-spacing: .5px; }
.play-button:hover { transform: translateY(-2px); }
.message-overlay { background: #080d24a8; backdrop-filter: blur(6px); }
.message-card { width: min(420px, 100%); padding: 27px; border: 1px solid #8296da66; border-radius: 20px; background: #111a3bf2; box-shadow: 0 18px 80px #0008; text-align: center; }
.message-card h2 { margin: 0; font-size: clamp(28px, 5vw, 42px); letter-spacing: -1.5px; }
.message-card > p:not(.eyebrow) { margin: 12px 0 20px; color: #c1cce3; font-size: 14px; line-height: 1.6; }
.message-card .eyebrow { margin-bottom: 8px; }
.touch-controls { position: absolute; inset: auto 12px 12px; z-index: 2; display: none; justify-content: space-between; pointer-events: none; }
.touch-controls button { width: 45px; height: 45px; border: 1px solid #c4d5ff66; border-radius: 50%; color: white; background: #101b44bf; font-size: 19px; pointer-events: auto; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 13px 3px 0; color: #7885a8; font: 9px ui-monospace, Consolas, monospace; letter-spacing: 1.4px; }
@media (max-width: 680px) {
  .shell { padding: 10px 9px; }
  .topbar { min-height: 48px; margin-bottom: 8px; }
  .back-link { font-size: 10px; }
  .brand { gap: 6px; font-size: 7px; }
  .brand b { font-size: 9px; }
  .brand-icon { width: 30px; height: 30px; }
  .menu-button { padding: 7px; font-size: 9px; }
  .game-frame { border-radius: 12px; }
  .overlay { align-items: start; overflow-y: auto; padding: 18px; background: #090e27d9; }
  .menu-card { margin: auto 0; }
  h1 { font-size: clamp(34px, 9vw, 48px); }
  .intro { margin: 10px 0 12px; font-size: 11px; }
  .world-picker { gap: 4px; }
  .world-card { min-height: 66px; padding: 6px 2px; }
  .world-card b { font-size: 8px; }
  .world-card small { font-size: 7px; }
  .menu-bottom { align-items: flex-start; flex-direction: column; margin-top: 12px; }
  .controls-copy { max-width: none; }
  .play-button { min-height: 40px; }
  .hud { inset: 7px 8px auto; gap: 7px; }
  .hud-world { min-width: 0; padding: 6px 8px; }
  .hud-world span { font-size: 7px; }
  .hud-world b { font-size: 9px; }
  .hud-health { font-size: 15px; letter-spacing: 1px; }
  .hud-stars { padding: 6px 8px; font-size: 12px; }
  .boss-hud { bottom: 7px; width: 70%; padding: 6px 9px; }
  .boss-title { margin-bottom: 4px; }
  .boss-title b { font-size: 9px; }
  .boss-title span { font-size: 7px; }
  .boss-track { height: 7px; }
  .touch-controls { display: flex; }
  .footer { font-size: 7px; letter-spacing: .6px; }
}
@media (hover: none) and (pointer: coarse) {
  .touch-controls { display: flex; }
}
