/* HOLDOUT - overlays and HUD. The game itself is drawn on the canvas. */

/* The two typefaces ship with the game (SIL Open Font License, see
   fonts/), so it looks the same offline and makes no third-party request.
   Oxanium is a variable font: one file covers every weight. */
@font-face {
  font-family: Oxanium;
  src: url(fonts/oxanium.woff2) format('woff2');
  font-weight: 200 800;
  font-display: swap;
}
@font-face { font-family: Barlow; src: url(fonts/barlow-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Barlow; src: url(fonts/barlow-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Barlow; src: url(fonts/barlow-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root {
  color-scheme: dark;
  --bg: #05070d;
  --ink: #e8f6ff;
  --dim: #7f93a8;
  --cyan: #7ff6ff;
  --pink: #ff3b6b;
  --gold: #ffd84f;
  --green: #5dff9a;
  --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);
  /* Oxanium: squared-off and technical, for the logo, titles and every
     number; Barlow: compact and readable for the words in between */
  --display: Oxanium, ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font: Barlow, ui-sans-serif, 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: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: none;
}

#stage, #stage canvas, #touch, #vignette {
  position: fixed;
  inset: 0;
}
#stage canvas { display: block; width: 100%; height: 100%; }

#vignette {
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(var(--vig, 0,0,0), 0.6) 100%);
  transition: background 3s;
}
#vignette.hurt {
  animation: hurt 0.35s ease-out;
}
@keyframes hurt {
  from { box-shadow: inset 0 0 120px rgba(255, 40, 80, 0.55); }
  to { box-shadow: inset 0 0 120px rgba(255, 40, 80, 0); }
}

/* the full-screen surface the thumb-stick listens on */
#touch { touch-action: none; }

#stick-base, #stick-knob {
  position: fixed;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
#stick-base {
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  border: 1.5px solid rgba(127, 246, 255, 0.22);
  background: radial-gradient(circle, rgba(127, 246, 255, 0.05), rgba(127, 246, 255, 0) 70%);
}
/* a small, quiet knob: it marks the thumb, it should not pull the eye */
#stick-knob {
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 1.5px solid rgba(127, 246, 255, 0.55);
  background: rgba(127, 246, 255, 0.12);
}
#stick-base.on { opacity: 1; }
#stick-knob.on { opacity: 0.85; }

/* ------------------------------------------------------------ HUD */

#hud {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 12px) 0 calc(var(--safe-l) + 12px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#hud.on { opacity: 1; }

#hud .xp {
  height: 7px;
  border-radius: 4px;
  background: rgba(93, 255, 154, 0.12);
  box-shadow: inset 0 0 0 1px rgba(93, 255, 154, 0.25);
  overflow: hidden;
}
#hud .xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #2dd47a, var(--green));
  box-shadow: 0 0 10px var(--green);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.15s linear;
}

#hud .row {
  display: grid;
  grid-template-columns: 44px 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(127, 246, 255, 0.5);
}
#hud .level { color: var(--green); font-size: 14px; }
#hud .timer { font-size: 22px; font-variant-numeric: tabular-nums; }
#hud .kills { justify-self: end; font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; }
#hud .kills::before { content: "✕ "; color: var(--pink); }

#hud .pause {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(127, 246, 255, 0.3);
  background: rgba(10, 16, 28, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
#hud .pause span { width: 4px; height: 14px; border-radius: 2px; background: var(--ink); }

/* ------------------------------------------------------------ overlays */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.overlay.on { opacity: 1; pointer-events: auto; }

.panel {
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  scrollbar-width: none;
}
.panel::-webkit-scrollbar { display: none; }

.title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(127, 246, 255, 0.7);
}
#over .title { color: var(--pink); text-shadow: 0 0 18px rgba(255, 59, 107, 0.7); }
.lv { margin-top: 4px; color: var(--dim); font-weight: 700; letter-spacing: 0.2em; font-size: 12px; }

