/* ==========================================================================
   VimWorm — css/base.css
   Bioluminescent night garden + cozy terminal design system.
   Owner: visual-design · loaded before css/screens.css

   CONTENTS
   01  Design tokens (:root)
   02  Modern reset
   03  Document & the night-garden background
   04  Typography & links
   05  Selection, scrollbars, focus-visible
   06  Layout primitives: .app .screen .topbar .brand
   07  Buttons (+ every variant used by the game)
   08  Keycaps / kbd
   09  Surfaces: .panel .card .eyebrow .tagline
   10  Progress / stat / badge
   11  Form controls: .select .input
   12  Helpers: .sr-only .skip-link .noscript utilities
   13  Global keyframes (background, screens, generic motion)
   14  Responsive primitives
   15  Reduced-motion paths (attribute + media query)
   ========================================================================== */

/* ==========================================================================
   01 · DESIGN TOKENS
   One place for every colour, type, space, radius, shadow and motion value.
   ========================================================================== */

:root {
  /* ---- palette · deep forest night ------------------------------------- */
  --bg: #07110f;
  --bg-soft: #0b1a16;
  --bg-deep: #040b09;

  --panel: #0e211c;
  --panel-2: #143129;
  --panel-3: #1a3e33;

  --line: rgba(178, 255, 206, 0.13);
  --line-soft: rgba(178, 255, 206, 0.07);
  --line-strong: rgba(184, 255, 92, 0.34);

  /* ---- palette · ink ---------------------------------------------------- */
  --ink: #f5f1df;
  --ink-dim: #a9c1b2;
  --ink-mute: #6f8d7c;

  /* ---- palette · garden bioluminescence -------------------------------- */
  --lime: #b8ff5c;
  --lime-soft: rgba(184, 255, 92, 0.13);
  --lime-deep: #84e02f;
  --mint: #63f2c3;
  --mint-soft: rgba(99, 242, 195, 0.13);
  --peach: #ffb27a;
  --peach-soft: rgba(255, 178, 122, 0.14);
  --berry: #ff86a9;
  --sky: #7cd8ff;
  --lavender: #c7b8ff;
  --lavender-soft: rgba(199, 184, 255, 0.16);
  --gold: #ffd66b;
  --gold-soft: rgba(255, 214, 107, 0.14);
  --danger: #ff6f6f;
  --danger-soft: rgba(255, 111, 111, 0.12);

  --glow-lime: rgba(184, 255, 92, 0.36);
  --glow-mint: rgba(99, 242, 195, 0.3);
  --glow-peach: rgba(255, 178, 122, 0.35);

  /* translucent glass, used by bars / chrome / HUD */
  --glass: rgba(13, 34, 28, 0.62);
  --glass-strong: rgba(9, 25, 20, 0.9);

  /* ---- type ------------------------------------------------------------- */
  --font-display: 'Space Grotesk', ui-rounded, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* ---- space scale ------------------------------------------------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-7: 2rem;
  --sp-8: 2.5rem;
  --sp-9: 3rem;
  --sp-10: 4rem;
  --sp-12: 6rem;

  /* ---- radius ----------------------------------------------------------- */
  --r-2xs: 4px;
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-2xl: 36px;
  --r-pill: 999px;

  /* ---- shadow ----------------------------------------------------------- */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 18px 44px -22px rgba(0, 0, 0, 0.82);
  --shadow-lg: 0 34px 90px -32px rgba(0, 0, 0, 0.92);
  --shadow-glow: 0 0 28px -6px var(--glow-lime);
  --shadow-glow-strong: 0 0 46px -4px var(--glow-lime);
  --inset-line: 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --ring: 0 0 0 3px rgba(184, 255, 92, 0.3);

  /* ---- layout ----------------------------------------------------------- */
  --gutter: clamp(1rem, 3.5vw, 2.5rem);
  --content-max: 1320px;
  --topbar-col: 1400px;

  /* ---- buffer (shared with screens.css + renderer measurements) --------- */
  --buffer-fs: clamp(0.82rem, 0.28vw + 0.74rem, 0.96rem);
  --buffer-lh: 1.9rem;

  /* ---- motion ----------------------------------------------------------- */
  --ease: cubic-bezier(0.22, 0.9, 0.28, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 340ms;
  --dur-4: 600ms;

  /* ---- stacking --------------------------------------------------------- */
  --z-bg: 0;
  --z-screen: 1;
  --z-topbar: 30;
  --z-overlay: 200;
  --z-toast: 300;
  --z-fx: 400;
}

/* ==========================================================================
   02 · MODERN RESET
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

svg {
  flex: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--mint);
  text-decoration: none;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--lime);
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

pre,
code,
kbd,
samp {
  font-family: var(--font-mono);
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

strong,
b {
  font-weight: 600;
  color: var(--ink);
}

em {
  font-style: italic;
}

small {
  font-size: 0.82em;
}

hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: var(--line);
}

::placeholder {
  color: var(--ink-mute);
  opacity: 1;
}

[hidden] {
  display: none !important;
}

table {
  border-collapse: collapse;
}

/* ==========================================================================
   03 · DOCUMENT & THE NIGHT-GARDEN BACKGROUND
   Fixed, decorative, cheap: three blurred glows, a faint grid and two
   pseudo-element fields of drifting fireflies (box-shadow "dots").
   #bg-fireflies is intentionally left empty in the markup — all CSS.
   ========================================================================== */

body {
  background-image:
    radial-gradient(1200px 900px at 78% -14%, rgba(36, 96, 78, 0.5), transparent 62%),
    radial-gradient(900px 720px at -12% 108%, rgba(34, 88, 52, 0.34), transparent 62%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  overflow: hidden;
  pointer-events: none;
}

.bg::after {
  /* darken the corners so foreground cards pop */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 34%, transparent 42%, rgba(2, 8, 6, 0.72) 100%);
}

.bg__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
  pointer-events: none;
}

