/* ============ tokens ============ */
:root {
  --bg:      oklch(96% 0.004 100);
  --surface: oklch(100% 0 0);
  --fg:      oklch(15% 0.02 100);
  --muted:   oklch(40% 0.02 100);
  --border:  oklch(15% 0.02 100);
  --accent:  oklch(60% 0.22 25);
  --accent-soft: oklch(60% 0.22 25 / 0.14);

  /* dark IDE surface inside the light brutalist chrome */
  --ide-bg:    oklch(16% 0.012 250);
  --ide-surface: oklch(20% 0.012 250);
  --ide-line:  oklch(28% 0.012 250);
  --ide-line-soft: oklch(24% 0.012 250);
  --ide-fg:    oklch(92% 0.005 80);
  --ide-muted: oklch(58% 0.012 80);
  --ide-gutter: oklch(45% 0.01 80);

  /* syntax */
  --tk-kw:   oklch(72% 0.16 285);
  --tk-fn:   oklch(85% 0.14 95);
  --tk-str:  oklch(78% 0.15 145);
  --tk-num:  oklch(78% 0.13 55);
  --tk-cm:   oklch(50% 0.012 130);
  --tk-var:  oklch(83% 0.045 235);
  --tk-mod:  oklch(78% 0.10 200);
  --tk-pn:   oklch(70% 0.005 80);

  --pass:    oklch(75% 0.17 145);
  --fail:    oklch(68% 0.22 25);

  --font-display: 'Times New Roman', 'Iowan Old Style', Georgia, serif;
  --font-body: ui-monospace, 'IBM Plex Mono', 'JetBrains Mono', Menlo, monospace;

  --top-bar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  overflow-x: hidden;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* ============ shared app top bar (landing / room / stack) ============ */
.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px 0 24px;
  height: var(--top-bar-h);
  border-bottom: 1.5px solid var(--border);
  background: var(--surface);
  position: relative;
  z-index: 10;
}
.app-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.app-mark .word {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.app-mark .word em { color: var(--accent); font-style: italic; }
.app-mark .tag {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  padding-inline-start: 14px;
  border-inline-start: 1.5px solid var(--border);
  font-weight: 700;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
}
.app-mark:hover .word { color: var(--accent); }
.app-mark:hover .word em { color: var(--fg); }
.app-top-meta {
  display: flex;
  align-items: stretch;
  gap: 18px;
  height: 100%;
}
.app-step {
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-inline-end: 1.5px solid var(--border);
  padding-inline-end: 18px;
}
.app-step b { color: var(--fg); }
.app-step .of { color: var(--muted); opacity: 0.6; }
.app-cta {
  background: var(--fg);
  color: var(--surface);
  border: 1.5px solid var(--fg);
  padding: 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: inherit;
  align-self: center;
  height: 36px;
}
.app-cta:hover { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.app-cta .arrow { font-family: var(--font-display); font-size: 18px; line-height: 1; font-weight: 400; letter-spacing: 0; }
.app-link {
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: center;
}
.app-link:hover { color: var(--accent); }

/* ============ SCREEN 1 — Room create ============ */
.s1 {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 1fr) minmax(280px, 0.62fr);
  gap: 0;
  min-height: calc(100vh - var(--top-bar-h));
}
.s1 .present {
  padding: 72px 56px 56px;
  border-inline-end: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: calc(100vh - var(--top-bar-h));
  background: var(--bg);
}
.s1 .create {
  padding: 72px 48px 56px;
  min-height: calc(100vh - var(--top-bar-h));
  background: var(--surface);
  border-inline-end: 1.5px solid var(--border);
  display: flex;
  align-items: flex-start;
}
.s1 .join {
  padding: 72px 40px 56px;
  min-height: calc(100vh - var(--top-bar-h));
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 28px;
}
.eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 14px;
}
.eyebrow .dot {
  width: 9px; height: 9px;
  background: var(--accent);
  display: inline-block;
}
.eyebrow .rule { flex: 1; border-top: 1.5px solid var(--border); }
.hero {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(60px, 8.6vw, 148px);
  line-height: 0.9;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0;
}
.hero em { font-style: italic; color: var(--accent); }
.lead {
  max-width: 48ch;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg);
}
.lead .accent-dash { color: var(--accent); }