.logo {
  font-size: clamp(40px, 14vw, 84px);
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: var(--ink);
  text-shadow: 0 0 24px rgba(127, 246, 255, 0.8), 0 0 4px #fff;
}
.logo span { color: var(--pink); text-shadow: 0 0 24px rgba(255, 59, 107, 0.9), 0 0 4px #fff; }
.sub { margin-top: 6px; color: var(--dim); letter-spacing: 0.14em; font-weight: 600; }
.hint { margin-top: 18px; color: var(--dim); font-size: 13px; }

button { font-family: inherit; color: inherit; cursor: pointer; }
button.big {
  margin-top: 32px;
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(127, 246, 255, 0.6);
  background: linear-gradient(180deg, rgba(127, 246, 255, 0.22), rgba(127, 246, 255, 0.06));
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.22em;
  box-shadow: 0 0 24px rgba(127, 246, 255, 0.25), inset 0 0 18px rgba(127, 246, 255, 0.12);
}
#title button.big { animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 40px rgba(127, 246, 255, 0.5), inset 0 0 18px rgba(127, 246, 255, 0.2); } }
button.ghost {
  margin-top: 12px;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--dim);
  font-weight: 700;
  letter-spacing: 0.16em;
}

/* level-up cards */
.cards { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px 10px 8px;
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(127, 246, 255, 0.28);
  background: linear-gradient(180deg, rgba(20, 32, 52, 0.95), rgba(10, 16, 28, 0.95));
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  animation: deal 0.28s cubic-bezier(.2, .9, .3, 1.2) forwards;
  animation-delay: calc(var(--i) * 70ms);
}
.card.new { border-color: rgba(255, 216, 79, 0.55); }
.card canvas { width: 64px; height: 64px; flex: none; }
.card .tag { font-size: 11px; font-weight: 800; letter-spacing: 0.16em; color: var(--green); }
.card.new .tag { color: var(--gold); }
.card .name { font-size: 18px; font-weight: 900; letter-spacing: 0.04em; margin-top: 1px; }
.card .text { font-size: 13px; color: var(--dim); margin-top: 3px; line-height: 1.3; }
#levelup:not(.armed) .card { filter: saturate(0.6) brightness(0.8); }
#levelup.armed .card:active { transform: scale(0.97); border-color: var(--cyan); }
@keyframes deal { to { opacity: 1; transform: none; } }

/* results */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.stat {
  padding: 12px;
  border-radius: 14px;
  background: rgba(20, 32, 52, 0.7);
  border: 1px solid rgba(127, 246, 255, 0.15);
}
.stat b { display: block; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--dim); letter-spacing: 0.16em; font-weight: 700; }

.loadout { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
.loadout .item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 4px;
  border-radius: 10px;
  background: rgba(20, 32, 52, 0.7);
  font-size: 12px;
  font-weight: 800;
  color: var(--dim);
}
.loadout canvas { width: 28px; height: 28px; }

#boot {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  letter-spacing: 0.4em;
  font-weight: 800;
  color: var(--dim);
  transition: opacity 0.3s;
}
#boot.done { opacity: 0; pointer-events: none; }

/* surge warning */
#banner {
  position: fixed;
  left: 0;
  right: 0;
  top: 38%;
  text-align: center;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.4em;
  color: var(--pink);
  text-shadow: 0 0 22px rgba(255, 59, 107, 0.9);
  pointer-events: none;
  opacity: 0;
}
#banner.on { animation: banner 1.6s ease-out; }
@keyframes banner {
  0% { opacity: 0; transform: scale(1.4); letter-spacing: 0.8em; }
  12% { opacity: 1; transform: scale(1); letter-spacing: 0.4em; }
  25%, 45% { opacity: 1; }
  35% { opacity: 0.4; }
  100% { opacity: 0; }
}

#fps {
  position: fixed;
  left: calc(var(--safe-l) + 12px);
  bottom: calc(var(--safe-b) + 10px);
  font: 700 11px ui-monospace, monospace;
  color: var(--green);
  pointer-events: none;
  white-space: pre;
  display: none;
}
#fps.on { display: block; }

.toggles { display: flex; gap: 8px; margin-top: 18px; }
.toggle {
  flex: 1;
  min-width: 0;
  padding: 12px 2px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 32, 52, 0.6);
  color: var(--dim);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.toggle.on { color: var(--ink); border-color: rgba(127, 246, 255, 0.55); box-shadow: inset 0 0 12px rgba(127, 246, 255, 0.15); }

