/* ==========================================================================
   Weblox — remote play
   A warm paper landing that turns into a dark control room.
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f1ece1;
  --paper-2: #e7e0d1;
  --paper-3: #ddd4c2;
  --ink: #12140f;
  --ink-2: #5b5e53;
  --ink-3: #67695d;
  --cobalt: #2946ff;
  --cobalt-dark: #1b31c4;
  --tomato: #ff4d2e;
  --butter: #ffd447;
  --line: rgba(18, 20, 15, 0.17);
  --line-strong: rgba(18, 20, 15, 0.42);

  --carbon: #0a0b0d;
  --carbon-2: #111318;
  --carbon-3: #181b21;
  --ivory: #f2eee5;
  --ivory-2: #b7b4ab;
  --ivory-3: #7b7d78;
  --edge: rgba(242, 238, 229, 0.13);
  --edge-strong: rgba(242, 238, 229, 0.28);
  --sky: #8fbdff;
  --mint: #8ef0b6;
  --rose: #ff8a7a;

  --display: "Bricolage Grotesque", "Archivo", sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  --r-sm: 5px;
  --r-md: 10px;
  --r-lg: 18px;
  --page: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.in-session {
  height: 100dvh;
  overflow: hidden;
  background: var(--carbon);
  color: var(--ivory);
}

::selection { background: var(--cobalt); color: #fff; }
body.in-session ::selection { background: var(--tomato); color: #120b08; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.12em 0.34em;
  border-radius: 3px;
  background: rgba(18, 20, 15, 0.07);
  border: 1px solid rgba(18, 20, 15, 0.09);
}

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
}
body.in-session :focus-visible { outline-color: var(--tomato); }

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  transition: transform 160ms ease;
}
.skip:focus { transform: none; }

.page-noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(circle at 18% 8%, rgba(41, 70, 255, 0.075), transparent 32%),
    radial-gradient(circle at 86% 14%, rgba(255, 77, 46, 0.07), transparent 26%),
    repeating-linear-gradient(0deg, rgba(18, 20, 15, 0.028) 0 1px, transparent 1px 5px);
  mix-blend-mode: multiply;
}
body.in-session .page-noise { display: none; }

.hidden, [hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.micro {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.11em;
  color: var(--ink-2);
  text-transform: lowercase;
}
body.in-session .micro { color: var(--ivory-3); }

.site { position: relative; z-index: 1; }

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 70px;
  padding: 0 clamp(20px, 4vw, 46px);
  background: rgba(241, 236, 225, 0.84);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(120%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.brand-mark { width: 25px; height: 25px; color: var(--ink); }
.brand-word {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.045em;
}
.brand-kicker {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  padding-left: 3px;
  border-left: 1px solid var(--line);
  line-height: 1.3;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: 16px;
}
.nav-links a {
  font-size: 13px;
  color: var(--ink-2);
  position: relative;
  padding: 4px 0;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.relay-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.32);
  white-space: nowrap;
}
.relay-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
}
.relay-pill[data-state="online"] i { background: #19a463; box-shadow: 0 0 0 3px rgba(25, 164, 99, 0.13); }
.relay-pill[data-state="offline"] i { background: var(--tomato); box-shadow: 0 0 0 3px rgba(255, 77, 46, 0.13); }
.relay-pill[data-state="online"] { border-color: rgba(25, 164, 99, 0.3); }
.relay-pill[data-state="offline"] { border-color: rgba(255, 77, 46, 0.3); color: #b52d16; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  box-shadow: 4px 4px 0 var(--cobalt);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 7px 7px 0 var(--cobalt); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--cobalt); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(18, 20, 15, 0.05); box-shadow: none; transform: none; }
.btn-ghost:active { transform: none; }

.btn-small { min-height: 36px; padding: 0 15px; font-size: 12px; box-shadow: 2px 2px 0 var(--cobalt); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn-quiet:hover { background: rgba(18, 20, 15, 0.05); transform: none; box-shadow: none; }
.btn-wide { width: 100%; min-height: 56px; }

.text-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ivory-2);
  font-size: 11px;
  border-bottom: 1px solid var(--edge);
}
.text-btn:hover { color: var(--ivory); border-color: var(--ivory); }

/* ==========================================================================
   Landing shell
   ========================================================================== */

.landing {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 46px);
}

