/* ==========================================================================
   Kumikae AS3 (組み替え) — Studio Daylight + Living Kumiko Mark + Live Hot Reload
   Crisp studio paper (#FAFAF8), Kumikae sumi indigo (#1D2938), and
   Kumikae kurenai crimson (#F0447B). Purposeful mechanical animations.
   ========================================================================== */

:root {
  --bg: #FAFAF8;
  --bg-tint: #F3F2EE;
  --stage-bg: #111822;
  --code-bg: #0D141D;

  --ink: #1D2938;
  --ink-soft: #526072;
  --ink-faint: #7E8A9A;

  --crimson: #F0447B;
  --crimson-deep: #D42C63;
  --teal: #36BAB4;
  --cyan: #5CE1E6;
  --emerald: #34D399;
  --gold: #FFC847;
  --coral: #FF8456;

  --rule: rgba(29, 41, 56, 0.12);
  --rule-strong: rgba(29, 41, 56, 0.24);
  --rule-dark: rgba(240, 245, 250, 0.12);

  --sumi-deep: #141D2A;
  --sumi: #1D2938;
  --paper-on-dark: #E9EEF5;
  --ink-on-dark-soft: #B9C4D2;
  --ink-on-dark-faint: #8796A9;
  --godot-blue: #478CBF;
  --godot-blue-light: #7DB6E3;

  --font-display: "Archivo", "Instrument Sans", sans-serif;
  --font-sans: "Instrument Sans", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1200px;
  --gutter: clamp(20px, 3.5vw, 44px);
  --ease-snap: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ol, pre, figure { margin: 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  color: var(--crimson-deep);
}

.studio-band .flash-workspace code,
.kumiko-caption code {
  color: var(--cyan);
}

kbd {
  font: 600 10.5px/1 var(--font-mono);
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(29, 41, 56, 0.08);
  border: 1px solid rgba(29, 41, 56, 0.16);
}

.flash-workspace kbd {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 13px;
}

.skip-link:focus { top: 12px; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

body.ws-fs-open {
  overflow: hidden;
}


/* ==========================================================================
   Buttons & Links
   ========================================================================== */

.btn-ink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 150ms ease, transform 140ms var(--ease-snap);
}

.btn-ink:hover {
  background: var(--crimson);
}

.btn-sm {
  padding: 9px 15px;
  font-size: 13.5px;
}

.btn-crimson {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 24px;
  border-radius: 5px;
  background: var(--crimson);
  color: #FFFFFF;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.btn-crimson:hover { background: var(--crimson-deep); }

.btn-crimson.btn-sm { padding: 10px 16px; font-size: 13.5px; }

.btn-line {
  display: inline-flex;
  align-items: center;
  padding: 13.5px 20px;
  border-radius: 5px;
  border: 1.5px solid rgba(233, 238, 245, 0.4);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.btn-line:hover {
  border-color: #FFFFFF;
  background: rgba(255, 255, 255, 0.06);
}

.link-light {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-on-dark-soft);
  border-bottom: 1.5px solid rgba(233, 238, 245, 0.3);
  padding-bottom: 2px;
  transition: color 120ms ease, border-color 120ms ease;
}

.link-light:hover { color: #FFFFFF; border-bottom-color: var(--crimson); }

.btn-crimson-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: 4px;
  border: 1.5px solid var(--crimson);
  color: var(--crimson-deep);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease, transform 140ms var(--ease-snap);
}

.btn-crimson-ghost:hover {
  background: var(--crimson);
  color: #FFFFFF;
}

.link-underline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1.5px solid var(--rule-strong);
  transition: color 120ms ease, border-color 120ms ease;
}

.link-underline:hover {
  color: var(--crimson-deep);
  border-bottom-color: var(--crimson);
}

.link-quiet {
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}

.link-quiet:hover {
  color: var(--crimson-deep);
}


/* ==========================================================================
   Header
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(20, 29, 42, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule-dark);
  color: var(--paper-on-dark);
}

.header .brand-logo path:first-child { fill: #E9EEF5; }
.header .link-quiet { color: var(--ink-on-dark-soft); }
.header .link-quiet:hover { color: #FFFFFF; }
.header .btn-ink { background: #FFFFFF; color: var(--sumi); }
.header .btn-ink:hover { background: var(--crimson); color: #FFFFFF; }

.header-row {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  overflow: visible;
  flex-shrink: 0;
  transition: transform 420ms var(--ease-snap);
}

.brand:hover .brand-logo {
  transform: rotate(-10deg) scale(1.06);
}

.brand-logo-piece {
  transition: transform 320ms var(--ease-snap);
}

.brand:hover .brand-logo-piece {
  transform: translate(66px, -31px) rotate(8deg);
}

.brand-name {
  font-family: var(--font-display);
  font-stretch: 118%;
  font-variation-settings: "wdth" 118;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-name span { color: var(--crimson); }

.brand-jp {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-on-dark-faint);
  padding-left: 10px;
  border-left: 1px solid var(--rule-dark);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-on-dark-soft);
  transition: color 120ms ease;
}

.nav a:hover { color: #FFFFFF; }

.header-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* ==========================================================================
   ACT 1: HERO — AS3 × 組み替え × GODOT JUNCTION (dark sumi, loud type)
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--sumi-deep);
  color: var(--paper-on-dark);
  padding: clamp(36px, 5vw, 64px) 0 clamp(40px, 5vw, 64px);
}

/* Asanoha kumiko lattice — the joinery pattern Kumikae is named after */
.hero-lattice {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='69.28' viewBox='0 0 120 69.28'%3E%3Cg fill='none' stroke='%23CED5DF' stroke-width='1'%3E%3Cpath d='M0 0L60 34.64L120 0M0 69.28L60 34.64L120 69.28M60 0V69.28M0 0V69.28M120 0V69.28M0 34.64H120M0 0L30 17.32L60 0L90 17.32L120 0M0 69.28L30 51.96L60 69.28L90 51.96L120 69.28M30 17.32V51.96M90 17.32V51.96'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px 69.28px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 62%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 62%, #000 20%, transparent 75%);
}

.hero-inner { position: relative; }

.hero-maker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-on-dark-soft);
  margin-bottom: clamp(18px, 2.4vw, 30px);
  transition: color 140ms ease;
}