.bg__glow--1 {
  left: -18vmax;
  bottom: -32vmax;
  width: min(72vmax, 980px);
  aspect-ratio: 1;
  background: radial-gradient(circle at 50% 50%, rgba(184, 255, 92, 0.2), rgba(99, 242, 195, 0.09) 42%, transparent 70%);
  animation: glow-drift-a 28s ease-in-out infinite alternate;
}

.bg__glow--2 {
  right: -24vmax;
  top: -30vmax;
  width: min(66vmax, 880px);
  aspect-ratio: 1;
  background: radial-gradient(circle at 50% 50%, rgba(199, 184, 255, 0.17), rgba(124, 216, 255, 0.08) 46%, transparent 72%);
  animation: glow-drift-b 34s ease-in-out infinite alternate;
}

.bg__glow--3 {
  left: 34%;
  top: 52%;
  width: min(48vmax, 640px);
  aspect-ratio: 1;
  opacity: 0.4;
  background: radial-gradient(circle at 50% 50%, rgba(255, 178, 122, 0.12), rgba(255, 134, 169, 0.05) 48%, transparent 72%);
  animation: glow-drift-c 24s ease-in-out infinite alternate;
}

.bg__grid {
  position: absolute;
  inset: -2px;
  opacity: 0.85;
  background-image:
    linear-gradient(to right, rgba(184, 255, 92, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(184, 255, 92, 0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 82% 72% at 50% 42%, #000 26%, transparent 78%);
  mask-image: radial-gradient(ellipse 82% 72% at 50% 42%, #000 26%, transparent 78%);
  animation: grid-breathe 22s ease-in-out infinite alternate;
}

.bg__fireflies {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg__fireflies::before,
.bg__fireflies::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  /* the dots themselves stay transparent; every box-shadow is one firefly */
  background: transparent;
  animation: firefly-drift 30s ease-in-out infinite alternate;
}

.bg__fireflies::before {
  box-shadow:
    4vw 14vh 3px 0 rgba(184, 255, 92, 0.9),
    11vw 38vh 2px 0 rgba(99, 242, 195, 0.8),
    17vw 71vh 3px 1px rgba(255, 214, 107, 0.65),
    23vw 23vh 2px 0 rgba(184, 255, 92, 0.7),
    31vw 56vh 3px 0 rgba(199, 184, 255, 0.7),
    38vw 8vh 2px 1px rgba(99, 242, 195, 0.8),
    44vw 84vh 3px 0 rgba(184, 255, 92, 0.75),
    52vw 31vh 2px 0 rgba(255, 178, 122, 0.7),
    59vw 66vh 3px 0 rgba(184, 255, 92, 0.6),
    66vw 12vh 2px 1px rgba(199, 184, 255, 0.65),
    73vw 47vh 3px 0 rgba(99, 242, 195, 0.7),
    81vw 79vh 2px 0 rgba(184, 255, 92, 0.8),
    88vw 27vh 3px 0 rgba(255, 214, 107, 0.6),
    94vw 61vh 2px 1px rgba(184, 255, 92, 0.7);
}

.bg__fireflies::after {
  opacity: 0.65;
  animation-duration: 44s;
  animation-delay: -12s;
  animation-direction: alternate-reverse;
  box-shadow:
    7vw 52vh 2px 0 rgba(99, 242, 195, 0.7),
    14vw 88vh 3px 0 rgba(184, 255, 92, 0.6),
    21vw 9vh 2px 1px rgba(199, 184, 255, 0.6),
    28vw 44vh 3px 0 rgba(184, 255, 92, 0.75),
    35vw 72vh 2px 0 rgba(255, 178, 122, 0.55),
    41vw 17vh 3px 1px rgba(99, 242, 195, 0.65),
    48vw 95vh 2px 0 rgba(184, 255, 92, 0.55),
    56vw 39vh 3px 0 rgba(255, 214, 107, 0.6),
    63vw 5vh 2px 0 rgba(184, 255, 92, 0.7),
    69vw 63vh 3px 1px rgba(199, 184, 255, 0.55),
    77vw 35vh 2px 0 rgba(99, 242, 195, 0.6),
    84vw 91vh 3px 0 rgba(184, 255, 92, 0.65),
    91vw 48vh 2px 1px rgba(255, 178, 122, 0.5),
    97vw 21vh 3px 0 rgba(184, 255, 92, 0.55);
}

/* ==========================================================================
   04 · TYPOGRAPHY & LINKS
   Display voice: Space Grotesk (rounded, geometric). Buffer voice: JetBrains.
   ========================================================================== */

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
}

h4 {
  font-size: 1rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint);
}

.eyebrow::before {
  content: "";
  width: 1.4rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
  opacity: 0.7;
}

.tagline {
  max-width: 44ch;
  color: var(--ink-dim);
  font-size: clamp(1rem, 0.55vw + 0.9rem, 1.18rem);
  line-height: 1.65;
}

.tagline__dim {
  color: var(--ink-mute);
  font-size: 0.94em;
}

/* links in prose get a soft underline; buttons/brand opt out via their classes */
a:not(.btn):not(.brand) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(99, 242, 195, 0.35);
  transition: color var(--dur-2) var(--ease), text-decoration-color var(--dur-2) var(--ease);
}

a:not(.btn):not(.brand):hover {
  text-decoration-color: var(--lime);
}

/* ==========================================================================
   05 · SELECTION · SCROLLBARS · FOCUS
   ========================================================================== */

::selection {
  background: rgba(184, 255, 92, 0.3);
  color: #ffffff;
}

html {
  scrollbar-color: rgba(184, 255, 92, 0.32) transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(184, 255, 92, 0.34), rgba(99, 242, 195, 0.22));
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(184, 255, 92, 0.55), rgba(99, 242, 195, 0.38));
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================================
   06 · LAYOUT PRIMITIVES · TOPBAR · BRAND
   ========================================================================== */