/* hero
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: clamp(30px, 5vw, 72px);
  align-items: center;
  min-height: min(760px, calc(100dvh - 70px));
  padding: clamp(48px, 7vw, 92px) 0 clamp(48px, 6vw, 84px);
}

.hero-copy { animation: rise-in 700ms var(--ease) both; }
.hero-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.045em;
  color: var(--ink-2);
}
.signal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tomato);
  box-shadow: 0 0 0 4px rgba(255, 77, 46, 0.14);
  animation: signal 2.6s ease-in-out infinite;
}
@keyframes signal {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 77, 46, 0.12); }
  50% { box-shadow: 0 0 0 7px rgba(255, 77, 46, 0); }
}

.hero h1 {
  margin: 0 0 30px;
  font-family: var(--display);
  font-weight: 720;
  font-size: clamp(58px, 9.4vw, 142px);
  line-height: 0.82;
  letter-spacing: -0.068em;
  color: var(--ink);
}
.hero h1 em {
  display: block;
  font-style: normal;
  color: var(--cobalt);
  letter-spacing: -0.075em;
}
.hero-lede {
  max-width: 47ch;
  margin: 0 0 32px;
  font-size: clamp(15px, 1.35vw, 17px);
  line-height: 1.65;
  color: var(--ink-2);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-ledger {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  max-width: 540px;
  margin: 44px 0 0;
  border-top: 1px solid var(--line);
}
.hero-ledger div { padding: 14px 14px 0 0; }
.hero-ledger div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.hero-ledger dt {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.hero-ledger dd { margin: 0; font-size: 12.5px; font-weight: 500; color: var(--ink); }

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

.hero-stage { animation: rise-in 850ms 120ms var(--ease) both; }

.link-card {
  position: relative;
  background: var(--carbon);
  color: var(--ivory);
  border: 1px solid #000;
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: 14px 14px 0 var(--cobalt);
  overflow: hidden;
}
.link-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 34%);
}
.link-card-head, .link-card-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.link-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tomato);
  box-shadow: 0 0 12px rgba(255, 77, 46, 0.8);
  animation: blip 1.8s ease-in-out infinite;
}
@keyframes blip { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.link-card .micro { color: var(--ivory-3); }

.link-viz {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(44px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 24px 6px 22px;
}
.node { display: grid; justify-items: start; gap: 2px; min-width: 82px; }
.node-end { justify-items: end; text-align: right; }
.node-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 7px;
  border: 1px solid var(--edge-strong);
  border-radius: 10px;
  background: rgba(242, 238, 229, 0.04);
  color: var(--ivory);
}
.node b { font-size: 11.5px; font-weight: 600; }
.node small { font-family: var(--mono); font-size: 9px; color: var(--ivory-3); }

.wire { position: relative; height: 44px; }
.wire-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--edge-strong) 0 4px, transparent 4px 9px);
}
.wire-pulse {
  position: absolute;
  top: calc(50% - 2px);
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 0 0 8px var(--sky);
  animation: travel 2.6s linear infinite;
}
.wire-pulse.p2 { animation-delay: 0.85s; background: var(--tomato); box-shadow: 0 0 8px var(--tomato); }
.wire-pulse.p3 { animation-delay: 1.7s; background: var(--butter); box-shadow: 0 0 8px var(--butter); }
@keyframes travel {
  from { left: 0; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  to { left: calc(100% - 4px); opacity: 0; }
}
.wire-label {
  position: absolute;
  top: calc(50% - 20px);
  left: 50%;
  translate: -50% 0;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--ivory-3);
  background: var(--carbon);
  padding: 0 5px;
}

.preview {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  overflow: hidden;
  background: #07080a;
}
.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--edge);
}
.preview-code {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--butter);
}

.preview-scene {
  position: relative;
  height: 220px;
  overflow: hidden;
  background:
    radial-gradient(circle at 62% 20%, rgba(143, 189, 255, 0.12), transparent 36%),
    linear-gradient(180deg, #111722, #07080a 74%);
}
.scene-grid {
  position: absolute;
  left: -35%;
  right: -35%;
  bottom: -42%;
  height: 112%;
  background:
    repeating-linear-gradient(90deg, rgba(143, 189, 255, 0.17) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(143, 189, 255, 0.17) 0 1px, transparent 1px 48px);
  transform: perspective(420px) rotateX(64deg);
  transform-origin: center top;
  mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 64%, transparent);
  opacity: 0.72;
}
.scene-block {
  position: absolute;
  width: 34px;
  height: 34px;
  background: linear-gradient(145deg, #2f46d6, #1a2579);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 5px 5px 0 rgba(7, 8, 10, 0.72);
  transform: rotate(8deg);
}
.scene-block.b1 { left: 14%; top: 27%; width: 44px; height: 44px; background: linear-gradient(145deg, #ff785f, #c92d13); }
.scene-block.b2 { right: 18%; top: 16%; width: 26px; height: 26px; background: linear-gradient(145deg, #ffd86b, #c99a13); transform: rotate(-7deg); }
.scene-block.b3 { right: 28%; top: 49%; width: 48px; height: 52px; background: linear-gradient(145deg, #263bce, #121a67); }
.scene-block.b4 { left: 30%; top: 61%; width: 22px; height: 22px; background: linear-gradient(145deg, #9ef0c0, #2d9c63); transform: rotate(-14deg); }
.scene-character {
  position: absolute;
  left: 47%;
  top: 37%;
  width: 28px;
  height: 56px;
  animation: bob 3.4s ease-in-out infinite;
}
.scene-character i {
  position: absolute;
  top: 0;
  left: 3px;
  width: 22px;
  height: 21px;
  border-radius: 4px;
  background: linear-gradient(145deg, #f2eee5, #b9b2a3);
  box-shadow: 3px 3px 0 rgba(7, 8, 10, 0.45);
}
.scene-character b {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 28px;
  height: 30px;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(145deg, #4260ff, #172583);
  box-shadow: 3px 3px 0 rgba(7, 8, 10, 0.45);
}
.scene-character::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  bottom: -10px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  filter: blur(5px);
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.scene-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 30%;
  background: linear-gradient(to bottom, transparent, rgba(143, 189, 255, 0.07), transparent);
  animation: scan 5s linear infinite;
}
@keyframes scan { from { transform: translateY(-100%); } to { transform: translateY(430%); } }
.scene-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ivory-3);
}
.scene-hud span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.scene-hud .live-dot { width: 5px; height: 5px; box-shadow: none; }

.link-card-foot {
  padding: 12px 2px 0;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ivory-3);
}

/* marquee ------------------------------------------------------------------ */