/* small join card title — sibling-but-quieter to the new-room form */
.s1 .join h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1;
  margin: 0 0 4px;
}
.s1 .join .join-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 32ch;
  margin: 0 0 8px;
}
.s1 .join .or-rule {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.s1 .join .or-rule::before,
.s1 .join .or-rule::after { content: ''; flex: 1; border-top: 1.5px dashed var(--border); }
.s1 .join .code-input {
  font-family: var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.s1 .join .btn-secondary {
  background: var(--fg);
  color: var(--surface);
  border: 1.5px solid var(--fg);
  padding: 14px 18px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11.5px;
  font-weight: 700;
  text-align: start;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-decoration: none;
  font-family: inherit;
}
.s1 .join .btn-secondary:hover { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.s1 .join .btn-secondary .arrow { font-family: var(--font-display); font-size: 22px; line-height: 1; font-weight: 400; letter-spacing: 0; }
.s1 .join .recent {
  margin-top: auto;
  align-self: stretch;
  border-top: 1.5px solid var(--border);
  padding-top: 18px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.s1 .join .recent .lbl {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 4px;
}
.s1 .join .recent a {
  display: flex;
  justify-content: space-between;
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--fg);
}
.s1 .join .recent a:last-child { border-bottom: none; }
.s1 .join .recent a:hover { color: var(--accent); }
.s1 .join .recent .code-chip { color: var(--muted); letter-spacing: 0.1em; }

.form { display: flex; flex-direction: column; gap: 26px; width: 100%; max-width: 480px; }
.form-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 14px; border-bottom: 1.5px solid var(--border); }
.form-head h3 { font-family: var(--font-display); font-weight: 400; font-size: 38px; line-height: 1; margin: 0; }
.form-head .num { font-family: var(--font-display); font-size: 32px; color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field .lbl {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input[type="text"] {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--fg);
  padding: 13px 14px;
  font-size: 14px;
  outline: none;
}
.field input[type="text"]:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.radios { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--border); }
.radios label {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--fg);
  border-inline-end: 1.5px solid var(--border);
  background: transparent;
}
.radios label:last-child { border-inline-end: none; }
.radios input { appearance: none; width: 12px; height: 12px; border: 1.5px solid var(--border); flex: 0 0 12px; background: transparent; }
.radios input:checked { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.radios label:has(input:checked) { background: var(--bg); color: var(--fg); }

.btn-primary {
  background: var(--accent);
  color: var(--surface);
  border: 1.5px solid var(--accent);
  padding: 16px 20px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 700;
  text-align: start;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-decoration: none;
}
.btn-primary:hover { background: var(--fg); border-color: var(--fg); color: var(--surface); }
.btn-primary .arrow { font-family: var(--font-display); font-size: 24px; line-height: 1; font-weight: 400; letter-spacing: 0; }

/* ============ SCREEN 2 — template picker ============ */
.s2 { padding: 56px 64px 56px; min-height: calc(100vh - var(--top-bar-h)); }
.s2 .header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1.5px solid var(--border);
}
.s2 h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(72px, 10vw, 156px);
  line-height: 0.92;
  letter-spacing: -0.025em;
  margin: 12px 0 0;
}
.s2 h2 em { font-style: italic; color: var(--accent); }
.s2 .sub {
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: 16px;
}
.s2 .step-tag {
  text-align: end;
  font-family: var(--font-display);
  font-size: clamp(60px, 8vw, 96px);
  line-height: 0.9;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.s2 .step-tag span { color: var(--fg); }

/* ============ stack filter bar (collapsible) ============ */
.filter-wrap { margin-bottom: 22px; }
.filter-wrap[data-expanded="true"] .filter-pill { display: none; }
.filter-wrap[data-expanded="false"] .filter-bar { display: none; }
.filter-pill {
  background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 9px 14px;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 3px 3px 0 var(--border);
  cursor: pointer;
}
.filter-pill:hover { background: var(--accent); color: var(--surface); border-color: var(--accent); box-shadow: 3px 3px 0 var(--fg); }
.filter-pill svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }
.filter-bar {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--border);
}
.filter-bar .filter-label {
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  border-inline-end: 1.5px solid var(--border);
  font-weight: 700;
  gap: 8px;
}
.filter-bar .filter-label svg { width: 12px; height: 12px; stroke: var(--accent); stroke-width: 2; fill: none; }
.filter-bar input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 16px;
  color: var(--fg);
  font-size: 13.5px;
  outline: none;
  font-family: var(--font-body);
  min-width: 0;
}
.filter-bar input::placeholder { color: var(--muted); letter-spacing: 0; text-transform: none; }
.filter-bar .filter-reset,
.filter-bar .filter-close {
  background: transparent;
  border: none;
  border-inline-start: 1.5px solid var(--border);
  padding: 0 16px;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--muted);
  font-family: var(--font-body);
  display: flex; align-items: center;
  cursor: pointer;
}
.filter-bar .filter-reset:hover,
.filter-bar .filter-close:hover { color: var(--accent); background: var(--bg); }
.filter-bar .filter-close { font-size: 18px; padding: 0 16px; font-family: var(--font-display); }
.stack-count {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  display: block;
}
.stack-count b { color: var(--fg); }
.stack-count.empty { color: var(--accent); }