.app {
  position: relative;
  z-index: var(--z-screen);
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.app:focus {
  outline: none;
}

.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100svh;
}

.screen.is-active {
  animation: screen-in var(--dur-4) var(--ease-out) both;
}

/* ---- topbar ------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) max(var(--gutter), calc((100% - var(--topbar-col)) / 2));
  background: linear-gradient(
    180deg,
    rgba(7, 17, 15, 0.92) 0%,
    rgba(7, 17, 15, 0.72) 58%,
    rgba(7, 17, 15, 0) 100%
  );
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
}

.topbar--landing {
  justify-content: space-between;
  padding-block: var(--sp-4) var(--sp-3);
}

.topbar--game {
  padding-block: var(--sp-2) var(--sp-2);
}

.topbar__title {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  text-align: center;
}

.topbar__title--left {
  text-align: left;
}

.topbar__heading {
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1rem, 0.6vw + 0.85rem, 1.3rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__sub {
  overflow: hidden;
  color: var(--ink-mute);
  font-size: 0.8rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__sub--tight {
  font-size: 0.76rem;
}

.topbar__kicker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.topbar__kicker > span:first-child {
  color: var(--mint);
}

.topbar__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.topbar--landing .topbar__actions {
  margin-left: 0;
}

/* ---- brand ------------------------------------------------------------- */

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem 0.3rem 0.35rem;
  border-radius: var(--r-pill);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  transition: color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}

