@font-face { font-family: 'Bungee'; src: url(bungee.woff2) format('woff2'); font-display: swap; }
:root {
  --ink: #fff7ea; --dim: #b9b2df; --panel: rgba(16, 10, 44, .84); --edge: rgba(255, 255, 255, .14);
  --gold: #ffd23f; --orange: #ff8a1f; --pink: #ff4f9a; --cyan: #5ee7ff; --violet: #8b5cff;
  --font: ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0726; color: var(--ink); font-family: var(--font);
  overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

#pauseBtn { position: fixed; z-index: 5; width: 44px; height: 44px; border-radius: 14px; border: 2px solid rgba(255,255,255,.25);
  background: rgba(20, 12, 56, .55); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
#pauseBtn:hover { background: rgba(60, 40, 140, .7); }

#ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px;
  pointer-events: auto; overflow: auto; }
.screen.active { display: flex; animation: fadeIn .25s ease-out; }
#s-title { background: radial-gradient(ellipse at 50% 45%, rgba(11,7,38,.5), rgba(11,7,38,.78)); }
#s-pause, #s-settings, #s-hangar, #s-scores, #s-howto, #s-continue, #s-over { background: rgba(8, 5, 26, .62); }
#s-clear { background: rgba(8, 5, 26, .35); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.panel { background: var(--panel); border: 2px solid var(--edge); border-radius: 22px; padding: 22px 22px 18px; width: min(380px, 100%);
  display: flex; flex-direction: column; gap: 12px; align-items: stretch; box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.08);
  animation: popIn .28s cubic-bezier(.2,1.4,.4,1); margin: auto; }
