/* ==========================================================================
   Antigravity 30-Minute Interactive Lab — Cosmic Motion Design System
   ========================================================================== */

:root {
  --bg-0: #050711;
  --bg-1: #0b1024;
  --bg-2: #111834;
  --surface: rgba(15, 22, 46, 0.72);
  --surface-strong: rgba(17, 25, 52, 0.92);
  --border: rgba(148, 163, 184, 0.16);
  --border-bright: rgba(56, 189, 248, 0.45);

  --text-0: #f8fafc;
  --text-1: #cbd5e1;
  --text-2: #94a3b8;

  --cyan: #38bdf8;
  --violet: #a78bfa;
  --emerald: #34d399;
  --amber: #fbbf24;
  --rose: #fb7185;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-glow: 0 18px 48px rgba(2, 6, 23, 0.65), 0 0 0 1px rgba(148, 163, 184, 0.12);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-0);
  background:
    radial-gradient(900px 520px at 14% -5%, rgba(56, 189, 248, 0.14), transparent 60%),
    radial-gradient(800px 500px at 88% 8%, rgba(167, 139, 250, 0.14), transparent 60%),
    radial-gradient(900px 600px at 50% 100%, rgba(52, 211, 153, 0.08), transparent 60%),
    var(--bg-0);
  line-height: 1.55;
  overflow-x: hidden;
}

#gravity-canvas,
#celebration-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#gravity-canvas {
  z-index: 0;
}

#celebration-canvas {
  z-index: 60;
}

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

code {
  font-size: 0.88em;
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
  padding: 0.15em 0.42em;
  border-radius: 6px;
}

kbd {
  display: inline-block;
  padding: 0.15em 0.5em;
  font-size: 0.78rem;
  color: var(--text-0);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-bottom-width: 2px;
  border-radius: 6px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Sticky Mission Control HUD ---------- */
.hud {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(5, 7, 17, 0.78);
  border-bottom: 1px solid var(--border);
}

.hud-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  text-align: left;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 0.95rem;
  letter-spacing: 0.12em;
}

.brand-text small {
  font-size: 0.74rem;
  color: var(--text-2);
}

.spin-slow {
  transform-origin: center;
  animation: spin 18s linear infinite;
}

.timer-widget {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
}

.timer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-2);
  transition: background 0.3s, box-shadow 0.3s;
}

.timer-dot.running {
  background: var(--emerald);
  box-shadow: 0 0 12px var(--emerald);
  animation: pulse 1.6s ease-in-out infinite;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 3.4rem;
}

.timer-actions {
  display: flex;
  gap: 0.35rem;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.7rem 0.2rem 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}

.progress-ring {
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 3.2;
}

.ring-fill {
  fill: none;
  stroke: var(--emerald);
  stroke-width: 3.2;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.55s var(--ease-spring);
}

/* ---------- Buttons ---------- */
.icon-btn,
.chip-btn,
.btn-primary,
.btn-ghost,
.btn-complete {
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s var(--ease-spring), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.icon-btn {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.14);
  color: var(--text-0);
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
}

.icon-btn.subtle {
  border-color: var(--border);
  background: transparent;
  color: var(--text-2);
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
  color: var(--text-0);
}

.chip-btn {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-1);
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
}

.chip-btn.accent {
  border-color: rgba(167, 139, 250, 0.5);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(167, 139, 250, 0.24));
  color: var(--text-0);
}

.chip-btn:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: linear-gradient(135deg, #0284c7, #7c3aed);
  color: #fff;
  font-size: 0.94rem;
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.24);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(124, 58, 237, 0.38);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 1.2rem;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-1);
  font-size: 0.92rem;
}

.btn-ghost:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--cyan);
  color: var(--text-0);
}

.btn-complete {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 1.3rem;
  border: 1px solid rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
  color: #a7f3d0;
  font-size: 0.92rem;
}

.btn-complete.done {
  background: rgba(52, 211, 153, 0.24);
  border-color: var(--emerald);
  color: #fff;
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.25);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------- Main Shell & Hero ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3.5rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 2rem;
  align-items: center;
  padding: 1.5rem 0 2.2rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #bae6fd;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}