.marquee {
  position: relative;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  background: var(--paper-2);
}
.marquee-track {
  display: flex;
  align-items: center;
  gap: 34px;
  width: max-content;
  animation: marquee 38s linear infinite;
}
.marquee-track span {
  font-family: var(--display);
  font-size: 31px;
  font-weight: 500;
  letter-spacing: -0.035em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(18, 20, 15, 0.48);
  white-space: nowrap;
}
.marquee-track span:nth-of-type(odd) { color: var(--ink); -webkit-text-stroke: 0; }
.marquee-track i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cobalt);
  flex: none;
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ==========================================================================
   Join
   ========================================================================== */

.join {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: clamp(34px, 6vw, 86px);
  align-items: start;
  padding: clamp(64px, 9vw, 118px) 0;
  scroll-margin-top: 90px;
}
.section-kicker {
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--cobalt-dark);
}
.join h2, .section-head h2, .network h2 {
  margin: 0 0 24px;
  font-family: var(--display);
  font-weight: 680;
  font-size: clamp(38px, 4.4vw, 61px);
  line-height: 0.94;
  letter-spacing: -0.052em;
}
.join-note {
  max-width: 45ch;
  margin: 0 0 32px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.7;
}
.join-points { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.join-points li {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.join-points li > span { font-family: var(--mono); font-size: 10px; color: var(--ink-3); padding-top: 3px; }
.join-points p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.join-points b { color: var(--ink); font-weight: 600; }

.join-card {
  position: relative;
  padding: clamp(22px, 3vw, 34px);
  background: #faf7f0;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 9px 9px 0 var(--ink);
}
.join-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.seat-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}
.field { display: block; padding: 18px 0 12px; border-bottom: 1px solid var(--line); }
.field > span {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.field > span small { font-size: 8px; color: var(--ink-3); letter-spacing: 0; }
.field input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  padding: 0;
  color: var(--ink);
}
#roomInput {
  font-family: var(--mono);
  font-size: clamp(28px, 3.4vw, 39px);
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  line-height: 1.1;
}
#roomInput::placeholder { color: rgba(18, 20, 15, 0.2); }
#nameInput { font-family: var(--display); font-size: 19px; font-weight: 500; letter-spacing: -0.02em; }
#nameInput::placeholder { color: rgba(18, 20, 15, 0.22); }
.field-compact { padding-top: 15px; }
.join-card .btn-wide { margin-top: 26px; }

.form-note, .form-error {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-3);
}
.form-note code { padding: 0.05em 0.26em; }
.form-error { color: #c6341b; min-height: 17px; margin-top: 8px; }
.preview-link {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 11.5px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong);
  align-self: flex-start;
}
.preview-link:hover { color: var(--cobalt); border-color: var(--cobalt); }

/* ==========================================================================
   How it works
   ========================================================================== */

.how { padding: clamp(52px, 8vw, 104px) 0; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 26px 64px;
  align-items: end;
  margin-bottom: 54px;
}
.section-head .section-kicker { grid-column: 1 / -1; margin: 0; }
.section-head h2 { margin: 0; }
.section-head > p:last-child { margin: 0; max-width: 52ch; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }

.steps {
  list-style: none;
  margin: 0 0 46px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1.5px solid var(--ink);
}
.step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  padding: 24px 22px 28px 0;
  border-bottom: 1px solid var(--line);
}
.step + .step { padding-left: 22px; border-left: 1px solid var(--line); }
.step-num { font-family: var(--mono); font-size: 11px; color: var(--ink-3); padding-top: 3px; }
.step h3 { margin: 0 0 10px; font-family: var(--display); font-size: 21px; font-weight: 650; letter-spacing: -0.025em; }
.step p { margin: 0 0 18px; color: var(--ink-2); font-size: 13px; line-height: 1.65; }
.step-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.04em; color: var(--ink-3); }

