/* ============================================================
   ABDUCTION — Bold cartoon arcade UI
   Flat punchy colours, rounded "sticker" panels with offset
   shadows (no glassmorphism), custom icons, juicy interactions.
   Mobile-first.
   ============================================================ */

:root {
  /* night-sky cartoon palette */
  --bg0: #2a1f63;
  --bg1: #130e30;
  --ink: #181043; /* dark text on bright fills */
  --paper: #322a73; /* panel surface */
  --paper-hi: #3d348a; /* panel top highlight */
  --paper-edge: #211a52; /* panel underside / outline */

  --lime: #5fe06b;
  --lime-d: #2c9a3c;
  --cyan: #3ad8d0;
  --cyan-d: #1e948f;
  --coral: #ff7a8a;
  --coral-d: #d34a5d;
  --sun: #ffd24a;
  --sun-d: #d9a41c;

  --text: #f5f2ff;
  --muted: #b1a8e6;

  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito",
    "Segoe UI", system-ui, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg1);
  color: var(--text);
  font-family: var(--font);
  font-weight: 700;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

.ic {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex: none;
  fill: currentColor;
  vertical-align: -0.14em;
}

/* ============================ HUD ============================ */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* a reusable chunky sticker panel */
.sticker {
  background: var(--paper);
  border: 2px solid var(--paper-edge);
  border-top-color: var(--paper-hi);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--paper-edge), 0 8px 16px rgba(0, 0, 0, 0.35);
}

/* streamlined top bar: one row (score · time · objectives · pause) + thin hull */
.hud-top {
  position: absolute;
  top: calc(8px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px - var(--safe-l) - var(--safe-r));
  max-width: 430px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 12px;
  background: rgba(46, 38, 108, 0.8);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}
.hud-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 19px;
  line-height: 1;
}
.stat .ic {
  font-size: 17px;
}
.s-score .ic {
  color: var(--sun);
}
.s-taken .ic {
  color: var(--lime);
}
.s-time .ic {
  color: var(--cyan);
}
.stat-val {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}
.hud-timer.warn {
  animation: shake 0.5s infinite;
}
.hud-timer.warn .stat-val,
.hud-timer.warn .ic {
  color: var(--coral);
}
@keyframes shake {
  25% {
    transform: translateX(-1.5px);
  }
  75% {
    transform: translateX(1.5px);
  }
}

/* thin hull bar under the row */
.hud-hull {
  display: flex;
  align-items: center;
}
.hud-hull-bar {
  position: relative;
  flex: 1;
  height: 7px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
}
.hud-hull-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--lime);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35);
  transition: width 0.18s cubic-bezier(0.2, 0.9, 0.3, 1), background 0.2s;
}
.hud-hull-fill.low {
  background: var(--coral);
}

/* objectives tracker: icon + remaining count, inline in the top row */
.hud-objs {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.ochip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.26);
  border-radius: 999px;
  padding: 3px 8px 3px 5px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}
.ochip .ic {
  font-size: 15px;
  color: var(--lime);
}
.ochip b {
  color: var(--sun);
  font-variant-numeric: tabular-nums;
  min-width: 0.9em;
  text-align: center;
}
.ochip.done {
  opacity: 0.55;
}
.ochip.done .ic {
  color: var(--lime);
}
.ochip.done b {
  color: var(--lime);
}

