/* ============================================================
   M360 — Spark  ·  Liquid Glass shared stylesheet
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

/* ---------- Tokens ---------- */
:root {
  /* aurora palette */
  --aurora-purple: #7c5cff;
  --aurora-orange: #ff7a59;
  --aurora-cyan:   #34e0ff;
  --aurora-pink:   #ff5c8d;
  --aurora-green:  #3ddc97;
  --base:          #0a0612;
  --base-2:        #14101f;

  /* text tiers */
  --text-1: rgba(255, 255, 255, 0.96);
  --text-2: rgba(255, 255, 255, 0.68);
  --text-3: rgba(255, 255, 255, 0.44);
  --text-on-light: #0a0612;

  /* glass — tinted dark base UNDER the blur, always */
  --glass-bg:        rgba(15, 15, 25, 0.62);
  --glass-bg-strong: rgba(12, 10, 22, 0.78);
  --glass-bg-bar:    rgba(15, 15, 25, 0.55);
  --glass-stroke:    rgba(255, 255, 255, 0.12);
  --glass-stroke-2:  rgba(255, 255, 255, 0.18);
  --glass-top-hi:    rgba(255, 255, 255, 0.30);
  --glass-bot-lo:    rgba(0, 0, 0, 0.35);
  /* backdrop filters — brightness + saturation lift so the aurora refracts through */
  --glass-filter:        blur(38px) saturate(225%) brightness(1.16) contrast(1.02);
  --glass-filter-strong: blur(52px) saturate(240%) brightness(1.2) contrast(1.03);
  --glass-sheen:         rgba(255, 255, 255, 0.20);

  /* radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-2xl: 36px;
  --r-pill: 999px;

  /* motion */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease:   cubic-bezier(0.2, 0.7, 0.2, 1);

  /* layout */
  --bar-h: 64px;
  --content-max: 1280px;
}

/* ---------- Type ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-1);
  background: var(--base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: 44px; font-weight: 640; }
h2 { font-size: 28px; font-weight: 620; }
h3 { font-size: 20px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
p  { margin: 0; line-height: 1.6; color: var(--text-2); }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}

.mono {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-feature-settings: "ss01", "ss02";
}

.muted   { color: var(--text-2); }
.dim     { color: var(--text-3); }

.grad-text {
  background: linear-gradient(105deg, #ff9a7a 0%, #ff7a59 30%, #c779ff 65%, #7c5cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============================================================
   AURORA WALLPAPER
   Layered radial blooms with slow drift; vignette pushes
   colour to the edges so text isn't fighting it.
   ============================================================ */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--base);
  overflow: hidden;
}
.aurora::before, .aurora::after,
.aurora .blob {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.85;
  will-change: transform;
}
.aurora::before {
  width: 720px; height: 720px;
  left: -160px; top: -180px;
  background: radial-gradient(circle, var(--aurora-purple) 0%, transparent 65%);
  animation: drift-a 28s ease-in-out infinite alternate;
}
.aurora::after {
  width: 820px; height: 820px;
  right: -200px; top: -120px;
  background: radial-gradient(circle, var(--aurora-orange) 0%, transparent 60%);
  animation: drift-b 28s ease-in-out infinite alternate;
}
.aurora .blob.c {
  width: 680px; height: 680px;
  left: 18%; bottom: -260px;
  background: radial-gradient(circle, var(--aurora-cyan) 0%, transparent 62%);
  opacity: 0.6;
  animation: drift-c 32s ease-in-out infinite alternate;
}
.aurora .blob.p {
  width: 520px; height: 520px;
  right: 8%; bottom: -160px;
  background: radial-gradient(circle, var(--aurora-pink) 0%, transparent 62%);
  opacity: 0.55;
  animation: drift-d 36s ease-in-out infinite alternate;
}

/* Vignette — pushes colour away from the centre where text lives. */
.aurora-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, transparent 0%, rgba(10,6,18,0.35) 55%, rgba(10,6,18,0.75) 100%),
    linear-gradient(180deg, rgba(10,6,18,0.55) 0%, transparent 18%, transparent 78%, rgba(10,6,18,0.75) 100%);
}

/* fine grain noise — adds material to the glass */
.aurora-grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

@keyframes drift-a {
  0%   { transform: translate3d(0, 0, 0)         scale(1); }
  100% { transform: translate3d(120px, 80px, 0)  scale(1.15); }
}
@keyframes drift-b {
  0%   { transform: translate3d(0, 0, 0)         scale(1.05); }
  100% { transform: translate3d(-140px, 60px, 0) scale(1); }
}
@keyframes drift-c {
  0%   { transform: translate3d(0, 0, 0)         scale(1); }
  100% { transform: translate3d(80px, -100px, 0) scale(1.18); }
}
@keyframes drift-d {
  0%   { transform: translate3d(0, 0, 0)         scale(1.1); }
  100% { transform: translate3d(-90px, -60px, 0) scale(1); }
}

/* ============================================================
   GLASS  —  tinted dark base + blur + edge weight
   ============================================================ */

.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--r-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-top-hi),
    inset 0 -1px 0 var(--glass-bot-lo),
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 24px 60px -12px rgba(0, 0, 0, 0.55),
    0 8px 24px -8px rgba(0, 0, 0, 0.35);
  position: relative;
}

.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-filter-strong);
  -webkit-backdrop-filter: var(--glass-filter-strong);
  border: 1px solid var(--glass-stroke-2);
  border-radius: var(--r-xl);
  box-shadow:
    inset 0 1px 0 var(--glass-top-hi),
    inset 0 -1px 0 var(--glass-bot-lo),
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 32px 80px -16px rgba(0, 0, 0, 0.65),
    0 10px 30px -8px rgba(0, 0, 0, 0.4);
}