.hero-maker img { height: 21px; width: auto; }
.hero-maker:hover { color: #FFFFFF; }

.hero h1 {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 900;
  font-size: clamp(38px, 8vw, 116px);
  line-height: 0.88;
  letter-spacing: -0.035em;
  color: #FFFFFF;
  text-wrap: balance;
}

.hero-title { position: relative; }

.hero-title .hero-cta {
  position: absolute;
  right: 0;
  bottom: 0.02em;
  font-size: clamp(46px, 8vw, 116px);
}

.hero-title .hero-cta > * { font-size: 15px; }
.hero-title .hero-cta .link-light { font-size: 14.5px; }

.hero-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 20px clamp(24px, 3.5vw, 48px);
  align-items: start;
  padding-top: clamp(18px, 2.4vw, 28px);
  border-top: 1px solid var(--rule-dark);
}



.hero-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.hero-timeline li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.4;
}

.hero-timeline b {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: 17px;
}

.tl-past { color: var(--ink-on-dark-faint); }
.tl-past b { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(206, 213, 223, 0.5); }
.tl-now { color: #FFFFFF; }
.tl-now b { color: var(--crimson); }

.hero-lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-on-dark-soft);
  max-width: 52ch;
}

.hero-lead strong { color: #FFFFFF; font-weight: 600; }
.hero-lead code { color: var(--cyan); }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

/* The junction stage */
.junction {
  max-width: 1000px;
  margin: clamp(4px, 1vw, 12px) auto clamp(18px, 2.4vw, 30px);
  perspective: 1400px;
}

.kumiko-btn {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transform-style: preserve-3d;
  will-change: transform;
  outline-offset: 6px;
}

.kumiko-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

#k-lattice-path { fill: #E9EEF5; }

.jx-mark,
.jx-chip {
  transform-box: fill-box;
  transform-origin: center;
}

.jx-rail line {
  stroke: #E9EEF5;
  stroke-width: 9;
  stroke-linecap: square;
  stroke-dasharray: 260;
}

.jx-rail .jx-tie {
  stroke: rgba(233, 238, 245, 0.45);
  stroke-width: 5;
}

.jx-chip rect { fill: var(--crimson); }

.jx-chip text {
  fill: #FFFFFF;
  font: 700 29px/1 var(--font-mono);
  text-anchor: middle;
}

.jx-rail-label {
  fill: var(--ink-on-dark-faint);
  font: 600 27px/1 var(--font-sans);
  text-anchor: middle;
  letter-spacing: 0.02em;
}

.kumiko-ring {
  fill: none;
  stroke: rgba(233, 238, 245, 0.2);
  stroke-width: 2;
  stroke-dasharray: 8 8;
  transition: stroke 240ms ease;
}

.kumiko-dot {
  fill: rgba(233, 238, 245, 0.4);
  transition: fill 240ms ease;
}

.kumiko-btn:hover .kumiko-ring { stroke: rgba(240, 68, 123, 0.7); }
.kumiko-btn:hover .kumiko-dot { fill: var(--crimson); }

.kumiko-wave { fill: none; }
.kumiko-wave-1 { stroke: var(--crimson); stroke-width: 5; }
.kumiko-wave-2 { stroke: #E9EEF5; stroke-width: 2.5; }

.kumiko-sparks line {
  stroke: var(--crimson);
  stroke-width: 5;
  stroke-linecap: round;
}

.kumiko-slot {
  fill: rgba(240, 68, 123, 0.16);
  stroke: var(--crimson);
  stroke-width: 3;
  stroke-dasharray: 11 7;
  stroke-linejoin: round;
}

.kumiko-trail {
  fill: none;
  stroke: var(--crimson);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 14 10;
}

.junction-flow {
  list-style: none;
  padding: 0;
  margin: -6px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  text-align: center;
}

.junction-flow li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.junction-flow strong {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-variation-settings: "wdth" 112;
  font-weight: 800;
  font-size: clamp(16px, 1.7vw, 22px);
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.junction-flow li:nth-child(2) strong { color: var(--crimson); }
.junction-flow li:nth-child(3) strong { color: var(--godot-blue-light); }

.junction-flow span {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-on-dark-faint);
  max-width: 30ch;
}

.junction-flow code { color: var(--cyan); }

/* Code peek (moved from hero into the editors section) */
.ide-lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.kumiko-caption { min-width: 0; }

.kc-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 12px;
}

.kc-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 6px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 140ms ease, border-color 180ms ease;
}