/* combo */
.hud-combo {
  position: absolute;
  top: calc(96px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  font-size: 26px;
  font-weight: 900;
  color: var(--sun);
  text-shadow: 0 3px 0 var(--sun-d), 0 0 18px rgba(255, 210, 74, 0.5);
  white-space: nowrap;
  animation: pop-in 0.18s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes pop-in {
  from {
    transform: translateX(-50%) rotate(-3deg) scale(0.4);
    opacity: 0;
  }
}

/* objectives — collapsible, lighter, out of the way */
.hud-objectives {
  position: absolute;
  top: calc(10px + var(--safe-t));
  left: calc(10px + var(--safe-l));
  padding: 5px;
  background: rgba(34, 26, 82, 0.66);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 2px solid var(--paper-edge);
  border-top-color: var(--paper-hi);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--paper-edge), 0 8px 16px rgba(0, 0, 0, 0.3);
  max-width: 230px;
  pointer-events: auto;
}
.obj-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 4px 5px;
  cursor: pointer;
}
.obj-flag {
  font-size: 14px;
  color: var(--lime);
}
.obj-head-label {
  flex: 1;
  text-align: left;
}
.obj-head-count {
  color: var(--sun);
  font-variant-numeric: tabular-nums;
}
.obj-chev {
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.2s;
}
.hud-objectives.collapsed .obj-chev {
  transform: rotate(-90deg);
}
#hud-objective-list {
  list-style: none;
  margin: 4px 2px 2px;
  padding: 0;
  font-size: 13px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
  max-height: 220px;
}
.hud-objectives.collapsed #hud-objective-list {
  max-height: 0;
  opacity: 0;
  margin: 0;
}
#hud-objective-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  line-height: 1.1;
  color: var(--text);
}
#hud-objective-list li .obj-ic {
  font-size: 16px;
  color: var(--muted);
}
#hud-objective-list li .obj-label {
  flex: 1;
}
#hud-objective-list .obj-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--sun);
}
#hud-objective-list li.done {
  color: var(--lime);
}
#hud-objective-list li.done .obj-ic,
#hud-objective-list li.done .obj-count {
  color: var(--lime);
}
#hud-objective-list li.done .obj-label {
  text-decoration: line-through;
  opacity: 0.75;
}

/* comms toasts */
#hud-broadcasts {
  position: absolute;
  bottom: calc(16px + var(--safe-b));
  left: calc(12px + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 64vw;
}
.broadcast {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  background: var(--lime);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--lime-d);
  animation: toast 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.broadcast .ic {
  font-size: 14px;
}
@keyframes toast {
  from {
    transform: translateX(-14px) scale(0.85);
    opacity: 0;
  }
}

/* ability buttons */
.hud-power {
  position: absolute;
  bottom: calc(22px + var(--safe-b));
  right: calc(18px + var(--safe-r));
  pointer-events: auto;
  display: flex;
  gap: 18px;
  touch-action: none;
}
.power-btn {
  --cd: 1;
  position: relative;
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.power-btn .ic {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25));
}
.power-btn.shield {
  background: var(--lime);
  --ring: var(--lime);
  box-shadow: 0 5px 0 var(--lime-d), 0 9px 16px rgba(0, 0, 0, 0.4);
}
.power-btn.emp {
  background: var(--cyan);
  --ring: var(--cyan);
  box-shadow: 0 5px 0 var(--cyan-d), 0 9px 16px rgba(0, 0, 0, 0.4);
}
.power-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
/* charging ring */
.power-btn::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--cd) * 360deg), rgba(0, 0, 0, 0.35) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
}
/* dim while recharging */
.power-btn:not(.ready) {
  filter: grayscale(0.55) brightness(0.78);
}
.power-btn.active {
  animation: throb 0.6s ease-in-out infinite;
}
@keyframes throb {
  50% {
    transform: scale(1.07);
  }
}
.power-cd {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.power-cd:empty {
  display: none;
}
.power-name {
  position: absolute;
  bottom: -16px;
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 900;
  color: var(--muted);
}

/* pause button (inline, right of the top row) */
.pause-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  pointer-events: auto;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.08s, background 0.1s;
}
.pause-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.pause-btn .ic {
  width: 18px;
  height: 18px;
}
.pause-btn:active {
  transform: scale(0.92);
}