.spec { border-top: 1px solid var(--line); }
.spec-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.spec-row > span:first-child { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: var(--ink-3); padding-top: 3px; }
.spec-row > span:last-child { color: var(--ink-2); }

/* ==========================================================================
   Network
   ========================================================================== */

.network {
  position: relative;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  padding: clamp(60px, 8vw, 104px) max(clamp(20px, 4vw, 46px), calc((100vw - var(--page)) / 2 + 46px));
  background: var(--carbon);
  color: var(--ivory);
  scroll-margin-top: 70px;
  overflow: hidden;
}
.network::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(41, 70, 255, 0.2), transparent 34%),
    radial-gradient(circle at 86% 82%, rgba(255, 77, 46, 0.1), transparent 34%),
    repeating-linear-gradient(0deg, rgba(242, 238, 229, 0.026) 0 1px, transparent 1px 6px);
}
.network > * { position: relative; }
.network .section-kicker { color: var(--sky); }
.network h2 { color: var(--ivory); }
.network-head {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 26px 64px;
  align-items: end;
  margin-bottom: 44px;
}
.network-head .section-kicker { grid-column: 1 / -1; margin: 0; }
.network-head h2 { margin: 0; }
.network-head > p:last-child { margin: 0; max-width: 50ch; color: var(--ivory-2); font-size: 14px; line-height: 1.7; }

.network-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--edge-strong);
  border-bottom: 1px solid var(--edge);
}
.stat { padding: 20px 20px 22px 0; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--edge); }
.stat-label { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--ivory-3); margin-bottom: 12px; }
.stat-value {
  display: block;
  font-family: var(--display);
  font-size: clamp(36px, 4.4vw, 58px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.9;
  color: var(--ivory);
}
.stat-value.is-small { font-size: clamp(24px, 2.7vw, 34px); letter-spacing: -0.035em; }
.stat-sub { display: block; margin-top: 10px; font-size: 11px; color: var(--ivory-3); }
.network-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 30px; }
.network .btn-ghost { color: var(--ivory); border-color: var(--edge-strong); }
.network .btn-ghost:hover { background: rgba(242, 238, 229, 0.06); }
.network .micro { color: var(--ivory-3); }

/* ==========================================================================
   Footer
   ========================================================================== */

.foot {
  display: grid;
  grid-template-columns: 0.7fr 1.4fr 0.8fr;
  gap: 28px;
  align-items: start;
  padding: 36px 0 54px;
}
.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.foot-brand .brand-mark { width: 21px; height: 21px; }
.foot p { margin: 0; font-size: 10.5px; line-height: 1.7; color: var(--ink-3); max-width: 66ch; }
.foot-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.foot-meta a { font-size: 11px; border-bottom: 1px solid var(--line); }
.foot-meta a:hover { color: var(--cobalt); border-color: var(--cobalt); }

/* ==========================================================================
   Session shell
   ========================================================================== */

.session {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  background: var(--carbon);
  color: var(--ivory);
}

.session-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 62px;
  padding: 0 16px;
  border-bottom: 1px solid var(--edge);
  background: rgba(10, 11, 13, 0.94);
}
.brand-dark { color: var(--ivory); }
.brand-dark .brand-mark { width: 22px; height: 22px; }
.brand-dark .brand-word { font-size: 18px; }

.session-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--carbon-2);
  color: var(--ivory);
  transition: border-color 150ms ease, background 150ms ease;
}
.room-chip:hover { border-color: var(--edge-strong); background: var(--carbon-3); }
.room-chip .micro { color: var(--ivory-3); }
.room-chip b { font-size: 12px; letter-spacing: 0.18em; color: var(--butter); }
.room-chip svg { color: var(--ivory-3); }
.session-stat {
  font-size: 10px;
  color: var(--ivory-3);
  white-space: nowrap;
  padding: 0 4px;
}
.session-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tool {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ivory-2);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.tool:hover { background: var(--carbon-2); color: var(--ivory); border-color: var(--edge); }
.tool-leave:hover { color: var(--rose); border-color: rgba(255, 138, 122, 0.28); }

.session-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 12px;
  padding: 12px;
}

.stage-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  gap: 8px;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #030405;
  border: 1px solid var(--edge);
  border-radius: 10px;
  overflow: hidden;
}
#screen {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #030405;
  outline: none;
  touch-action: none;
  cursor: crosshair;
}
.stage.is-live #screen { cursor: none; }
.stage:not(.is-live) #screen { cursor: default; }