.card.evo {
  border-color: rgba(255, 216, 79, 0.9);
  background: linear-gradient(180deg, rgba(60, 48, 12, 0.95), rgba(24, 18, 6, 0.95));
  box-shadow: 0 0 22px rgba(255, 216, 79, 0.35), inset 0 0 18px rgba(255, 216, 79, 0.12);
}
.card.evo .tag { color: var(--gold); }
.card.evo .name { color: #fff3c4; }

/* boss health */
#bossbar {
  position: fixed;
  left: calc(var(--safe-l) + 24px);
  right: calc(var(--safe-r) + 24px);
  top: calc(var(--safe-t) + 66px);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}
#bossbar.on { opacity: 1; }
#bossbar .name {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.32em;
  color: var(--pink);
  text-shadow: 0 0 12px rgba(255, 59, 107, 0.8);
}
#bossbar .bar {
  margin-top: 5px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 59, 107, 0.15);
  box-shadow: inset 0 0 0 1px rgba(255, 59, 107, 0.35);
  overflow: hidden;
}
#bossbar .fill {
  height: 100%;
  background: linear-gradient(90deg, #ff2f55, #ff7a5a);
  box-shadow: 0 0 10px #ff3b6b;
  transform-origin: left center;
  transition: transform 0.12s linear;
}
#over.won .title { color: var(--gold); text-shadow: 0 0 18px rgba(255, 216, 79, 0.8); }
#banner.gold { color: var(--gold); text-shadow: 0 0 22px rgba(255, 216, 79, 0.9); }