/* pause screen */
.pause-screen {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: radial-gradient(120% 90% at 50% 40%, rgba(8, 6, 24, 0.6), rgba(8, 6, 24, 0.9));
  animation: fade-in 0.2s ease;
}
.pause-screen.hidden {
  display: none !important;
}
@media (min-width: 760px) {
  .pause-screen {
    align-items: center;
  }
}
.pause-objs {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pause-objs li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 800;
}
.pause-objs li.done {
  color: var(--lime);
}
.pause-objs .po-ic {
  font-size: 20px;
  color: var(--lime);
}
.pause-objs .po-label {
  flex: 1;
  text-align: left;
}
.pause-objs .po-count {
  color: var(--sun);
  font-variant-numeric: tabular-nums;
}
.pause-objs li.done .po-count {
  color: var(--lime);
}

/* results "haul" grid (what you abducted) */
.haul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 16px;
}
.haul-item {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 7px 12px;
  font-weight: 900;
  font-size: 15px;
}
.haul-item .ic {
  font-size: 19px;
  color: var(--lime);
}
.haul-item b {
  color: var(--sun);
  font-variant-numeric: tabular-nums;
}

/* level select */
.lvl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 6px 0 14px;
}
.lvl-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid var(--paper-edge);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.07s, border-color 0.1s;
}
.lvl-card:not(.locked):active {
  transform: scale(0.98);
}
.lvl-card:not(.locked) {
  border-color: var(--lime);
}
.lvl-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.lvl-num {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  background: var(--paper-hi);
  color: var(--lime);
}
.lvl-card.locked .lvl-num {
  color: var(--muted);
}
.lvl-name {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.15;
}
.lvl-lock {
  margin-left: auto;
  color: var(--muted);
}
.lvl-lock .ic {
  width: 18px;
  height: 18px;
}

/* menu secondary buttons + ship shop + leaderboard screen */
.menu-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}
.menu-btns .btn {
  flex: 1;
  min-width: 120px;
  margin: 0;
  font-size: 14px;
  padding: 13px 10px;
}
.menu-btns .ic {
  font-size: 16px;
  vertical-align: -0.16em;
}
.ach-tally {
  font-size: 12px;
  color: var(--sun);
  margin-left: 2px;
}

.ship-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0 14px;
}
@media (min-width: 520px) {
  .ship-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.ship-card {
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.ship-card.sel {
  border-color: var(--lime);
  background: rgba(95, 224, 107, 0.08);
}
.ship-prev {
  width: 100%;
  display: flex;
  justify-content: center;
}
.ship-svg {
  width: 84px;
  height: auto;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}
.ship-name {
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
}
.ship-btn,
.ship-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-weight: 900;
  font-size: 13px;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.ship-btn .ic,
.ship-tag .ic {
  width: 15px;
  height: 15px;
}
.ship-btn.buy {
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--sun-d);
}
.ship-btn.own {
  background: var(--lime);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--lime-d);
}
.ship-btn.cant {
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
  box-shadow: none;
  opacity: 0.7;
}
.ship-btn:active {
  transform: translateY(2px);
}
.ship-tag.sel {
  background: transparent;
  color: var(--lime);
}