.brand:hover {
  color: var(--lime);
  background: rgba(184, 255, 92, 0.07);
}

.brand__bug {
  display: inline-block;
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 0 7px rgba(184, 255, 92, 0.5));
  transition: transform var(--dur-3) var(--ease-bounce);
}

.brand:hover .brand__bug {
  transform: rotate(-10deg) scale(1.08);
}

.brand__name {
  text-transform: lowercase;
}

/* ==========================================================================
   07 · BUTTONS
   Press physics live on the individual translate/scale properties so every
   button can also use `transform` freely without collisions.
   ========================================================================== */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.68rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  translate: 0 0;
  scale: 1;
  -webkit-tap-highlight-color: transparent;
  transition:
    translate var(--dur-2) var(--ease),
    scale var(--dur-1) var(--ease),
    background-color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    filter var(--dur-2) var(--ease);
}

.btn:hover {
  translate: 0 -2px;
}

.btn:active {
  translate: 0 1px;
  scale: 0.985;
  transition-duration: 60ms;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  translate: none;
  scale: none;
  box-shadow: none;
  filter: none;
}

/* ---- primary ------------------------------------------------------------ */

.btn--primary {
  border-color: rgba(238, 255, 186, 0.85);
  background: linear-gradient(135deg, #d8ff92 0%, var(--lime) 42%, #8ef0a5 100%);
  color: #081307;
  box-shadow:
    0 10px 26px -12px rgba(184, 255, 92, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 0 0 1px rgba(7, 17, 15, 0.18) inset;
}

.btn--primary:hover {
  filter: brightness(1.04) saturate(1.04);
  box-shadow:
    0 18px 42px -14px rgba(184, 255, 92, 0.82),
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 0 0 1px rgba(7, 17, 15, 0.18) inset;
}

.btn--primary:active {
  filter: brightness(0.98);
}

/* ---- ghost -------------------------------------------------------------- */

.btn--ghost {
  border-color: var(--line);
  background: rgba(16, 42, 34, 0.52);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.btn--ghost:hover {
  border-color: var(--line-strong);
  background: rgba(23, 58, 47, 0.68);
  box-shadow:
    0 0 26px -14px var(--glow-lime),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

/* ---- icon button -------------------------------------------------------- */

.btn--icon {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  padding: 0;
  border-color: var(--line);
  border-radius: var(--r-pill);
  background: rgba(16, 42, 34, 0.52);
  color: var(--ink-dim);
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.btn--icon:hover {
  border-color: var(--line-strong);
  background: rgba(23, 58, 47, 0.68);
  color: var(--lime);
}

/* ---- sizes -------------------------------------------------------------- */

.btn--sm {
  padding: 0.48rem 0.85rem;
  font-size: 0.85rem;
}

.btn--xs,
.btn--tiny {
  gap: 0.3rem;
  padding: 0.32rem 0.68rem;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.005em;
}

.btn--xl {
  gap: 0.7rem;
  padding: 1rem 1.55rem;
  font-size: clamp(1rem, 0.4vw + 0.92rem, 1.12rem);
  letter-spacing: -0.01em;
}

/* ---- link --------------------------------------------------------------- */

.btn--link {
  padding: 0.5rem 0.35rem;
  border-color: transparent;
  background: none;
  color: var(--mint);
  font-weight: 500;
  box-shadow: none;
}

.btn--link:hover {
  border-color: transparent;
  background: none;
  color: var(--lime);
  box-shadow: none;
}

/* ---- danger ghost ------------------------------------------------------- */

.btn--danger-ghost {
  border-color: rgba(255, 111, 111, 0.26);
  background: rgba(255, 111, 111, 0.05);
  color: #ffb8b8;
  font-weight: 500;
}

.btn--danger-ghost:hover {
  border-color: rgba(255, 111, 111, 0.5);
  background: rgba(255, 111, 111, 0.12);
  color: #ffd2d2;
}

/* ---- back --------------------------------------------------------------- */

.btn--back {
  flex: none;
  padding-left: 0.7rem;
  gap: 0.4rem;
  color: var(--ink-dim);
  font-weight: 500;
}

.btn--back > span[aria-hidden] {
  transition: transform var(--dur-2) var(--ease);
}

.btn--back:hover {
  color: var(--ink);
}

.btn--back:hover > span[aria-hidden] {
  transform: translateX(-3px);
}

/* ---- hint --------------------------------------------------------------- */

.btn--hint {
  border-color: rgba(255, 214, 107, 0.26);
  background: rgba(255, 214, 107, 0.06);
  color: var(--gold);
}

.btn--hint:hover {
  border-color: rgba(255, 214, 107, 0.48);
  background: rgba(255, 214, 107, 0.12);
  color: #ffe19a;
  box-shadow: 0 0 22px -12px rgba(255, 214, 107, 0.8);
}

/* ---- pressed toggles (sound / reduced motion) --------------------------- */

.btn[aria-pressed="true"]:not(.btn--primary) {
  border-color: var(--line-strong);
  background: var(--lime-soft);
  color: var(--lime);
}

/* ---- keycap inside a button --------------------------------------------- */

.btn__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  padding: 0.16em 0.42em;
  border: 1px solid rgba(7, 17, 15, 0.22);
  border-bottom-width: 1px;
  border-radius: 6px;
  background: rgba(7, 17, 15, 0.14);
  box-shadow: none;
  color: currentColor;
  font-size: 0.78em;
  line-height: 1.2;
  translate: 0 1px;
}

.btn--primary .btn__key {
  background: rgba(7, 17, 15, 0.16);
  color: #081307;
}

/* ---- sound toggle icon --------------------------------------------------- */

.sound-toggle {
  position: relative;
}

.sound-toggle__icon {
  display: block;
  font-size: 1rem;
  line-height: 1;
  transition: transform var(--dur-3) var(--ease-bounce), opacity var(--dur-2) var(--ease), filter var(--dur-2) var(--ease);
}

.sound-toggle:hover .sound-toggle__icon {
  transform: scale(1.1);
}

.sound-toggle[aria-pressed="false"] {
  color: var(--ink-mute);
}

.sound-toggle[aria-pressed="false"] .sound-toggle__icon {
  opacity: 0.5;
  filter: grayscale(1);
}

/* ==========================================================================
   08 · KEYCAPS · kbd
   ========================================================================== */

kbd,
.keycap {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  padding: 0.14em 0.42em 0.18em;
  border: 1px solid rgba(178, 255, 206, 0.22);
  border-bottom: 2px solid rgba(0, 0, 0, 0.48);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(44, 84, 69, 0.92), rgba(15, 37, 30, 0.95));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 2px 3px rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  vertical-align: 0.06em;
}

.keycaps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 1rem;
}

.keycaps kbd,
.keycaps .keycap {
  padding: 0.18em 0.48em 0.22em;
  font-size: 0.8rem;
}

.keycaps--wrap {
  flex-wrap: wrap;
}

.keycaps__dots {
  margin-inline: 0.1rem;
  color: var(--ink-mute);
  opacity: 0.6;
  font-size: 1.05rem;
  line-height: 1;
}

/* dynamically rendered "no new keys" notes */
.keycaps__empty,
.complete-keys__empty {
  color: var(--ink-mute);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.45;
}

/* ==========================================================================
   09 · SURFACES · panel · card · eyebrow · tagline helpers
   ========================================================================== */

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 100% at 8% 0%, rgba(99, 242, 195, 0.08), transparent 58%),
    linear-gradient(165deg, rgba(21, 51, 42, 0.82) 0%, rgba(9, 25, 20, 0.94) 62%, rgba(6, 18, 15, 0.96) 100%);
  box-shadow:
    var(--shadow-md),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.card {
  position: relative;
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(110% 100% at 10% 0%, rgba(99, 242, 195, 0.06), transparent 60%),
    linear-gradient(165deg, rgba(21, 51, 42, 0.7), rgba(8, 22, 18, 0.9));
  box-shadow: var(--shadow-sm);
}

.card--interactive {
  cursor: pointer;
  transition:
    translate var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}

.card--interactive:hover {
  translate: 0 -3px;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md), 0 0 28px -12px var(--glow-lime);
}