.kc-tab:hover { color: var(--ink); }

.kc-tab.active {
  color: var(--ink);
  border-bottom-color: var(--crimson);
}

.kc-code {
  background: var(--sumi-deep);
  color: #E7EEF8;
  padding: 16px 18px;
  border-radius: 6px;
  font: 400 12.5px/1.65 var(--font-mono);
  overflow-x: auto;
  margin-bottom: 12px;
  min-height: 196px;
  transition: opacity 160ms ease;
}

.kc-code.fading { opacity: 0.4; }
.kc-code code { color: inherit; font-size: inherit; }

.kc-note {
  font-size: 15px;
  color: var(--ink-soft);
}

/* ==========================================================================
   ACT 2: THE STAGE & LIVE HOT-RELOADING F9 ACTIONS PANEL
   ========================================================================== */

.studio-band {
  padding: clamp(56px, 7vw, 96px) 0 clamp(64px, 8vw, 110px);
  background: var(--sumi);
  color: var(--paper-on-dark);
  border-top: 1px solid var(--rule-dark);
}

.studio-band h2 { color: #FFFFFF; }
.studio-band .band-note { color: var(--ink-on-dark-soft); }
.studio-band .band-note strong { color: #FFFFFF; }
.studio-band .band-note code { color: var(--cyan); }
.studio-band .band-note kbd { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); }

.band-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 16px 48px;
  align-items: end;
  margin-bottom: 28px;
}