.stack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block-start: 1.5px solid var(--border);
  border-inline-start: 1.5px solid var(--border);
}
.stack.hidden { display: none; }
.stack {
  border-block-end: 1.5px solid var(--border);
  border-inline-end: 1.5px solid var(--border);
  padding: 32px 28px 24px;
  background: var(--surface);
  position: relative;
  cursor: pointer;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  min-height: 296px;
  transition: background 120ms ease;
}
.stack:hover { background: var(--bg); }
.stack.selected { background: var(--bg); }
.stack.selected::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border: 3px solid var(--accent);
  pointer-events: none;
  z-index: 2;
}
.stack .head { display: flex; justify-content: space-between; align-items: baseline; }
.stack .lang {
  font-family: var(--font-display);
  font-size: 96px;
  line-height: 0.88;
  font-weight: 400;
  letter-spacing: -0.04em;
}
.stack .lang em { font-style: italic; color: var(--accent); }
.stack .num-tag {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.stack .name {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11.5px;
  color: var(--fg);
  font-weight: 700;
}
.stack .name .runner { color: var(--muted); font-weight: 400; }
.stack .files {
  font-size: 11px;
  color: var(--fg);
  border-top: 1.5px dashed var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.5;
}
.stack .files .meta { color: var(--muted); margin-bottom: 6px; letter-spacing: 0.1em; }
.stack .files .f { color: var(--fg); }
.stack .files .f .x { color: var(--muted); }

/* in-card "Start coding" reveal — appears only on selected card */
.stack .start-coding {
  position: absolute;
  inset-inline-end: 16px;
  bottom: 16px;
  background: var(--accent);
  color: var(--surface);
  border: 1.5px solid var(--accent);
  padding: 9px 14px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  z-index: 3;
  box-shadow: 3px 3px 0 var(--fg);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease, background 120ms ease, box-shadow 120ms ease;
  cursor: pointer;
}
.stack.selected .start-coding { opacity: 1; transform: translateY(0); pointer-events: auto; }
.stack .start-coding:hover { background: var(--fg); border-color: var(--fg); box-shadow: 5px 5px 0 var(--accent); }
.stack .start-coding .arrow { font-family: var(--font-display); font-size: 18px; line-height: 1; font-weight: 400; letter-spacing: 0; }
/* keep card .name from peeking under the floating button */
.stack.selected .name .runner { opacity: 0.35; }

.s2 .footer {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.s2 .footer-meta {
  flex: 1;
  margin-inline: 24px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.s2 .footer-meta b { color: var(--fg); }

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--border);
  padding: 14px 20px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
}
.btn-ghost:hover { background: var(--fg); color: var(--surface); }

/* ============ SCREEN 3 — editor ============ */
.s3 {
  height: 100vh;
  display: grid;
  grid-template-rows: 60px 1fr 30px;
  background: var(--bg);
}

/* top bar */
.ide-top {
  display: grid;
  grid-template-columns: minmax(340px, auto) 1fr auto;
  align-items: stretch;
  border-bottom: 1.5px solid var(--border);
  background: var(--surface);
}
.ide-room {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  border-inline-end: 1.5px solid var(--border);
}
.ide-room .mark {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.ide-room .mark em { color: var(--accent); font-style: italic; }
.ide-room .room-meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  line-height: 1.5;
  color: var(--muted);
  border-inline-start: 1.5px solid var(--border);
  padding-inline-start: 16px;
}
.ide-room .room-meta b { display: block; color: var(--fg); font-weight: 700; letter-spacing: 0.14em; font-size: 11px; }

.ide-toolbar { display: flex; align-items: stretch; justify-content: center; }
.tool-btn {
  background: transparent;
  color: var(--fg);
  border: none;
  border-inline-end: 1.5px solid var(--border);
  padding: 0 26px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11.5px;
  font-weight: 700;
}
.tool-btn:first-of-type { border-inline-start: 1.5px solid var(--border); }
.tool-btn .glyph { display: inline-block; }
.tool-btn .glyph.run {
  width: 0; height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent var(--fg);
}
.tool-btn .glyph.build { width: 10px; height: 10px; border: 1.5px solid var(--fg); }
.tool-btn .glyph.test { width: 10px; height: 10px; background: var(--fg); transform: rotate(45deg); }
.tool-btn .kbd {
  margin-inline-start: 10px;
  font-size: 9px;
  color: var(--muted);
  border: 1.5px solid var(--border);
  padding: 1px 5px;
  letter-spacing: 0.05em;
  font-weight: 400;
}
.tool-btn:hover { background: var(--bg); }
.tool-btn.test-active {
  background: var(--fg);
  color: var(--surface);
}
.tool-btn.test-active .glyph.test { background: var(--surface); }
.tool-btn.test-active .glyph.run { border-color: transparent transparent transparent var(--surface); }
.tool-btn.test-active .glyph.build { border-color: var(--surface); }
.tool-btn.test-active .kbd { color: var(--surface); border-color: var(--surface); opacity: 0.7; }

.ide-presence {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border-inline-start: 1.5px solid var(--border);
}
.avatars { display: flex; }
.avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  margin-inline-start: -8px;
  position: relative;
}
.avatar:first-child { margin-inline-start: 0; }
.avatar.live::after {
  content: '';
  position: absolute;
  width: 9px; height: 9px;
  background: var(--pass);
  border: 1.5px solid var(--surface);
  right: -3px; bottom: -3px;
}
.avatar.idle { color: var(--muted); opacity: 0.7; }
.avatar.k1 { background: oklch(82% 0.16 90); }
.avatar.k2 { background: oklch(78% 0.13 200); }
.avatar.k3 { background: oklch(80% 0.15 30); }
.avatar.k4 { background: oklch(78% 0.12 285); }
.presence-count {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  line-height: 1.3;
}
.presence-count b { color: var(--fg); display: block; font-size: 14px; font-family: var(--font-display); font-weight: 400; letter-spacing: 0; }
.invite-btn {
  background: var(--fg);
  color: var(--surface);
  border: 1.5px solid var(--fg);
  padding: 9px 14px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.invite-btn:hover { background: var(--accent); border-color: var(--accent); }
.invite-btn .plus { font-size: 14px; font-weight: 400; line-height: 1; }

/* IDE main grid */
.ide-main {
  display: grid;
  grid-template-columns: var(--files-w, 252px) 1fr var(--term-w, 400px);
  min-height: 0;
}
body.files-collapsed .ide-main { --files-w: 44px; }
body.term-collapsed .ide-main { --term-w: 44px; }

/* file panel */
.file-panel {
  border-inline-end: 1.5px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-header {
  padding: 0 14px;
  border-bottom: 1.5px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  flex: 0 0 40px;
}
.panel-header .label b { color: var(--fg); font-weight: 700; }
.panel-header .actions { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  background: transparent;
  border: 1.5px solid transparent;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1;
  font-family: var(--font-body);
}
.icon-btn:hover { color: var(--fg); border-color: var(--border); }
.icon-btn.collapse { font-family: var(--font-display); font-size: 16px; padding: 0 6px; }
.file-tree { flex: 1; padding: 10px 4px; overflow: auto; }
.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--fg);
  user-select: none;
}
.file-row:hover { background: var(--bg); }
.file-row.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.file-row .glyph {
  font-family: var(--font-body);
  font-size: 9px;
  color: var(--muted);
  width: 16px;
  flex: 0 0 16px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.file-row .glyph svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: square; stroke-linejoin: miter; }
.file-row.folder { color: var(--fg); font-weight: 700; }
.file-row.folder .glyph { color: var(--accent); }
.file-row.selected .glyph { color: var(--accent); }
.file-row.depth-1 { padding-inline-start: 26px; }
.file-row .dot { color: var(--accent); font-size: 14px; line-height: 0.5; margin-inline-start: auto; opacity: 0; }
.file-row.dirty .dot { opacity: 1; }
.file-sep { height: 8px; }
body.files-collapsed .file-panel .file-tree,
body.files-collapsed .file-panel .panel-header .label,
body.files-collapsed .file-panel .panel-header .actions .new { display: none; }