.panel.wide { width: min(560px, 100%); }
h2 { font-family: 'Bungee', var(--font); font-weight: 400; margin: 0 0 4px; text-align: center; font-size: 28px; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff 10%, #ffd23f 60%, #ff8a1f); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #3b1466); }
.sub { margin: 0; text-align: center; color: var(--dim); font-size: 14px; line-height: 1.35; }

.btn { font-family: 'Bungee', var(--font); font-size: 20px; letter-spacing: .5px; color: #2a0f45; cursor: pointer; border: 0; border-radius: 16px;
  padding: 12px 16px; background: linear-gradient(180deg, #ffe066, #ffb02e 55%, #ff8a1f); box-shadow: 0 5px 0 #b4501a, 0 8px 18px rgba(0,0,0,.35);
  transition: transform .08s, box-shadow .08s, filter .15s; display: flex; flex-direction: column; align-items: center; line-height: 1.05; outline: none; }
.btn small { font-family: var(--font); font-weight: 700; font-size: 12px; letter-spacing: 0; opacity: .75; margin-top: 3px; }
.btn:hover, .btn:focus-visible { filter: brightness(1.1); }
.btn:focus-visible, .chip:focus-visible, .skin:focus-visible, .tab:focus-visible, .tg:focus-visible, .link:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b4501a, 0 3px 8px rgba(0,0,0,.35); }
.btn.big { font-size: 34px; padding: 16px; border-radius: 20px; }
.btn.small { font-size: 14px; padding: 10px 8px; background: linear-gradient(180deg, #a98bff, #7b56f5); color: #fff; box-shadow: 0 4px 0 #4527a8, 0 6px 14px rgba(0,0,0,.3); }
.btn.small:active { box-shadow: 0 1px 0 #4527a8; }
.btn[disabled], .btn.locked { filter: grayscale(.8) brightness(.7); cursor: default; }
#bSurvival { background: linear-gradient(180deg, #7ef0ff, #2fb8ff 60%, #2485ff); box-shadow: 0 5px 0 #1a4fae, 0 8px 18px rgba(0,0,0,.35); color: #071a4a; }
.row2, .row3 { display: grid; gap: 10px; }
.row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: 1fr 1fr 1fr; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: rgba(0,0,0,.3); padding: 5px; border-radius: 14px; }
.chip { font: 800 15px var(--font); color: var(--dim); background: transparent; border: 0; border-radius: 10px; padding: 9px 4px; cursor: pointer; }
.chip.on { background: linear-gradient(180deg, #ff6fb0, #e83f8a); color: #fff; box-shadow: 0 3px 0 #8c1f55; }
.link { background: none; border: 0; color: var(--cyan); font: 700 14px var(--font); cursor: pointer; text-decoration: underline; padding: 4px; }
.gc { color: rgba(255,255,255,.55); font-size: 12px; text-decoration: none; text-align: center; }
.gc:hover { color: #fff; }
#s-title > .gc { position: absolute; bottom: 10px; left: 0; right: 0; }

.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(400px, 100%); margin: auto; }
.logo-col { display: flex; flex-direction: column; align-items: center; }
.menu-col { display: flex; flex-direction: column; gap: 11px; width: 100%; }
#logoShip { width: 128px; height: 128px; margin-bottom: -18px; animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 8px 18px rgba(255,140,40,.35)); }
@keyframes bob { 50% { transform: translateY(-8px) rotate(2deg); } }
.logo { margin: 0; font-family: 'Bungee', var(--font); font-weight: 400; line-height: .9; text-align: center; display: flex; gap: 12px;
  font-size: clamp(44px, 13vw, 64px); }
.logo span { background: linear-gradient(180deg, #fff 0%, #ffe066 45%, #ff8a1f 75%, #ff4f9a); -webkit-background-clip: text; background-clip: text;
  color: transparent; filter: drop-shadow(0 4px 0 #3b1466) drop-shadow(0 0 18px rgba(255,120,200,.45)); }
.logo .l2 { background: linear-gradient(180deg, #fff 0%, #8ff5ff 45%, #3fa0ff 75%, #8b5cff); -webkit-background-clip: text; background-clip: text; }
.tagline { margin: 8px 0 0; color: var(--dim); font-size: 14px; text-align: center; font-weight: 700; }
.hiline { text-align: center; color: var(--gold); font: 400 13px 'Bungee', var(--font); opacity: .9; min-height: 16px; }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tg { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: rgba(255,255,255,.07); border: 2px solid transparent;
  color: var(--ink); border-radius: 12px; padding: 9px 10px; font: 700 14px var(--font); cursor: pointer; }
.tg i { width: 34px; height: 20px; border-radius: 10px; background: #3a2f66; position: relative; flex: none; transition: background .15s; }
.tg i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #aaa; transition: all .15s; }
.tg.on i { background: #2fc37a; } .tg.on i::after { left: 17px; background: #fff; }
.slider { display: flex; align-items: center; gap: 10px; font: 700 14px var(--font); }
.slider input { flex: 1; accent-color: var(--gold); }

.skins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.skin { background: rgba(255,255,255,.06); border: 2px solid transparent; border-radius: 14px; padding: 8px 4px; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font: 800 13px var(--font); }
.skin canvas { width: 64px; height: 64px; }
.skin small { font-weight: 600; font-size: 10.5px; color: var(--dim); text-align: center; line-height: 1.2; min-height: 26px; }
.skin.sel { border-color: var(--gold); background: rgba(255,210,63,.12); }
.skin.lock canvas { filter: brightness(0) opacity(.5); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tab { font: 800 13px var(--font); background: rgba(255,255,255,.07); color: var(--dim); border: 0; border-radius: 10px; padding: 7px 10px; cursor: pointer; }
.tab.on { background: var(--violet); color: #fff; }
.scores { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.scores li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center; background: rgba(255,255,255,.05);
  border-radius: 9px; padding: 6px 10px; font-weight: 700; font-size: 14px; }
.scores li::before { content: counter(s); font-family: 'Bungee', var(--font); color: var(--gold); }
.scores li b { font-family: 'Bungee', var(--font); font-weight: 400; }
.scores li span.st { color: var(--dim); font-size: 12px; }
.scores li.me { background: rgba(255,210,63,.18); }
.scores .empty { text-align: center; color: var(--dim); padding: 20px; background: none; grid-template-columns: 1fr; }
.scores .empty::before { content: none; }
.stats { text-align: center; color: var(--dim); font-size: 12.5px; }
.howto { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.4; }
.howto b { color: var(--gold); }
kbd { background: rgba(255,255,255,.14); border-radius: 5px; padding: 0 5px; font: 700 12px var(--font); border-bottom: 2px solid rgba(0,0,0,.4); }
.howto i { font-style: normal; font-family: 'Bungee', var(--font); padding: 0 5px; border-radius: 50%; color: #fff; }
.c-s { background: #ff8a1f; } .c-l { background: #22b8ff; } .c-h { background: #2fc35a; } .c-b { background: #e8b100; }

.tally { display: flex; flex-direction: column; gap: 6px; }
.tally div { display: flex; justify-content: space-between; font-weight: 800; font-size: 15px; background: rgba(255,255,255,.05); border-radius: 9px; padding: 7px 11px;
  animation: popIn .25s ease-out both; }
.tally div b { font-family: 'Bungee', var(--font); font-weight: 400; color: var(--gold); }
.tally div.tot { background: rgba(255,210,63,.16); font-size: 17px; }
.tally div.unl { background: linear-gradient(90deg, rgba(47,184,255,.25), rgba(139,92,255,.25)); color: #cfe9ff; justify-content: center; }
.count { font: 400 72px 'Bungee', var(--font); text-align: center; color: var(--gold); line-height: 1; }
.final { font: 400 40px 'Bungee', var(--font); text-align: center; color: var(--gold); text-shadow: 0 3px 0 #6a2d10; }
.namebox { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; text-align: center; color: var(--gold); }
.namebox input { font: 400 22px 'Bungee', var(--font); text-align: center; padding: 8px; border-radius: 12px; border: 2px solid var(--gold);
  background: rgba(0,0,0,.35); color: #fff; text-transform: uppercase; user-select: text; -webkit-user-select: text; outline: none; }
.unlocks { display: flex; flex-direction: column; gap: 6px; }
.unlocks div { background: linear-gradient(90deg, rgba(94,231,255,.2), rgba(139,92,255,.2)); border-radius: 10px; padding: 8px 10px; font-weight: 800; font-size: 14px;
  text-align: center; animation: popIn .4s cubic-bezier(.2,1.4,.4,1) both; }

#toast { position: fixed; z-index: 20; left: 50%; top: 70px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; transition: all .3s;
  background: linear-gradient(90deg, #2fb8ff, #8b5cff); color: #fff; font: 800 15px var(--font); padding: 10px 16px; border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* short landscape screens (phones) */
@media (max-height: 520px) and (orientation: landscape) {
  .screen { padding: 8px; }
  .title-wrap { flex-direction: row; width: min(720px, 100%); gap: 26px; align-items: center; }
  .logo-col { flex: 1; } .menu-col { flex: 1; gap: 8px; }
  #logoShip { width: 92px; height: 92px; margin-bottom: -10px; }
  .logo { font-size: 48px; }
  .btn.big { font-size: 26px; padding: 10px; }
  .btn { font-size: 16px; padding: 9px 12px; }
  .btn.small { font-size: 12px; padding: 8px 6px; }
  .panel { padding: 14px 16px 12px; gap: 8px; }
  .panel.wide { width: min(640px, 100%); }
  h2 { font-size: 22px; }
  .skins { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .skin canvas { width: 48px; height: 48px; }
  .howto { font-size: 12.5px; gap: 4px; }
  .tagline { font-size: 12px; }
  #s-title > .gc { bottom: 4px; }
  .count { font-size: 52px; }
  .final { font-size: 30px; }
  .tally { gap: 3px; } .tally div { padding: 3px 10px; font-size: 13px; } .tally div.tot { font-size: 14px; }
}
@media (max-width: 380px) { .skins { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { #logoShip { animation: none; } .screen.active, .panel { animation: none; } }
.navfocus:focus { outline: 3px solid #fff; outline-offset: 3px; }