.hero h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.text-gradient {
  background: linear-gradient(110deg, #38bdf8 0%, #c084fc 52%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 0 0 1.45rem;
  font-size: 1.04rem;
  color: var(--text-1);
  max-width: 58ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Orbital Hero Visual */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.orbital-scene {
  position: relative;
  width: 310px;
  height: 310px;
  display: grid;
  place-items: center;
}

.core-planet {
  position: relative;
  z-index: 3;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%, #38bdf8, #4f46e5 65%, #1e1b4b);
  box-shadow: 0 0 42px rgba(56, 189, 248, 0.45), inset 0 0 20px rgba(255, 255, 255, 0.22);
  animation: floatY 4.5s ease-in-out infinite;
}

.core-planet span {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 1rem;
}

.core-planet small {
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.85);
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(148, 163, 184, 0.25);
}

.orbit-1 {
  width: 170px;
  height: 170px;
  animation: spin 16s linear infinite;
}

.orbit-2 {
  width: 235px;
  height: 235px;
  animation: spinReverse 24s linear infinite;
}

.orbit-3 {
  width: 298px;
  height: 298px;
  animation: spin 34s linear infinite;
}

.sat {
  position: absolute;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  background: rgba(11, 16, 36, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: var(--text-0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.sat-cli {
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  animation: counterSpinCentered 16s linear infinite;
}

.sat-ide {
  top: 20%;
  right: -18px;
  border-color: rgba(167, 139, 250, 0.55);
  animation: counterSpinReverse 24s linear infinite;
}

.sat-app {
  bottom: 14%;
  left: -22px;
  border-color: rgba(52, 211, 153, 0.55);
  animation: counterSpinReverse 24s linear infinite;
}

.sat-sdk {
  top: 12%;
  left: -14px;
  border-color: rgba(251, 191, 36, 0.55);
  animation: counterSpin 34s linear infinite;
}

.sat-mcp {
  bottom: 6%;
  right: -12px;
  border-color: rgba(251, 113, 133, 0.55);
  animation: counterSpin 34s linear infinite;
}

/* ---------- 5-Block Timeline Stepper ---------- */
.timeline-nav {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-track {
  position: absolute;
  top: 23px;
  left: 5%;
  right: 5%;
  height: 3px;
  background: rgba(148, 163, 184, 0.16);
  border-radius: 99px;
  overflow: hidden;
  z-index: 0;
}

.timeline-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--emerald));
  transition: width 0.5s var(--ease-spring);
}

.timeline-steps {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.65rem;
}

.step-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  color: var(--text-1);
  text-align: left;
  transition: transform 0.25s var(--ease-spring), border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.step-btn:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.45);
}

.step-btn.active {
  border-color: var(--cyan);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.18), rgba(15, 22, 46, 0.92));
  color: var(--text-0);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.16);
}

.step-btn.completed {
  border-color: rgba(52, 211, 153, 0.45);
}

.step-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--cyan);
}

.step-btn.completed .step-top {
  color: var(--emerald);
}

.step-title {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}

/* ---------- Module Stage & Cards ---------- */
.module-stage {
  outline: none;
  animation: stageEnter 0.42s var(--ease-spring);
}

.module-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.65rem;
  box-shadow: var(--shadow-glow);
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.module-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.badge-mini {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-mini.emerald {
  background: rgba(52, 211, 153, 0.15);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.35);
}

.badge-mini.violet {
  background: rgba(167, 139, 250, 0.16);
  color: #ddd6fe;
  border-color: rgba(167, 139, 250, 0.35);
}

.badge-mini.amber {
  background: rgba(251, 191, 36, 0.15);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.35);
}

.badge-mini.rose {
  background: rgba(251, 113, 133, 0.15);
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.35);
}

.module-header h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  letter-spacing: -0.02em;
}

.module-header p {
  margin: 0;
  color: var(--text-1);
  max-width: 72ch;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.grid-asymmetric {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr;
  gap: 1.25rem;
}

.panel {
  background: rgba(9, 13, 29, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.panel-sub {
  margin: -0.35rem 0 0.9rem;
  font-size: 0.86rem;
  color: var(--text-2);
}

/* ---------- Block 1: Surfaces & Safety Simulator ---------- */
.surface-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-pill {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-1);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.2s var(--ease-spring);
}

.tab-pill:hover {
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--text-0);
}

.tab-pill.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(167, 139, 250, 0.2));
  border-color: var(--cyan);
  color: var(--text-0);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.14);
}