/* editor */
.editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--ide-bg);
  color: var(--ide-fg);
  min-width: 0;
  overflow: hidden;
}
.tab-bar {
  display: flex;
  border-bottom: 1.5px solid var(--ide-line);
  background: var(--ide-bg);
  min-height: 40px;
  align-items: stretch;
}
.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  font-size: 12px;
  color: var(--ide-muted);
  border-inline-end: 1px solid var(--ide-line);
  cursor: pointer;
  user-select: none;
}
.tab.active {
  color: var(--ide-fg);
  background: var(--ide-surface);
  box-shadow: inset 0 2px 0 var(--accent);
}
.tab .close { color: var(--ide-muted); font-size: 14px; margin-inline-start: 4px; }
.tab .close:hover { color: var(--ide-fg); }
.tab .dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; opacity: 0; }
.tab.dirty .dot { opacity: 1; }
.tab-spacer { flex: 1; border-inline-end: 1px solid var(--ide-line); }
.tab-meta { display: flex; align-items: center; padding: 0 14px; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ide-muted); gap: 12px; }

.editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: 58px 1fr;
  overflow: auto;
  background: var(--ide-bg);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.65;
}
.editor-body .lines {
  text-align: end;
  color: var(--ide-gutter);
  padding: 16px 12px 24px 8px;
  user-select: none;
  background: var(--ide-bg);
  border-inline-end: 1px solid var(--ide-line-soft);
  font-variant-numeric: tabular-nums;
}
.editor-body .lines span { display: block; }
.editor-body .lines span.active { color: var(--ide-fg); }
.editor-body .code {
  padding: 16px 0 24px 16px;
  color: var(--ide-fg);
  position: relative;
  min-width: 0;
}
.code .line {
  display: block;
  min-height: 1.65em;
  padding-inline-end: 24px;
  white-space: pre;
}
.code .line.active { background: oklch(22% 0.012 250); }
.code .cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--ide-fg);
  vertical-align: -2px;
  animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.peer-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: oklch(82% 0.16 90);
  vertical-align: -2px;
  position: relative;
}
.peer-cursor::after {
  content: 'mira';
  position: absolute;
  top: -16px;
  inset-inline-start: -2px;
  background: oklch(82% 0.16 90);
  color: var(--ide-bg);
  padding: 1px 5px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

/* syntax */
.tk-kw  { color: var(--tk-kw); }
.tk-fn  { color: var(--tk-fn); }
.tk-str { color: var(--tk-str); }
.tk-num { color: var(--tk-num); }
.tk-cm  { color: var(--tk-cm); font-style: italic; }
.tk-var { color: var(--tk-var); }
.tk-mod { color: var(--tk-mod); }
.tk-pn  { color: var(--tk-pn); }

/* terminal panel */
.term-panel {
  border-inline-start: 1.5px solid var(--border);
  background: var(--ide-bg);
  color: var(--ide-fg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.term-tabs {
  display: flex;
  background: var(--ide-bg);
  border-bottom: 1.5px solid var(--ide-line);
  height: 40px;
  align-items: stretch;
}
.term-tab {
  background: transparent;
  color: var(--ide-muted);
  border: none;
  border-inline-end: 1px solid var(--ide-line);
  padding: 0 14px;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.term-tab.active { color: var(--ide-fg); background: var(--ide-surface); box-shadow: inset 0 2px 0 var(--accent); }
.term-tab .count {
  background: var(--fail);
  color: var(--ide-bg);
  padding: 1px 5px;
  font-size: 9px;
  letter-spacing: 0.04em;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}
.term-tab.pass .count { background: var(--pass); }
.term-tab-spacer { flex: 1; border-inline-end: 1px solid var(--ide-line); }
.term-tab-meta { display: flex; align-items: center; padding: 0 14px; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ide-muted); }

.term-body {
  flex: 1;
  padding: 14px 16px 18px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.65;
  overflow: auto;
  background: var(--ide-bg);
  color: oklch(82% 0.005 100);
}
.term-body .ln { display: block; white-space: pre-wrap; }
.term-body .pass  { color: var(--pass); }
.term-body .fail  { color: var(--fail); }
.term-body .dim   { color: var(--ide-muted); }
.term-body .hl    { color: var(--ide-fg); font-weight: 700; }
.term-body .accent { color: var(--accent); }
.term-body .cmd::before { content: '$ '; color: var(--ide-muted); }
.term-body .cmd { color: var(--ide-fg); }
.term-body .check { color: var(--pass); }
.term-body .cross { color: var(--fail); }
.term-body .arrow-row::before { content: '› '; color: var(--accent); }

.term-section { margin-top: 10px; }
.term-section .label {
  display: inline-block;
  background: var(--fail);
  color: var(--ide-bg);
  padding: 1px 7px;
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 700;
  text-transform: uppercase;
}
.term-section .label.pass-tag { background: var(--pass); }
.term-section .heading { color: var(--ide-fg); margin-inline-start: 8px; }
.term-running {
  display: flex; align-items: center; gap: 10px;
  color: var(--accent);
  font-weight: 700;
  margin-top: 14px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}
.term-running .blob {
  width: 8px; height: 8px;
  background: var(--accent);
  animation: pulse 0.9s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.4; transform: scale(0.85);} 50% { opacity: 1; transform: scale(1.1);} }

body.term-collapsed .term-panel .term-tabs { display: none; }
body.term-collapsed .term-panel .term-body { display: none; }
body.term-collapsed .term-panel { position: relative; }
body.term-collapsed .term-panel::before {
  content: 'OUTPUT';
  position: absolute;
  top: 18px;
  inset-inline-start: 0;
  inset-inline-end: 0;
  text-align: center;
  color: var(--ide-fg);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  height: 200px;
  margin: 0 auto;
}

/* status bar */
.ide-status {
  background: var(--fg);
  color: var(--bg);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 20px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
}
.ide-status .seg { display: flex; gap: 8px; align-items: center; }
.ide-status .seg::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--bg);
  opacity: 0.5;
  flex: 0 0 7px;
}
.ide-status .seg.tdd-idle::before { background: var(--bg); opacity: 0.5; }
.ide-status .seg.tdd-red::before { background: var(--accent); opacity: 1; }
.ide-status .seg.tdd-green::before { background: var(--pass); opacity: 1; }
.ide-status .seg.tdd-running::before { background: var(--accent); opacity: 0.8; }
.ide-status .seg.ws::before { background: var(--pass); opacity: 1; }
.ide-status .sep { opacity: 0.3; }
.ide-status .right { margin-inline-start: auto; display: flex; gap: 20px; }