/* ==========================================================================
   10 · PROGRESS · STAT · BADGE
   ========================================================================== */

.progress {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 0.55rem;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--lime));
  box-shadow: 0 0 14px rgba(184, 255, 92, 0.5);
  transition: width var(--dur-4) var(--ease-out);
}

.progress__fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%);
  animation: progress-shimmer 3.2s var(--ease) infinite;
}

.progress--sm {
  height: 0.4rem;
}

.progress--lg {
  height: 0.8rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.stat__value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat__label {
  font-size: 0.62rem;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16em 0.5em;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--lime {
  border-color: rgba(184, 255, 92, 0.35);
  background: var(--lime-soft);
  color: var(--lime);
}

.badge--mint {
  border-color: rgba(99, 242, 195, 0.35);
  background: var(--mint-soft);
  color: var(--mint);
}

.badge--gold {
  border-color: rgba(255, 214, 107, 0.35);
  background: var(--gold-soft);
  color: var(--gold);
}

/* ==========================================================================
   11 · FORM CONTROLS
   ========================================================================== */

.select {
  width: 100%;
  padding: 0.6rem 2.1rem 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background-color: rgba(7, 20, 16, 0.72);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23b8ff5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.88rem;
  line-height: 1.4;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.select:hover {
  border-color: var(--line-strong);
}

.select:focus-visible {
  border-color: var(--line-strong);
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.select option {
  background: var(--bg-soft);
  color: var(--ink);
}

.input,
.textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(7, 20, 16, 0.72);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.4;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.input:hover,
.textarea:hover {
  border-color: var(--line-strong);
}

.input:focus-visible,
.textarea:focus-visible {
  border-color: var(--line-strong);
  box-shadow: var(--ring);
  outline: none;
}

/* ==========================================================================
   12 · HELPERS · sr-only · skip-link · noscript · utilities
   ========================================================================== */

.sr-only {
  position: absolute !important;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 999;
  padding: 0.65rem 1.1rem;
  border-radius: var(--r-sm);
  background: var(--lime);
  color: #07110f;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease);
}

.skip-link:focus,
.skip-link:focus-visible {
  color: #07110f;
  transform: translateY(0);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.noscript {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  z-index: 999;
  width: max-content;
  max-width: min(92vw, 560px);
  padding: 0.85rem 1.25rem;
  border: 1px solid rgba(255, 111, 111, 0.35);
  border-radius: var(--r-md);
  background: rgba(32, 12, 12, 0.94);
  box-shadow: var(--shadow-lg);
  color: #ffd7d7;
  font-size: 0.9rem;
  text-align: center;
  transform: translateX(-50%);
}

/* ---- small utilities (used sparingly by screens.css / future markup) ---- */

.u-mono {
  font-family: var(--font-mono);
}

.u-dim {
  color: var(--ink-dim);
}

.u-mute {
  color: var(--ink-mute);
}

.u-lime {
  color: var(--lime);
}

.u-gold {
  color: var(--gold);
}

.u-center {
  text-align: center;
}

.u-nowrap {
  white-space: nowrap;
}

.u-grow {
  flex: 1 1 auto;
  min-width: 0;
}

.u-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.u-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ==========================================================================
   13 · GLOBAL KEYFRAMES
   Component-level keyframes live next to their components in screens.css.
   ========================================================================== */

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes glow-drift-a {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(6vw, -4vh, 0) scale(1.12);
  }
}

@keyframes glow-drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1.05);
  }
  to {
    transform: translate3d(-5vw, 5vh, 0) scale(0.94);
  }
}

@keyframes glow-drift-c {
  from {
    transform: translate3d(-3vw, 2vh, 0) scale(0.95);
  }
  to {
    transform: translate3d(4vw, -3vh, 0) scale(1.1);
  }
}

@keyframes grid-breathe {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 0.9;
  }
}