.stage-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 34px;
  padding: 0 3px;
}
.stream-state { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stream-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  color: var(--ivory-3);
  white-space: nowrap;
}
.stream-pill i { width: 5px; height: 5px; border-radius: 50%; background: var(--ivory-3); }
.stream-pill[data-state="live"] { color: var(--mint); }
.stream-pill[data-state="live"] i { background: var(--mint); box-shadow: 0 0 7px rgba(142, 240, 182, 0.75); }
.stream-pill[data-state="waiting"] i { background: var(--butter); animation: blip 1.6s ease-in-out infinite; }
.stream-pill[data-state="error"] { color: var(--rose); }
.stream-pill[data-state="error"] i { background: var(--rose); }
.stream-fact { font-size: 9px; color: var(--ivory-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-bar-actions { display: flex; align-items: center; gap: 6px; }
.mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--edge);
  border-radius: 5px;
  background: var(--carbon-2);
  color: var(--ivory-2);
  font-size: 10px;
}
.mini:hover { color: var(--ivory); border-color: var(--edge-strong); }
#railBtnMobile { display: none; }

/* boot surface ------------------------------------------------------------- */

.boot {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(41, 70, 255, 0.2), transparent 36%),
    radial-gradient(circle at 64% 68%, rgba(255, 77, 46, 0.1), transparent 30%),
    var(--carbon);
  transition: opacity 520ms var(--ease), visibility 520ms;
}
.boot.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-grid {
  position: absolute;
  inset: -20%;
  background:
    repeating-linear-gradient(90deg, rgba(242, 238, 229, 0.05) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(0deg, rgba(242, 238, 229, 0.05) 0 1px, transparent 1px 46px);
  transform: perspective(520px) rotateX(53deg) translateY(6%);
  mask-image: radial-gradient(circle at 50% 48%, #000, transparent 66%);
  opacity: 0.55;
}
.boot-inner {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 24px;
  max-width: 560px;
}
.boot-mark {
  display: grid;
  grid-template-columns: repeat(2, 13px);
  gap: 4px;
  margin-bottom: 26px;
}
.boot-mark i {
  width: 13px;
  height: 13px;
  background: var(--ivory);
  border-radius: 2px;
  animation: boot-block 1.25s ease-in-out infinite;
}
.boot-mark i:nth-child(1) { animation-delay: 0s; }
.boot-mark i:nth-child(2) { animation-delay: 0.12s; opacity: 0.7; }
.boot-mark i:nth-child(3) { animation-delay: 0.24s; opacity: 0.45; }
.boot-mark i:nth-child(4) { animation-delay: 0.36s; background: var(--tomato); }
@keyframes boot-block {
  0%, 100% { transform: translateY(0) scale(1); }
  34% { transform: translateY(-7px) scale(1.04); }
  66% { transform: translateY(0) scale(0.96); }
}
.boot-eyebrow {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--ivory-3);
}
.boot-title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 620;
  letter-spacing: -0.045em;
  line-height: 0.98;
  color: var(--ivory);
}
.boot-detail { margin: 0 0 22px; font-size: 12px; color: var(--ivory-2); }
.boot-progress {
  width: min(280px, 68vw);
  height: 2px;
  background: var(--edge);
  overflow: hidden;
}
.boot-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cobalt), var(--sky) 46%, var(--tomato));
  transition: width 420ms var(--ease);
}
.boot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(280px, 68vw);
  margin-top: 9px;
  font-size: 9px;
  color: var(--ivory-3);
}
.boot-meta span:last-child { text-align: right; max-width: 72%; }
.boot-action { margin-top: 20px; background: var(--ivory); color: var(--carbon); border-color: var(--ivory); box-shadow: 3px 3px 0 var(--tomato); }
.boot-stages {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  display: flex;
  justify-content: center;
  gap: 26px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.13em;
  color: var(--ivory-3);
}
.boot-stages span { position: relative; padding-top: 9px; }
.boot-stages span::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--edge);
}
.boot-stages span.done { color: var(--ivory-2); }
.boot-stages span.done::before { background: var(--sky); }
.boot-stages span.active { color: var(--butter); }
.boot-stages span.active::before { background: var(--butter); }

.stage-message {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 6, 8, 0.92);
  backdrop-filter: blur(8px);
}
.stage-message > div { max-width: 440px; text-align: center; }
.stage-message h3 {
  margin: 10px 0 12px;
  font-family: var(--display);
  font-size: 32px;
  font-weight: 620;
  letter-spacing: -0.04em;
}
.stage-message p { margin: 0 0 20px; color: var(--ivory-2); font-size: 13px; line-height: 1.65; }

/* control ribbon and reactions --------------------------------------------- */

