/* ============================================================
   Cosmic Cluck — styles
   Neon arcade UI over a full-bleed canvas.
   ============================================================ */

:root {
  --ink: #05060f;
  --cyan: #5ff0ff;
  --magenta: #ff5fd0;
  --yellow: #ffd166;
  --lime: #9dff6b;
  --text: #eaf2ff;
  --muted: #a4b4d8;
  --panel: rgba(11, 13, 30, 0.74);
  --line: rgba(150, 190, 255, 0.22);
  --font: ui-rounded, "SF Pro Rounded", "Baloo 2", "Segoe UI", system-ui, -apple-system, "Trebuchet MS", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #05060f;
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

kbd {
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 700;
  padding: 0.18em 0.44em;
  margin: 0 0.08em;
  border-radius: 7px;
  border: 1px solid rgba(180, 215, 255, 0.35);
  border-bottom-width: 2px;
  background: rgba(120, 170, 255, 0.12);
  color: #dbeaff;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- stage */

.stage {
  position: fixed;
  touch-action: none;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 78% 12%, rgba(70, 30, 160, 0.5), transparent 55%),
    radial-gradient(circle at 12% 88%, rgba(0, 120, 160, 0.35), transparent 55%),
    #05060f;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 3px);
  opacity: 0.45;
  mix-blend-mode: overlay;
}

.game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* ---------------------------------------------------------------- hud */

.hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(8px, 1.6vw, 18px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.hud.on { opacity: 1; transform: none; }

.hud-slot { display: flex; gap: 8px; align-items: center; }
.hud-left { flex-direction: column; align-items: flex-start; }
.hud-mid { flex-direction: column; align-items: center; padding-top: 2px; }
.hud-right { flex-direction: column; align-items: flex-end; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.42em 0.85em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 28, 0.62);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: clamp(0.66rem, 1.5vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.pill .lbl { font-size: 0.82em; color: var(--muted); opacity: 0.8; }
.pill strong, .score-pill span:last-child, .best-pill span:last-child {
  color: #fff;
  font-size: 1.22em;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.score-pill span:last-child { color: var(--cyan); text-shadow: 0 0 14px rgba(95, 240, 255, 0.5); }
.best-pill { color: var(--muted); }
.best-pill span:last-child { color: var(--yellow); font-size: 1em; }

.wave { color: #cfe0ff; letter-spacing: 0.2em; }

/* hearts */
.hearts { gap: 7px; padding: 0.55em 0.8em; }
.heart {
  width: 15px;
  height: 19px;
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 35% 28%, #fff 0 32%, #ffe3a6 60%, #ffb52e 100%);
  box-shadow: 0 0 12px rgba(255, 190, 60, 0.55), inset 0 -2px 3px rgba(180, 90, 0, 0.35);
  transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}
.heart.off {
  opacity: 0.2;
  filter: grayscale(1);
  background: #93a6c9;
  box-shadow: none;
  transform: scale(0.86);
}

/* power indicator */
.power {
  color: var(--lime);
  border-color: rgba(157, 255, 107, 0.35);
  box-shadow: 0 0 22px rgba(157, 255, 107, 0.18);
  font-size: clamp(0.6rem, 1.3vw, 0.72rem);
}
.power[hidden] { display: none; }

/* combo */
.combo {
  margin-top: 6px;
  font-size: clamp(0.9rem, 3vw, 1.5rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.7), 0 2px 0 rgba(120, 60, 0, 0.5);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.2, 1.7, 0.4, 1);
}
.combo.show { opacity: 1; transform: scale(1); }
.combo.pop { transform: scale(1.22); }

/* boss health */
.bossbar {
  position: absolute;
  top: clamp(74px, 12vh, 116px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: min(560px, 76vw);
  padding: 0.5em 0.9em 0.7em;
  border-radius: 16px;
  border: 1px solid rgba(255, 95, 208, 0.35);
  background: rgba(20, 6, 26, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 30px rgba(255, 95, 208, 0.18);
  pointer-events: none;
}
.bossbar[hidden] { display: none; }

.bossname {
  display: block;
  text-align: center;
  font-size: clamp(0.58rem, 1.5vw, 0.72rem);
  font-weight: 900;
  letter-spacing: 0.22em;
  color: #ffc6ec;
  margin-bottom: 0.45em;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5fd0, #ffd166);
  box-shadow: 0 0 18px rgba(255, 120, 200, 0.8);
  transition: width 0.18s ease-out;
}

/* turbo meter */
.dashmeter {
  position: absolute;
  left: 50%;
  bottom: clamp(10px, 2.4vh, 26px);
  transform: translateX(-50%);
  z-index: 3;
  width: min(240px, 46vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(8, 12, 28, 0.7);
  border: 1px solid var(--line);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.hud.on ~ .dashmeter { opacity: 1; }
.dashmeter i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5ff0ff, #9dff6b);
  box-shadow: 0 0 12px rgba(95, 240, 255, 0.7);
}
.dashmeter.full i { background: linear-gradient(90deg, #9dff6b, #5ff0ff); }

/* banner + quip */
.banner {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  align-items: center;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  padding: 0 1em;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.banner strong {
  font-size: clamp(2rem, 9vw, 4.6rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 0.95;
  background: linear-gradient(180deg, #ffffff, #9ff4ff 55%, #3ad2ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(95, 240, 255, 0.55));
}

.banner span {
  font-size: clamp(0.66rem, 2vw, 0.9rem);
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #ffd7f2;
  text-shadow: 0 0 16px rgba(255, 95, 208, 0.6);
}

.quip {
  position: absolute;
  left: 50%;
  bottom: clamp(40px, 8vh, 78px);
  transform: translateX(-50%);
  z-index: 3;
  padding: 0.5em 1.1em;
  border-radius: 999px;
  background: rgba(8, 10, 24, 0.55);
  border: 1px solid var(--line);
  color: #d9e8ff;
  font-size: clamp(0.66rem, 1.9vw, 0.84rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  max-width: min(600px, 88vw);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.quip.show { opacity: 1; }

/* tool buttons */
.tools {
  position: absolute;
  right: clamp(8px, 1.6vw, 18px);
  bottom: clamp(8px, 1.6vw, 18px);
  z-index: 4;
  display: flex;
  gap: 8px;
}

.iconbtn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 28, 0.62);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  color: #cfe6ff;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
}
.iconbtn:hover { transform: translateY(-2px); border-color: rgba(95, 240, 255, 0.55); }
.iconbtn:active { transform: translateY(0) scale(0.96); }
.iconbtn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.iconbtn svg { width: 21px; height: 21px; }
.iconbtn .fill { fill: currentColor; }
.iconbtn .wave { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.iconbtn .slash { fill: none; stroke: #ff7d94; stroke-width: 2.2; stroke-linecap: round; opacity: 0; }
.iconbtn.muted .wave { opacity: 0; }
.iconbtn.muted .slash { opacity: 1; }
.iconbtn .play-tri { display: none; }
.iconbtn.is-paused .pause-bars { display: none; }
.iconbtn.is-paused .play-tri { display: block; }

/* ---------------------------------------------------------------- screens */

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  /* Column flex + auto margins: a short panel is centred, a tall panel starts
     at the top and scrolls instead of being clipped above the viewport. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(10px, 3vw, 34px);
  background: radial-gradient(circle at 50% 42%, rgba(14, 12, 40, 0.42), rgba(4, 4, 12, 0.88));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0.32s ease;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.screen .panel { flex: 0 0 auto; margin: auto 0; }
.screen.show { opacity: 1; visibility: visible; }

.panel {
  width: min(640px, 100%);
  padding: clamp(20px, 4vw, 40px);
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 80px rgba(95, 240, 255, 0.06);
  text-align: center;
  transform: translateY(14px) scale(0.985);
  transition: transform 0.42s cubic-bezier(0.2, 1.2, 0.35, 1);
  position: relative;
  overflow: hidden;
}
.screen.show .panel { transform: none; }

.panel::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 200px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 95, 208, 0.22), transparent 70%);
  pointer-events: none;
}

.panel-small { width: min(480px, 100%); }

.kicker {
  margin: 0 0 0.9em;
  font-size: clamp(0.56rem, 1.7vw, 0.7rem);
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--magenta);
  text-shadow: 0 0 18px rgba(255, 95, 208, 0.5);
}

.logo {
  margin: 0;
  font-size: clamp(2.5rem, 12vw, 5rem);
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff, #b9f8ff 45%, #2fd4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(95, 240, 255, 0.45));
}
.logo span {
  display: block;
  background: linear-gradient(180deg, #fff, #ffc0ec 40%, #ff4fc8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0.5em 0 0;
  font-size: clamp(0.7rem, 2.2vw, 0.86rem);
  font-weight: 800;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--yellow);
}

.blurb {
  margin: 1.1em auto 1.5em;
  max-width: 44ch;
  font-size: clamp(0.86rem, 2.4vw, 1rem);
  line-height: 1.55;
  color: #cfddf7;
}

.heading {
  margin: 0.1em 0 0.6em;
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff, #bff7ff 60%, #58d8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.heading-over { background: linear-gradient(180deg, #fff, #ffc0ec 55%, #ff4fc8); -webkit-background-clip: text; background-clip: text; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.85em 2.4em;
  font-family: inherit;
  font-size: clamp(0.86rem, 2.4vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #041526;
  background: linear-gradient(180deg, #a9fbff, #2fd0ff 60%, #0aa8e0);
  box-shadow: 0 12px 34px rgba(20, 180, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(20, 180, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.8); filter: saturate(1.1); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; }

.btn-ghost {
  background: transparent;
  color: #cfe6ff;
  border: 1px solid rgba(150, 190, 255, 0.35);
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(120, 170, 255, 0.1); box-shadow: none; }

.keys {
  list-style: none;
  margin: 1.6em 0 0;
  padding: 1.15em 0 0;
  border-top: 1px solid rgba(150, 190, 255, 0.16);
  display: grid;
  gap: 0.62em;
  text-align: left;
  font-size: clamp(0.74rem, 2vw, 0.86rem);
  color: #b9cbed;
}
.keys li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55em; }
.keys li span { min-width: 8.5em; color: #e6f0ff; }

.footnote {
  margin: 1.5em 0 0;
  font-size: clamp(0.66rem, 1.9vw, 0.76rem);
  line-height: 1.5;
  color: var(--muted);
  opacity: 0.85;
}
.footnote em { color: var(--lime); font-style: normal; font-weight: 800; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 1.1em 0 1.5em;
}
.stats > div {
  padding: 0.85em 0.4em;
  border-radius: 16px;
  border: 1px solid rgba(150, 190, 255, 0.18);
  background: rgba(8, 12, 28, 0.5);
}
.stats .lbl {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4em;
}
.stats strong {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-variant-numeric: tabular-nums;
  color: #fff;
}
#over-score { color: var(--cyan); }
#over-best { color: var(--yellow); }

.over-quip {
  margin: 0 0 0.4em;
  font-size: clamp(0.82rem, 2.4vw, 0.95rem);
  color: #ffd7f2;
  min-height: 1.4em;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 1.2em;
}

/* ---------------------------------------------------------------- small screens */

@media (max-height: 700px) {
  .blurb { margin: 0.8em auto 1em; }
  .keys { margin-top: 1em; padding-top: 0.85em; gap: 0.4em; }
  .footnote { display: none; }
  .logo { font-size: clamp(2rem, 9vw, 3.2rem); }
}

@media (max-width: 520px) {
  .keys li span { min-width: 100%; }
  .hud { flex-wrap: wrap; }
  .hud-right { flex-direction: row; }
  .best-pill { display: none; }
  .pill { padding: 0.36em 0.6em; letter-spacing: 0.08em; }
  .panel { border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------------------------- CC-01D arcade controls */

.controls {
  position: absolute;
  inset: 0;
  /* Below every screen (z 5): rebuilt controls can never cover a menu. */
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  touch-action: none;
}
.controls.show { opacity: 1; pointer-events: none; }
.controls.show .ctrl { pointer-events: auto; }

.ctrl {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* CC-01E classic arcade stick: dark metal base, directional marks,
   metal shaft and a bright red ball top. Same element, same hitbox. */
.vstick {
  width: 156px;
  height: 156px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  --kx: 0px;
  --ky: 0px;
  --shaft-len: 0px;
  --shaft-ang: 0deg;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.42));
}
.vstick.side-left { left: calc(env(safe-area-inset-left, 0px) + 16px); }
.vstick.side-right { right: calc(env(safe-area-inset-right, 0px) + 16px); }

.vstick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(188, 226, 255, 0.62);
  background:
    radial-gradient(circle at 36% 25%, rgba(255, 255, 255, 0.32), rgba(160, 192, 225, 0.12) 34%, rgba(10, 14, 24, 0.96) 76%),
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.055) 0deg 4deg, rgba(0, 0, 0, 0.18) 4deg 9deg),
    radial-gradient(circle at 50% 50%, #3d4859 0%, #232b3b 48%, #0e121c 100%);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.55),
    0 0 26px rgba(95, 240, 255, 0.16),
    inset 0 3px 6px rgba(255, 255, 255, 0.22),
    inset 0 -9px 18px rgba(0, 0, 0, 0.72),
    inset 0 0 0 10px rgba(6, 9, 18, 0.5);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.vstick-base::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px solid rgba(225, 242, 255, 0.22);
  background: radial-gradient(circle at 50% 44%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}

.vstick-well {
  position: absolute;
  left: 50%; top: 50%;
  width: 106px; height: 106px;
  margin: -53px 0 0 -53px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(3, 6, 12, 0.94), rgba(15, 21, 34, 0.9) 66%, rgba(110, 140, 170, 0.18) 100%);
  box-shadow: inset 0 7px 14px rgba(0, 0, 0, 0.8), inset 0 -2px 4px rgba(180, 220, 255, 0.18);
  pointer-events: none;
}

.vstick-mark {
  position: absolute;
  width: 0; height: 0;
  border-style: solid;
  border-color: transparent;
  opacity: 0.8;
  pointer-events: none;
}
.mark-up { left: 50%; top: 11px; margin-left: -7px; border-width: 0 7px 9px; border-bottom-color: #d5f7ff; }
.mark-down { left: 50%; bottom: 11px; margin-left: -7px; border-width: 9px 7px 0; border-top-color: #d5f7ff; }
.mark-left { top: 50%; left: 11px; margin-top: -7px; border-width: 7px 9px 7px 0; border-right-color: #d5f7ff; }
.mark-right { top: 50%; right: 11px; margin-top: -7px; border-width: 7px 0 7px 9px; border-left-color: #d5f7ff; }

.vstick-hub {
  position: absolute;
  left: 50%; top: 50%;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #7a8ba2, #2b3546 62%, #0a0e16 100%);
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.vstick-shaft {
  position: absolute;
  left: 50%; top: 50%;
  width: var(--shaft-len, 0px);
  height: 15px;
  margin-top: -7.5px;
  transform-origin: 0 50%;
  transform: rotate(var(--shaft-ang, 0deg));
  border-radius: 0 8px 8px 0;
  background: linear-gradient(180deg, #e6f1ff 0%, #9db0c8 34%, #45536a 72%, #121a29 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.08s linear;
  pointer-events: none;
}
.vstick.deflected .vstick-shaft { opacity: 1; }

.vstick-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 66px; height: 66px;
  margin: -33px 0 0 -33px;
  border-radius: 50%;
  border: 1px solid rgba(255, 206, 190, 0.6);
  background: radial-gradient(circle at 33% 25%, #ffffff 0 6%, #ffd3c9 13%, #ff6b50 35%, #e0241b 62%, #8c0b07 87%, #4a0300 100%);
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.6),
    0 0 22px rgba(255, 96, 62, 0.42),
    inset -6px -8px 14px rgba(72, 4, 0, 0.6),
    inset 5px 6px 12px rgba(255, 224, 206, 0.38);
  transform: translate(var(--kx, 0px), var(--ky, 0px));
  transition: transform 0.045s linear, filter 0.12s ease, box-shadow 0.12s ease;
  pointer-events: none;
}
.vstick-knob::after {
  content: "";
  position: absolute;
  left: 17%; top: 12%;
  width: 28%; height: 21%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  filter: blur(1.6px);
}
.vstick.is-active .vstick-base {
  border-color: rgba(140, 250, 255, 0.95);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(95, 240, 255, 0.42),
    inset 0 3px 6px rgba(255, 255, 255, 0.26),
    inset 0 -9px 18px rgba(0, 0, 0, 0.72),
    inset 0 0 0 10px rgba(6, 9, 18, 0.5);
}
.vstick.is-active .vstick-knob {
  filter: brightness(1.16) saturate(1.12);
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.6),
    0 0 34px rgba(255, 120, 80, 0.8),
    inset -6px -8px 14px rgba(72, 4, 0, 0.55),
    inset 5px 6px 12px rgba(255, 235, 220, 0.42);
}

/* Turbo: lower corner opposite the stick. */
.btn-turbo, .btn-fire {
  min-width: 92px;
  min-height: 92px;
  border-radius: 50%;
  border: 2px solid rgba(255, 209, 102, 0.7);
  background: rgba(255, 209, 102, 0.16);
  color: #fff3c4;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 0 rgba(60, 30, 0, 0.8);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 28px rgba(255, 209, 102, 0.26);
}
.btn-turbo { bottom: calc(env(safe-area-inset-bottom, 0px) + 28px); }
.btn-fire { bottom: calc(env(safe-area-inset-bottom, 0px) + 132px); }
/* Advanced two-stick layouts: keep TURBO above the aim stick, not on top of it. */
.controls.has-aim-stick .btn-turbo {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 178px);
  right: calc(env(safe-area-inset-right, 0px) + 48px);
}
.controls.has-aim-stick .btn-turbo.side-left {
  left: calc(env(safe-area-inset-left, 0px) + 48px);
  right: auto;
}
.btn-turbo.side-left, .btn-fire.side-left { left: calc(env(safe-area-inset-left, 0px) + 28px); }
.btn-turbo.side-right, .btn-fire.side-right { right: calc(env(safe-area-inset-right, 0px) + 28px); }
.btn-turbo.ready { animation: turbo-ready 1.15s ease-in-out infinite; }
.btn-turbo:active { transform: scale(0.95); }
.btn-turbo.cooling {
  border-color: rgba(170, 192, 220, 0.5);
  color: #c6d4e8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 0 24px rgba(0, 0, 0, 0.4);
  animation: none;
}
.turbo-label {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 2px;
  line-height: 1;
  pointer-events: none;
}
.turbo-text {
  font-size: 0.86rem;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 0 rgba(60, 30, 0, 0.9);
}
.turbo-state {
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #eaffcb;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}
.btn-turbo.cooling .turbo-text { opacity: 0.92; color: #eef4ff; }
.btn-turbo.cooling .turbo-state { color: #ffd79a; }
.turbo-ring {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: conic-gradient(#9dff6b var(--cd, 100%), rgba(255, 255, 255, 0.1) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  filter: drop-shadow(0 0 5px rgba(157, 255, 107, 0.65));
  pointer-events: none;
  transition: background 0.1s linear;
}
.btn-turbo.cooling .turbo-ring {
  background: conic-gradient(#ffc46b var(--cd, 0%), rgba(255, 255, 255, 0.1) 0);
  filter: drop-shadow(0 0 4px rgba(255, 196, 107, 0.4));
}
.btn-fire {
  border-color: rgba(255, 95, 208, 0.65);
  background: rgba(255, 95, 208, 0.16);
  color: #ffd9f1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 28px rgba(255, 95, 208, 0.3);
}

@keyframes turbo-ready {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 24px rgba(255, 209, 102, 0.3); }
  50% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 38px rgba(157, 255, 107, 0.62); }
}

@media (max-width: 520px) {
  .vstick { width: 136px; height: 136px; }
  .vstick-well { width: 92px; height: 92px; margin: -46px 0 0 -46px; }
  .vstick-knob { width: 58px; height: 58px; margin: -29px 0 0 -29px; }
  .vstick-hub { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
  .mark-up { top: 9px; }
  .mark-down { bottom: 9px; }
  .mark-left { left: 9px; }
  .mark-right { right: 9px; }
  .btn-turbo, .btn-fire { min-width: 78px; min-height: 78px; font-size: 0.72rem; }
  .btn-fire { bottom: calc(env(safe-area-inset-bottom, 0px) + 116px); }
  .controls.has-aim-stick .btn-turbo {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 164px);
    right: calc(env(safe-area-inset-right, 0px) + 44px);
  }
  .controls.has-aim-stick .btn-turbo.side-left {
    left: calc(env(safe-area-inset-left, 0px) + 44px);
    right: auto;
  }
  .turbo-text { font-size: 0.74rem; }
  .turbo-state { font-size: 0.5rem; }
}

@media (pointer: coarse), (max-width: 820px), (max-height: 520px) {
  .tools {
    top: calc(env(safe-area-inset-top, 0px) + 72px);
    right: calc(env(safe-area-inset-right, 0px) + 10px);
    bottom: auto;
  }
}

/* ---------------------------------------------------------------- CC-01 menu/screens */

.menu { display: grid; gap: 10px; margin: 1.2em 0; }
.menu .btn { width: 100%; }

.setup { text-align: left; display: grid; gap: 14px; margin: 1em 0; }
.setup-group { padding: 0.9em 1em; border-radius: 16px; border: 1px solid rgba(150,190,255,0.18); background: rgba(8,12,28,0.45); }
.setup-group h3 { margin: 0 0 0.6em; font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--cyan); }
.setup-group label { display: flex; align-items: center; gap: 0.5em; margin: 0.35em 0; font-size: 0.9rem; color: #cfe0ff; cursor: pointer; min-height: 40px; padding: 0.25em 0; }
.setup-group input[type="radio"], .setup-group input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--cyan); flex-shrink: 0; }
.setup-group input[type="range"] { flex: 1; }
#screen-setup .heading { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--cyan); text-shadow: 0 0 18px rgba(95, 240, 255, 0.45); }
/* CC-01E.3: bright, readable headings across all menus. */
.heading, .heading-over {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(95, 240, 255, 0.45), 0 2px 0 rgba(0,0,0,0.85);
}
.heading-over { color: #ff7dd6; text-shadow: 0 0 18px rgba(255, 95, 208, 0.55), 0 2px 0 rgba(0,0,0,0.85); }
.logo { filter: drop-shadow(0 4px 0 rgba(0,0,0,0.9)) drop-shadow(0 0 30px rgba(95,240,255,0.7)); }

/* Layout preview */
.layout-preview {
  position: relative;
  width: 100%;
  height: 110px;
  margin: 0.8em 0 0.2em;
  border-radius: 14px;
  border: 1px solid rgba(150,190,255,0.25);
  background: rgba(6,10,24,0.6);
  overflow: hidden;
}
.layout-preview .lp-area {
  position: absolute; inset: 8px;
  border-radius: 10px;
  border: 1px dashed rgba(150,190,255,0.25);
}
.layout-preview .lp-stick {
  position: absolute;
  bottom: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a70, #d12b1a);
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 0 12px rgba(255,100,80,0.5);
}
.layout-preview .lp-stick.right { right: 14px; }
.layout-preview .lp-stick.left { left: 14px; }
.layout-preview .lp-aim {
  position: absolute;
  bottom: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9fdcff, #1a8fd1);
  border: 2px solid rgba(255,255,255,0.6);
}
.layout-preview .lp-aim.right { right: 60px; }
.layout-preview .lp-aim.left { left: 60px; }
.layout-preview .lp-turbo {
  position: absolute;
  bottom: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a0, #d9a020);
  border: 2px solid rgba(255,255,255,0.6);
}
.layout-preview .lp-turbo.right { right: 14px; }
.layout-preview .lp-turbo.left { left: 14px; }
.layout-preview .lp-label {
  position: absolute; top: 6px; left: 0; right: 0;
  text-align: center; font-size: 0.7rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase;
}
.quick-summary { margin: 0.3em 0 0.8em; font-size: 0.85rem; color: var(--cyan); text-align: center; letter-spacing: 0.02em; opacity: 0.95; }
.hint { margin: 0.55em 0 0; font-size: 0.78rem; line-height: 1.45; color: #cfe0ff; opacity: 0.92; }

.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; margin: 1em 0; }
.howto-col h3 { margin: 0 0 0.5em; color: var(--cyan); font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; }
@media (max-width: 520px) { .howto { grid-template-columns: 1fr; } }

.scores { margin: 1em 0; }
.scoretable { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.scoretable th, .scoretable td { padding: 0.55em 0.6em; border-bottom: 1px solid rgba(150,190,255,0.16); text-align: left; }
.scoretable th { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; }
.scoretable td:last-child { color: var(--yellow); font-weight: 800; text-align: right; }

/* confirm dialog */
.confirm { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(4,4,12,0.7); backdrop-filter: blur(4px); }
.confirm[hidden] { display: none; }
.confirm-box { width: min(420px, 90%); padding: 1.6em; border-radius: 22px; border: 1px solid var(--line); background: var(--panel); text-align: center; }
.confirm-box p { margin: 0 0 1em; color: #eaf2ff; font-weight: 700; }

/* safe area padding for HUD on notched devices */
.hud { padding-top: calc(env(safe-area-inset-top, 0px) + 8px); }

/* CC-01B / CC-01D / CC-01E readability + contrast */
.logo, .logo span {
  -webkit-text-stroke: 2.6px rgba(2, 5, 14, 0.96);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.9)) drop-shadow(0 0 24px rgba(95, 240, 255, 0.55));
}
#screen-title .panel {
  background: rgba(10, 13, 32, 0.92);
  border-color: rgba(150, 200, 255, 0.32);
}
.tagline {
  color: #ffe08a;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85), 0 0 14px rgba(255, 209, 102, 0.45);
}
.heading, .heading-over {
  -webkit-text-stroke: 2px rgba(2, 5, 14, 0.92);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.9)) drop-shadow(0 0 18px rgba(95, 240, 255, 0.35));
}
.heading-over {
  background: linear-gradient(180deg, #ffffff 0%, #ffe3f4 46%, #ff7dd6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.92)) drop-shadow(0 0 20px rgba(255, 95, 208, 0.55));
}
.over-quip { color: #ffe9f0; font-weight: 700; }
.stats strong { color: #fff6e2; }
.btn { min-height: 46px; padding: 0.7em 1.2em; }
.kicker { color: #d4e2ff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7); }
.footnote { color: #d6e3ff; }

.hud .pill {
  background: rgba(6, 10, 24, 0.82);
  border-color: rgba(160, 200, 255, 0.36);
}
.wave {
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85), 0 0 10px rgba(120, 220, 255, 0.5);
}
.score-pill span:last-child {
  color: #8ff7ff;
  text-shadow: 0 0 12px rgba(95, 240, 255, 0.7), 0 2px 0 rgba(0, 0, 0, 0.85);
}
.best-pill span:last-child {
  color: #ffe08a;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85);
}
.combo {
  -webkit-text-stroke: 1.5px rgba(3, 6, 16, 0.9);
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.8), 0 3px 0 rgba(0, 0, 0, 0.85);
}
.power {
  color: #d2ffb0;
  background: rgba(6, 10, 24, 0.88);
  border-color: rgba(157, 255, 107, 0.5);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.85);
}

/* Health: bright eggs for remaining life, clearly outlined empty shells for lost life. */
.hearts {
  background: rgba(6, 10, 24, 0.85);
  border-color: rgba(255, 209, 102, 0.52);
  gap: 8px;
}
.heart {
  width: 16px;
  height: 20px;
  background: radial-gradient(circle at 35% 26%, #ffffff 0 34%, #ffefc4 56%, #ffc23a 86%, #e08800 100%);
  box-shadow:
    0 0 12px rgba(255, 200, 80, 0.85),
    0 0 0 1.5px rgba(255, 255, 255, 0.6),
    inset 0 -2px 3px rgba(150, 80, 0, 0.4);
}
.heart.off {
  opacity: 1;
  transform: scale(0.88);
  background: radial-gradient(circle at 40% 30%, rgba(120, 140, 175, 0.18), rgba(3, 6, 14, 0.75) 72%);
  box-shadow: inset 0 0 0 2px rgba(160, 184, 220, 0.7);
  filter: none;
  position: relative;
}
.heart.off::after {
  content: "";
  position: absolute;
  left: 50%; top: -1px;
  width: 2px; height: 21px;
  margin-left: -1px;
  border-radius: 2px;
  background: rgba(255, 130, 150, 0.95);
  transform: rotate(38deg);
}

/* Wave banner: solid white with a heavy dark outline and a soft dark plate. */
.banner::before {
  content: "";
  position: absolute;
  inset: -18% -16%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(3, 6, 16, 0.8) 0%, rgba(3, 6, 16, 0.55) 46%, rgba(3, 6, 16, 0) 74%);
  z-index: -1;
  pointer-events: none;
}
.banner strong {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  -webkit-text-stroke: 3px rgba(3, 6, 16, 0.96);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.95)) drop-shadow(0 0 26px rgba(95, 240, 255, 0.85));
}
.banner span {
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.9), 0 0 18px rgba(255, 95, 208, 0.7);
}

/* The button ring already shows turbo readiness; the centre meter would sit
   under the stick on a phone. Keep it on precise-pointer desktops only. */
@media (pointer: coarse), (max-width: 820px) {
  .dashmeter { display: none; }
}

/* safe areas for mobile controls */
.controls { padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }

/* ---------------------------------------------------------------- CC-01E landscape menus */

/* A rotated phone leaves very little height. Keep every menu option reachable:
   compact rows, a two-column title menu, and panels that scroll from the top
   instead of being clipped in the middle. */
@media (orientation: landscape) and (max-height: 620px) {
  .screen { padding: 8px 14px; }
  .panel { padding: 12px 20px; border-radius: 20px; }
  .kicker { margin-bottom: 0.35em; font-size: 0.58rem; }
  .logo { font-size: clamp(1.9rem, 9vh, 3rem); }
  .tagline { margin-top: 0.3em; font-size: 0.62rem; letter-spacing: 0.28em; }
  .blurb, .footnote { display: none; }
  .heading { font-size: clamp(1.35rem, 5.4vh, 2rem); margin-bottom: 0.35em; }
  .btn { min-height: 40px; padding: 0.5em 1em; font-size: 0.78rem; }
  .menu { gap: 7px; margin: 0.7em 0 0; }
  .row { margin-top: 0.7em; gap: 8px; }
  .setup { grid-template-columns: 1fr 1fr; gap: 8px; margin: 0.35em 0; }
  .setup-group { padding: 0.5em 0.75em; }
  .setup-group h3 { margin-bottom: 0.3em; font-size: 0.66rem; }
  .setup-group label { margin: 0.1em 0; font-size: 0.76rem; }
  #screen-setup .hint { display: none; }
  #screen-setup .btn { min-height: 36px; }
  .howto { margin: 0.4em 0; gap: 10px; }
  .keys { margin-top: 0.5em; padding-top: 0.45em; gap: 0.28em; font-size: 0.72rem; }
  .stats { margin: 0.6em 0 0.8em; }
  #screen-title .panel {
    width: min(780px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 1.1fr);
    grid-template-areas:
      "kicker menu"
      "logo menu"
      "tagline menu";
    column-gap: 22px;
    align-items: center;
    text-align: left;
  }
  #screen-title .kicker { grid-area: kicker; align-self: end; }
  #screen-title .logo { grid-area: logo; }
  #screen-title .tagline { grid-area: tagline; align-self: start; }
  #screen-title .menu {
    grid-area: menu;
    grid-template-columns: 1fr 1fr;
    margin: 0;
  }
  #screen-title .menu .btn:first-child { grid-column: 1 / -1; }
}
