@charset "utf-8";
:root {
  color-scheme: dark;
  --ink: #0b0e10;
  --panel: #111618;
  --panel-soft: #151b1d;
  --line: #293133;
  --line-soft: #1d2628;
  --text: #edf1ec;
  --muted: #858f8f;
  --quiet: #596565;
  --mint: #71e0cb;
  --mint-dim: #234941;
  --coral: #ff8176;
  --gold: #f2c768;
  --font-ar: "Noto Sans Arabic", "Noto Kufi Arabic", Tahoma, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ink); scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--ink); font-family: var(--font-ar); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.page-shell { width: min(1480px, calc(100% - 72px)); margin-inline: auto; }
.topbar { min-height: 79px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.brand-mark { width: 39px; height: 39px; color: var(--mint); display: block; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 14px; font-weight: 700; letter-spacing: -.035em; }
.brand-copy small { color: var(--muted); font-size: 10px; }
.topbar-meta { display: flex; align-items: center; gap: 26px; color: var(--muted); font-size: 11px; }
.issue-label, .live-indicator { display: inline-flex; align-items: center; gap: 8px; }
.tiny-square { width: 6px; height: 6px; background: var(--gold); display: inline-block; transform: rotate(45deg); }
.live-indicator { color: #a6b0ab; }
.live-indicator i, .stage-dot { width: 7px; height: 7px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 0 4px rgba(113,224,203,.09), 0 0 13px rgba(113,224,203,.38); }
.intro { display: flex; justify-content: space-between; align-items: end; padding: 44px 0 32px; gap: 40px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 15px; color: var(--mint); font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.eyebrow-rule { display: inline-block; width: 25px; height: 1px; background: #43635e; }
.latin { direction: ltr; unicode-bidi: isolate; font-family: var(--font-mono); letter-spacing: .08em; }
.eyebrow .latin { font-size: 9px; color: var(--quiet); }
h1 { margin: 0; font-size: clamp(34px, 4.4vw, 60px); line-height: 1.23; font-weight: 650; letter-spacing: -.065em; text-wrap: pretty; }
h1 em { color: var(--mint); font-style: normal; }
.lede { margin: 13px 0 0; color: #9ca5a1; font-size: 14px; }
.intro-note { min-width: 220px; margin-bottom: 5px; padding-inline-start: 18px; border-inline-start: 1px solid var(--line); color: #a5adab; }
.note-index { color: var(--coral); font: 10px var(--font-mono); letter-spacing: .12em; }
.intro-note p { margin: 8px 0 0; font-size: 12px; line-height: 1.9; }
.workspace { direction: ltr; display: grid; grid-template-columns: minmax(0, 1.63fr) minmax(290px, .72fr); gap: 22px; align-items: stretch; }
.stage-column { direction: rtl; min-width: 0; }
.stage-topline { min-height: 41px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.stage-title { display: inline-flex; align-items: center; gap: 9px; color: #cad1cd; font-size: 12px; }
.stage-dot { width: 6px; height: 6px; }
.stage-code { color: var(--quiet); font-size: 9px; margin-inline-start: 5px; }
.stage-stats { display: inline-flex; align-items: center; gap: 13px; direction: ltr; }
.stage-stats > span:not(.stat-divider) { display: inline-flex; align-items: baseline; gap: 5px; }
.stage-stats b { font: 12px var(--font-mono); color: var(--mint); font-weight: 500; }
.stage-stats small { color: var(--muted); font-size: 10px; direction: rtl; }
.stat-divider { width: 1px; height: 13px; background: var(--line); }
.canvas-frame { height: clamp(390px, 51vw, 638px); position: relative; overflow: hidden; isolation: isolate; background: #0c1315; border: 1px solid #263234; }
.canvas-frame::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 49% 47%, rgba(37,97,88,.17), transparent 57%), linear-gradient(115deg, transparent 42%, rgba(255,255,255,.012) 42.1%, transparent 42.3%); }
#swarm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#swarm-canvas.is-dragging { cursor: grabbing; }
.canvas-coordinate { position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 8px; color: rgba(204,218,211,.56); font: 9px var(--font-mono); letter-spacing: .025em; pointer-events: none; }
.coordinate-top { inset-block-start: 17px; inset-inline-start: 18px; }
.coordinate-bottom { inset-block-end: 17px; inset-inline-start: 18px; color: rgba(204,218,211,.44); font-family: var(--font-ar); }
.coordinate-mark { width: 5px; height: 5px; border: 1px solid var(--mint); border-radius: 50%; }
.coordinate-cross { color: var(--coral); font: 16px var(--font-mono); }
.canvas-corner { width: 15px; height: 15px; position: absolute; pointer-events: none; opacity: .65; }
.corner-tl { top: 0; left: 0; border-top: 1px solid var(--mint); border-left: 1px solid var(--mint); }
.corner-br { bottom: 0; right: 0; border-bottom: 1px solid var(--mint); border-right: 1px solid var(--mint); }
.paused-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8,12,13,.38); backdrop-filter: blur(2px); color: var(--text); pointer-events: none; }
.paused-overlay[hidden] { display: none; }
.paused-overlay span { padding: 9px 14px; border: 1px solid rgba(255,255,255,.17); background: rgba(8,12,13,.78); font-size: 12px; }
.stage-footer { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 10px; }
.stage-footer > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.footer-spark { width: 5px; height: 5px; background: var(--gold); display: inline-block; transform: rotate(45deg); }
.stage-footer .latin { color: var(--quiet); font-size: 8px; }
.stage-footer .latin b { color: var(--coral); }
.control-rail { direction: rtl; min-width: 0; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(21,27,29,.85), rgba(15,20,22,.92)); padding: 19px 20px 15px; display: flex; flex-direction: column; }
.rail-heading { display: flex; align-items: start; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line-soft); }
.rail-kicker { display: block; font-size: 8px; color: var(--quiet); margin-bottom: 6px; }
.rail-heading h2 { font-size: 18px; line-height: 1.2; margin: 0; letter-spacing: -.04em; font-weight: 600; }
.rail-number { font: 9px var(--font-mono); color: var(--coral); padding-top: 3px; }
.mode-section { padding: 14px 0 15px; border-bottom: 1px solid var(--line-soft); }
.section-label { display: flex; justify-content: space-between; align-items: baseline; color: #cbd2ce; font-size: 11px; margin-bottom: 10px; }
.micro-hint, .tiny-label { color: var(--quiet); font-size: 9px; }
.mode-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-button { min-height: 40px; padding: 0 9px; background: transparent; border: 1px solid var(--line); display: flex; align-items: center; gap: 7px; text-align: right; font-size: 10px; cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.mode-button:hover { border-color: #4a6660; background: rgba(113,224,203,.045); }
.mode-button.is-active { border-color: #4e867b; background: rgba(113,224,203,.08); color: #d9f8ef; }
.mode-button kbd { margin-inline-start: auto; color: var(--quiet); font: 8px var(--font-mono); background: transparent; }
.mode-button.is-active kbd { color: var(--mint); }
.mode-glyph { width: 15px; height: 15px; position: relative; flex: 0 0 15px; }
.glyph-flock::before, .glyph-flock::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--mint); top: 5px; left: 5px; box-shadow: -5px -3px 0 -1px var(--mint), 5px -2px 0 -1px var(--mint), -3px 5px 0 -1px var(--mint), 4px 5px 0 -1px var(--mint); }
.glyph-vortex::before { content: ""; position: absolute; inset: 1px; border: 1px solid var(--mint); border-left-color: transparent; border-radius: 50%; transform: rotate(-25deg); }
.glyph-vortex::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--mint); top: 5px; left: 6px; }
.glyph-migrate::before { content: "→"; position: absolute; inset: -4px 0 0; color: var(--mint); font: 20px var(--font-mono); }
.glyph-fish::before { content: ""; position: absolute; width: 8px; height: 6px; border-radius: 65% 45% 45% 65%; background: var(--mint); top: 4px; left: 4px; }
.glyph-fish::after { content: ""; position: absolute; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-right: 5px solid var(--mint); top: 3px; left: 0; }
.parameters { padding: 14px 0 11px; }
.parameters .section-label { margin-bottom: 3px; }
.range-control { display: block; padding: 9px 0 7px; cursor: pointer; }
.range-heading { display: flex; align-items: center; justify-content: space-between; color: #d6ddda; font-size: 11px; }
.range-heading output { color: var(--mint); font: 11px var(--font-mono); direction: ltr; }
input[type="range"] { --fill: 45%; appearance: none; display: block; width: 100%; height: 16px; margin: 5px 0 0; background: transparent; cursor: pointer; direction: ltr; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--mint) 0 var(--fill), #354141 var(--fill) 100%); }
input[type="range"]::-moz-range-track { height: 2px; background: #354141; }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--mint); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 10px; height: 10px; border: 2px solid var(--ink); background: var(--mint); border-radius: 50%; margin-top: -4px; box-shadow: 0 0 0 1px var(--mint); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 1px solid var(--ink); background: var(--mint); border-radius: 50%; box-shadow: 0 0 0 1px var(--mint); }
.range-scale { display: flex; justify-content: space-between; color: var(--quiet); font: 8px var(--font-mono); direction: ltr; }
.range-description { display: block; color: var(--quiet); font-size: 9px; margin-top: 2px; }
.obstacle-row { margin-top: auto; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.obstacle-copy { display: inline-flex; align-items: center; gap: 10px; }
.obstacle-symbol { position: relative; width: 23px; height: 23px; border: 1px dashed var(--coral); border-radius: 50%; opacity: .9; }
.obstacle-symbol::after { content: ""; position: absolute; inset: 6px; background: var(--coral); border-radius: 50%; opacity: .7; }
.obstacle-copy > span:last-child { display: grid; gap: 2px; }
.obstacle-copy strong { font-weight: 550; font-size: 10px; }
.obstacle-copy small { color: var(--quiet); font-size: 9px; }
.toggle { width: 34px; height: 19px; padding: 2px; border: 1px solid #3b4646; border-radius: 30px; background: #202829; cursor: pointer; transition: .2s ease; }
.toggle span { display: block; width: 13px; height: 13px; border-radius: 50%; background: #7e8988; transition: transform .2s ease, background .2s ease; }
.toggle.is-on { background: rgba(113,224,203,.17); border-color: #4f8479; }
.toggle.is-on span { transform: translateX(-14px); background: var(--mint); }
[dir="rtl"] .toggle.is-on span { transform: translateX(-14px); }
.rail-actions { display: flex; gap: 7px; padding-top: 13px; }
.action-primary, .action-icon { min-height: 39px; border: 1px solid #35413f; background: #17201f; cursor: pointer; transition: .18s ease; }
.action-primary { flex: 1; display: flex; align-items: center; justify-content: center; gap: 9px; color: #e0f8f0; font-size: 11px; }
.action-primary:hover { border-color: var(--mint); background: #1a2b27; }
.action-icon { width: 40px; display: grid; place-items: center; color: #aab5b0; }
.action-icon:hover { border-color: #637872; color: var(--mint); }
.action-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.play-icon { display: inline-flex; width: 13px; height: 13px; align-items: center; justify-content: center; gap: 3px; }
.play-icon i { width: 2px; height: 11px; display: block; background: var(--mint); }
.play-icon.is-playing::before { content: ""; width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 7px solid var(--mint); }
.play-icon.is-playing i { display: none; }
.rail-footnote { display: flex; align-items: flex-start; gap: 7px; margin: 10px 0 0; color: var(--quiet); font-size: 9px; line-height: 1.7; }
.footnote-dot { flex: 0 0 5px; width: 5px; height: 5px; margin-top: 5px; border-radius: 50%; background: var(--gold); }
.page-footer { min-height: 57px; margin-top: 27px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--quiet); font-size: 9px; }
.footer-separator { color: var(--coral); padding-inline: 5px; }
.page-footer .latin { font-size: 8px; letter-spacing: .13em; }
@media (min-width: 1500px) { .canvas-frame { height: min(650px, 50vw); } }
@media (max-width: 1050px) {
  .page-shell { width: min(100% - 44px, 900px); }
  .workspace { grid-template-columns: minmax(0, 1.35fr) minmax(265px, .85fr); gap: 14px; }
  .control-rail { padding-inline: 15px; }
  .canvas-frame { height: clamp(390px, 55vw, 590px); }
  .intro { padding-top: 35px; }
}
@media (max-width: 760px) {
  .page-shell { width: calc(100% - 32px); }
  .topbar { min-height: 66px; }
  .topbar-meta { gap: 13px; font-size: 9px; }
  .intro { padding: 31px 0 23px; align-items: end; }
  h1 { font-size: clamp(35px, 8vw, 52px); }
  .lede { max-width: 330px; font-size: 12px; }
  .intro-note { min-width: 155px; padding-inline-start: 11px; }
  .intro-note p { font-size: 10px; }
  .workspace { direction: rtl; display: flex; flex-direction: column; gap: 13px; }
  .stage-column { order: 0; }
  .control-rail { order: 1; }
  .canvas-frame { height: clamp(345px, 104vw, 510px); }
  .control-rail { padding: 16px 17px 13px; }
  .mode-list { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; }
  .mode-button { min-height: 47px; padding: 5px 5px; justify-content: center; flex-direction: column; gap: 1px; font-size: 9px; text-align: center; }
  .mode-button kbd { display: none; }
  .mode-glyph { height: 14px; }
  .parameters { display: grid; grid-template-columns: 1fr 1fr; column-gap: 17px; }
  .parameters .section-label { grid-column: 1 / -1; }
  .range-control { padding-block: 7px 5px; }
  .range-description { min-height: 15px; }
  .stage-footer { font-size: 9px; }
}
@media (max-width: 480px) {
  .page-shell { width: calc(100% - 24px); }
  .topbar { min-height: 61px; }
  .brand-mark { width: 35px; height: 35px; }
  .brand-copy strong { font-size: 12px; }
  .brand-copy small { font-size: 9px; }
  .topbar-meta { gap: 10px; }
  .issue-label { display: none; }
  .intro { padding: 26px 0 18px; gap: 12px; }
  .intro-note { min-width: 105px; margin-bottom: 2px; }
  .intro-note p { font-size: 9px; }
  .note-index { font-size: 8px; }
  h1 { font-size: clamp(32px, 9.2vw, 42px); }
  .desktop-break { display: none; }
  .lede { font-size: 10px; max-width: 230px; line-height: 1.8; }
  .eyebrow { font-size: 9px; gap: 7px; margin-bottom: 11px; }
  .eyebrow .latin { font-size: 8px; }
  .stage-topline { min-height: 35px; }
  .stage-title { font-size: 10px; gap: 7px; }
  .stage-code { font-size: 8px; }
  .stage-stats { gap: 8px; }
  .stage-stats b { font-size: 10px; }
  .stage-stats small { font-size: 9px; }
  .canvas-frame { height: 104vw; max-height: 440px; min-height: 320px; }
  .coordinate-top { inset-block-start: 12px; inset-inline-start: 12px; }
  .coordinate-bottom { inset-block-end: 12px; inset-inline-start: 12px; }
  .stage-footer .latin { font-size: 7px; }
  .stage-footer { min-height: 35px; gap: 8px; }
  .control-rail { padding-inline: 13px; }
  .parameters { column-gap: 11px; }
  .page-footer { margin-top: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