/* invite popover */
.invite-pop {
  display: none;
  position: fixed;
  top: 72px;
  inset-inline-end: 14px;
  z-index: 900;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: 4px 4px 0 var(--border);
  padding: 18px 20px;
  width: 360px;
  font-size: 12px;
}
.invite-pop.open { display: block; }
.invite-pop .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.invite-pop .title { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.invite-pop .lbl { text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.invite-pop .share-row { border: 1.5px solid var(--border); padding: 10px 12px; display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.invite-pop .share-row .url { color: var(--fg); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-pop .share-row .copy { background: var(--accent); color: var(--surface); border: none; padding: 5px 10px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 10px; font-weight: 700; }
.invite-pop input[type="text"] { width: 100%; border: 1.5px solid var(--border); background: transparent; color: var(--fg); padding: 10px 12px; font-size: 13px; }

/* ============ editor logo-as-link ============ */
.ide-room .mark a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
}
.ide-room .mark a:hover em { color: var(--accent); }
.ide-room .mark a:hover { color: var(--accent); }

/* ============ watch toggle (toolbar) ============ */
.watch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border-inline-end: 1.5px solid var(--border);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.watch-toggle input { display: none; }
.watch-toggle .box {
  width: 13px; height: 13px;
  border: 1.5px solid var(--border);
  background: transparent;
  display: inline-block;
  position: relative;
  flex: 0 0 13px;
}
.watch-toggle input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}
.watch-toggle input:checked + .box::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: var(--surface);
}
.watch-toggle:hover { color: var(--fg); }
.watch-toggle:hover .box { border-color: var(--fg); }
.watch-toggle.on { color: var(--fg); }

/* ============ settings button (top right) ============ */
.settings-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--fg);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-inline-start: 6px;
}
.settings-btn svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.5; fill: none; }
.settings-btn:hover { background: var(--accent); color: var(--surface); border-color: var(--accent); }

/* ============ settings modal ============ */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(15% 0.02 100 / 0.55);
  z-index: 1100;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 24px;
  overflow: auto;
}
.settings-overlay.open { display: flex; }
.settings-modal {
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: 6px 6px 0 var(--border);
  width: 760px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}
.settings-modal .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid var(--border);
  padding: 16px 22px;
}
.settings-modal .head .title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1;
}
.settings-modal .head .title em { color: var(--accent); font-style: italic; }
.settings-modal .head .close {
  background: transparent;
  border: 1.5px solid transparent;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 24px;
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}
.settings-modal .head .close:hover { color: var(--accent); border-color: var(--border); }
.settings-modal .tabs {
  display: flex;
  border-bottom: 1.5px solid var(--border);
}
.settings-modal .tab-btn {
  background: transparent;
  border: none;
  border-inline-end: 1.5px solid var(--border);
  padding: 13px 22px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-modal .tab-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.5; fill: none; }