@keyframes firefly-drift {
  from {
    transform: translate3d(0, 1.5vh, 0);
  }
  to {
    transform: translate3d(1.5vw, -2.5vh, 0);
  }
}

@keyframes progress-shimmer {
  0%,
  55% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ==========================================================================
   14 · RESPONSIVE PRIMITIVES
   Screen layouts & breakpoint-specific composition live in screens.css.
   ========================================================================== */

@media (hover: none) {
  .btn:hover {
    translate: none;
  }

  .card--interactive:hover {
    translate: none;
  }
}

@media (max-width: 900px) {
  :root {
    --r-2xl: 28px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-3);
    padding-block: 0.7rem;
  }

  .topbar__title {
    text-align: left;
  }

  .topbar--landing {
    padding-block: var(--sp-3);
  }
}

@media (max-width: 620px) {
  :root {
    --gutter: 1rem;
    --buffer-lh: 1.7rem;
  }

  body {
    font-size: 0.97rem;
  }

  .topbar {
    padding-block: 0.55rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .topbar__actions {
    gap: 0.35rem;
  }

  .topbar__sub {
    font-size: 0.74rem;
  }

  .btn {
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
  }

  .btn--icon {
    width: 2.3rem;
    height: 2.3rem;
    font-size: 0.92rem;
  }

  .btn--xl {
    padding: 0.9rem 1.3rem;
  }

  .eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
  }
}

/* ==========================================================================
   15 · REDUCED MOTION
   Two explicit paths, exactly as the contract requires:
   a) the player pressed "Reduce motion" → <html data-reduced-motion="true">
   b) the OS asks for reduced motion (prefers-reduced-motion: reduce)
   In both cases, decorative animation + transition are removed wholesale.
   ========================================================================== */

html[data-reduced-motion="true"] {
  scroll-behavior: auto;
}

html[data-reduced-motion="true"] *,
html[data-reduced-motion="true"] *::before,
html[data-reduced-motion="true"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  html *,
  html *::before,
  html *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