.band-head h2,
.proof-left h2,
.ide-top h2,
.start-band h2 {
  font-family: var(--font-display);
  font-stretch: 118%;
  font-variation-settings: "wdth" 118;
  font-size: clamp(32px, 4.2vw, 58px);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.band-note {
  font-size: 17px;
  color: var(--ink-soft);
}

.flash-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  background: var(--stage-bg);
  color: #ECF2F9;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(29, 41, 56, 0.22);
}

.flash-workspace.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 300;
  width: 100vw;
  height: 100dvh;
  border-radius: 0;
  border: 0;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
}

.flash-workspace.is-fullscreen .stage-side,
.flash-workspace.is-fullscreen .actions-side {
  height: 100%;
  min-height: 0;
}

.flash-workspace.is-fullscreen .stage-frame {
  aspect-ratio: auto;
  height: 100%;
}

.flash-workspace.is-fullscreen .as-editor-scroll {
  max-height: none;
  flex: 1;
  min-height: 0;
}

.flash-workspace.is-fullscreen .as-pre,
.flash-workspace.is-fullscreen .as-input,
.flash-workspace.is-fullscreen .as-gutter {
  font-size: 13px;
  line-height: 1.62;
}

.ws-btn.is-active {
  border-color: var(--crimson);
  background: rgba(240, 68, 123, 0.16);
  color: #FFFFFF;
}

.stage-side {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rule-dark);
  min-width: 0;
}

.actions-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--code-bg);
}

.ws-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 0 14px;
  min-height: 44px;
  background: #161F2C;
  border-bottom: 1px solid var(--rule-dark);
  font: 500 12px/1 var(--font-mono);
}

.ws-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #B4C3D6;
}

.ws-title strong { color: #FFFFFF; }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-block;
  transition: transform 200ms var(--ease-snap), background-color 200ms ease;
}

.live-dot.pulse {
  transform: scale(1.7);
  background: #7DFFC7;
}

.ws-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-hint {
  font-size: 11px;
  color: #7D90A8;
}

.dirty-dot {
  font-size: 11px;
  color: var(--gold);
}

.ws-btn {
  border: 1px solid rgba(240, 245, 250, 0.18);
  background: transparent;
  color: #D2DFEE;
  font: 500 11.5px/1 var(--font-mono);
  padding: 5px 9px;
  border-radius: 3px;
  cursor: pointer;
}

.ws-btn:hover {
  border-color: var(--crimson);
  color: #FFFFFF;
}

.stage-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #080D15;
  overflow: hidden;
  flex: 1;
  transition: box-shadow 220ms ease;
}

.stage-frame.reloaded {
  box-shadow: inset 0 0 0 3px var(--emerald);
}

.stage-frame.errored {
  box-shadow: inset 0 0 0 3px var(--crimson);
}

.stage-poster {
  position: absolute;
  inset: 0;
}

.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.poster-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.poster-scrim {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: clamp(16px, 2.5vw, 28px);
  background: linear-gradient(to top, rgba(8, 13, 21, 0.9) 0%, rgba(8, 13, 21, 0.25) 48%, rgba(8, 13, 21, 0.04) 100%);
}

.poster-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.poster-sub {
  font-size: 15px;
  font-weight: 600;
  color: #FFFFFF;
}

.btn-play-wasm {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border: 0;
  border-radius: 4px;
  background: #8AF6D4;
  color: #091F29;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms var(--ease-snap), background-color 140ms ease;
}

.btn-play-wasm span {
  font: 500 11.5px/1 var(--font-mono);
  padding-left: 10px;
  border-left: 1px solid rgba(9, 31, 41, 0.25);
  opacity: 0.78;
}