.lb-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  margin: 2px 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.lb-tabs::-webkit-scrollbar {
  display: none;
}
.lb-tab {
  flex: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
.lb-tab.active {
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--sun-d);
}
.lb-sub {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin: 0 0 8px;
}
.lb-body {
  min-height: 80px;
  margin: 6px 0 14px;
}
.lb-empty {
  color: var(--muted);
  font-weight: 700;
  padding: 20px 0;
}
.lb-rows {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 380px;
  text-align: left;
}
.lb-rows li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
}
.lb-rows li:nth-child(odd) {
  background: rgba(0, 0, 0, 0.18);
}
.lb-rows li.me {
  background: rgba(255, 210, 74, 0.16);
  box-shadow: inset 0 0 0 1px var(--sun);
}
.lb-rows .lb-rank {
  width: 26px;
  color: var(--sun);
  font-weight: 900;
}
.lb-rows .lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-rows .lb-score {
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

/* ===================== Achievements ===================== */
/* unlock toast */
.ach-toast {
  position: fixed;
  z-index: 30;
  top: calc(-120px - var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 28px);
  max-width: 360px;
  padding: 11px 14px;
  background: linear-gradient(180deg, #3a2f86, #2a2168);
  border: 2px solid var(--sun);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: top 0.4s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.ach-toast.show {
  top: calc(12px + var(--safe-t));
}
.ach-toast-ic {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--sun-d);
}
.ach-toast-ic .ic {
  width: 26px;
  height: 26px;
}
.ach-toast-h {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 900;
  color: var(--sun);
}
.ach-toast-name {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
}

/* menu tally badge */
.ach-tally {
  font-size: 13px;
  color: var(--sun);
  margin-left: 4px;
}

/* achievements list */
.ach-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 14px;
}
.ach {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 10px 12px;
}
.ach.got {
  border-color: var(--sun);
  background: rgba(255, 210, 74, 0.08);
}
.ach-ic {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--paper-hi);
  color: var(--muted);
  box-shadow: 0 3px 0 var(--paper-edge);
}
.ach.got .ach-ic {
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--sun-d);
}
.ach-ic .ic {
  width: 26px;
  height: 26px;
}
.ach-body {
  flex: 1;
  min-width: 0;
}
.ach-name {
  font-weight: 900;
  font-size: 15px;
}
.ach-desc {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin: 2px 0 5px;
}
.ach-bar {
  height: 7px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
}
.ach-bar span {
  display: block;
  height: 100%;
  background: var(--lime);
  border-radius: 999px;
}
.ach-prog {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.ach-done {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 900;
  color: var(--sun);
}
.ach-done .ic {
  width: 15px;
  height: 15px;
}

/* ===================== Pre-game briefing ===================== */
.briefing {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 40%, rgba(8, 6, 24, 0.45), rgba(8, 6, 24, 0.82));
  animation: fade-in 0.3s ease;
}
.briefing.hidden {
  display: none !important;
}
.brief-tag {
  font-size: 12px;
  letter-spacing: 4px;
  font-weight: 900;
  color: var(--lime);
}
.brief-level {
  font-size: clamp(24px, 7vw, 38px);
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text);
  text-shadow: 0 3px 0 var(--paper-edge);
  text-align: center;
}
.brief-objs {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
}
.brief-objs li {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--paper);
  border: 2px solid var(--paper-edge);
  border-top-color: var(--paper-hi);
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--paper-edge);
  animation: brief-rise 0.4s cubic-bezier(0.2, 1.3, 0.4, 1) backwards;
}
.brief-objs li:nth-child(2) {
  animation-delay: 0.08s;
}
.brief-objs li:nth-child(3) {
  animation-delay: 0.16s;
}
.brief-objs li:nth-child(4) {
  animation-delay: 0.24s;
}
.brief-objs li .ic {
  font-size: 22px;
  color: var(--lime);
}
.brief-objs li span {
  flex: 1;
}
.brief-objs li b {
  color: var(--sun);
  font-weight: 900;
}
@keyframes brief-rise {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
.brief-count {
  margin-top: 8px;
  font-size: clamp(64px, 22vw, 120px);
  font-weight: 900;
  line-height: 1;
  color: var(--lime);
  text-shadow: 0 6px 0 var(--lime-d), 0 8px 20px rgba(0, 0, 0, 0.5);
  min-height: 1px;
}
.brief-count.go {
  color: var(--sun);
  text-shadow: 0 6px 0 var(--sun-d), 0 8px 20px rgba(0, 0, 0, 0.5);
}
.brief-count.pop {
  animation: count-pop 0.45s cubic-bezier(0.2, 1.5, 0.35, 1);
}
@keyframes count-pop {
  from {
    transform: scale(0.3);
    opacity: 0.2;
  }
  60% {
    transform: scale(1.12);
    opacity: 1;
  }
  to {
    transform: scale(1);
  }
}

/* ========================= Overlays ========================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: radial-gradient(130% 90% at 50% -10%, var(--bg0), var(--bg1) 70%);
  overflow-y: auto;
}
/* cartoon twinkle-stars */
.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cg fill='%23fff'%3E%3Cpath d='M34 16c1 6 2 7 8 8-6 1-7 2-8 8-1-6-2-7-8-8 6-1 7-2 8-8z'/%3E%3Cpath d='M186 54c.7 4 1.3 4.6 5.3 5.3-4 .7-4.6 1.3-5.3 5.3-.7-4-1.3-4.6-5.3-5.3 4-.7 4.6-1.3 5.3-5.3z'/%3E%3Cpath d='M120 150c.8 5 1.6 5.8 6.6 6.6-5 .8-5.8 1.6-6.6 6.6-.8-5-1.6-5.8-6.6-6.6 5-.8 5.8-1.6 6.6-6.6z'/%3E%3Cpath d='M70 200c.6 3.6 1.1 4.1 4.7 4.7-3.6.6-4.1 1.1-4.7 4.7-.6-3.6-1.1-4.1-4.7-4.7 3.6-.6 4.1-1.1 4.7-4.7z'/%3E%3C/g%3E%3C/svg%3E");
  animation: twinkle 4s ease-in-out infinite, drift 90s linear infinite;
}
@keyframes twinkle {
  50% {
    opacity: 0.28;
  }
}
@keyframes drift {
  to {
    background-position: -240px 240px;
  }
}
.overlay.hidden {
  display: none;
}