.control-ribbon {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 6px 6px 13px;
  border: 1px solid rgba(255, 77, 46, 0.4);
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.control-ribbon span { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ivory); white-space: nowrap; }
.control-ribbon span i { width: 6px; height: 6px; border-radius: 50%; background: var(--tomato); animation: blip 1.5s ease-in-out infinite; }
.control-ribbon button {
  border: 0;
  border-radius: 999px;
  background: var(--ivory);
  color: var(--carbon);
  font-size: 10px;
  font-weight: 600;
  padding: 5px 10px;
}
.control-ribbon button:hover { background: var(--tomato); color: #120b08; }

.reactions { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.reaction-float {
  position: absolute;
  bottom: 10%;
  font-size: 30px;
  animation: float-up 2.8s var(--ease) forwards;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}
@keyframes float-up {
  from { transform: translateY(0) scale(0.7) rotate(-6deg); opacity: 0; }
  18% { opacity: 1; transform: translateY(-24px) scale(1.08) rotate(2deg); }
  to { transform: translateY(-220px) scale(0.92) rotate(-4deg); opacity: 0; }
}

.reaction-menu {
  position: absolute;
  right: 46px;
  bottom: 36px;
  display: flex;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--edge-strong);
  border-radius: 8px;
  background: var(--carbon-2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.reaction-menu button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-size: 17px;
}
.reaction-menu button:hover { background: var(--carbon-3); transform: scale(1.12); }

.stream-toast {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 18px;
  translate: -50% 8px;
  max-width: 82%;
  padding: 8px 13px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.88);
  color: var(--ivory);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, translate 180ms var(--ease);
  backdrop-filter: blur(10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stream-toast.on { opacity: 1; translate: -50% 0; }

/* touch controls ----------------------------------------------------------- */

.touch {
  position: absolute;
  z-index: 6;
  inset: auto 0 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px 20px;
  pointer-events: none;
}
.stick {
  position: relative;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(242, 238, 229, 0.25);
  border-radius: 50%;
  background: rgba(10, 11, 13, 0.32);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  touch-action: none;
}
.stick-ring {
  position: absolute;
  inset: 22px;
  border: 1px dashed rgba(242, 238, 229, 0.16);
  border-radius: 50%;
}
.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(242, 238, 229, 0.82);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.touch-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: auto; }
.touch-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid rgba(242, 238, 229, 0.28);
  background: rgba(10, 11, 13, 0.38);
  backdrop-filter: blur(6px);
  color: var(--ivory);
  font-size: 11px;
  font-weight: 600;
  touch-action: none;
}
.touch-btn:active { background: var(--tomato); color: #120b08; border-color: var(--tomato); }
.touch-jump { width: 76px; height: 76px; }
.touch-use { width: 56px; height: 56px; font-size: 10px; }

/* ==========================================================================
   Session rail
   ========================================================================== */

.rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--carbon-2);
  border: 1px solid var(--edge);
  border-radius: 10px;
  overflow: hidden;
}
.rail-tabs {
  flex: none;
  display: flex;
  align-items: center;
  height: 45px;
  padding: 0 6px;
  border-bottom: 1px solid var(--edge);
  gap: 2px;
}
.rail-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ivory-3);
  font-size: 11px;
}
.rail-tab:hover { color: var(--ivory-2); background: var(--carbon-3); }
.rail-tab[aria-selected="true"] { color: var(--ivory); background: var(--carbon-3); }
.rail-tab .count, .rail-tab .unread {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ivory-2);
  background: rgba(242, 238, 229, 0.1);
  border-radius: 999px;
  padding: 1px 6px;
}
.rail-tab .unread { background: var(--tomato); color: #160a06; }
.rail-close {
  display: none;
  margin-left: auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  background: none;
  color: var(--ivory-2);
}

.rail-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--carbon-3) transparent;
}
.rail-panel::-webkit-scrollbar { width: 6px; }
.rail-panel::-webkit-scrollbar-thumb { background: var(--carbon-3); border-radius: 3px; }

.host-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--carbon);
}
.host-card[data-state="online"] { border-color: rgba(142, 240, 182, 0.25); }
.host-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  color: var(--ivory-2);
}
.host-card[data-state="online"] .host-icon { color: var(--mint); border-color: rgba(142, 240, 182, 0.24); }
.host-card > div { min-width: 0; }
.host-card b { display: block; font-size: 12px; font-weight: 600; }
.host-card small { display: block; margin-top: 2px; font-size: 10px; color: var(--ivory-3); }
.host-state {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--ivory-3);
}
.host-card[data-state="online"] .host-state { color: var(--mint); }

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 1px 7px;
}
.capacity-bar { height: 2px; background: var(--edge); overflow: hidden; }
.capacity-bar span { display: block; width: 0%; height: 100%; background: var(--sky); transition: width 400ms var(--ease), background 200ms ease; }
.capacity-bar span.is-near { background: var(--butter); }
.capacity-bar span.is-full { background: var(--tomato); }
.capacity-note { margin: 7px 1px 0; font-size: 10px; color: var(--ivory-3); }