.surface-detail {
  animation: fadeSlide 0.32s var(--ease-spring);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0;
  display: grid;
  gap: 0.55rem;
}

.feature-list li {
  display: flex;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--text-1);
}

.feature-list li::before {
  content: "✦";
  color: var(--cyan);
  flex-shrink: 0;
}

.ide-gear-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.mini-demo-box {
  margin-top: 0.85rem;
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  background: #060916;
  border: 1px solid rgba(56, 189, 248, 0.24);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #e2e8f0;
  overflow-x: auto;
}

.ghost-code {
  color: rgba(148, 163, 184, 0.65);
  font-style: italic;
}

.policy-controls {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.policy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.86rem;
}

.select-dark {
  background: #0b1126;
  color: var(--text-0);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  padding: 0.38rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.action-matrix {
  display: grid;
  gap: 0.5rem;
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  transition: transform 0.2s, border-color 0.25s;
}

.action-row:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.verdict {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.verdict.allow {
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.verdict.sandbox {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.verdict.ask {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.verdict.deny {
  background: rgba(251, 113, 133, 0.16);
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.4);
}

/* ---------- Block 2: Slash Command & @ Mention Console ---------- */
.cmd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.cmd-chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
  transition: all 0.2s;
}

.cmd-chip:hover {
  border-color: var(--cyan);
  color: #fff;
}

.cmd-chip.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--cyan);
  color: #fff;
}

.cmd-chip.mention.active {
  background: rgba(167, 139, 250, 0.24);
  border-color: var(--violet);
}

.terminal-sim {
  border-radius: var(--radius-md);
  background: #060915;
  border: 1px solid rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-2);
}

.term-dots {
  display: flex;
  gap: 0.38rem;
}