/* Liquid-glass sheen: a bright top edge fading down + a soft corner catch-light
   + a faint lower lip. Reads as curved, refractive glass. */
.glass::after, .glass-strong::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--glass-sheen) 0%, rgba(255,255,255,0.04) 16%, transparent 38%),
    radial-gradient(140% 90% at 0% -10%, rgba(255,255,255,0.12) 0%, transparent 42%);
  mix-blend-mode: screen;
  opacity: 0.95;
}

/* ============================================================
   TOP BAR — sticky floating pill
   ============================================================ */

.topbar-wrap {
  position: sticky;
  top: 20px;
  z-index: 40;
  padding: 0 24px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.topbar {
  pointer-events: auto;
  width: 100%;
  max-width: var(--content-max);
  height: var(--bar-h);
  padding: 0 14px 0 18px;
  border-radius: var(--r-pill);
  background: var(--glass-bg-bar);
  backdrop-filter: var(--glass-filter-strong);
  -webkit-backdrop-filter: var(--glass-filter-strong);
  border: 1px solid var(--glass-stroke);
  box-shadow:
    inset 0 1px 0 var(--glass-top-hi),
    inset 0 -1px 0 var(--glass-bot-lo),
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 18px 50px -10px rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 640;
  letter-spacing: -0.01em;
  font-size: 15.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-name { white-space: nowrap; }
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.55), transparent 45%),
    linear-gradient(135deg, #c779ff 0%, #7c5cff 35%, #ff7a59 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    inset 0 -1px 0 rgba(0,0,0,0.25),
    0 4px 14px rgba(124, 92, 255, 0.45);
}
.brand-mark.lg {
  width: 56px; height: 56px;
  border-radius: 16px;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,0.45),
    inset 0 -1.5px 0 rgba(0,0,0,0.25),
    0 12px 30px rgba(124, 92, 255, 0.45),
    0 0 0 0.5px rgba(255,255,255,0.1);
}
.brand-mark.xl {
  width: 76px; height: 76px;
  border-radius: 22px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
}
.nav a {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.nav a:hover { color: var(--text-1); background: rgba(255,255,255,0.06); }
.nav a.active {
  color: var(--text-1);
  background: rgba(255,255,255,0.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.bar-spacer { flex: 1; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  width: 240px;
  color: var(--text-3);
  font-size: 13.5px;
  transition: background 0.2s, border-color 0.2s;
}
.search:hover { background: rgba(255,255,255,0.07); }
.search input {
  flex: 1; border: 0; background: transparent; outline: 0; color: var(--text-1);
  font-size: 13.5px;
}
.search input::placeholder { color: var(--text-3); }
.search kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  color: var(--text-3);
  border: 1px solid rgba(255,255,255,0.06);
}

.iconbtn {
  width: 38px; height: 38px;
  border-radius: var(--r-pill);
  display: grid; place-items: center;
  color: var(--text-2);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  position: relative;
  transition: background 0.2s, color 0.2s, transform 0.3s var(--spring);
}
.iconbtn:hover { background: rgba(255,255,255,0.09); color: var(--text-1); }
.iconbtn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--aurora-orange);
  box-shadow: 0 0 0 2px rgba(15,15,25,0.9), 0 0 8px var(--aurora-orange);
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-purple));
  display: grid; place-items: center;
  font-size: 12px; font-weight: 640; color: white;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 4px 10px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.tiny { width: 18px; height: 18px; font-size: 9px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.warm { background: linear-gradient(135deg, var(--aurora-orange), var(--aurora-pink)); }
.avatar.green { background: linear-gradient(135deg, var(--aurora-cyan), var(--aurora-green)); }
.avatar.violet { background: linear-gradient(135deg, var(--aurora-pink), var(--aurora-purple)); }

/* ============================================================
   BUTTONS — solid for confident tap targets
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-1);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 0.25s var(--spring), background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,0.13); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.08);
  color: var(--text-2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text-1); }

.btn-primary {
  color: white;
  background:
    linear-gradient(135deg, #ff8a6b 0%, #ff5b8a 45%, #8a5cff 100%);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 10px 24px -6px rgba(255, 105, 130, 0.5),
    0 4px 10px -2px rgba(124, 92, 255, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 14px 32px -6px rgba(255, 105, 130, 0.6),
    0 6px 14px -2px rgba(124, 92, 255, 0.5);
}

.btn-success {
  color: white;
  background: linear-gradient(135deg, #4be0a8 0%, #34c2e0 100%);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 10px 24px -6px rgba(75, 224, 168, 0.45);
}

.btn-lg { height: 52px; padding: 0 26px; font-size: 15px; border-radius: var(--r-pill); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; gap: 6px; }
.btn-block { width: 100%; }

/* Floating action button — bottom-right primary */
.fab {
  position: fixed;
  right: 32px;
  bottom: 32px;
  z-index: 30;
  height: 54px;
  padding: 0 22px 0 18px;
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-pill);
  color: white;
  background:
    linear-gradient(135deg, #ff8a6b 0%, #ff5b8a 45%, #8a5cff 100%);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 18px 40px -8px rgba(255, 90, 130, 0.55),
    0 8px 20px -4px rgba(124, 92, 255, 0.45);
  transition: transform 0.3s var(--spring), box-shadow 0.3s;
}
.fab:hover { transform: translateY(-3px) scale(1.02); }
.fab .plus {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

/* ============================================================
   INPUTS
   ============================================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field label {
  font-size: 12.5px;
  font-weight: 540;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.input, .textarea, .select {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 0 0 1px rgba(0,0,0,0.1);
  color: var(--text-1);
  font-size: 14.5px;
  outline: 0;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .textarea:hover, .select:hover { background: rgba(0,0,0,0.34); }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(255,255,255,0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 0 4px rgba(124, 92, 255, 0.18);
  background: rgba(0,0,0,0.34);
}
.textarea { height: auto; padding: 14px 16px; resize: vertical; min-height: 96px; line-height: 1.55; }

.input-icon {
  position: relative;
}
.input-icon svg {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.input-icon .input { padding-left: 44px; }

/* ============================================================
   PILLS, CHIPS, BADGES
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 540;
  color: var(--text-2);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: pointer;
}
.chip:hover { background: rgba(255,255,255,0.08); color: var(--text-1); }
.chip.active {
  background: rgba(255,255,255,0.12);
  color: var(--text-1);
  border-color: rgba(255,255,255,0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
}
.chip svg { opacity: 0.85; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-1);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
}
.badge.dot::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge.phaser  { color: #ffaf5c; background: rgba(255,122,89,0.14); border-color: rgba(255,122,89,0.22); }
.badge.three   { color: #c79bff; background: rgba(124,92,255,0.16); border-color: rgba(124,92,255,0.26); }
.badge.pixi    { color: #ff9bbf; background: rgba(255,92,141,0.14); border-color: rgba(255,92,141,0.24); }
.badge.canvas  { color: #7be3ff; background: rgba(52,224,255,0.12); border-color: rgba(52,224,255,0.22); }
.badge.html    { color: #b8e8a0; background: rgba(140,220,120,0.12); border-color: rgba(140,220,120,0.22); }

.version-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 640;
  letter-spacing: 0.02em;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  color: var(--text-1);
  background: rgba(20, 16, 31, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.version-pill.current {
  color: white;
  background: linear-gradient(135deg, rgba(255,122,89,0.95), rgba(124,92,255,0.95));
  border-color: rgba(255,255,255,0.3);
}

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px 24px 120px;
}

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }

/* ============================================================
   SCREEN-SPECIFIC bits live in each .html so this file
   stays small — but we share a couple of common patterns.
   ============================================================ */

/* Section header bar */
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 20px;
}
.section-head h1 .accent-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-left: 6px;
  margin-bottom: 4px;
  vertical-align: middle;
  background: var(--aurora-orange);
  box-shadow: 0 0 14px var(--aurora-orange);
}