.btn-play-wasm:hover {
  background: #B8FFE8;
}

.poster-keys {
  font-size: 13px;
  color: #A7BCCB;
}

.wasm-host {
  position: absolute;
  inset: 0;
}

.wasm-host iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.stage-toast {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 12;
  padding: 7px 12px;
  border-radius: 4px;
  background: rgba(13, 41, 30, 0.95);
  border: 1px solid var(--emerald);
  color: #7DFFC7;
  font: 600 11.5px/1 var(--font-mono);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 240ms var(--ease-snap);
}

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

.stage-toast.is-err {
  background: rgba(51, 16, 29, 0.95);
  border-color: var(--crimson);
  color: #FF8BB0;
}

/* F9 Actions Panel — Live Editable Syntax-Highlighted Editor */
.as-tabs {
  display: flex;
  gap: 2px;
}

.as-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #889BB2;
  font: 500 12px/1 var(--font-mono);
  padding: 13px 8px;
  cursor: pointer;
}

.as-tab:hover { color: #FFFFFF; }

.as-tab.active {
  color: #FFFFFF;
  border-bottom-color: var(--crimson);
}

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: #111925;
  border-bottom: 1px solid var(--rule-dark);
}

.preset-label {
  font: 500 11px/1 var(--font-mono);
  color: #7D90A8;
  margin-right: 2px;
}

.p-btn {
  border: 1px solid rgba(240, 245, 250, 0.16);
  background: rgba(255, 255, 255, 0.03);
  color: #D2DFEE;
  font: 500 11px/1 var(--font-sans);
  padding: 4px 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.p-btn:hover {
  border-color: var(--cyan);
  color: #FFFFFF;
}

.p-btn.p-btn-err:hover {
  border-color: var(--crimson);
  color: #FF8BB0;
}

.as-editor-scroll {
  flex: 1;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  overflow: auto;
  max-height: 308px;
}

.as-gutter {
  padding: 14px 8px 14px 0;
  text-align: right;
  font: 400 12px/1.6 var(--font-mono);
  color: #46576E;
  border-right: 1px solid rgba(240, 245, 250, 0.07);
  user-select: none;
  white-space: pre;
}

.as-editor-stack {
  position: relative;
  min-width: max-content;
}

.as-pre,
.as-input {
  margin: 0;
  padding: 14px 16px;
  font: 400 12px/1.6 var(--font-mono);
  tab-size: 4;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  letter-spacing: 0;
}

.as-pre {
  min-height: 100%;
  pointer-events: none;
  color: #E7EEF8;
}

.as-pre code { color: inherit; font-size: inherit; }

.as-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--cyan);
  overflow: hidden;
}

.as-input::selection {
  background: rgba(92, 225, 230, 0.24);
}