.settings-modal .tab-btn.active {
  color: var(--fg);
  background: var(--bg);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.settings-modal .tab-btn:hover { color: var(--fg); }
.settings-modal .body {
  padding: 22px 24px 8px;
  overflow: auto;
  max-height: 60vh;
}
.settings-modal .panel { display: none; }
.settings-modal .panel.active { display: block; }
.settings-modal .group-h {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent);
  margin: 20px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-modal .group-h:first-child { margin-top: 0; }
.settings-modal .group-h .rule { flex: 1; border-top: 1.5px dashed var(--border); }
.settings-modal .row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
  align-items: center;
}
.settings-modal .row:last-child { border-bottom: none; }
.settings-modal .row .label-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-modal .row .label-col .lbl {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10.5px;
  color: var(--fg);
  font-weight: 700;
}
.settings-modal .row .label-col .hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.settings-modal input[type="text"],
.settings-modal input[type="email"],
.settings-modal input[type="number"],
.settings-modal select {
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  width: 100%;
}
.settings-modal input[type="text"]:focus,
.settings-modal input[type="email"]:focus,
.settings-modal input[type="number"]:focus,
.settings-modal select:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.settings-modal input.cmd {
  font-family: var(--font-body);
  letter-spacing: 0.02em;
}
.settings-modal input[readonly] { color: var(--muted); background: transparent; }
.settings-modal .swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-modal .swatch {
  width: 28px; height: 28px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  position: relative;
  background: var(--c, var(--accent));
}
.settings-modal .swatch.active::after {
  content: '';
  position: absolute;
  inset: -5px;
  border: 1.5px solid var(--fg);
  pointer-events: none;
}
.settings-modal .num-with-suffix {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-modal .num-with-suffix input { width: 80px; }
.settings-modal .num-with-suffix .suffix {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.settings-modal .switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.settings-modal .switch-row input { display: none; }
.settings-modal .switch-row .box {
  width: 13px; height: 13px;
  border: 1.5px solid var(--border);
  background: transparent;
  display: inline-block;
  position: relative;
}
.settings-modal .switch-row input:checked + .box { background: var(--accent); border-color: var(--accent); }
.settings-modal .switch-row input:checked + .box::after {
  content: ''; position: absolute; inset: 2px; background: var(--surface);
}
.settings-modal .switch-row input:checked ~ .lbl { color: var(--fg); }
.settings-modal .actions {
  border-top: 1.5px solid var(--border);
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.settings-modal .actions button {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 11px;
  font-weight: 700;
  padding: 11px 18px;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1.5px solid var(--border);
}
.settings-modal .actions .cancel { background: transparent; color: var(--fg); }
.settings-modal .actions .save { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.settings-modal .actions .cancel:hover { background: var(--fg); color: var(--surface); border-color: var(--fg); }
.settings-modal .actions .save:hover { background: var(--fg); border-color: var(--fg); }

/* ============ resizable column handles ============ */
.ide-main { position: relative; }
.resize-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 6px;
  background: transparent;
  cursor: col-resize;
  z-index: 5;
}
.resize-handle.left { inset-inline-start: var(--files-w, 252px); transform: translateX(-3px); }
.resize-handle.right { inset-inline-end: var(--term-w, 400px); transform: translateX(3px); }
.resize-handle::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 100ms ease;
}
.resize-handle:hover::after,
.resize-handle.dragging::after { background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe, body.resizing .editor-body { pointer-events: none; }
body.files-collapsed .resize-handle.left { display: none; }
body.term-collapsed .resize-handle.right { display: none; }

/* ============ LANDING PAGE ============ */
.landing {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--top-bar-h));
}

/* hero */
.land-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.85fr);
  border-bottom: 1.5px solid var(--border);
}
.land-hero .hero-main {
  padding: 80px 64px 72px;
  border-inline-end: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--bg);
}
.land-hero .hero-eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 14px;
}
.land-hero .hero-eyebrow .dot { width: 9px; height: 9px; background: var(--accent); display: inline-block; }
.land-hero .hero-eyebrow .rule { flex: 1; border-top: 1.5px solid var(--border); max-width: 240px; }
.land-hero .hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(64px, 9.4vw, 168px);
  line-height: 0.88;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--fg);
}
.land-hero .hero-title em { font-style: italic; color: var(--accent); }
.land-hero .hero-title .quiet { color: var(--muted); }
.land-hero .hero-lead {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--fg);
  max-width: 54ch;
  margin: 0;
}
.land-hero .hero-lead em { font-style: italic; color: var(--accent); }
.land-hero .hero-ctas {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.land-hero .hero-ctas .btn-primary { width: auto; padding: 18px 22px; display: inline-flex; gap: 32px; min-width: 280px; }
.land-hero .hero-ctas .btn-ghost { padding: 16px 20px; }
.land-hero .hero-meta {
  margin-top: auto;
  padding-top: 26px;
  border-top: 1.5px dashed var(--border);
  display: flex;
  gap: 32px;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  flex-wrap: wrap;
}
.land-hero .hero-meta b { color: var(--fg); display: block; font-family: var(--font-display); font-size: 22px; letter-spacing: -0.01em; font-weight: 400; margin-bottom: 4px; }

.land-hero .hero-side {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  padding: 48px 44px 44px;
  gap: 18px;
}
.land-hero .hero-side .side-h {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
}
.land-hero .hero-side .side-h .dot { width: 8px; height: 8px; background: var(--accent); }
.land-hero .hero-side .side-h .rule { flex: 1; border-top: 1.5px solid var(--border); }
.land-hero .hero-side .side-cap {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}
.land-hero .hero-side .side-cap b { color: var(--fg); }

.land-term {
  background: var(--ide-bg);
  color: var(--ide-fg);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.7;
  padding: 18px 20px;
  border: 1.5px solid var(--fg);
  box-shadow: 5px 5px 0 var(--fg);
  flex: 1;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
.land-term .term-top {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px dashed var(--ide-line);
  padding-bottom: 10px;
  margin-bottom: 12px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ide-muted);
  font-weight: 700;
}
.land-term .term-top .dot { width: 7px; height: 7px; background: var(--pass); }
.land-term .ln { display: block; white-space: pre-wrap; }
.land-term .cmd::before { content: '$ '; color: var(--ide-muted); }
.land-term .cmd { color: var(--ide-fg); }
.land-term .dim { color: var(--ide-muted); }
.land-term .fail { color: var(--fail); }
.land-term .pass { color: var(--pass); }
.land-term .hl   { color: var(--ide-fg); font-weight: 700; }
.land-term .lbl  { display: inline-block; padding: 1px 6px; font-size: 9.5px; letter-spacing: 0.14em; font-weight: 700; text-transform: uppercase; color: var(--ide-bg); }
.land-term .lbl.fail { background: var(--fail); }
.land-term .lbl.pass { background: var(--pass); }
.land-term .arrow-row::before { content: '› '; color: var(--accent); }

/* the loop */
.land-loop { padding: 80px 64px; border-bottom: 1.5px solid var(--border); background: var(--bg); }
.section-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
  margin-bottom: 44px;
  padding-bottom: 22px;
  border-bottom: 1.5px solid var(--border);
}
.section-head .h-eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: flex; align-items: center; gap: 14px;
}
.section-head .h-eyebrow .dot { width: 9px; height: 9px; background: var(--accent); }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(56px, 7.4vw, 108px);
  line-height: 0.9;
  margin: 14px 0 0;
  letter-spacing: -0.022em;
}
.section-head h2 em { font-style: italic; color: var(--accent); }
.section-head .h-aside {
  text-align: end;
  font-family: var(--font-display);
  font-size: clamp(40px, 5.4vw, 72px);
  line-height: 0.9;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.section-head .h-aside .of { color: var(--fg); }

.loop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block-start: 1.5px solid var(--border);
  border-inline-start: 1.5px solid var(--border);
}
.phase {
  border-block-end: 1.5px solid var(--border);
  border-inline-end: 1.5px solid var(--border);
  padding: 32px 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  min-height: 280px;
  position: relative;
}
.phase .num {
  font-family: var(--font-display);
  font-size: 88px;
  line-height: 0.85;
  color: var(--accent);
  font-weight: 400;
  letter-spacing: -0.04em;
}
.phase h3 {
  font-family: var(--font-display);
  font-size: 38px;
  line-height: 1;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.015em;
}
.phase h3 em { color: var(--accent); font-style: italic; }
.phase p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
  margin: 0;
  max-width: 38ch;
}
.phase .tag {
  margin-top: auto;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1.5px dashed var(--border);
  padding-top: 12px;
  font-weight: 700;
}
.phase .tag b { color: var(--fg); }
.phase .marker {
  position: absolute;
  top: 24px;
  inset-inline-end: 24px;
  width: 11px;
  height: 11px;
  background: var(--accent);
}
.phase.green .num { color: var(--pass); }
.phase.green .marker { background: var(--pass); }
.phase.green h3 em { color: var(--pass); }
.phase.refactor .num { color: var(--fg); }
.phase.refactor .marker { background: var(--fg); }
.phase.refactor h3 em { color: var(--fg); }