/* ship select */
.ships { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.ship {
  padding: 10px 6px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 22, 38, 0.8);
  color: var(--dim);
}
.ship canvas { width: 56px; height: 56px; display: block; margin: 0 auto; }
.ship .n { font-weight: 900; font-size: 12px; letter-spacing: 0.14em; color: var(--ink); margin-top: 4px; }
.ship .d { font-size: 11px; line-height: 1.3; margin-top: 4px; }
.ship.sel { border-color: var(--c, var(--cyan)); box-shadow: 0 0 18px color-mix(in srgb, var(--c, #7ff6ff) 35%, transparent), inset 0 0 14px color-mix(in srgb, var(--c, #7ff6ff) 15%, transparent); }
.ship.locked { opacity: 0.55; }
.ship.locked canvas { filter: grayscale(1) brightness(0.6); }
.ship.locked .n::before { content: "🔒 "; }
#title button.big { margin-top: 18px; }
.credits { color: var(--gold); margin-left: 6px; }
.credits::before, .credits-big::before { content: "◆ "; }
.best { margin-top: 12px; color: var(--dim); font-size: 12px; letter-spacing: 0.12em; font-weight: 700; }

/* shop */
.credits-big { margin-top: 6px; color: var(--gold); font-weight: 900; font-size: 22px; text-shadow: 0 0 12px rgba(255, 216, 79, 0.5); }
.ups { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.up {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(14, 22, 38, 0.85);
  border: 1px solid rgba(127, 246, 255, 0.15);
  text-align: left;
}
.up .n { font-weight: 900; letter-spacing: 0.04em; }
.up .d { font-size: 12px; color: var(--dim); margin-top: 2px; }
.up .pips { margin-top: 5px; display: flex; gap: 4px; }
.up .pips i { width: 14px; height: 5px; border-radius: 3px; background: rgba(127, 246, 255, 0.15); }
.up .pips i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.up button {
  min-width: 78px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 216, 79, 0.5);
  background: rgba(255, 216, 79, 0.1);
  color: var(--gold);
  font-weight: 900;
}
.up button:disabled { opacity: 0.35; border-color: rgba(255, 255, 255, 0.15); color: var(--dim); background: transparent; }
.locks { margin-top: 18px; text-align: left; font-size: 12px; color: var(--dim); line-height: 1.7; }
.locks b { color: var(--ink); letter-spacing: 0.12em; font-size: 11px; display: block; margin-bottom: 2px; }

/* difficulty */
.diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 14px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(14, 22, 38, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.seg {
  padding: 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-weight: 900;
  letter-spacing: 0.2em;
  font-size: 13px;
}
.seg.on { background: rgba(127, 246, 255, 0.16); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(127, 246, 255, 0.5); }
.seg[data-diff="easy"].on { background: rgba(93, 255, 154, 0.14); box-shadow: inset 0 0 0 1px rgba(93, 255, 154, 0.55); }
.diff-note { margin-top: 6px; font-size: 11px; color: var(--dim); }
#hud .badge {
  text-align: center;
  margin-top: -2px;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--green);
  white-space: nowrap;
}

/* level-up reroll */
#levelup .reroll { display: none; margin-top: 14px; }
#levelup .reroll.on { display: block; }

/* results extras */
.earned { margin-top: 8px; color: var(--gold); font-weight: 900; font-size: 18px; letter-spacing: 0.08em; }
.earned .nb { display: block; color: var(--green); font-size: 12px; letter-spacing: 0.2em; margin-top: 4px; }
.unlocks { margin-top: 14px; }
.unlocks div {
  margin-top: 6px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 216, 79, 0.5);
  background: rgba(60, 48, 12, 0.5);
  color: #fff3c4;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------ typography */
.logo, .title, .lv, button.big, .seg, .ship .n, .card .name, .card .tag,
#hud .level, #hud .timer, #hud .kills, #hud .badge, .stat b, .earned, .credits-big,
#banner, #bossbar .name, .up .n, .up button, .best, .toggle, button.ghost {
  font-family: var(--display);
}
#hud .timer { font-weight: 700; letter-spacing: 0.06em; }
.card .text, .ship .d, .up .d, .hint, .sub, .locks { font-family: var(--font); }
.sub { font-weight: 600; }

/* ------------------------------------------------------------ title */
/* The demo swarm plays behind the title: a light scrim, no blur. */
#title { background: radial-gradient(ellipse at center, rgba(3, 5, 10, 0.35), rgba(3, 5, 10, 0.78) 85%); backdrop-filter: none; -webkit-backdrop-filter: none; }
.logo {
  position: relative;
  display: inline-block;
  animation: power-on 1.1s steps(1) both, breathe-logo 4s ease-in-out 1.1s infinite;
}
/* a scan line sweeps the logo as it powers on */
.logo::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: 0;
  height: 18%;
  background: linear-gradient(180deg, transparent, rgba(127, 246, 255, 0.55), transparent);
  mix-blend-mode: screen;
  animation: scan 1.2s ease-out 0.2s both;
  pointer-events: none;
}
@keyframes power-on {
  0% { opacity: 0; }
  12% { opacity: 0.8; }
  18% { opacity: 0.1; }
  30% { opacity: 1; }
  38% { opacity: 0.35; }
  46%, 100% { opacity: 1; }
}
@keyframes scan { from { top: -20%; opacity: 1; } to { top: 110%; opacity: 0; } }
@keyframes breathe-logo {
  50% { text-shadow: 0 0 34px rgba(127, 246, 255, 0.95), 0 0 6px #fff; }
}
.ship canvas { transition: transform 0.25s; }
.ship.sel canvas { animation: idle-ship 2.4s ease-in-out infinite; }
@keyframes idle-ship {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 4px var(--c, #7ff6ff)); }
  50% { transform: translateY(-4px); filter: drop-shadow(0 0 12px var(--c, #7ff6ff)); }
}

/* ------------------------------------------------------------ transitions */
.overlay .panel { transform: translateY(14px); transition: transform 0.28s cubic-bezier(.2, .9, .3, 1.1); }
.overlay.on .panel { transform: none; }

/* ------------------------------------------------------------ HUD extras */
#hud .xp-fill {
  background: linear-gradient(90deg, #2dd47a, var(--green) 40%, #c8ffe0 50%, var(--green) 60%, #2dd47a);
  background-size: 300% 100%;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
#hud .level.pop { animation: pop 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 0% { transform: scale(1.7); color: #fff; } 100% { transform: none; } }
#hud .badge { color: var(--dim); letter-spacing: 0.32em; }
#hud .weapons {
  position: fixed;
  left: calc(var(--safe-l) + 10px);
  bottom: calc(var(--safe-b) + 10px);
  display: flex;
  gap: 5px;
}
.wslot {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(8, 12, 22, 0.7);
  border: 1px solid rgba(127, 246, 255, 0.18);
  overflow: hidden;
}
.wslot.evo { border-color: rgba(255, 216, 79, 0.6); }
.wslot canvas { width: 100%; height: 100%; display: block; }
/* the cooldown sweeps down from the top as the weapon recharges */
.wslot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 10, 0.6);
  transform-origin: bottom;
  transform: scaleY(var(--cd, 0));
}
.wslot span {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font: 700 9px var(--display);
  color: var(--ink);
  z-index: 1;
}
#fps { bottom: calc(var(--safe-b) + 52px); }
@media (prefers-reduced-motion: reduce) {
  .logo, .logo::after, .ship.sel canvas, #hud .xp-fill { animation: none; }
}

/* ------------------------------------------------------------ how to play */
#howto { background: rgba(3, 5, 10, 0.94); }
#howto .panel { display: flex; flex-direction: column; overflow: hidden; }
#howto .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 700 12px var(--display);
  letter-spacing: 0.3em;
  color: var(--dim);
}
#howto .skip {
  padding: 8px 4px 8px 12px;
  border: 0;
  background: none;
  color: var(--dim);
  font: 700 12px var(--display);
  letter-spacing: 0.2em;
}
#howto .track {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
  min-height: 0;
  flex: 1 1 auto;
}
#howto .track::-webkit-scrollbar { display: none; }
#howto .page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow-y: auto;
  padding: 6px 2px 0;
}
#howto .step { font: 700 11px var(--display); color: var(--dim); letter-spacing: 0.2em; }
#howto .title { margin-top: 2px; }
#howto .pic {
  display: block;
  width: min(320px, 100%);
  height: auto;
  aspect-ratio: 320 / 150;
  margin: 12px auto 4px;
  border-radius: 14px;
  background: radial-gradient(ellipse at center, rgba(40, 70, 110, 0.35), rgba(8, 12, 22, 0.9));
  border: 1px solid rgba(127, 246, 255, 0.14);
}
#howto .cards-mini { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
#howto .cards-mini canvas {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(14, 22, 38, 0.9);
  border: 1px solid rgba(127, 246, 255, 0.25);
}
/* the last card is an evolution: the gold one */
#howto .cards-mini canvas:last-child { border-color: rgba(255, 216, 79, 0.7); box-shadow: 0 0 12px rgba(255, 216, 79, 0.35); }
#howto ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  text-align: left;
  font: 500 15px/1.4 var(--font);
  color: var(--dim);
}
#howto li { position: relative; padding: 7px 0 7px 18px; }
#howto li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 14px;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}
#howto li b { color: var(--ink); font-weight: 700; }
#howto .dots { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
#howto .dots i {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  transition: width 0.2s, background 0.2s;
  cursor: pointer;
}
#howto .dots i.on { width: 22px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
#howto button.big { margin-top: 14px; flex: none; }
#howto .next { animation: none; }