.player-list { margin-top: 8px; }
.player {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 3px;
  border-radius: 5px;
}
.player:hover { background: rgba(242, 238, 229, 0.03); }
.player-avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  color: #0b0c0e;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
}
.player-name {
  min-width: 0;
  font-size: 11.5px;
  color: var(--ivory-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-name b { color: var(--ivory); font-weight: 500; }
.player-you { color: var(--ivory-3); font-size: 9px; }
.player-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  color: var(--tomato);
  border: 1px solid rgba(255, 77, 46, 0.28);
  border-radius: 999px;
  padding: 2px 6px;
  white-space: nowrap;
}
.player-badge.queued { color: var(--butter); border-color: rgba(255, 212, 71, 0.3); }
.player-badge.host { color: var(--mint); border-color: rgba(142, 240, 182, 0.3); }

.queue-box { margin-top: 18px; }
.queue-box .rail-heading { margin-top: 0; }
.queue-list { list-style: none; margin: 0; padding: 0; counter-reset: q; }
.queue-list li {
  counter-increment: q;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: 10.5px;
  color: var(--ivory-2);
}
.queue-list li::before {
  content: counter(q);
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--carbon-3);
  font-family: var(--mono);
  font-size: 8px;
  color: var(--ivory-3);
}
.queue-list li.mine { color: var(--butter); }

/* chat --------------------------------------------------------------------- */

.rail-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 13px; scrollbar-width: thin; }
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-thumb { background: var(--carbon-3); border-radius: 3px; }
.chat-msg { margin: 0 0 10px; font-size: 11.5px; line-height: 1.5; color: var(--ivory-2); overflow-wrap: break-word; }
.chat-msg .who { display: block; font-size: 10px; font-weight: 600; margin-bottom: 1px; }
.chat-msg .when { font-family: var(--mono); font-size: 8px; color: var(--ivory-3); margin-left: 5px; font-weight: 400; }
.chat-msg.self .who { color: var(--sky); }
.chat-sys {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  color: var(--ivory-3);
}
.chat-sys b { color: var(--ivory-2); font-weight: 500; }
.chat-empty { margin: 12px 2px; font-size: 11px; color: var(--ivory-3); }
.chat-form {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 9px;
  border-top: 1px solid var(--edge);
}
.chat-form input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--edge);
  border-radius: 5px;
  background: var(--carbon);
  padding: 0 10px;
  outline: none;
  font-size: 11.5px;
}
.chat-form input:focus { border-color: var(--edge-strong); }
.chat-form input::placeholder { color: var(--ivory-3); }
.chat-form button {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--edge);
  border-radius: 5px;
  background: var(--carbon);
  color: var(--ivory-2);
}
.chat-form button:hover { background: var(--carbon-3); color: var(--ivory); }
.chat-note { margin: 0; padding: 0 10px 9px; font-size: 9px; line-height: 1.4; color: var(--ivory-3); }