/* features */
.land-features { padding: 80px 64px; border-bottom: 1.5px solid var(--border); }
.feat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-block-start: 1.5px solid var(--border);
  border-inline-start: 1.5px solid var(--border);
}
.feat {
  border-block-end: 1.5px solid var(--border);
  border-inline-end: 1.5px solid var(--border);
  padding: 32px 32px 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
}
.feat:hover { background: var(--surface); }
.feat .head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--font-body);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--fg);
}
.feat .head .n { color: var(--accent); }
.feat h4 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
}
.feat h4 em { color: var(--accent); font-style: italic; }
.feat p {
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
  margin: 0;
  max-width: 42ch;
}
.feat .pill {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1.5px dashed var(--border);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.feat .pill .k { color: var(--fg); }

/* end-of-page CTA bar */
.land-cta-bar {
  background: var(--fg);
  color: var(--surface);
  padding: 56px 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.land-cta-bar .big {
  font-family: var(--font-display);
  font-size: clamp(38px, 4.8vw, 68px);
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.022em;
  max-width: 22ch;
}
.land-cta-bar .big em { color: var(--accent); font-style: italic; }
.land-cta-bar .btn-primary {
  width: auto;
  padding: 20px 26px;
  display: inline-flex;
  gap: 30px;
  background: var(--accent);
  border-color: var(--accent);
  min-width: 280px;
}
.land-cta-bar .btn-primary:hover { background: var(--surface); border-color: var(--surface); color: var(--fg); }
.land-cta-bar .secondary {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bg);
  opacity: 0.7;
  text-decoration: none;
}
.land-cta-bar .secondary:hover { opacity: 1; color: var(--accent); }

/* footer */
.land-footer {
  padding: 24px 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px 32px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  flex-wrap: wrap;
}
.land-footer a { color: var(--muted); text-decoration: none; }
.land-footer a:hover { color: var(--accent); }
.land-footer .left { display: flex; align-items: center; gap: 18px; }
.land-footer .left .mark {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-weight: 400;
  text-transform: none;
}
.land-footer .left .mark em { color: var(--accent); font-style: italic; }
.land-footer .right { display: flex; gap: 22px; }

/* small screens — keep usable */
@media (max-width: 1240px) {
  .s1 { grid-template-columns: 1.1fr 0.9fr; }
  .s1 .join { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 36px 48px; border-top: 1.5px solid var(--border); min-height: auto; }
  .s1 .join > * { flex: 1 1 220px; }
  .s1 .join .recent { flex: 1 1 100%; margin-top: 8px; }
  .land-hero { grid-template-columns: 1fr; }
  .land-hero .hero-main { border-inline-end: none; border-bottom: 1.5px solid var(--border); }
  .feat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .s1 { grid-template-columns: 1fr; }
  .s1 .present { border-inline-end: none; border-bottom: 1.5px solid var(--border); padding: 56px 32px; min-height: auto; }
  .s1 .create { padding: 56px 32px; min-height: auto; border-inline-end: none; border-bottom: 1.5px solid var(--border); }
  .s1 .join { flex-direction: column; padding: 36px 32px; }
  .s2 { padding: 40px 32px; }
  .stack-grid { grid-template-columns: 1fr 1fr; }
  .ide-main { grid-template-columns: 220px 1fr 320px; }
  .land-hero .hero-main, .land-hero .hero-side { padding: 56px 32px; }
  .land-loop, .land-features, .land-cta-bar, .land-footer { padding-inline: 32px; }
  .loop-grid { grid-template-columns: 1fr; }
  .feat-grid { grid-template-columns: 1fr; }
  .app-top { padding: 0 18px; }
  .app-mark .tag { display: none; }
  .section-head { grid-template-columns: 1fr; }
  .section-head .h-aside { text-align: start; }
}

/* ============ host integration additions ============ */
.route-screen { min-height: 100vh; }
.hidden-route { display: none !important; }
.hidden-modal { display: none !important; }

.form-note,
.stack-help,
.settings-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.room-join-form {
  width: 100%;
  max-width: 360px;
  gap: 18px;
}

.ide-toolbar .invite-btn {
  border-inline-start: 1.5px solid var(--border);
  border-inline-end: 1.5px solid var(--border);
  border-block: none;
  padding-inline: 18px;
  min-width: 138px;
  justify-content: center;
  text-decoration: none;
  border-radius: 0;
}

.ide-toolbar .invite-btn .plus {
  font-size: 16px;
}

.live-editor-body {
  display: block;
  padding: 0;
  overflow: hidden;
}

.editor-host {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 540px;
  overflow: hidden;
}

.editor-host .ace_editor,
.editor-host .ace_scroller,
.editor-host .ace_gutter {
  background: var(--ide-bg);
}

.editor-host .ace_editor {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.65;
}

.editor-host .ace_gutter {
  color: var(--ide-gutter);
  border-inline-end: 1px solid var(--ide-line);
}

.editor-host .ace_gutter-active-line,
.editor-host .ace_active-line {
  background: oklch(22% 0.012 250 / 0.92);
}

.editor-host .ace_marker-layer .ace_selection {
  background: oklch(60% 0.22 25 / 0.22);
}

.editor-host.editor-focused {
  box-shadow: inset 0 0 0 1px oklch(60% 0.22 25 / 0.48);
}

#editor-language-label {
  color: var(--accent);
}

.editor-summary-shell {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--ide-line);
  background: var(--ide-surface);
}

.result-banner {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--ide-line);
  background: var(--ide-bg);
}

.result-banner[data-status="passed"] {
  border-color: var(--pass);
}

.result-banner[data-status="failed"] {
  border-color: var(--fail);
}