/* ------------------------------------------------------------ first-run tips */
#tip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 22%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#tip.on { opacity: 1; }
#tip .text {
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(5, 7, 13, 0.7);
  font: 800 16px var(--display);
  letter-spacing: 0.18em;
  color: var(--ink);
  text-shadow: 0 0 12px rgba(127, 246, 255, 0.7);
}
#tip.gems .text { color: var(--green); text-shadow: 0 0 12px rgba(93, 255, 154, 0.7); }
#tip .finger { display: none; }
#tip.move .finger {
  display: block;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(127, 246, 255, 0.25);
  box-shadow: 0 0 18px rgba(127, 246, 255, 0.6);
  animation: drag 1.8s ease-in-out infinite;
}
@keyframes drag {
  0% { transform: translate(-60px, 0) scale(0.85); opacity: 0; }
  15% { transform: translate(-60px, 0) scale(1); opacity: 1; }
  60% { transform: translate(60px, -24px) scale(1); opacity: 1; }
  80%, 100% { transform: translate(60px, -24px) scale(0.85); opacity: 0; }
}
#levelup .pick-tip { display: none; }
#levelup.first .pick-tip {
  display: block;
  margin-top: 8px;
  font: 800 14px var(--display);
  letter-spacing: 0.3em;
  color: var(--gold);
  animation: pulse-tip 1s ease-in-out infinite;
}
@keyframes pulse-tip { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  #tip.move .finger, #levelup.first .pick-tip { animation: none; }
}