.summary-line {
  color: var(--text-2);
  font-size: 14.5px;
  margin-top: 8px;
}

/* utility scroll-snap chip row */
.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Tip / status link */
.status-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-3);
}
.status-link .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--aurora-green);
  box-shadow: 0 0 0 0 rgba(61,220,151,0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61,220,151,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(61,220,151,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,220,151,0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1120px) {
  /* keyboard hint is decorative — drop it before the bar gets tight */
  .search kbd { display: none; }
  .nav a { padding: 8px 11px; }
}
@media (max-width: 1000px) {
  .nav { display: none; }
}
@media (max-width: 900px) {
  h1 { font-size: 32px; }
  h2 { font-size: 22px; }
  .topbar-wrap { top: 12px; padding: 0 12px; }
  .topbar { height: 56px; padding: 0 10px 0 14px; gap: 10px; }
  .search { width: 200px; }
  .page { padding: 24px 16px 100px; }
  .fab { right: 16px; bottom: 16px; height: 50px; padding: 0 18px 0 14px; }
}
@media (max-width: 680px) {
  .search { width: 150px; }
}
@media (max-width: 560px) {
  .search { display: none; }
  .brand .brand-name { display: none; }
}

/* ============================================================
   THEME — smooth cross-fade between light & dark
   The dark tokens above are the default. Light overrides below.
   ============================================================ */

html.theme-anim,
html.theme-anim body,
html.theme-anim .glass,
html.theme-anim .glass-strong,
html.theme-anim .topbar,
html.theme-anim .game-card,
html.theme-anim .index-card,
html.theme-anim .vrow,
html.theme-anim .btn,
html.theme-anim .chip,
html.theme-anim .badge,
html.theme-anim .input,
html.theme-anim .select,
html.theme-anim .textarea {
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease),
    border-color 0.45s var(--ease), box-shadow 0.45s var(--ease) !important;
}

:root[data-theme="light"] {
  --aurora-purple: #8b6bff;
  --aurora-orange: #ff7a59;
  --aurora-cyan:   #2bc7ef;
  --aurora-pink:   #ff5c8d;
  --aurora-green:  #2bbf85;
  --base:          #eceefb;
  --base-2:        #f6f7fd;

  --text-1: rgba(18, 16, 34, 0.94);
  --text-2: rgba(28, 24, 48, 0.62);
  --text-3: rgba(38, 34, 60, 0.44);
  --text-on-light: #ffffff;

  --glass-bg:        rgba(255, 255, 255, 0.58);
  --glass-bg-strong: rgba(255, 255, 255, 0.74);
  --glass-bg-bar:    rgba(255, 255, 255, 0.62);
  --glass-stroke:    rgba(20, 18, 40, 0.10);
  --glass-stroke-2:  rgba(20, 18, 40, 0.16);
  --glass-top-hi:    rgba(255, 255, 255, 0.95);
  --glass-bot-lo:    rgba(20, 18, 40, 0.06);
  --glass-filter:        blur(30px) saturate(150%) brightness(1.03);
  --glass-filter-strong: blur(40px) saturate(160%) brightness(1.04);
  --glass-sheen:         rgba(255, 255, 255, 0.55);
}

