:root {
  --ink: #e9f1ff;
  --muted: #9fb0cc;
  --panel: rgba(9, 13, 24, 0.82);
  --line: rgba(134, 217, 255, 0.28);
  --cy: #86d9ff;
  --pink: #ff7ab6;
  --good: #6dffa6;
  --bad: #ff5d7c;
  --gold: #ffe28a;
  --head: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --body: "Exo 2", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #04060c; color: var(--ink); font-family: var(--body); overflow: hidden; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* retro: faint CRT scanlines over the game picture (menus and touch buttons sit above them) */
body.scan #app::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.16) 0 1px, rgba(0,0,0,0) 1px 3px); }
.ui, .touch, .pausebtn { z-index: 2; }
body.playing #cv { cursor: none; }

/* ---------- overlay screens */
.ui { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow-y: auto; background: radial-gradient(ellipse at center, rgba(4,6,12,0.25), rgba(4,6,12,0.7)); }
.ui[hidden] { display: none; }
.panel { width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: rise 0.35s ease-out; }
.panel.wide { width: min(860px, 100%); }
.panel.small { width: min(420px, 100%); text-align: center; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.kicker { font: 700 12px/1.2 var(--head); letter-spacing: 0.18em; color: var(--cy); margin-bottom: 6px; }
.kicker.good { color: var(--good); } .kicker.bad { color: var(--bad); }
h1, h2, h3 { font-family: var(--head); margin: 0 0 12px; letter-spacing: 0.04em; }
h2 { font-size: clamp(22px, 4vw, 30px); }
h2.big { font-size: clamp(34px, 7vw, 52px); color: var(--gold); }
h3 { font-size: 14px; color: var(--cy); margin-top: 16px; }
p { line-height: 1.5; margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.good { color: var(--good); } .cy { color: var(--cy); }

/* title */
.title { text-align: center; width: min(500px, 100%); }
.logo { font-size: clamp(40px, 9vw, 68px); line-height: 0.95; margin: 4px 0 12px; font-weight: 900; display: flex; flex-direction: column; align-items: center; }
.logo span { background: linear-gradient(180deg, #ffffff, #9fdcff 60%, #4aa8ff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(80,180,255,0.45)); }
.logo .b { background: linear-gradient(180deg, #ffe0ef, #ff8fc4 60%, #ff4f9a); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 18px rgba(255,90,160,0.45)); letter-spacing: 0.12em; }
.tag { color: var(--muted); margin-bottom: 18px; }
.note { color: var(--muted); font-size: 13px; margin-top: 8px; }
.hint-rotate { display: none; color: var(--gold); font-size: 13px; }
@media (orientation: portrait) and (pointer: coarse) { .hint-rotate { display: block; } }

/* buttons */
.menu { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.menu.row { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.menu.row button { flex: 1 1 160px; }
.menu.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
button { font: 600 16px var(--body); color: var(--ink); background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; padding: 12px 16px; cursor: pointer; transition: transform 0.08s, background 0.15s, border-color 0.15s; min-height: 46px; }
button:hover:not([disabled]) { background: rgba(134,217,255,0.12); border-color: rgba(134,217,255,0.5); }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button:active:not([disabled]) { transform: scale(0.98); }
button.primary { background: linear-gradient(180deg, #4cc3ff, #1f7fd6); border-color: #7fd6ff; color: #fff; font-weight: 700; box-shadow: 0 6px 22px rgba(40,150,255,0.35); }
button.primary:hover { background: linear-gradient(180deg, #6fd0ff, #2b8fe6); }
button.danger { border-color: rgba(255,93,124,0.5); color: #ffb3c2; }
button[disabled] { opacity: 0.4; cursor: not-allowed; }
.diff { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.diff button { flex: 1; padding: 9px 8px; min-height: 40px; font-size: 14px; }
.diff button.sel, .tog.sel, .skin.sel { border-color: var(--gold); background: rgba(255,226,138,0.12); }

/* story / radio */
.story p { font-size: 17px; min-height: 1.5em; }
.radio { background: rgba(255,122,182,0.07); border: 1px solid rgba(255,122,182,0.35); border-radius: 12px; padding: 12px 14px; margin: 14px 0; }
.radio.ctl { background: rgba(134,217,255,0.06); border-color: rgba(134,217,255,0.3); }
.radio .who { font: 700 11px var(--head); letter-spacing: 0.14em; color: var(--pink); margin-bottom: 6px; }
.radio.ctl .who { color: var(--cy); }
.radio p { margin: 0; min-height: 3em; font-size: 16px; }
.tip { font-size: 14px; color: var(--gold); }
/* what's coming: threat cards on the story and briefing screens */
.story { width: min(720px, 100%); }
h3.ahead { margin: 18px 0 8px; font-size: 13px; letter-spacing: 0.14em; color: var(--pink); }
.threats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 6px; }
.threat { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.10); }
.threat svg { flex: 0 0 auto; }
.threat b { display: block; font-size: 14px; }
.threat span { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
.threat.hot { border-color: rgba(255,226,138,0.6); background: rgba(255,226,138,0.08); }
.threat.soon svg { filter: drop-shadow(0 0 4px rgba(255,90,140,0.35)); }
.teaser { margin: 10px 0; }
.mini-threats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: -6px 0 12px; opacity: 0.9; }
.mini-threats svg { width: 24px; height: 24px; }
.tlabel { font: 700 11px var(--head); letter-spacing: 0.14em; color: var(--muted); margin-bottom: 5px; }
.tlabel.new { color: var(--gold); }
.runline { text-align: center; color: var(--muted); margin: 10px 0 4px; }
.runline b { color: var(--ink); }
.unlock { text-align: center; padding: 10px; border-radius: 10px; background: rgba(255,226,138,0.1); border: 1px solid rgba(255,226,138,0.4); margin: 10px 0; }

/* depth meter */
.depth { margin: 14px 0 6px; }
.depth .track { position: relative; height: 12px; border-radius: 6px; background: rgba(255,255,255,0.08); display: flex; justify-content: space-between; align-items: center; padding: 0 3px; overflow: hidden; }
.depth .fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #2b8fe6, #ff7ab6); border-radius: 6px; transition: width 0.8s ease; }
.depth i { position: relative; width: 3px; height: 6px; background: rgba(255,255,255,0.25); border-radius: 1px; }
.depth i.on { background: rgba(255,255,255,0.85); }
.depth .ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; align-items: center; }
.depth .ends b { color: var(--pink); }
.depth .heart { color: var(--pink); font-size: 16px; }

/* tables */
.tally { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 15px; }
.tally td { padding: 5px 2px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.tally td:last-child { text-align: right; font-family: var(--head); font-size: 14px; }
.tally tr.zero td { color: var(--muted); }
.tally tr.tot td { color: var(--gold); font-weight: 700; border-bottom: 0; }
.scores { width: 100%; border-collapse: collapse; font-size: 15px; margin-bottom: 10px; }
.scores th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px; }
.scores td { padding: 7px 4px; border-top: 1px solid rgba(255,255,255,0.07); }
.scores td:nth-child(3) { font-family: var(--head); color: var(--gold); }
.scores tr.me td { background: rgba(255,226,138,0.12); }

/* name entry */
.namebox { margin: 14px 0; }
.namebox label { display: block; color: var(--gold); margin-bottom: 8px; font-weight: 700; }
.namebox .row { display: flex; gap: 8px; }
.namebox input { flex: 1; min-width: 0; font: 700 18px var(--head); letter-spacing: 0.06em; color: var(--ink); background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; -webkit-user-select: text; user-select: text; }
.namebox input:focus { outline: 2px solid var(--gold); }

/* missions grid */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mcard { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 10px 12px; }
.mcard .n { font: 900 18px var(--head); color: var(--cy); }
.mcard .nm { font-size: 14px; }
.mcard .st { font-size: 12px; color: var(--gold); min-height: 1em; }

/* how-to */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 22px; }
.cols p { font-size: 14px; }
kbd { display: inline-block; min-width: 24px; padding: 1px 6px; margin: 0 2px 2px 0; font: 700 12px var(--head); color: var(--ink); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); border-bottom-width: 3px; border-radius: 6px; text-align: center; }

/* settings */
.slider { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
.slider input { flex: 1; accent-color: var(--cy); }
.skins { display: flex; flex-wrap: wrap; gap: 8px; }
.skin { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 14px; min-height: 40px; }
.skin .sw { width: 18px; height: 18px; border-radius: 50%; border: 3px solid; }

/* ---------- touch controls */
.touch { position: absolute; inset: auto 0 0 0; height: 46%; pointer-events: auto; touch-action: none; }
.touch[hidden] { display: none; }
.touch .tl, .touch .tr { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 12px; align-items: flex-end; }
.touch .tl { left: max(16px, env(safe-area-inset-left)); }
.touch .tr { right: max(16px, env(safe-area-inset-right)); }
.tb { width: 76px; height: 76px; border-radius: 50%; padding: 0; font: 700 22px var(--head); color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.25); touch-action: none; min-height: 0; }
.tb.sm { width: 62px; height: 62px; font-size: 10px; letter-spacing: 0.05em; margin-bottom: 30px; }
.tb.big { width: 96px; height: 96px; font-size: 12px; background: rgba(76,195,255,0.14); border-color: rgba(134,217,255,0.55); }
.tb.on { background: rgba(134,217,255,0.4); border-color: #fff; transform: scale(0.95); }
.pausebtn { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); margin-top: 52px; width: 40px; height: 34px; min-height: 0; padding: 0; font: 900 13px var(--head); background: rgba(0,0,0,0.3); border-radius: 8px; opacity: 0.7; }
.pausebtn[hidden] { display: none; }
@media (pointer: fine) { .pausebtn { opacity: 0.35; } .pausebtn:hover { opacity: 1; } }
@media (max-height: 420px) { .tb { width: 64px; height: 64px; } .tb.big { width: 80px; height: 80px; } .tb.sm { width: 54px; height: 54px; margin-bottom: 22px; } .panel { padding: 18px 20px; } }

/* link to the web guide on the How to play screen */
.guidelink { text-align: center; margin: 14px 0 0; font-size: 15px; }
.guidelink a { color: #86d9ff; }

/* online high scores */
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.tabs button { flex: 1; padding: 9px 8px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--ink); font: 700 13px var(--head); letter-spacing: 0.06em; cursor: pointer; }
.tabs button.sel { border-color: var(--cy); color: var(--cy); background: rgba(80,220,255,0.1); }
.scores tr.gap td { text-align: center; color: var(--muted); border-top: 0; padding: 2px; }
.pilotbox { margin: 12px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,0.25); text-align: left; }
.pilotbox p { margin: 0 0 6px; }
.pilotbox .code { font-family: var(--head); letter-spacing: 0.08em; color: var(--gold); }
.pilotbox .row { display: flex; gap: 8px; margin-top: 8px; }
.pilotbox input { flex: 1; min-width: 0; font: 600 14px var(--head); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; -webkit-user-select: text; user-select: text; }
.pilotbox button[type="submit"] { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--cy); background: rgba(80,220,255,0.12); color: var(--cy); font: 700 13px var(--head); cursor: pointer; }
.linkish { border: 0; background: none; padding: 0 2px; color: var(--cy); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.online { margin: 12px 0; }
.online .ranks { font-weight: 700; margin: 0 0 4px; }
.online .ranks b { color: var(--gold); font-family: var(--head); }
.newbest { color: var(--gold); font-weight: 700; margin: 8px 0 0; }
.pname { margin: 10px 0 2px; text-align: left; }
.pname label { display: block; font-weight: 700; font-size: 13px; color: var(--gold); margin-bottom: 6px; }
.pname .row { display: flex; gap: 8px; }
.pname input { flex: 1; min-width: 0; font: 700 15px var(--head); letter-spacing: 0.04em; color: var(--ink); background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; -webkit-user-select: text; user-select: text; }
.pname input:focus { outline: 2px solid var(--gold); }
.pname button[type="submit"] { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--gold); background: rgba(255,226,138,0.12); color: var(--gold); font: 700 13px var(--head); cursor: pointer; }
.nmsg { min-height: 16px; margin: 6px 0 0; }
.nmsg.bad { color: var(--bad); } .nmsg.good { color: var(--good); }

/* ---------- Skiff Rush */
html, body { background: #0a1a28; }
.logo span { background: linear-gradient(180deg, #ffffff, #bff3ff 55%, #3fd6ff); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 18px rgba(63,214,255,0.5)); }
.logo .b { background: linear-gradient(180deg, #ffe3f6, #ff8fe0 55%, #ff4fd8); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 18px rgba(255,79,216,0.5)); letter-spacing: 0.14em; }
button.primary { background: linear-gradient(180deg, #ff6fe0, #c42aa6); border-color: #ff9fe8; box-shadow: 0 6px 22px rgba(255,79,216,0.35); }
button.primary:hover { background: linear-gradient(180deg, #ff8fe8, #d63ab8); }
.lime { color: #d8ff5a; } .pink { color: #ff7ad8; } .gold { color: var(--gold); }
.ui { background: radial-gradient(ellipse at center, rgba(10,26,40,0.15), rgba(4,8,16,0.6)); }
/* touch: swipe anywhere, hop + cloud buttons bottom right */
.touch { inset: auto 0 0 auto; width: 240px; height: 200px; pointer-events: none; }
.touch .tr { pointer-events: auto; }
.touch .swipe { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 108px); margin: 0; font: 600 11px var(--head); letter-spacing: 0.08em; color: rgba(255,255,255,0.45); pointer-events: none; }
.tb { width: 72px; height: 72px; font-size: 11px; letter-spacing: 0.06em; margin-bottom: 18px; }
.tb.big { width: 92px; height: 92px; margin-bottom: 0; background: rgba(255,79,216,0.16); border-color: rgba(255,143,224,0.6); font-size: 14px; }
.tb.on { background: rgba(255,143,224,0.45); }
.pausebtn { left: auto; right: max(12px, env(safe-area-inset-right)); transform: none; margin-top: 0; top: max(12px, env(safe-area-inset-top)); }

.bad { color: var(--bad); }