.result-banner[data-status="running"] {
  border-color: var(--accent);
}

.result-banner-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--ide-line);
  color: var(--ide-fg);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  font-weight: 700;
}

.result-banner h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
  color: var(--ide-fg);
}

.result-detail,
.result-summary {
  margin: 0;
  color: var(--ide-muted);
  font-size: 11px;
  line-height: 1.6;
}

.editor-summary-grid,
.editor-timing-strip {
  margin: 0;
}

.summary-grid,
.timing-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.summary-card,
.timing-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--ide-line);
  background: var(--ide-bg);
}

.summary-card span,
.timing-card span {
  color: var(--ide-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.summary-card strong,
.timing-card strong {
  color: var(--ide-fg);
  font-size: 12px;
  font-weight: 400;
}

#output.term-body {
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stack-help {
  margin: 0 0 18px;
}

.stack button.start-coding {
  font-family: inherit;
}

.settings-overlay {
  display: flex;
}

.settings-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
}

.settings-actions .btn-secondary,
.settings-actions .btn-ghost {
  min-height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  font-weight: 700;
}

.settings-actions .btn-secondary {
  background: var(--fg);
  color: var(--surface);
}

.settings-actions .btn-ghost {
  background: transparent;
  color: var(--fg);
}

.settings-actions .btn-secondary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.settings-actions .btn-ghost:hover {
  background: var(--fg);
  color: var(--surface);
}

.provider-picks,
.provider-status-grid,
.provider-stats-grid {
  display: grid;
  gap: 10px;
}

.provider-pick,
.provider-status-card,
.provider-stats-card {
  border: 1.5px solid var(--border);
  padding: 12px;
  background: var(--surface);
}

.provider-pick {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.provider-pick strong,
.provider-status-card strong,
.provider-stats-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.provider-pick span,
.provider-status-card p,
.provider-stats-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.status-pill,
.history-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 9.5px;
  font-weight: 700;
}

.history-table-shell {
  overflow: auto;
  border: 1.5px solid var(--border);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.history-table th,
.history-table td {
  border-bottom: 1.5px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 11px;
  line-height: 1.5;
}

.history-table th {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 9.5px;
}

.history-muted,
.empty-state {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.admin-screen {
  min-height: calc(100vh - var(--top-bar-h));
  padding: 56px 64px;
  display: grid;
  gap: 28px;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1.5px solid var(--border);
}

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-actions .btn-secondary,
.admin-actions .btn-ghost,
.admin-delete-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  font-weight: 700;
  background: transparent;
  color: var(--fg);
}

.admin-actions .btn-secondary,
.admin-delete-button {
  background: var(--fg);
  color: var(--surface);
}

.admin-actions .btn-secondary:hover,
.admin-delete-button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

.admin-actions .btn-ghost:hover {
  background: var(--fg);
  color: var(--surface);
}

.admin-delete-button:disabled {
  background: transparent;
  color: var(--muted);
  cursor: not-allowed;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1.5px solid var(--border);
  border-left: 1.5px solid var(--border);
}

.admin-metrics .feat {
  min-height: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 22px;
}

.admin-panel {
  display: grid;
  gap: 16px;
}

.admin-panel .section-head {
  margin-bottom: 0;
}

.run-metrics-shell.hidden {
  display: none;
}

.file-row {
  display: grid;
  grid-template-columns: 16px 16px minmax(0, 1fr) auto;
}

.file-row .disclosure {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.file-row .disclosure svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.file-row .disclosure.hidden {
  visibility: hidden;
}

.file-row .entry-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .dirty-indicator {
  margin-inline-start: auto;
  color: var(--accent);
  opacity: 0;
}

.file-row.selected .dirty-indicator,
.file-row.dirty .dirty-indicator {
  opacity: 1;
}

.file-row.depth-2 { padding-inline-start: 42px; }
.file-row.depth-3 { padding-inline-start: 58px; }
.file-row.depth-4 { padding-inline-start: 74px; }
.file-row.depth-5 { padding-inline-start: 90px; }
.file-row.depth-6 { padding-inline-start: 106px; }

body.files-collapsed .file-panel .panel-header .actions .new,
body.files-collapsed .file-panel .panel-header .actions #delete-entry-button {
  display: none;
}

.settings-btn {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  gap: 10px;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  font-family: var(--font-body);
}

.settings-btn svg {
  width: 15px;
  height: 15px;
}

.hljs-keyword,
.hljs-literal,
.hljs-selector-tag,
.hljs-name {
  color: var(--tk-kw);
}

.hljs-title,
.hljs-title.function_,
.hljs-title.class_,
.hljs-section,
.hljs-function .hljs-title {
  color: var(--tk-fn);
}

.hljs-string,
.hljs-regexp,
.hljs-template-string {
  color: var(--tk-str);
}

.hljs-number,
.hljs-symbol,
.hljs-bullet {
  color: var(--tk-num);
}

.hljs-comment,
.hljs-quote {
  color: var(--tk-cm);
  font-style: italic;
}

.hljs-variable,
.hljs-property,
.hljs-attr,
.hljs-attribute,
.hljs-params {
  color: var(--tk-var);
}

.hljs-built_in,
.hljs-type,
.hljs-class,
.hljs-tag .hljs-name,
.hljs-meta {
  color: var(--tk-mod);
}

.hljs-punctuation,
.hljs-operator,
.hljs-subst {
  color: var(--tk-pn);
}

@media (max-width: 1200px) {
  .admin-screen {
    padding: 40px 32px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .ide-main {
    grid-template-columns: 220px 1fr;
    grid-template-rows: minmax(520px, auto) auto;
  }

  .term-panel {
    grid-column: 1 / -1;
    min-height: 420px;
  }
}

@media (max-width: 900px) {
  .admin-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .timing-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ide-main {
    grid-template-columns: 1fr;
  }

  .file-panel,
  .editor-pane,
  .term-panel {
    min-width: 0;
  }

  #editor {
    min-height: 360px;
  }
}