:root[data-theme="light"] .glass,
:root[data-theme="light"] .game-card,
:root[data-theme="light"] .index-card {
  box-shadow:
    inset 0 1px 0 var(--glass-top-hi),
    inset 0 -1px 0 var(--glass-bot-lo),
    0 22px 56px -16px rgba(40, 36, 80, 0.28),
    0 8px 22px -10px rgba(40, 36, 80, 0.18);
}
:root[data-theme="light"] .glass-strong {
  box-shadow:
    inset 0 1px 0 var(--glass-top-hi),
    0 30px 72px -18px rgba(40, 36, 80, 0.32),
    0 10px 28px -10px rgba(40, 36, 80, 0.2);
}
:root[data-theme="light"] .topbar {
  box-shadow:
    inset 0 1px 0 var(--glass-top-hi),
    0 16px 44px -14px rgba(40, 36, 80, 0.26);
}

/* lighter aurora blobs + light vignette */
:root[data-theme="light"] .aurora::before { opacity: 0.42; }
:root[data-theme="light"] .aurora::after  { opacity: 0.42; }
:root[data-theme="light"] .aurora .blob.c { opacity: 0.34; }
:root[data-theme="light"] .aurora .blob.p { opacity: 0.32; }
:root[data-theme="light"] .aurora-grain { opacity: 0.04; mix-blend-mode: multiply; }
:root[data-theme="light"] .aurora-vignette {
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, transparent 0%, rgba(236,238,251,0.45) 55%, rgba(236,238,251,0.85) 100%),
    linear-gradient(180deg, rgba(236,238,251,0.6) 0%, transparent 18%, transparent 78%, rgba(236,238,251,0.85) 100%);
}

/* light: flip the "white film" chrome to ink film so it reads on light glass */
:root[data-theme="light"] .nav a:hover { background: rgba(20,18,40,0.05); }
:root[data-theme="light"] .nav a.active { background: rgba(20,18,40,0.07); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6); }
:root[data-theme="light"] .search { background: rgba(20,18,40,0.04); border-color: rgba(20,18,40,0.07); }
:root[data-theme="light"] .search:hover { background: rgba(20,18,40,0.06); }
:root[data-theme="light"] .search kbd { background: rgba(20,18,40,0.07); border-color: rgba(20,18,40,0.06); }
:root[data-theme="light"] .iconbtn { background: rgba(20,18,40,0.04); border-color: rgba(20,18,40,0.08); }
:root[data-theme="light"] .iconbtn:hover { background: rgba(20,18,40,0.08); }
:root[data-theme="light"] .iconbtn .dot { box-shadow: 0 0 0 2px rgba(255,255,255,0.95), 0 0 8px var(--aurora-orange); }
:root[data-theme="light"] .btn { background: rgba(20,18,40,0.06); border-color: rgba(20,18,40,0.1); box-shadow: inset 0 1px 0 rgba(255,255,255,0.5); color: var(--text-1); }
:root[data-theme="light"] .btn:hover { background: rgba(20,18,40,0.1); }
:root[data-theme="light"] .btn-ghost { background: transparent; border-color: rgba(20,18,40,0.1); }
:root[data-theme="light"] .btn-ghost:hover { background: rgba(20,18,40,0.05); }
/* Keep the coloured CTAs coloured in light mode (the generic .btn light rule
   above would otherwise flatten them to grey with invisible white text). */