.term-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.term-dots span:nth-child(1) { background: #fb7185; }
.term-dots span:nth-child(2) { background: #fbbf24; }
.term-dots span:nth-child(3) { background: #34d399; }

.terminal-body {
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  min-height: 255px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.prompt-line {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.prompt-caret {
  color: var(--emerald);
  font-weight: 700;
}

.trace-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.trace-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.75);
  border-left: 3px solid var(--cyan);
  opacity: 0;
  transform: translateY(8px);
  animation: fadeSlide 0.38s var(--ease-spring) forwards;
}

.trace-item.artifact {
  border-left-color: var(--violet);
}

.trace-item.gate {
  border-left-color: var(--amber);
  background: rgba(251, 191, 36, 0.08);
}

.trace-item.done {
  border-left-color: var(--emerald);
}

/* ---------- Block 3: Rules vs Skills Lab ---------- */
.precedence-ladder {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ladder-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  font-size: 0.84rem;
}

.ladder-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.18);
  color: var(--cyan);
  flex-shrink: 0;
}

.context-meter {
  height: 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  margin: 0.65rem 0;
}

.meter-seg {
  height: 100%;
  transition: width 0.6s var(--ease-spring);
}

.seg-rules { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.seg-meta { background: linear-gradient(90deg, #a78bfa, #8b5cf6); }
.seg-skill { background: linear-gradient(90deg, #34d399, #10b981); }

.meter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-2);
}

.dot-legend {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.3rem;
}

.code-editor {
  width: 100%;
  min-height: 190px;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #060916;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  resize: vertical;
}

.code-editor:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.validation-box {
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  border: 1px solid var(--border);
}

.validation-box.valid {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.validation-box.warn {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

/* ---------- Block 4: Subagent Flow & SDK Stepper ---------- */
.flow-stage {
  position: relative;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: #060916;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.agent-nodes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.agent-node {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.agent-node.parent {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-color: rgba(56, 189, 248, 0.4);
}

.agent-node.working {
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.22);
  transform: translateY(-2px);
}

.agent-node.done {
  border-color: var(--emerald);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.18);
}

.node-bar {
  margin-top: 0.5rem;
  height: 6px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.node-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width 0.2s linear;
}

.agent-node.done .node-bar-fill {
  background: var(--emerald);
}

.sdk-code-box {
  background: #060916;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.65rem 0;
  overflow-x: auto;
}

.sdk-line {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  padding: 0.3rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #cbd5e1;
  white-space: pre;
  transition: background 0.2s, border-color 0.2s;
}

.sdk-line:hover {
  background: rgba(56, 189, 248, 0.08);
}

.sdk-line.active {
  background: rgba(167, 139, 250, 0.16);
  border-left-color: var(--violet);
  color: #fff;
}

.sdk-callout {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.35);
  font-size: 0.86rem;
}

/* ---------- Block 5: Scenario Matcher & Quiz ---------- */
.scenario-grid {
  display: grid;
  gap: 0.55rem;
}

.scenario-btn {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-1);
  font-size: 0.86rem;
  transition: all 0.2s;
}

.scenario-btn:hover,
.scenario-btn.active {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.14);
  color: #fff;
}

.scenario-answer {
  margin-top: 0.9rem;
  padding: 0.95rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(52, 211, 153, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.35);
  animation: fadeSlide 0.3s var(--ease-spring);
}

.quiz-card {
  display: grid;
  gap: 0.75rem;
}

.quiz-q {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid var(--border);
}

.quiz-q p {
  margin: 0 0 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.quiz-options {
  display: grid;
  gap: 0.4rem;
}

.quiz-opt {
  text-align: left;
  padding: 0.52rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 24, 0.8);
  color: var(--text-1);
  font-size: 0.84rem;
  transition: all 0.2s;
}

.quiz-opt:hover {
  border-color: var(--cyan);
  color: #fff;
}

.quiz-opt.correct {
  background: rgba(52, 211, 153, 0.18);
  border-color: var(--emerald);
  color: #ecfdf5;
}

.quiz-opt.wrong {
  background: rgba(251, 113, 133, 0.16);
  border-color: var(--rose);
  color: #fff1f2;
}

.quiz-explain {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.quiz-score-banner {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.18), rgba(56, 189, 248, 0.16));
  border: 1px solid rgba(52, 211, 153, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ---------- Footer & KBD Bar ---------- */
.stage-footer {
  margin-top: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.kbd-bar {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.15rem;
  font-size: 0.8rem;
  color: var(--text-2);
}

/* ---------- Modal & Toast ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: min(920px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.75);
  animation: stageEnter 0.3s var(--ease-spring);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0.25rem 0 0;
  font-size: 1.25rem;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body {
  padding: 1.3rem 1.4rem;
  overflow-y: auto;
  display: grid;
  gap: 1rem;
}

.cs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.cs-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.cs-card h4 {
  margin: 0 0 0.55rem;
  color: var(--cyan);
}

.cs-card ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  color: var(--text-1);
}

.cs-card a {
  color: #7dd3fc;
}

.toast {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  z-index: 70;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--cyan);
  color: var(--text-0);
  font-size: 0.85rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease-spring);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Animations ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spinReverse {
  to { transform: rotate(-360deg); }
}

@keyframes counterSpinCentered {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(-360deg); }
}

@keyframes counterSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

@keyframes counterSpinReverse {
  to { transform: rotate(360deg); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.25); }
}

@keyframes stageEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Reduced Motion & Responsive ---------- */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

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

@media (max-width: 920px) {
  .hero,
  .grid-2,
  .grid-asymmetric,
  .cs-grid {
    grid-template-columns: 1fr;
  }

  .timeline-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .timeline-track {
    display: none;
  }

  .surface-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .agent-nodes {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
    color: #0f172a;
  }
  .hud, .app-shell, #gravity-canvas, #celebration-canvas, .modal-actions {
    display: none !important;
  }
  .modal-backdrop {
    position: static;
    background: none;
    padding: 0;
  }
  .modal-panel {
    box-shadow: none;
    border: none;
    max-height: none;
    background: #fff;
    color: #0f172a;
  }
  .cs-card {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
  }
  .cs-card ul, .cs-card a {
    color: #1e293b;
  }
}