.rail-foot { flex: none; padding: 10px; border-top: 1px solid var(--edge); }
.control-btn {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 1px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--edge-strong);
  border-radius: 7px;
  background: var(--ivory);
  color: var(--carbon);
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease;
}
.control-btn:hover { background: #fff; }
.control-btn:disabled { opacity: 0.45; cursor: default; }
.control-btn .control-dot {
  grid-row: 1 / 3;
  align-self: center;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cobalt);
}
.control-btn span:nth-child(2) { font-size: 11.5px; font-weight: 600; line-height: 1.3; }
.control-btn .control-sub { font-size: 9px; color: #5f6259; }
.control-btn[data-state="mine"] { background: var(--tomato); border-color: var(--tomato); color: #150a07; }
.control-btn[data-state="mine"] .control-dot { background: #150a07; }
.control-btn[data-state="mine"] .control-sub { color: rgba(21, 10, 7, 0.66); }
.control-btn[data-state="queued"] { background: var(--butter); border-color: var(--butter); color: #171204; }
.control-btn[data-state="queued"] .control-dot { background: #171204; }
.control-btn[data-state="queued"] .control-sub { color: rgba(23, 18, 4, 0.66); }
.rail-foot-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding: 0 2px; }

/* ==========================================================================
   Modal
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 6, 8, 0.7);
  backdrop-filter: blur(7px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(560px, 100%);
  max-height: min(86dvh, 760px);
  overflow-y: auto;
  padding: clamp(20px, 3vw, 30px);
  background: #faf7f0;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 9px 9px 0 var(--cobalt);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-head h2 {
  margin: 5px 0 0;
  font-family: var(--display);
  font-size: 31px;
  font-weight: 650;
  letter-spacing: -0.045em;
}
.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
}
.modal-close:hover { background: rgba(18, 20, 15, 0.06); }
.modal-lede { margin: 14px 0 20px; font-size: 12px; line-height: 1.6; color: var(--ink-2); }

.check-grid { border-top: 1px solid var(--line); }
.check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.check-name { font-size: 12px; }
.check-result { font-size: 10px; color: var(--ink-2); text-align: right; }
.check-state { display: grid; place-items: center; }
.check-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper-3);
}
.check-state[data-state="run"] i { background: var(--butter); animation: blip 1s ease-in-out infinite; }
.check-state[data-state="ok"] i { background: #19a463; }
.check-state[data-state="warn"] i { background: #d69a00; }
.check-state[data-state="fail"] i { background: var(--tomato); }
.check-verdict {
  margin-top: 18px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.check-log {
  margin: 12px 0 0;
  padding: 10px;
  max-height: 130px;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: rgba(18, 20, 15, 0.035);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.7;
  color: var(--ink-2);
  white-space: pre-wrap;
}
.modal-actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.modal-actions .btn { min-height: 42px; box-shadow: 3px 3px 0 var(--cobalt); }
.modal-actions .micro { color: var(--ink-3); }

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-stack {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 20px;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--edge-strong);
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.94);
  color: var(--ivory);
  font-size: 11px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  pointer-events: auto;
  animation: toast-in 220ms var(--ease) both;
}
.toast.is-out { animation: toast-out 180ms ease forwards; }
.toast button {
  border: 0;
  background: var(--ivory);
  color: var(--carbon);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 9px;
  font-weight: 600;
}
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0; } }
@keyframes toast-out { to { opacity: 0; translate: 0 6px; } }

/* ==========================================================================
   Motion
   ========================================================================== */

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 34px; }
  .hero h1 { font-size: clamp(56px, 9.6vw, 112px); }
  .session-body { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 52px; }
  .hero-stage { max-width: 560px; }
  .link-card { box-shadow: 10px 10px 0 var(--cobalt); }
  .join { grid-template-columns: 1fr; }
  .join-card { max-width: 560px; }
  .section-head, .network-head { grid-template-columns: 1fr; gap: 16px; align-items: start; }
  .section-head h2, .network-head h2 { margin-bottom: 6px; }
  .steps { grid-template-columns: 1fr; }
  .step, .step + .step { padding: 20px 0; border-left: 0; }
  .network-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--edge); }
  .foot { grid-template-columns: 1fr 1fr; }
  .foot p { grid-column: 1 / -1; grid-row: 2; }

  .session-body { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .rail {
    position: fixed;
    z-index: 60;
    top: 70px;
    right: 8px;
    bottom: 8px;
    width: min(370px, calc(100vw - 16px));
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    transform: translateX(calc(100% + 20px));
    transition: transform 260ms var(--ease);
  }
  .rail.open { transform: none; }
  .rail-close { display: grid; }
  #railBtnMobile { display: inline-flex; }
  .session-id .session-stat { display: none; }
}

@media (max-width: 700px) {
  .nav { gap: 14px; height: 62px; padding: 0 16px; }
  .nav-links { display: none; }
  .brand-kicker { display: none; }
  .relay-pill { padding: 6px 9px; font-size: 9px; }
  .hero { padding-top: 38px; }
  .hero h1 { font-size: clamp(52px, 15vw, 82px); }
  .hero-ledger { grid-template-columns: 1fr; margin-top: 32px; }
  .hero-ledger div, .hero-ledger div + div { padding: 10px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .hero-ledger dd { font-size: 12px; }
  .link-viz { grid-template-columns: auto 1fr auto; gap: 8px; padding: 20px 0; }
  .node { min-width: 66px; }
  .node b { font-size: 10.5px; }
  .node small { font-size: 8px; }
  .preview-scene { height: 190px; }
  .marquee-track span { font-size: 24px; }
  .join { padding: 66px 0; }
  .join h2, .section-head h2, .network h2 { font-size: clamp(34px, 9vw, 48px); }
  .join-card { box-shadow: 6px 6px 0 var(--ink); }
  .spec-row { grid-template-columns: 1fr; gap: 3px; padding: 10px 0; }
  .network-grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 15px 12px 16px 0; }
  .stat + .stat { padding-left: 12px; }
  .stat-value { font-size: 34px; }
  .foot { grid-template-columns: 1fr; padding: 28px 0 40px; }
  .foot p { grid-row: auto; }
  .foot-meta { align-items: flex-start; }
  .session-top { height: 54px; padding: 0 10px; gap: 10px; }
  .brand-dark .brand-word { display: none; }
  .room-chip { height: 30px; }
  .stage-bar { height: 40px; }
  .stream-fact { display: none; }
  .rail { top: 60px; }
  .boot-stages { gap: 14px; }
  .boot-title { font-size: 28px; }
  .boot-detail { font-size: 11px; }
}

@media (max-width: 430px) {
  .hero-actions .btn { flex: 1; }
  .hero-line { font-size: 10px; }
  .link-card { padding: 14px; }
  .link-card-foot { font-size: 8px; }
  .join-card { padding: 20px 18px; }
  #roomInput { letter-spacing: 0.2em; }
  .modal-card { box-shadow: 5px 5px 0 var(--cobalt); }
}

@media (hover: none), (pointer: coarse) {
  .touch { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .marquee-track { animation: none; }
}
