/* fonts:start — bundled locally so the game works offline and in the iOS app (SIL OFL, see fonts/) */
@font-face { font-family: 'Orbitron'; font-weight: 400 900; font-display: swap; src: url('../fonts/orbitron.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 500; font-display: swap; src: url('../fonts/rajdhani-500.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 600; font-display: swap; src: url('../fonts/rajdhani-600.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 700; font-display: swap; src: url('../fonts/rajdhani-700.woff2') format('woff2'); }
/* fonts:end */

:root {
  --bg: #05010f;
  --panel: rgba(14, 6, 34, 0.92);
  --panel-2: rgba(28, 12, 60, 0.75);
  --line: rgba(160, 120, 255, 0.28);
  --text: #eaf6ff;
  --muted: #9a9cc4;
  --cyan: #2ff3ff;
  --pink: #ff2d95;
  --violet: #9d4dff;
  --gold: #ffd23d;
  --green: #3dff8a;
  --red: #ff3d6e;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: 'Rajdhani', system-ui, sans-serif; font-weight: 600;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: none;
}

canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }

#ui { position: fixed; inset: 0; pointer-events: none; }
.layer { position: absolute; inset: 0; }
.layer > * { pointer-events: auto; }
.hud > *, .banner-layer > * { pointer-events: none; }
.hidden { display: none !important; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3 { font-family: 'Orbitron', sans-serif; margin: 0; letter-spacing: 0.06em; }
.muted { color: var(--muted); }
.num { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1.3em; letter-spacing: 0.02em; line-height: 1; }
.center { text-align: center; }
.tiny { font-size: 12px; }

/* ---------- buttons ---------- */
.btn {
  font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: 14px; letter-spacing: 0.1em;
  padding: 14px 18px; border-radius: 12px; min-height: 48px;
  border: 2px solid var(--cyan); color: var(--cyan);
  background: rgba(47, 243, 255, 0.07);
  box-shadow: 0 0 12px rgba(47, 243, 255, 0.25), inset 0 0 12px rgba(47, 243, 255, 0.12);
  text-shadow: 0 0 8px rgba(47, 243, 255, 0.7);
  transition: transform 0.08s, filter 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; filter: grayscale(0.6); }
.btn.primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, #ff2d95, #9d4dff);
  box-shadow: 0 0 22px rgba(255, 45, 149, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}
.btn.big { font-size: 22px; padding: 18px; min-height: 64px; letter-spacing: 0.2em; }
.btn.small { font-size: 12px; padding: 8px 12px; min-height: 38px; }
.btn.buy { border-color: var(--gold); color: var(--gold); background: rgba(255, 210, 61, 0.08); box-shadow: 0 0 12px rgba(255, 210, 61, 0.25); text-shadow: 0 0 8px rgba(255, 210, 61, 0.6); }
.btn.danger { border-color: var(--red); color: var(--red); background: rgba(255, 61, 110, 0.08); box-shadow: none; text-shadow: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; font-size: 26px; line-height: 1;
  border: 2px solid var(--line); background: var(--panel-2); color: var(--text);
  display: grid; place-items: center;
}
.coin-ico {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  background: var(--gold); clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
  filter: drop-shadow(0 0 4px var(--gold));
}
.coins-pill {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid rgba(255, 210, 61, 0.4); color: var(--gold);
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 18px; line-height: 1;
}

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(var(--st) + 12px) calc(var(--sr) + 16px) calc(var(--sb) + 14px) calc(var(--sl) + 16px);
  max-width: 560px; margin: 0 auto; animation: fadein 0.25s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.topbar .title { flex: 1; text-align: center; font-size: 18px; text-shadow: 0 0 12px rgba(157, 77, 255, 0.8); }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; margin: 8px -16px 0; padding: 4px 16px 16px; }

.menu .logo { margin-top: 4vh; text-align: center; font-family: 'Orbitron', sans-serif; font-weight: 900; line-height: 0.95; }
.logo-a { font-size: clamp(54px, 18vw, 86px); color: #fff; letter-spacing: 0.12em;
  text-shadow: 0 0 6px #fff, 0 0 18px var(--cyan), 0 0 40px var(--cyan); }
.logo-b { font-size: clamp(30px, 10vw, 48px); color: var(--pink); letter-spacing: 0.18em;
  text-shadow: 0 0 6px #ffb3da, 0 0 18px var(--pink), 0 0 40px var(--pink); animation: flicker 5s infinite; }
@keyframes flicker { 0%, 92%, 96%, 100% { opacity: 1; } 94% { opacity: 0.5; } }
.menu-spacer { flex: 1; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.daily-btn { position: relative; border-color: var(--gold); color: var(--gold); text-shadow: 0 0 8px rgba(255, 210, 61, 0.6); background: rgba(255, 210, 61, 0.06); box-shadow: 0 0 10px rgba(255, 210, 61, 0.2); }
.daily-btn.glow { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 26px rgba(255, 210, 61, 0.7); } }
.badge { position: absolute; top: -8px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; display: grid; place-items: center; text-shadow: none; box-shadow: 0 0 10px var(--red); }
.full-btn { border-color: var(--gold); color: #1d1200; background: linear-gradient(135deg, #ffe680, #ffb52e); text-shadow: none; box-shadow: 0 0 16px rgba(255, 210, 61, 0.5); }
.modal.paywall { border-color: rgba(255, 210, 61, 0.6); box-shadow: 0 0 40px rgba(255, 210, 61, 0.3); }
.perks { list-style: none; padding: 0; margin: 12px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.perks li { display: flex; flex-direction: column; padding: 8px 12px 8px 30px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); position: relative; }
.perks li::before { content: '★'; position: absolute; left: 10px; top: 8px; color: var(--gold); text-shadow: 0 0 6px var(--gold); }
.perks b { font-size: 16px; }
.perks span { color: var(--muted); font-size: 14px; }
.btn.ghost { border-color: transparent; background: none; box-shadow: none; color: var(--muted); text-shadow: none; }
.skin-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.skin { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--k); }
.skin.on { border-color: var(--k); box-shadow: 0 0 8px var(--k); }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }
.version-tag { flex: 1; min-width: 0; text-align: center; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- map ---------- */
.world-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.world-tab { padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.world-tab .wnum { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 16px; color: var(--wc); text-shadow: 0 0 10px var(--wc); }
.world-tab .wname { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.world-tab.active { border-color: var(--wc); box-shadow: 0 0 14px color-mix(in srgb, var(--wc) 50%, transparent); }
.world-tab.locked { opacity: 0.5; }
.world-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 4px; }
.world-head h2 { font-size: 20px; color: var(--wc); text-shadow: 0 0 14px var(--wc); }
.star-count { display: flex; align-items: center; gap: 4px; color: var(--gold); font-size: 16px; }
.star-count .star-svg { width: 18px; fill: var(--gold); }
.path { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px 0 20px; }
.path::before { content: ''; position: absolute; left: 50%; top: 30px; bottom: 50px; width: 3px; transform: translateX(-50%);
  background: linear-gradient(var(--pink), var(--violet)); opacity: 0.35; border-radius: 3px; }
.node-wrap { display: flex; align-items: center; gap: 14px; width: 50%; position: relative; }
.node-wrap.left { flex-direction: row-reverse; text-align: right; padding-right: 0; margin-left: 0; transform: translateX(37px); }
.node-wrap.right { margin-left: 50%; transform: translateX(-37px); }
.node {
  flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  border: 3px solid var(--wc); background: radial-gradient(circle, rgba(255, 45, 149, 0.25), rgba(10, 2, 30, 0.95) 70%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--wc) 60%, transparent), inset 0 0 14px color-mix(in srgb, var(--wc) 40%, transparent);
  font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 15px; color: #fff; text-shadow: 0 0 8px var(--wc);
}
.node:active:not(:disabled) { transform: scale(0.94); }
.node.cleared { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 210, 61, 0.5); }
.node.boss { width: 86px; height: 86px; border-color: var(--red); font-size: 14px; box-shadow: 0 0 26px rgba(255, 61, 110, 0.7); animation: pulse-red 2s infinite; }
@keyframes pulse-red { 50% { box-shadow: 0 0 40px rgba(255, 61, 110, 0.9); } }
.node.locked { border-color: #3a2f5c; background: rgba(10, 4, 26, 0.9); box-shadow: none; color: #5d5680; text-shadow: none; animation: none; }
.node-name { font-family: 'Orbitron', sans-serif; font-size: 12px; font-weight: 800; letter-spacing: 0.05em; }
.node-stars { display: flex; gap: 2px; margin-top: 4px; }
.node-wrap.left .node-stars { justify-content: flex-end; }
.node-stars .star-svg { width: 16px; fill: #2b2450; }
.node-stars .on .star-svg { fill: var(--gold); filter: drop-shadow(0 0 4px var(--gold)); }
.soon { text-align: center; padding: 60px 20px; }
.soon img { width: 80px; opacity: 0.8; }
.soon h3 { margin: 12px 0 6px; }

/* ---------- hangar / shop ---------- */
.ship-card { display: flex; gap: 12px; padding: 14px; margin-bottom: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.ship-card.selected { border-color: var(--sc); box-shadow: 0 0 18px color-mix(in srgb, var(--sc) 45%, transparent); }
.ship-card canvas { width: 92px; height: 92px; flex: none; align-self: center; }
.ship-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ship-info h3 { color: var(--sc); text-shadow: 0 0 10px var(--sc); font-size: 17px; }
.ship-info p { margin: 0; font-size: 14px; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; font-size: 11px; color: var(--muted); }
.statbar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.statbar i { display: block; height: 100%; background: var(--sc); box-shadow: 0 0 8px var(--sc); }
.ship-weapon { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.ship-weapon img { width: 26px; height: 26px; }
.ship-weapon em { color: var(--muted); font-style: normal; width: 100%; font-size: 12px; }
.ship-info .btn { align-self: flex-start; }

.shop-row { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.shop-row img { width: 44px; height: 44px; flex: none; }
.shop-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-info b { font-size: 16px; }
.shop-info small { color: var(--muted); font-size: 13px; }
.shop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.shop-lvl { font-family: 'Rajdhani', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.shop-fx { font-size: 15px !important; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-fx b { font-weight: 700; }
.fx-now { color: var(--text); }
.fx-arrow { color: var(--muted); margin: 0 2px; }
.fx-next { color: var(--green); text-shadow: 0 0 8px rgba(61, 255, 138, 0.5); }
.pips { display: flex; gap: 4px; margin-top: 5px; }
.pips i { width: 16px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }
.pips i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.shop-row .btn { min-width: 84px; }

/* ---------- modals ---------- */
.modal-layer { display: none; }
.modal-layer.open { display: flex; align-items: center; justify-content: center; padding: calc(var(--st) + 12px) 14px calc(var(--sb) + 12px); }
.backdrop { position: absolute; inset: 0; background: rgba(3, 0, 12, 0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal {
  position: relative; width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto;
  padding: 20px 18px; border-radius: 20px; background: var(--panel); border: 1px solid rgba(157, 77, 255, 0.5);
  box-shadow: 0 0 40px rgba(157, 77, 255, 0.35); animation: pop 0.22s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { text-align: center; font-size: 22px; margin-bottom: 8px; text-shadow: 0 0 14px rgba(157, 77, 255, 0.9); }
.modal p { margin: 6px 0 12px; }
.modal-kicker { text-align: center; font-family: 'Orbitron', sans-serif; font-size: 12px; letter-spacing: 0.2em; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.modal-actions.col { flex-direction: column; }
.goals { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.goals li { display: flex; align-items: center; gap: 10px; font-size: 16px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.goals .star-svg { width: 20px; fill: #2b2450; flex: none; }
.goals li.done .star-svg { fill: var(--gold); filter: drop-shadow(0 0 4px var(--gold)); }
.goals.inline { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 6px; }
.goals.inline li { font-size: 13px; padding: 4px 8px; gap: 4px; }
.goals.inline .star-svg { width: 14px; }
.goals.progress { gap: 5px; margin: 8px 0 4px; }
.goals.progress li { font-size: 14px; padding: 6px 10px; gap: 8px; }
.goals.progress .star-svg { width: 16px; }
.goals.progress span { flex: 1; }
.goals.progress b { font-family: 'Orbitron', sans-serif; font-size: 13px; color: var(--muted); }
.goals.progress li.done b { color: var(--gold); }
.goals.progress li.miss { background: rgba(255, 61, 90, 0.1); }
.goals.progress li.miss b { color: #ff5a7a; }
.brief-ship { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
.brief-ship canvas { width: 54px; height: 54px; }
.brief-ship div { flex: 1; line-height: 1.2; }
.brief-ship small { color: var(--muted); }

.toggle { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 17px; }
.toggle i { width: 50px; height: 28px; border-radius: 14px; background: #2b2450; position: relative; transition: background 0.2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #8a84b0; transition: transform 0.2s, background 0.2s; }
.toggle.on i { background: rgba(47, 243, 255, 0.35); box-shadow: 0 0 10px rgba(47, 243, 255, 0.5); }
.toggle.on i::after { transform: translateX(22px); background: var(--cyan); }
.toggle.choice b { font-size: 15px; color: var(--cyan); text-shadow: 0 0 8px rgba(47, 243, 255, 0.6); }
.stats-line { margin-top: 14px; font-size: 13px; text-align: center; }

.days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.day { padding: 10px 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--gold); }
.day small { color: var(--muted); font-size: 11px; }
.day b { font-size: 19px; }
.day:last-child { grid-column: span 2; border-color: rgba(255, 210, 61, 0.5); }
.day.got { opacity: 0.4; }
.day.today { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 210, 61, 0.6); background: rgba(255, 210, 61, 0.1); animation: pulse 1.4s infinite; }

/* ---------- level up ---------- */
.modal.levelup, .modal.results, .modal.revive { border-color: rgba(47, 243, 255, 0.5); box-shadow: 0 0 40px rgba(47, 243, 255, 0.3); }
.lu-title { text-align: center; font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 28px; letter-spacing: 0.08em;
  color: #fff; text-shadow: 0 0 8px var(--cc, var(--cyan)), 0 0 24px var(--cc, var(--cyan)); }
.lu-title.lose { --cc: var(--red); }
.cards { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 12px; }
.card {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px; border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--cc) 70%, transparent); background: color-mix(in srgb, var(--cc) 8%, rgba(10, 4, 26, 0.9));
  box-shadow: 0 0 14px color-mix(in srgb, var(--cc) 30%, transparent);
  animation: cardin 0.3s backwards;
}
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
@keyframes cardin { from { transform: translateX(-20px); opacity: 0; } }
.card:active { transform: scale(0.97); }
.card.chosen { transform: scale(1.03); background: color-mix(in srgb, var(--cc) 35%, rgba(10, 4, 26, 0.9)); box-shadow: 0 0 30px var(--cc); transition: transform 0.08s, background 0.08s; }
.lu-step { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 3px 9px; border-radius: 999px; font-size: 14px; letter-spacing: 0.06em;
  background: var(--pink); color: #fff; text-shadow: none; box-shadow: 0 0 12px var(--pink); }
.card.evo { border-color: var(--gold); background: linear-gradient(135deg, rgba(255, 210, 61, 0.2), rgba(255, 45, 149, 0.15)); animation: cardin 0.3s backwards, pulse 1.2s infinite; }
.card img { width: 54px; height: 54px; flex: none; }
.card-info { flex: 1; min-width: 0; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card-top b { font-size: 17px; color: var(--cc); }
.tag { font-family: 'Orbitron', sans-serif; font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); white-space: nowrap; }
.tag.new { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.card.evo .tag { background: var(--gold); color: #2a1600; }
.card-desc { font-size: 14px; color: #c9cbe8; margin-top: 3px; line-height: 1.25; }
.card-combo { font-size: 12px; font-weight: 700; color: #3dffc8; margin-top: 3px; letter-spacing: 0.02em; }
.card-combo::before { content: '⚡ '; }
.card.combo { border-color: #3dffc8; background: linear-gradient(135deg, rgba(61, 255, 200, 0.16), rgba(47, 243, 255, 0.08)); animation: cardin 0.3s backwards, pulse-combo 1.2s infinite; }
@keyframes pulse-combo { 50% { box-shadow: 0 0 26px rgba(61, 255, 200, 0.7); } }
.locked-tap { pointer-events: none; opacity: 0.85; }
.build { display: flex; flex-direction: column; gap: 6px; align-items: center; margin-top: 6px; }
.build-row { display: flex; gap: 6px; min-height: 0; }
.build-item { position: relative; width: 38px; height: 38px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--ic) 60%, transparent); background: rgba(255, 255, 255, 0.04); }
.build-item img { width: 100%; height: 100%; }
.build-item b { position: absolute; right: -4px; bottom: -4px; font-size: 11px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--ic); color: #0a0420; display: grid; place-items: center; font-family: 'Orbitron', sans-serif; }
.reroll { display: flex; margin: 12px auto 0; }

/* ---------- results ---------- */
.rstars { display: flex; justify-content: center; gap: 8px; margin: 12px 0 6px; }
.rstar .star-svg { width: 56px; fill: #2b2450; }
.rstar:nth-child(2) .star-svg { width: 68px; margin-top: -10px; }
.rstar.on { animation: starpop 0.45s backwards cubic-bezier(0.2, 1.6, 0.4, 1); }
.rstar.on .star-svg { fill: var(--gold); filter: drop-shadow(0 0 10px var(--gold)); }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } }
.rstar { position: relative; }
.rstar.new::after { content: 'NEW'; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); font: 700 9px 'Orbitron', sans-serif; letter-spacing: 0.1em; color: #0a0420; background: var(--gold); border-radius: 6px; padding: 1px 5px; }
.rtable .world-bonus span, .rtable .world-bonus b { color: var(--gold); }
.rtable { margin-top: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); padding: 6px 12px; }
.rtable div { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.rtable span { color: var(--muted); }
.rtable .total { border: 0; font-size: 18px; color: var(--gold); }
.rtable .total span { color: var(--text); }
.rtable .total b { font-size: 22px; display: flex; align-items: center; gap: 6px; }

/* ---------- HUD ---------- */
.hud-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--st) + 6px) calc(var(--sr) + 12px) 0 calc(var(--sl) + 12px); }
.xpbar { position: relative; height: 16px; border-radius: 8px; background: rgba(10, 4, 30, 0.75); border: 1px solid rgba(47, 243, 255, 0.4); overflow: hidden; }
.xpfill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #2fd2ff, #9d4dff, #ff2d95); box-shadow: 0 0 12px #2fd2ff; transition: transform 0.12s; }
.xplvl { position: absolute; inset: 0; display: grid; place-items: center; font-family: 'Orbitron', sans-serif; font-size: 10px; font-weight: 900; letter-spacing: 0.1em; text-shadow: 0 0 4px #000, 0 0 2px #000; }
.hud-row { display: grid; grid-template-columns: 1fr auto 1fr 44px; align-items: center; gap: 8px; margin-top: 6px; }
.hud-stat { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 20px; display: flex; align-items: baseline; gap: 5px; text-shadow: 0 0 8px rgba(255, 45, 149, 0.8); }
.hud-stat small { font-family: 'Orbitron', sans-serif; font-size: 9px; color: var(--muted); letter-spacing: 0.1em; }
.hud-stat.right { justify-content: flex-end; color: var(--gold); text-shadow: 0 0 8px rgba(255, 210, 61, 0.6); align-items: center; }
.hud-timer { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 22px; text-shadow: 0 0 10px var(--cyan); }
.hud-timer.boss-mode { color: var(--red); text-shadow: 0 0 10px var(--red); }
.pause-btn { pointer-events: auto !important; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 4, 30, 0.6); display: flex; align-items: center; justify-content: center; gap: 5px; }
.pause-btn i { width: 4px; height: 16px; border-radius: 2px; background: var(--text); }
.bossbar { margin-top: 8px; }
.bossname { text-align: center; font-family: 'Orbitron', sans-serif; font-size: 11px; font-weight: 900; letter-spacing: 0.25em; color: var(--red); text-shadow: 0 0 8px var(--red); margin-bottom: 3px; }
.bosstrack { height: 10px; border-radius: 5px; background: rgba(10, 4, 30, 0.8); border: 1px solid rgba(255, 61, 110, 0.6); overflow: hidden; }
.bossfill { height: 100%; transform-origin: left; background: linear-gradient(90deg, #ff2d6f, #ff8a2a); box-shadow: 0 0 10px var(--red); transition: transform 0.15s; }

/* ---------- banner & toast ---------- */
.banner-layer { display: flex; align-items: flex-start; justify-content: center; padding-top: calc(var(--st) + 19vh); }
.banner { text-align: center; animation: banner 2.6s ease forwards; padding: 0 16px; }
.banner-title { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(26px, 8.5vw, 40px); letter-spacing: 0.08em; color: #fff;
  text-shadow: 0 0 8px var(--pink), 0 0 26px var(--pink); }
.banner-sub { font-family: 'Orbitron', sans-serif; font-size: 14px; letter-spacing: 0.25em; color: var(--cyan); text-shadow: 0 0 10px var(--cyan); margin-top: 6px; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.6); } 10% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(0.95); } }
.toast { position: absolute; left: 50%; top: calc(var(--st) + 70px); transform: translateX(-50%); padding: 10px 18px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--gold); color: var(--gold); font-family: 'Orbitron', sans-serif; font-size: 13px; opacity: 0; pointer-events: none; white-space: nowrap; }
.toast.show { animation: toast 2.2s ease; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ---------- TEST variant (js/testkit.js) ---------- */
.test-build .version-tag { color: var(--red); font-weight: 700; }
.test-build .hud-row { grid-template-columns: 1fr auto 1fr 44px 44px; }
.test-btn { border-color: var(--red) !important; font-size: 18px; }
.fps { position: fixed; left: calc(var(--sl) + 8px); bottom: calc(var(--sb) + 6px); z-index: 50; pointer-events: none; font: 600 12px 'Rajdhani', sans-serif;
  color: var(--green); background: rgba(5, 1, 15, 0.7); padding: 2px 6px; border-radius: 6px; }
.modal.testkit { border-color: var(--red); }
.tk-kicker { color: var(--red); }
.tk-head { margin: 12px 0 6px; font-family: 'Orbitron', sans-serif; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.tk-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.tk-boss { display: flex; flex-direction: column; gap: 2px; border-color: var(--wc) !important; color: var(--wc) !important; }
.tk-boss small { font-family: 'Rajdhani', sans-serif; color: var(--muted); }

/* ---------- tutorial ---------- */
.tip-box { position: absolute; left: 50%; bottom: calc(42% + 10px); transform: translateX(-50%); width: min(calc(100% - 32px), 360px);
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px;
  background: rgba(14, 6, 34, 0.88); border: 1px solid var(--gold); box-shadow: 0 0 18px rgba(255, 210, 61, 0.35);
  animation: tip-in 0.35s ease; transition: opacity 0.5s, transform 0.5s; }
.tip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tip-text b { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 14px; letter-spacing: 0.1em; color: var(--gold); text-shadow: 0 0 8px rgba(255, 210, 61, 0.6); }
.tip-text span { font-size: 15px; line-height: 1.25; color: var(--text); }
.tip-skip { flex: none; align-self: flex-start; font-family: 'Orbitron', sans-serif; font-size: 10px; letter-spacing: 0.12em; color: var(--muted);
  padding: 8px 6px; min-height: 32px; }
.tip-check { display: none; font-style: normal; font-size: 26px; color: var(--green); text-shadow: 0 0 10px var(--green); }
.tip-box.done { border-color: var(--green); opacity: 0; transform: translate(-50%, -14px); }
.tip-box.done .tip-check { display: block; }
.tip-box.done .tip-skip { display: none; }
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.lu-hint { margin: 8px auto 2px; max-width: 340px; padding: 8px 12px; border-radius: 10px; text-align: center; font-size: 15px; line-height: 1.25;
  color: var(--gold); border: 1px dashed rgba(255, 210, 61, 0.6); background: rgba(255, 210, 61, 0.07); }
.coach { position: fixed; width: min(calc(100% - 24px), 230px); z-index: 5; padding: 7px 11px; pointer-events: none !important;
  border-radius: 10px; background: rgba(14, 6, 34, 0.95); border: 1px solid var(--gold); box-shadow: 0 0 14px rgba(255, 210, 61, 0.3);
  font-size: 14px; line-height: 1.25; animation: coach-in 0.35s ease; }
.coach b { display: block; font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 11px; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 2px; }
.coach-tail { position: absolute; left: var(--tail, 50%); bottom: -6px; width: 10px; height: 10px; margin-left: -5px; transform: rotate(45deg);
  background: rgba(14, 6, 34, 0.95); border: solid var(--gold); border-width: 0 1px 1px 0; }
.coach.below .coach-tail { bottom: auto; top: -6px; border-width: 1px 0 0 1px; }
@keyframes coach-in { from { opacity: 0; } to { opacity: 1; } }
.coach-target { animation: coach-pulse 1.2s ease-in-out infinite; border-radius: 12px; }
@keyframes coach-pulse { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(255, 210, 61, 0.7); } }

@media (max-height: 640px) {
  .menu .logo { margin-top: 1vh; }
  .card { padding: 9px; }
  .card img { width: 44px; height: 44px; }
  .cards { gap: 7px; }
}

/* ---------- combos (v1.2) ---------- */
.hud-combos { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 5px; pointer-events: none; }
.combo-chip { font: 700 9px 'Orbitron', sans-serif; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 6px; color: var(--cc);
  border: 1px solid color-mix(in srgb, var(--cc) 60%, transparent); background: rgba(10, 4, 30, 0.7); white-space: nowrap; }
.combo-chip.on { background: color-mix(in srgb, var(--cc) 35%, rgba(10, 4, 30, 0.8)); color: #fff; box-shadow: 0 0 10px var(--cc); }
.build-combos { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 320px; }
.combo-list { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #c9cbe8; }
.combo-list b { color: var(--cc); margin-right: 4px; }
/* ---------- codex ---------- */
.codex-count { font: 700 15px 'Orbitron', sans-serif; color: var(--gold); min-width: 54px; text-align: right; }
.codex-head { font: 700 13px 'Orbitron', sans-serif; letter-spacing: 0.12em; color: var(--muted); margin: 14px 2px 8px; display: flex; justify-content: space-between; }
.codex-head span { color: var(--gold); }
.codex-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--cc, #6b5fa0) 45%, transparent); }
.codex-item img { width: 44px; height: 44px; flex: none; }
.codex-item b { display: block; color: var(--cc); font-size: 15px; }
.codex-item small { display: block; color: #c9cbe8; font-size: 13px; line-height: 1.25; margin-top: 2px; }
.codex-item em { display: block; font-style: normal; font-size: 12px; color: #3dffc8; margin-top: 3px; }
.codex-item.locked { opacity: 0.6; --cc: #6b5fa0; }
.codex-item.locked b { color: var(--muted); letter-spacing: 0.2em; }
.codex-q { width: 44px; height: 44px; flex: none; border-radius: 10px; display: grid; place-items: center; font: 800 22px 'Orbitron', sans-serif;
  color: var(--muted); border: 1px dashed rgba(255, 255, 255, 0.2); }
.codex-link { width: 100%; margin-top: 4px; }
.codex-new { margin-top: 10px; padding: 8px 12px; border-radius: 10px; text-align: center; font: 700 12px 'Orbitron', sans-serif; letter-spacing: 0.04em;
  color: #3dffc8; background: rgba(61, 255, 200, 0.1); border: 1px solid rgba(61, 255, 200, 0.4); }

/* Endless mode (v1.3): the card under a world's sectors and the score on its results screen */
.endless-card { display: flex; flex-direction: column; align-items: center; gap: 4px; width: calc(100% - 40px); margin: 6px 20px 24px; padding: 14px 16px;
  border-radius: 14px; border: 1px solid var(--wc); background: color-mix(in srgb, var(--wc) 14%, transparent); color: var(--text, #e9e6ff);
  font: inherit; box-shadow: 0 0 18px color-mix(in srgb, var(--wc) 35%, transparent); }
.endless-card b { font-family: 'Orbitron', sans-serif; letter-spacing: 0.12em; color: var(--wc); }
.endless-card span { font-size: 13px; opacity: 0.85; }
.endless-card.locked { opacity: 0.55; box-shadow: none; border-style: dashed; }
.endless-score { display: flex; flex-direction: column; align-items: center; margin: 10px 0 2px; }
.endless-score b { font-family: 'Orbitron', sans-serif; font-size: 46px; color: var(--wc); text-shadow: 0 0 18px var(--wc); }
.endless-score span { font-family: 'Orbitron', sans-serif; font-size: 12px; letter-spacing: 0.3em; opacity: 0.8; }
.lb-btn { display: block; margin: 0 auto 12px; }