.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  background: var(--paper);
  border: 3px solid var(--paper-edge);
  border-top-color: var(--paper-hi);
  border-radius: 28px 28px 0 0;
  padding: 26px 20px calc(24px + var(--safe-b));
  box-shadow: 0 -2px 0 var(--paper-hi) inset, 0 -14px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: sheet 0.34s cubic-bezier(0.18, 1.3, 0.4, 1);
  max-height: 94vh;
  overflow-y: auto;
}
@keyframes sheet {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
}

/* headings */
.title {
  font-size: clamp(42px, 14vw, 66px);
  font-weight: 900;
  letter-spacing: -1px;
  margin: 6px 0 2px;
  color: var(--lime);
  text-shadow: 0 4px 0 var(--lime-d), 0 5px 14px rgba(0, 0, 0, 0.4);
}
.subtitle {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}
.card h2 {
  font-size: 30px;
  font-weight: 900;
  margin: 2px 0 2px;
  letter-spacing: -0.5px;
}

/* how-to rows */
.howto {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}
.how-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.35;
}
.how-row b {
  color: var(--text);
}
.how-ic {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
}
.how-ic .ic {
  width: 22px;
  height: 22px;
}
.how-ic.a {
  background: var(--lime);
  box-shadow: 0 3px 0 var(--lime-d);
}
.how-ic.b {
  background: var(--cyan);
  box-shadow: 0 3px 0 var(--cyan-d);
}
.how-ic.c {
  background: var(--coral);
  box-shadow: 0 3px 0 var(--coral-d);
}
.how-ic.d {
  background: var(--sun);
  box-shadow: 0 3px 0 var(--sun-d);
  color: var(--ink);
}
kbd {
  background: var(--paper-edge);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}

/* buttons — chunky pills with a 3D underside */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 16px 24px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.3px;
  cursor: pointer;
  color: var(--ink);
  background: var(--lime);
  margin: 12px 0 0;
  box-shadow: 0 6px 0 var(--lime-d), 0 10px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.07s, box-shadow 0.07s, filter 0.1s;
}
.btn:hover {
  filter: brightness(1.05);
}
.btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--lime-d), 0 3px 8px rgba(0, 0, 0, 0.3);
}
.btn.secondary {
  color: var(--text);
  background: var(--paper-hi);
  box-shadow: 0 6px 0 var(--paper-edge), 0 10px 18px rgba(0, 0, 0, 0.3);
}
.btn.secondary:active {
  box-shadow: 0 1px 0 var(--paper-edge);
}

/* result stat row */
.stat-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}
.result {
  flex: 1;
  max-width: 150px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 16px;
  padding: 12px 6px;
}
.result .big {
  font-size: 28px;
  font-weight: 900;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}