/* ActionScript 3 Syntax Tokens */
.tok-kw { color: #FF6295; font-weight: 500; }
.tok-type { color: #5CE1E6; }
.tok-fn { color: #4AE2A8; }
.tok-meta { color: #C695FF; }
.tok-str { color: #FFC847; }
.tok-num { color: #FF9D6E; }
.tok-cm { color: #647892; font-style: italic; }

.err-line {
  display: inline-block;
  width: 100%;
  background: rgba(240, 68, 123, 0.22);
  border-left: 2px solid var(--crimson);
  margin-left: -16px;
  padding-left: 14px;
}

.color-pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  margin-right: 4px;
  vertical-align: -0.5px;
}

.as-diag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  background: #131B26;
  border-top: 1px solid var(--rule-dark);
  font: 500 11.5px/1.35 var(--font-mono);
}

.d-ok { color: var(--emerald); }
.d-err { color: #FF88AE; }

.btn-reload-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 0;
  border-radius: 3px;
  background: var(--crimson);
  color: #FFFFFF;
  font: 600 12px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, transform 120ms ease;
}

.btn-reload-live:hover {
  background: #FF5D92;
}

/* ==========================================================================
   ACT 3: COMPILER & SPEED PROOF (ANIMATED BARS)
   ========================================================================== */

.proof-band {
  padding: clamp(60px, 7.5vw, 96px) 0;
  border-bottom: 1px solid var(--rule);
}

.proof-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.proof-left h2 { margin-bottom: 18px; font-size: clamp(30px, 3.3vw, 44px); }

.proof-copy {
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink-soft);
  margin-bottom: 22px;
}

.proof-copy strong { color: var(--ink); }

.target-list {
  border-top: 2px solid var(--ink);
  margin-bottom: 22px;
}

.target-list > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}

.target-list dt {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-variation-settings: "wdth" 112;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
}

.target-list dd {
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.bench-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  font-size: 14px;
  color: var(--ink-soft);
}

.bench-key {
  display: flex;
  gap: 16px;
  color: var(--ink);
}

.bench-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot-as3,
.dot-cs {
  width: 10px;
  height: 6px;
  display: inline-block;
  border-radius: 1px;
}

.dot-as3 { background: var(--crimson); }
.dot-cs { background: #7D90A6; }

.b-item {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 104px;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.b-item-p99 { border-bottom: 1.5px solid var(--ink); }

.b-meta strong {
  display: block;
  font: 600 13px/1.2 var(--font-mono);
}

.b-meta span {
  display: block;
  font-size: 12px;
  color: var(--ink-faint);
}

.b-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.b-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 8px;
  align-items: center;
}

.b-bar span {
  height: 7px;
  border-radius: 1px;
  display: block;
  width: 0;
  transition: width 760ms var(--ease-snap);
}

.fill-as3 { background: var(--crimson); }
.fill-cs { background: #8A9BB0; }

.b-bar em {
  font-style: normal;
  text-align: right;
  font: 500 11.5px/1 var(--font-mono);
  color: var(--ink-soft);
}

.b-ratio {
  text-align: right;
  font-family: var(--font-display);
  font-stretch: 112%;
  font-variation-settings: "wdth" 112;
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.02em;
}


.b-ratio.win { color: var(--crimson); }

.bench-note {
  padding-top: 16px;
  font-size: 14.5px;
  color: var(--ink-soft);
}

/* ==========================================================================
   ACT 4: RIDER IDE & EDITORS INDEX
   ========================================================================== */

.ide-band {
  padding: clamp(60px, 7.5vw, 96px) 0;
  background: var(--bg-tint);
  border-bottom: 1px solid var(--rule);
}

.ide-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 24px;
}

.ide-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.ide-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 140ms ease, border-color 180ms ease;
}

.ide-tab:hover { color: var(--ink); }

.ide-tab.active {
  color: var(--ink);
  border-bottom-color: var(--crimson);
}

.ide-figure { margin-bottom: 40px; }

.ide-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: #131B26;
  overflow: hidden;
  cursor: zoom-in;
}

.ide-zoom img {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  margin: 0 auto;
  transition: opacity 200ms ease;
}

.ide-zoom img.swapping { opacity: 0.35; }

.ide-cap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 24px;
  padding-top: 14px;
  font-size: 15px;
  color: var(--ink-soft);
}

.editors-index { border-top: 2px solid var(--ink); }

.ed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name link" "desc desc";
  gap: 6px 24px;
  align-items: baseline;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--rule);
  transition: color 120ms ease;
}

.ed-row strong {
  grid-area: name;
  font-family: var(--font-display);
  font-stretch: 112%;
  font-variation-settings: "wdth" 112;
  font-size: clamp(18px, 1.7vw, 22px);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.ed-row span {
  grid-area: desc;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 62ch;
}

.ed-row em {
  grid-area: link;
  font-style: normal;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--crimson-deep);
}

.ed-row:hover strong,
.ed-row:hover em { color: var(--crimson); }

/* ==========================================================================
   ACT 5: START & ALPHA + ANICANON FOOTER
   ========================================================================== */

