:root {
  --space1: #0b1036;
  --space2: #1a1f5c;
  --ink: #f8fafc;
  --muted: #a5b4fc;
  --card: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .16);
  --good: #4ade80;
  --bad: #f87171;
  --gold: #fde047;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 70% 0%, #2b2f7a 0%, var(--space2) 35%, var(--space1) 100%) fixed;
  color: var(--ink);
  font-family: "Nunito", "Segoe UI Rounded", "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px; line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
.hidden { display: none !important; }

.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: .6; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: rgba(11, 16, 54, .7); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px); height: 58px;
}
.logo { font-weight: 900; font-size: 24px; white-space: nowrap; }
.top-actions { display: flex; gap: 8px; }
.top-btn { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.top-btn:hover { background: rgba(255, 255, 255, .16); }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* ---------- instellen ---------- */
.intro { text-align: center; margin: 4px 0 16px; }
.intro h1 { margin: 0 0 6px; font-size: 32px; }
.intro p { margin: 0; color: var(--muted); }
.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; transition: opacity .2s; }
.card.off { opacity: .4; }
.card h2 { margin: 0 0 10px; font-size: 19px; }
.card h2 small { color: var(--muted); font-weight: 600; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips + .chips { margin-top: 10px; }
.chip {
  background: rgba(255, 255, 255, .08); border: 2px solid var(--line); border-radius: 14px;
  padding: 9px 14px; font-weight: 800; font-size: 17px; transition: background .15s, border-color .15s;
}
.chip b { font-size: 20px; margin-right: 4px; color: var(--gold); }
.chip:hover { border-color: rgba(255, 255, 255, .4); }
.chip.on { background: rgba(253, 224, 71, .18); border-color: var(--gold); }
.chip.tbl { width: 52px; padding: 9px 0; text-align: center; }
.chip.mini { font-size: 14px; padding: 5px 10px; font-weight: 700; }
.sub-h { margin: 14px 0 8px; font-size: 16px; color: var(--muted); }
.chip small { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; min-height: 18px; }
.start-row { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; margin: 20px 0; }
.example { color: var(--muted); font-size: 16px; }
.example b { color: var(--ink); }
.big-btn {
  background: linear-gradient(180deg, #fb923c, #ea580c); color: #fff;
  font-size: 24px; font-weight: 900; padding: 14px 34px; border-radius: 16px;
  box-shadow: 0 5px 0 #9a3412; transition: transform .1s;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #9a3412; }
.big-btn:disabled { filter: grayscale(1); opacity: .5; cursor: not-allowed; }
.big-btn.small { font-size: 18px; padding: 10px 22px; }
.big-btn.ghost { background: rgba(255, 255, 255, .14); box-shadow: 0 5px 0 rgba(0, 0, 0, .3); }
.howto { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.howto h2 { margin: 0 0 10px; font-size: 20px; }
.howto-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.howto-grid div { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.howto-grid span { color: var(--muted); }
.note { color: var(--muted); font-size: 14px; margin: 14px 0 0; }

/* ---------- spel ---------- */
#screen-game main, #screen-game { padding: 0; }
.game-wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; height: calc(100vh - 58px - 32px); height: calc(100dvh - 58px - 32px); min-height: 480px; }
.hud { display: grid; grid-template-columns: 70px 1fr 110px; align-items: center; gap: 8px; }
.hud-left, .hud-right { text-align: center; }
.hud-right { text-align: right; }
.hud-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 800; }
.hud-val { font-size: 30px; font-weight: 900; line-height: 1; }
.hud-sum {
  text-align: center; font-size: 42px; font-weight: 900; color: var(--gold); line-height: 1.1;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line); border-radius: 16px; padding: 4px 8px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hud-sum.flash-good { animation: fg .5s; }
.hud-sum.flash-bad { animation: fb .5s; }
@keyframes fg { 30% { background: rgba(74, 222, 128, .45); } }
@keyframes fb { 30% { background: rgba(248, 113, 113, .5); } }
.hud-shields { font-size: 20px; letter-spacing: 1px; white-space: nowrap; }
.hud-shields .lost { opacity: .2; filter: grayscale(1); }
.hud-score { font-size: 14px; color: var(--muted); font-weight: 700; }
.hud-score span { color: var(--ink); font-size: 18px; font-weight: 900; }
.progress { height: 8px; background: rgba(255, 255, 255, .12); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #a78bfa, #f0abfc); transition: width .3s; }
.canvas-box { position: relative; flex: 1; min-height: 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: #070b26; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; }
.toast {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 3;
  background: rgba(5, 8, 30, .85); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px;
  font-weight: 800; font-size: 18px; text-align: center; max-width: 92%; pointer-events: none;
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }
.toast small { display: block; color: var(--muted); font-weight: 700; font-size: 15px; }
.overlay {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; overflow: auto;
  background: rgba(5, 8, 30, .78); text-align: center; padding: 20px;
}
.ov-title { font-size: 38px; font-weight: 900; margin: 0 0 6px; }
.ov-text { font-size: 19px; margin: 6px 0 12px; }
.ov-big { font-size: 64px; font-weight: 900; color: var(--gold); line-height: 1; }
.ov-count { font-size: 90px; font-weight: 900; color: var(--gold); }
.ov-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.ov-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0; }
.ov-list span { background: rgba(255, 255, 255, .1); border-radius: 10px; padding: 4px 10px; font-weight: 800; }
.ov-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.ov-stats div { background: rgba(255, 255, 255, .08); border-radius: 12px; padding: 6px 12px; font-size: 15px; color: var(--muted); }
.ov-stats b { display: block; font-size: 26px; color: var(--ink); }
.touch { display: none; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; }
.t-btn {
  background: rgba(255, 255, 255, .14); border-radius: 18px; font-size: 32px; font-weight: 900; height: 70px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .35); user-select: none; -webkit-user-select: none; touch-action: none;
}
.t-btn.fire { background: linear-gradient(180deg, #fb923c, #ea580c); }
.t-btn.down { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
body.touchy .touch { display: grid; }

@media (max-width: 860px) {
  .setup { grid-template-columns: 1fr; }
  .howto-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  main { padding: 10px; }
  .logo { font-size: 20px; }
  .top { padding: 8px 10px; }
  .top-btn { padding: 6px 10px; font-size: 16px; }
  .bt { display: none; }
  .intro h1 { font-size: 24px; }
  .chip { font-size: 15px; padding: 7px 10px; }
  .chip.tbl { width: 44px; }
  .howto-grid { grid-template-columns: 1fr; }
  .game-wrap { height: calc(100dvh - 58px - 20px); }
  .hud { grid-template-columns: 54px 1fr 92px; gap: 6px; }
  .hud-sum { font-size: 30px; }
  .hud-val { font-size: 24px; }
  .hud-shields { font-size: 16px; }
  .t-btn { height: 60px; }
  .ov-title { font-size: 28px; }
}