.result .lbl {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: 2px;
}

/* upgrade shop */
.bank {
  font-size: 15px;
  margin: 4px 0 14px;
  color: var(--muted);
}
.bank b {
  color: var(--sun);
  font-size: 21px;
  font-weight: 900;
}
.shop {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.upg {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 11px 13px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.07s, border-color 0.1s, background 0.1s;
}
.upg:active {
  transform: scale(0.98);
}
.upg.cant {
  opacity: 0.5;
}
.upg.maxed {
  border-color: var(--lime);
  background: rgba(95, 224, 107, 0.12);
}
.u-icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--paper-hi);
  color: var(--lime);
  box-shadow: 0 3px 0 var(--paper-edge);
}
.u-icon .ic {
  width: 24px;
  height: 24px;
}
.u-body {
  flex: 1;
  min-width: 0;
}
.u-name {
  font-weight: 900;
  font-size: 14.5px;
}
.u-desc {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  margin: 3px 0 6px;
  line-height: 1.3;
}
.u-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.u-pips {
  letter-spacing: 3px;
  color: var(--cyan);
  font-size: 12px;
}
.u-cost {
  margin-left: auto;
  color: var(--sun);
  font-weight: 900;
  font-size: 13px;
}

/* leaderboard */
.lb {
  margin-top: 18px;
}
.lb-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--sun);
  font-weight: 900;
  margin-bottom: 8px;
}
.lb-title .ic {
  font-size: 16px;
}
.lb ol {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 360px;
  text-align: left;
}
.lb li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 14px;
}
.lb li:nth-child(odd) {
  background: rgba(0, 0, 0, 0.18);
}
.lb-rank {
  width: 22px;
  color: var(--lime);
  font-weight: 900;
}
.lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score {
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  font-weight: 900;
}

/* pilot name field */
.field {
  width: 100%;
  max-width: 340px;
  margin: 6px auto 2px;
  background: rgba(0, 0, 0, 0.22);
  border: 2px solid var(--paper-edge);
  border-radius: 14px;
  padding: 13px 16px;
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
}
.field::placeholder {
  color: var(--muted);
}
.field:focus {
  outline: none;
  border-color: var(--lime);
}

/* ===================== Larger screens ===================== */
@media (min-width: 760px) {
  .overlay {
    align-items: center;
  }
  .card {
    border-radius: 28px;
    padding: 30px 32px;
    animation: pop 0.22s cubic-bezier(0.18, 1.4, 0.4, 1);
  }
  @keyframes pop {
    from {
      transform: scale(0.92);
      opacity: 0;
    }
  }
  .shop {
    grid-template-columns: 1fr 1fr;
  }
  .btn {
    display: inline-block;
    width: auto;
    min-width: 210px;
    margin: 14px 6px 0;
  }
}

/* phones & small tablets: drop objectives below the centred console so they
   never overlap the score bar in the top-left corner */
@media (max-width: 820px) {
  .hud-objectives {
    top: calc(100px + var(--safe-t));
    left: calc(8px + var(--safe-l));
    max-width: 58vw;
  }
  .hud-combo {
    top: auto;
    bottom: calc(150px + var(--safe-b));
    font-size: 22px;
  }
}

/* short landscape phones */
@media (max-height: 430px) and (orientation: landscape) {
  .hud-hull {
    top: calc(60px + var(--safe-t));
  }
  .hud-objectives {
    top: calc(96px + var(--safe-t));
    max-width: 190px;
  }
  .hud-combo {
    bottom: calc(120px + var(--safe-b));
  }
  .card {
    padding: 16px 20px;
  }
}

/* very small phones */
@media (max-width: 380px) {
  .stat {
    padding: 5px 9px;
    font-size: 19px;
  }
  .power-btn {
    width: 64px;
    height: 64px;
  }
  .power-btn .ic {
    width: 28px;
    height: 28px;
  }
}