.start-band {
  padding: clamp(56px, 7vw, 88px) 0;
  border-bottom: 1px solid var(--rule);
}

.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.start-band h2 { margin-bottom: 20px; }

.start-steps {
  list-style: none;
  padding: 0;
  border-top: 2px solid var(--ink);
}

.start-steps li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.start-steps li span {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-size: 40px;
  font-weight: 900;
  line-height: 0.9;
  color: var(--crimson);
}

.start-steps li strong { color: var(--ink); }
.start-steps li a { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--crimson); text-underline-offset: 3px; }

.alpha-side h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-stretch: 112%;
  font-variation-settings: "wdth" 112;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
}

.alpha-side {
  border-top: 2px solid var(--ink);
  padding-top: 20px;
}

.alpha-side p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.alpha-side strong { color: var(--ink); }

.footer {
  position: relative;
  padding: clamp(52px, 6vw, 80px) 0 40px;
  background: var(--sumi-deep);
  color: var(--paper-on-dark);
}


.footer .link-underline { color: #FFFFFF; border-bottom-color: rgba(233, 238, 245, 0.3); }
.footer .link-underline:hover { color: #FFFFFF; border-bottom-color: var(--crimson); }

.maker-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px 56px;
  align-items: center;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--rule-dark);
}

.maker-label {
  display: block;
  font: 500 13px/1 var(--font-sans);
  color: var(--ink-on-dark-faint);
  margin-bottom: 14px;
}

.anicanon-mark { height: clamp(52px, 6vw, 76px); width: auto; }

.maker-copy p {
  font-size: 15.5px;
  color: var(--ink-on-dark-soft);
  max-width: 56ch;
  margin-bottom: 16px;
}

.maker-copy strong { color: #FFFFFF; }

.maker-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 20px;
  font-size: 12.5px;
  color: var(--ink-on-dark-faint);
}

.footer-marks {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--ink-on-dark-soft);
}

.footer-legal a { text-decoration: underline; text-underline-offset: 2px; }

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 22, 34, 0.9);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(1240px, 95vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lightbox-close {
  align-self: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #131B26;
  color: #FFFFFF;
  font: 500 12px/1 var(--font-mono);
  padding: 7px 12px;
  border-radius: 3px;
  cursor: pointer;
}

.lightbox-panel img {
  max-height: 78vh;
  width: auto;
  margin: 0 auto;
  object-fit: contain;
}

.lightbox-panel p {
  font-size: 13px;
  color: #C7D4E3;
  text-align: center;
}

/* ==========================================================================
   Reduced Motion & Responsive
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .kumiko-piece, .kumiko-piece-old, .kumiko-pulse, .kumiko-lattice, .kumiko-slot { animation: none !important; }
  .b-bar span, .kumiko-ring, .kumiko-piece, .brand-logo-piece, .ide-zoom img { transition: none !important; }
}

@media (max-width: 980px) {
  .nav { display: none; }

  .hero-title .hero-cta { position: static; margin-top: 22px; font-size: inherit; }

  .hero-row,
  .ide-lower,
  .band-head,
  .flash-workspace,
  .proof-grid,
  .start-grid,
  .maker-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage-side {
    border-right: 0;
    border-bottom: 1px solid var(--rule-dark);
  }

  .flash-workspace.is-fullscreen {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 42dvh 58dvh;
  }


}

@media (max-width: 600px) {
  .hero h1 { font-size: 13vw; font-stretch: 100%; font-variation-settings: "wdth" 100; }
  .junction-flow strong { font-size: 14px; }
  .junction-flow { gap: 8px; }
  .junction-flow span { display: none; }
  .junction { margin-left: -8px; margin-right: -8px; }

  .brand-jp,
  .header-links .link-quiet,
  .ws-hint,
  .actions-side .ws-tools {
    display: none;
  }

  .b-item {
    grid-template-columns: 120px minmax(0, 1fr) 62px;
    gap: 8px;
  }
}