:root[data-theme="light"] .btn-primary,
:root[data-theme="light"] .btn-success {
  color: #fff;
  border-color: rgba(255,255,255,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    inset 0 -1px 0 rgba(0,0,0,0.12),
    0 10px 24px -6px rgba(255,105,130,0.45),
    0 4px 12px -2px rgba(124,92,255,0.4);
}
:root[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #ff8a6b 0%, #ff5b8a 45%, #8a5cff 100%);
}
:root[data-theme="light"] .btn-success {
  background: linear-gradient(135deg, #34e0ff 0%, #4be0a8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    inset 0 -1px 0 rgba(0,0,0,0.12),
    0 10px 24px -6px rgba(52,224,255,0.45);
}
:root[data-theme="light"] .chip { background: rgba(20,18,40,0.05); border-color: rgba(20,18,40,0.08); }
:root[data-theme="light"] .chip:hover { background: rgba(20,18,40,0.09); }
:root[data-theme="light"] .chip.active { background: rgba(20,18,40,0.12); border-color: rgba(20,18,40,0.16); color: var(--text-1); box-shadow: inset 0 1px 0 rgba(255,255,255,0.5); }
:root[data-theme="light"] .badge { background: rgba(20,18,40,0.06); border-color: rgba(20,18,40,0.08); }
:root[data-theme="light"] .input,
:root[data-theme="light"] .textarea,
:root[data-theme="light"] .select {
  background: rgba(255,255,255,0.55);
  border-color: rgba(20,18,40,0.1);
  box-shadow: inset 0 1px 2px rgba(20,18,40,0.04);
}
:root[data-theme="light"] .input:hover,
:root[data-theme="light"] .textarea:hover,
:root[data-theme="light"] .select:hover { background: rgba(255,255,255,0.72); }
:root[data-theme="light"] .input:focus,
:root[data-theme="light"] .textarea:focus,
:root[data-theme="light"] .select:focus {
  background: rgba(255,255,255,0.85);
  border-color: rgba(124,92,255,0.5);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.16);
}

/* light: patch per-screen dark fills (defined inline in pages) */
:root[data-theme="light"] .dropzone { background: rgba(255,255,255,0.46); border-color: rgba(20,18,40,0.18); }
:root[data-theme="light"] .file-row,
:root[data-theme="light"] .stat,
:root[data-theme="light"] .activity-spark,
:root[data-theme="light"] .qr-link,
:root[data-theme="light"] .copy-row,
:root[data-theme="light"] .engine-row,
:root[data-theme="light"] .tags-input,
:root[data-theme="light"] .segmented {
  background: rgba(255,255,255,0.5);
  border-color: rgba(20,18,40,0.08);
}
:root[data-theme="light"] .qr-link button,
:root[data-theme="light"] .tags-input .t,
:root[data-theme="light"] .segmented .seg.on { background: rgba(20,18,40,0.07); }
:root[data-theme="light"] .sso-btn,
:root[data-theme="light"] .reaction,
:root[data-theme="light"] .share-btn { background: rgba(20,18,40,0.05); border-color: rgba(20,18,40,0.09); }
:root[data-theme="light"] .sso-btn:hover,
:root[data-theme="light"] .reaction:hover,
:root[data-theme="light"] .share-btn:hover { background: rgba(20,18,40,0.09); }
:root[data-theme="light"] .vrow {
  box-shadow: inset 0 1px 0 var(--glass-top-hi), 0 8px 22px -10px rgba(40,36,80,0.2);
}
:root[data-theme="light"] .vrow::before { border-color: rgba(255,255,255,0.9); }
:root[data-theme="light"] .version-pill { background: rgba(255,255,255,0.78); color: var(--text-1); border-color: rgba(20,18,40,0.12); }

/* ============================================================
   STACK BADGES — colour-coded engine identity
   ============================================================ */
.badge.react   { color: #4cc2e8; background: rgba(76,194,232,0.14); border-color: rgba(76,194,232,0.26); }
.badge.js      { color: #e6c34a; background: rgba(230,195,74,0.14); border-color: rgba(230,195,74,0.26); }
.badge.html5   { color: #ff9460; background: rgba(255,122,89,0.14); border-color: rgba(255,122,89,0.24); }
:root[data-theme="light"] .badge.phaser { color: #c4601f; }
:root[data-theme="light"] .badge.three  { color: #6b3fd4; }
:root[data-theme="light"] .badge.pixi   { color: #c43a6b; }
:root[data-theme="light"] .badge.canvas { color: #1f86b0; }
:root[data-theme="light"] .badge.html   { color: #3f8f2a; }
:root[data-theme="light"] .badge.react  { color: #1f86b0; }
:root[data-theme="light"] .badge.js     { color: #9a7e15; }
:root[data-theme="light"] .badge.html5  { color: #c4601f; }

/* ============================================================
   THEME TOGGLE — liquid-glass sliding switch
   ============================================================ */
.theme-toggle {
  position: relative;
  width: 64px; height: 34px;
  flex-shrink: 0;
  padding: 0;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-stroke-2);
  box-shadow: inset 0 1px 0 var(--glass-top-hi), inset 0 -1px 0 var(--glass-bot-lo);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.3s var(--ease);
}
:root[data-theme="light"] .theme-toggle { background: rgba(20,18,40,0.05); }
.theme-toggle .tt-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2440, #14101f);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 10px rgba(0,0,0,0.45);
  transition: transform 0.5s var(--spring), background 0.4s var(--ease);
  z-index: 2;
}
:root[data-theme="light"] .theme-toggle .tt-thumb {
  transform: translateX(30px);
  background: linear-gradient(135deg, #fff3d6, #ffd479);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 12px rgba(255,180,80,0.5);
}
.theme-toggle svg {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  transition: opacity 0.3s var(--ease);
}
.theme-toggle .tt-moon { right: 9px; color: var(--text-2); opacity: 1; }
.theme-toggle .tt-sun  { left: 9px; color: #e8a93a; opacity: 0; }
:root[data-theme="light"] .theme-toggle .tt-moon { opacity: 0; }
:root[data-theme="light"] .theme-toggle .tt-sun  { opacity: 1; }
.theme-toggle.floating {
  position: fixed; top: 22px; right: 22px; z-index: 60;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: var(--glass-bg-bar);
}

/* ============================================================
   POINTER PHYSICS — tilt, specular highlight, magnetism
   ============================================================ */
.tilt { transform-style: preserve-3d; will-change: transform; }
.cardspec {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  border-radius: inherit;
  background: radial-gradient(circle 200px at var(--mx, 50%) var(--my, 0%),
    rgba(255,255,255,0.22), transparent 62%);
  mix-blend-mode: screen;
  transition: opacity 0.3s var(--ease);
}
:root[data-theme="light"] .cardspec {
  background: radial-gradient(circle 200px at var(--mx, 50%) var(--my, 0%),
    rgba(255,255,255,0.7), transparent 60%);
  mix-blend-mode: soft-light;
}
.tilt:hover .cardspec { opacity: 1; }
.magnetic { will-change: transform; }

/* ============================================================
   SPLASH — Spark intro with star above the K
   ============================================================ */
#splash {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: var(--base);
  overflow: hidden;
}
html.splash-seen #splash { display: none; }
#splash .splash-aurora {
  position: absolute; inset: -10%;
  background:
    radial-gradient(circle at 28% 32%, var(--aurora-purple) 0%, transparent 45%),
    radial-gradient(circle at 74% 64%, var(--aurora-orange) 0%, transparent 42%),
    radial-gradient(circle at 60% 20%, var(--aurora-cyan) 0%, transparent 40%);
  filter: blur(70px);
  opacity: 0.55;
  animation: splash-breathe 3s var(--ease) infinite alternate;
}
@keyframes splash-breathe {
  from { transform: scale(1) translate(0,0); }
  to   { transform: scale(1.12) translate(2%, -1%); }
}
#splash .splash-mark {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 18px;
  padding: 30px 46px;
  border-radius: var(--r-2xl);
  background: var(--glass-bg);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-stroke-2);
  box-shadow: inset 0 1px 0 var(--glass-top-hi), 0 40px 90px -20px rgba(0,0,0,0.5);
  animation: splash-pop 0.8s var(--spring) both;
}
@keyframes splash-pop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
#splash .splash-puck {
  width: 64px; height: 64px; border-radius: 18px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.55), transparent 45%),
    linear-gradient(135deg, #c779ff 0%, #7c5cff 35%, #ff7a59 100%);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,0.45), 0 12px 30px rgba(124,92,255,0.5);
  animation: splash-puck-in 0.9s var(--spring) 0.1s both;
}
@keyframes splash-puck-in {
  from { transform: scale(0.4) rotate(-18deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
#splash .splash-word {
  font-size: 58px; font-weight: 680; letter-spacing: -0.03em;
  color: var(--text-1);
  line-height: 1;
}
#splash .splash-word { animation: splash-letter 0.6s var(--spring) 0.4s both; }
@keyframes splash-letter { from { transform: translateY(0.12em); opacity:0; } to { transform: translateY(0); opacity:1; } }
#splash.leaving {
  animation: splash-out 0.7s var(--ease) forwards;
  pointer-events: none;
}
@keyframes splash-out {
  to { opacity: 0; transform: scale(1.04); filter: blur(6px); }
}
#splash .splash-skip {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 2;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
}

/* Wordmark wrapper: keeps "Spark" as a single plain text run so the
   parent gradient (background-clip:text) fills EVERY letter including the
   K. The star is a sibling absolutely-positioned against this wrapper —
   never wrapping a letter in a positioned box (that paints the glyph
   separately and drops it out of the clipped gradient = the "missing K"). */
.wordmark { position: relative; white-space: nowrap; }
.spark-star {
  display: none; /* only the big splash star reads well; it's an artifact when small */
  position: absolute;
  top: -0.3em; right: -0.34em;
  width: 0.4em; height: 0.4em;
  background: var(--aurora-orange);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  filter: drop-shadow(0 0 6px rgba(255,138,80,0.85));
  animation: star-twinkle 2.6s var(--ease) infinite;
}
#splash .spark-star {
  display: block;
  top: -0.2em; right: -0.4em;
  animation: star-pop 0.6s var(--spring) 0.7s both, star-twinkle 2.6s var(--ease) 1.3s infinite;
}
@keyframes star-pop { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes star-twinkle {
  0%, 100% { transform: scale(1) rotate(0); opacity: 0.95; }
  50%      { transform: scale(1.28) rotate(45deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #splash .splash-aurora, #splash .splash-mark, #splash .splash-puck,
  #splash .splash-word, .spark-star { animation: none !important; }
}

/* ============================================================
   ANIMATED SPARK — lives inside the brand puck
   ============================================================ */
.brand-mark { position: relative; overflow: hidden; }
.brand-spark {
  position: absolute; inset: 0;
  pointer-events: none;
  display: grid; place-items: center;
}
.brand-spark .bolt {
  width: 52%; height: 52%;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.35));
  animation: bolt-pulse 2.8s var(--ease) infinite;
  transform-origin: center;
}
@keyframes bolt-pulse {
  0%, 100% { transform: scale(1) rotate(0); opacity: 0.96; }
  45%      { transform: scale(1.16) rotate(-6deg); opacity: 1; }
  70%      { transform: scale(0.96) rotate(2deg); }
}
.brand-spark .twinkle {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  animation: twinkle 2.8s var(--ease) infinite;
}
.brand-spark .twinkle.a { width: 14%; height: 14%; top: 20%; right: 22%; animation-delay: 0.2s; }
.brand-spark .twinkle.b { width: 9%; height: 9%; bottom: 26%; left: 24%; animation-delay: 1.1s; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4); }
  30%      { opacity: 0.95; transform: scale(1); }
  55%      { opacity: 0; transform: scale(0.4); }
}
/* sheen sweep across the puck */
.brand-mark::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.45) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: puck-sheen 4.5s var(--ease) infinite;
}
@keyframes puck-sheen {
  0%, 62% { transform: translateX(-120%); }
  78%     { transform: translateX(120%); }
  100%    { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .brand-spark .bolt, .brand-spark .twinkle, .brand-mark::after { animation: none !important; }
  .brand-mark::after { opacity: 0; }
}

/* filtering animation on gallery cards */
.game-card { transition: transform 0.45s var(--spring), box-shadow 0.4s var(--ease), opacity 0.35s var(--ease); }
.game-card.filtered-out {
  opacity: 0; transform: scale(0.92);
  pointer-events: none;
}

/* engine filter scroller */
.engine-filters {
  display: flex; gap: 8px; align-items: center;
  overflow-x: auto;
  padding: 4px 2px 10px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.engine-filters::-webkit-scrollbar { display: none; }
.engine-filters .chip { flex-shrink: 0; }
.engine-filters .chip .cnt {
  font-size: 11px; opacity: 0.6; font-weight: 600;
  margin-left: 2px;
}
.engine-filters .chip .swatch-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ============================================================
   MODAL — glass dialog + backdrop
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(6, 4, 12, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
:root[data-theme="light"] .modal-backdrop { background: rgba(40, 38, 70, 0.32); }
.modal-backdrop.in { opacity: 1; }
.modal {
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex; flex-direction: column;
  border-radius: var(--r-2xl);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(42px) saturate(190%);
  -webkit-backdrop-filter: blur(42px) saturate(190%);
  border: 1px solid var(--glass-stroke-2);
  box-shadow:
    inset 0 1px 0 var(--glass-top-hi),
    inset 0 -1px 0 var(--glass-bot-lo),
    0 40px 100px -20px rgba(0,0,0,0.7);
  transform: scale(0.92) translateY(10px);
  opacity: 0;
  transition: transform 0.5s var(--spring), opacity 0.35s var(--ease);
}
.modal.lg { max-width: 600px; }
.modal-backdrop.in .modal { transform: scale(1) translateY(0); opacity: 1; }
.modal-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 24px 24px 16px;
}
.modal-head .m-icon {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; flex-shrink: 0;
  color: white;
  background: linear-gradient(135deg, #8a5cff, #ff5b8a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 8px 20px -4px rgba(124,92,255,0.5);
}
.modal-head .m-icon.green { background: linear-gradient(135deg, #4be0a8, #34c2e0); box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 8px 20px -4px rgba(75,224,168,0.5); }
.modal-head .m-icon.warn { background: linear-gradient(135deg, #ffb454, #ff7a59); box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 8px 20px -4px rgba(255,138,80,0.5); }
.modal-head .m-icon.danger { background: linear-gradient(135deg, #ff6b6b, #ff5c8d); box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 8px 20px -4px rgba(255,92,141,0.5); }
.modal-head h3 { font-size: 19px; font-weight: 640; }
.modal-head .m-sub { color: var(--text-2); font-size: 13.5px; margin-top: 4px; line-height: 1.5; }
.modal-head .m-x {
  margin-left: auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-3);
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-stroke);
  flex-shrink: 0; transition: background 0.2s, color 0.2s;
}
.modal-head .m-x:hover { background: rgba(255,255,255,0.12); color: var(--text-1); }
:root[data-theme="light"] .modal-head .m-x { background: rgba(20,18,40,0.05); }
.modal-body { padding: 0 24px; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 18px 24px 22px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.modal-foot .foot-note { margin-right: auto; font-size: 12.5px; color: var(--text-3); }

/* processing / detection visuals inside modal */
.proc-progress {
  height: 8px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.08); overflow: hidden; margin: 4px 0 18px;
}
:root[data-theme="light"] .proc-progress { background: rgba(20,18,40,0.08); }
.proc-progress .bar {
  height: 100%; width: 0%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, #ff8a6b, #ff5b8a 50%, #8a5cff);
  box-shadow: 0 0 14px rgba(255,90,130,0.5);
  transition: width 0.5s var(--ease);
}
.proc-steps { display: flex; flex-direction: column; gap: 2px; }
.proc-step {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 4px;
  font-size: 14px; color: var(--text-3);
  transition: color 0.3s var(--ease);
}
.proc-step .dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  border: 1.5px solid var(--glass-stroke-2);
  color: transparent;
  transition: all 0.3s var(--ease);
}
.proc-step .lbl { flex: 1; }
.proc-step .tail { font-size: 12px; color: var(--text-3); font-family: "SF Mono", ui-monospace, monospace; opacity: 0; transition: opacity 0.3s; }
.proc-step.active { color: var(--text-1); }
.proc-step.active .dot {
  border-color: transparent;
  background: linear-gradient(135deg, #8a5cff, #ff5b8a);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.18);
}
.proc-step.active .dot::after {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.proc-step.done { color: var(--text-2); }
.proc-step.done .dot { border-color: transparent; background: linear-gradient(135deg, #4be0a8, #34c2e0); color: #fff; }
.proc-step.done .tail { opacity: 1; }
.proc-step.done .dot svg { width: 12px; height: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* separated modules list */
.sep-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 4px; }
.sep-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: rgba(0,0,0,0.24);
  border: 1px solid var(--glass-stroke);
  opacity: 0; transform: translateX(-8px);
  animation: sep-in 0.45s var(--spring) forwards;
}
:root[data-theme="light"] .sep-item { background: rgba(255,255,255,0.5); }
@keyframes sep-in { to { opacity: 1; transform: none; } }
.sep-item .ic {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-size: 9px; font-weight: 700;
}
.sep-item .nm { flex: 1; min-width: 0; }
.sep-item .nm strong { font-weight: 580; font-size: 13.5px; color: var(--text-1); display: block; }
.sep-item .nm span { font-size: 12px; color: var(--text-3); }
.sep-item .sz { font-size: 12px; font-family: "SF Mono", ui-monospace, monospace; color: var(--text-2); }

/* detection result chip + signals */
.detect-result {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(124,92,255,0.12), rgba(255,90,130,0.1));
  border: 1px solid var(--glass-stroke-2);
  margin-bottom: 16px;
}
.detect-result .big-engine {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px;
  background: linear-gradient(135deg, #8a5cff, #ff5b8a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.detect-result .meta { flex: 1; }
.detect-result .meta .name { font-size: 16px; font-weight: 640; color: var(--text-1); }
.detect-result .meta .ver { font-size: 12.5px; color: var(--text-2); }
.detect-result .conf { text-align: right; }
.detect-result .conf .pct { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.detect-result .conf .pct.high { color: var(--aurora-green); }
.detect-result .conf .pct.mid { color: #ffb454; }
.detect-result .conf .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.signal-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; }
.signal-list .sig { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.signal-list .sig code { font-family: "SF Mono", ui-monospace, monospace; font-size: 12px; color: var(--text-1); background: rgba(255,255,255,0.07); padding: 1px 6px; border-radius: 5px; }
:root[data-theme="light"] .signal-list .sig code { background: rgba(20,18,40,0.06); }
.signal-list .sig .ok { color: var(--aurora-green); flex-shrink: 0; }

.code-paste {
  width: 100%; min-height: 150px; resize: vertical;
  padding: 14px 16px; border-radius: var(--r-md);
  background: rgba(0,0,0,0.3); border: 1px solid var(--glass-stroke);
  color: var(--text-1); font-family: "SF Mono", ui-monospace, monospace; font-size: 12.5px;
  line-height: 1.5; outline: none;
}
:root[data-theme="light"] .code-paste { background: rgba(255,255,255,0.6); }
.code-paste:focus { border-color: rgba(124,92,255,0.5); box-shadow: 0 0 0 4px rgba(124,92,255,0.16); }

/* exception callout */
.callout {
  display: flex; gap: 12px; padding: 14px 16px;
  border-radius: var(--r-md); margin-bottom: 8px;
  font-size: 13.5px; line-height: 1.5; color: var(--text-2);
}
.callout.warn { background: rgba(255,138,80,0.1); border: 1px solid rgba(255,138,80,0.26); }
.callout.danger { background: rgba(255,92,141,0.1); border: 1px solid rgba(255,92,141,0.28); }
.callout .ci { flex-shrink: 0; margin-top: 1px; }
.callout.warn .ci { color: #ffb454; }
.callout.danger .ci { color: #ff7a99; }
.callout strong { color: var(--text-1); font-weight: 580; }

/* engine pick grid */
.engine-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0; }
.engine-pick .ep {
  padding: 14px 10px; border-radius: var(--r-md); text-align: center; cursor: pointer;
  background: rgba(255,255,255,0.04); border: 1px solid var(--glass-stroke);
  transition: background 0.2s, border-color 0.2s, transform 0.25s var(--spring);
}
:root[data-theme="light"] .engine-pick .ep { background: rgba(20,18,40,0.04); }
.engine-pick .ep:hover { transform: translateY(-2px); background: rgba(255,255,255,0.09); }
.engine-pick .ep.sel { border-color: rgba(124,92,255,0.6); background: rgba(124,92,255,0.14); }
.engine-pick .ep .dotc { width: 12px; height: 12px; border-radius: 50%; margin: 0 auto 8px; }
.engine-pick .ep .en { font-size: 12.5px; font-weight: 560; color: var(--text-1); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-stack {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 150; display: flex; flex-direction: column-reverse; gap: 10px;
  align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px 12px 14px; border-radius: var(--r-pill);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid var(--glass-stroke-2);
  box-shadow: inset 0 1px 0 var(--glass-top-hi), 0 18px 44px -10px rgba(0,0,0,0.5);
  font-size: 14px; color: var(--text-1); font-weight: 500;
  pointer-events: auto;
  transform: translateY(20px) scale(0.95); opacity: 0;
  transition: transform 0.5s var(--spring), opacity 0.3s var(--ease);
  max-width: 92vw;
}
.toast.in { transform: none; opacity: 1; }
.toast .ti {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
}
.toast .ti.ok { background: linear-gradient(135deg, #4be0a8, #34c2e0); }
.toast .ti.info { background: linear-gradient(135deg, #8a5cff, #ff5b8a); }
.toast .ti.warn { background: linear-gradient(135deg, #ffb454, #ff7a59); }

/* ============================================================
   SCENARIO SWITCHER (prototype QA affordance, upload page)
   ============================================================ */
.scenario-bar {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: rgba(124,92,255,0.07);
  border: 1px dashed rgba(124,92,255,0.32);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
:root[data-theme="light"] .scenario-bar { background: rgba(124,92,255,0.08); }
.scenario-bar .sb-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 640; letter-spacing: 0.06em; text-transform: uppercase;
  color: #b9a6ff;
}
.scenario-bar .sb-label svg { width: 13px; height: 13px; }
:root[data-theme="light"] .scenario-bar .sb-label { color: #6b48d6; }
.scenario-bar .sb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.scenario-bar .sc {
  height: 28px; padding: 0 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 540; color: var(--text-2);
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-stroke);
  cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.2s var(--spring);
}
:root[data-theme="light"] .scenario-bar .sc { background: rgba(255,255,255,0.5); }
.scenario-bar .sc:hover { color: var(--text-1); transform: translateY(-1px); }
.scenario-bar .sc:active { transform: translateY(0); }

/* ============================================================
   Disabled / not-yet-built controls (demo cleanliness)
   ============================================================ */
.nav a.nav-off {
  opacity: 0.32;
  pointer-events: none;
  cursor: default;
}
.is-disabled {
  opacity: 0.4 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  filter: saturate(0.4);
}

/* ============================================================
   AI Description (gallery card + game page)
   ============================================================ */
.ai-chip {
  display: inline-block;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px; border-radius: var(--r-pill);
  color: #fff; vertical-align: middle;
  background: linear-gradient(135deg, #8a5cff, #34e0ff);
  box-shadow: 0 2px 8px -2px rgba(124,92,255,0.6);
}
.game-card .ai-desc {
  font-size: 12px; line-height: 1.45; color: var(--text-2);
  margin: 6px 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.game-card .ai-desc .ai-chip { font-size: 8.5px; padding: 1px 6px; margin-right: 4px; }
.ai-desc-line {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; max-width: 60ch;
  font-size: 14.5px; line-height: 1.5; color: var(--text-2);
}
.ai-desc-line .ai-chip { flex-shrink: 0; align-self: center; }

/* ============================================================
   Game play-frame is always dark → keep its inner text light in
   light mode too (otherwise theme tokens make it invisible).
   ============================================================ */
:root[data-theme="light"] .hero-frame .hint,
:root[data-theme="light"] .hero-frame .hint kbd,
:root[data-theme="light"] .hero-frame .frame-corner { color: rgba(255,255,255,0.92); }
:root[data-theme="light"] .hero-frame .hint { background: rgba(15,15,25,0.55); border-color: rgba(255,255,255,0.12); }
:root[data-theme="light"] .hero-frame .frame-corner { background: rgba(15,15,25,0.55); border-color: rgba(255,255,255,0.14); }
