:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f2f5f7;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #fff;
  --surface-muted: #eaf0f4;
  --text: #071825;
  --muted: #64727e;
  --faint: #91a0aa;
  --line: rgba(7, 24, 37, .12);
  --navy: #0b325c;
  --cyan: #19bbed;
  --cyan-bright: #49d4ff;
  --button-text: #03131e;
  --shadow: 0 30px 80px rgba(9, 38, 63, .10);
  --grid: rgba(11, 50, 92, .055);
  --success: #078466;
  --danger: #be3f4d;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #03070d;
  --surface: rgba(7, 17, 27, .89);
  --surface-solid: #08131e;
  --surface-muted: #0c1c2a;
  --text: #f2f7fb;
  --muted: #91a4b3;
  --faint: #5f7382;
  --line: rgba(181, 221, 244, .13);
  --navy: #7dbbf0;
  --cyan: #39c5f6;
  --cyan-bright: #78dfff;
  --button-text: #03131e;
  --shadow: 0 36px 100px rgba(0, 0, 0, .42);
  --grid: rgba(71, 170, 228, .055);
  --success: #5de1bd;
  --danger: #ff8791;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--bg);
  background-size: 64px 64px;
  color: var(--text);
  transition: background-color .25s ease, color .25s ease;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: radial-gradient(circle at 15% -10%, color-mix(in srgb, var(--cyan) 13%, transparent), transparent 34%);
  content: "";
  pointer-events: none;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  translate: 0 -160%;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
}
.skip-link:focus { translate: 0; }

.ambient {
  position: fixed;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  border-radius: 50%;
  pointer-events: none;
}
.ambient-one { width: 38vw; height: 38vw; min-width: 340px; min-height: 340px; top: 8vh; right: -24vw; }
.ambient-two { width: 210px; height: 210px; top: 54vh; left: -145px; }

.topbar {
  width: min(1240px, calc(100% - 48px));
  min-height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; width: clamp(12rem, 21vw, 17rem); }
.brand img { display: block; width: 100%; height: auto; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.nav-cta, .back-link, .text-link {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.nav-cta { display: inline-flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--cyan); padding: 8px 2px; }
.back-link, .text-link { color: var(--muted); }
.nav-cta:hover, .back-link:hover, .text-link:hover { color: var(--cyan); }

.preview-badge, .mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.preview-badge span, .mode span { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}
.icon-button:hover { border-color: var(--cyan); transform: rotate(5deg); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }

main { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: clamp(72px, 10vw, 136px) 0 64px; }

.hero { max-width: 830px; margin-bottom: clamp(50px, 7vw, 82px); }
.eyebrow, .section-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .19em;
  text-transform: uppercase;
}
.eyebrow span { width: 28px; height: 1px; background: var(--cyan); }
h1 { margin: 0; max-width: 820px; font-size: clamp(3.35rem, 8.4vw, 7.5rem); font-weight: 520; letter-spacing: -.072em; line-height: .91; }
h1 em { display: block; color: var(--cyan); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.hero-copy { max-width: 620px; margin: 28px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.7; }
.hero-actions { display: flex; align-items: center; gap: 24px; margin-top: 32px; }
.hero-button { min-height: 52px; text-decoration: none; }
.text-link { display: inline-flex; align-items: center; gap: 8px; }

.workspace-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 54px);
  backdrop-filter: blur(20px);
}
.card-glow { position: absolute; width: 260px; height: 260px; top: -170px; right: -100px; border-radius: 50%; background: var(--cyan); opacity: .1; filter: blur(20px); pointer-events: none; }
.hidden { display: none !important; }
.auth-pending #pair-card, .auth-pending #task-card { visibility: hidden; }

.section-heading { display: flex; align-items: center; gap: 16px; }
.section-number, .readiness-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--cyan) 45%, var(--line));
  border-radius: 50%;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
}
.section-kicker { margin: 0 0 5px; color: var(--faint); }
h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 580; letter-spacing: -.04em; }
.section-copy { max-width: 570px; margin: 24px 0; color: var(--muted); line-height: 1.6; }

.pair-form { display: flex; gap: 12px; max-width: 570px; position: relative; z-index: 6; }
.auth-form { display: grid; gap: 14px; max-width: 420px; position: relative; z-index: 6; }
.auth-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.auth-form input { min-height: 46px; border-radius: 12px; padding: 0 14px; font-size: 15px; }
.auth-error { min-height: 1.3em; margin: 0; color: var(--danger); font-size: 14px; font-weight: 650; }
#pair-connect { position: relative; z-index: 7; min-width: 160px; justify-self: start; }
input, textarea {
  outline: none;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}
select {
  appearance: none;
  width: 100%;
  min-height: 46px;
  outline: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-solid);
  color: var(--text);
  padding: 0 42px 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 18%, transparent); }
select:disabled { color: var(--faint); cursor: wait; }
input:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 18%, transparent); }
#pair-code { min-width: 0; flex: 1; border-radius: 12px; padding: 14px 17px; letter-spacing: .32em; font-weight: 700; }
#pair-code::placeholder { color: var(--faint); }

.primary-button, .secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 19px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; background: linear-gradient(120deg, var(--cyan), var(--cyan-bright)); color: var(--button-text); }
.primary-button:hover:not(:disabled), .secondary-button:hover { transform: translateY(-2px); filter: brightness(1.04); }
.primary-button:disabled { opacity: .42; cursor: wait; }
.secondary-button { border: 1px solid var(--line); background: var(--surface-muted); color: var(--text); }
.trust-note { margin: 16px 0 0; color: var(--faint); font-size: 12px; line-height: 1.5; }
.lock { color: var(--cyan); font-size: 8px; margin-right: 5px; }
[data-error]::after { display: block; margin-top: 12px; color: var(--danger); content: attr(data-error); font-size: 13px; }

.task-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.mode { color: var(--success); }
.readiness-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 32px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.readiness-item { min-width: 0; display: flex; gap: 12px; align-items: center; background: var(--surface-solid); padding: 18px; }
.readiness-icon { width: 34px; height: 34px; font-size: 9px; }
.readiness-item div { min-width: 0; display: grid; gap: 4px; }
.readiness-item small { color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.readiness-item strong { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.workspace-detail { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.task-form { position: relative; z-index: 4; display: grid; gap: 8px; margin-top: 12px; }
.task-form > label { font-size: 14px; font-weight: 750; }
.task-form-heading { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.task-form-heading > label { font-size: 14px; font-weight: 750; }
.task-mode { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); padding: 3px; }
.task-mode label { cursor: pointer; }
.task-mode input { position: absolute; opacity: 0; pointer-events: none; }
.task-mode span { display: block; border-radius: 6px; color: var(--muted); padding: 6px 11px; font-size: 12px; font-weight: 800; }
.task-mode input:checked + span { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.task-mode input:focus-visible + span { outline: 2px solid var(--cyan); }
.composer-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface-solid) 96%, transparent); box-shadow: none; backdrop-filter: blur(18px); }
textarea { display: block; width: 100%; min-height: 62px; max-height: 220px; resize: none; border: 0; background: transparent; padding: 15px 16px 6px; line-height: 1.5; }
textarea:focus { box-shadow: none; }
.composer-shell:focus-within { border-color: var(--line); box-shadow: none; }
.composer-main textarea:focus { border-color: transparent; outline: none; box-shadow: none; }
.composer-main { display: grid; grid-template-columns: auto minmax(90px, 1fr) auto auto; align-items: end; gap: 8px; padding: 7px 8px; }
.composer-main textarea { min-height: 40px; padding: 9px 5px 7px; }
.composer-attach, .composer-send { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0; }
.composer-attach { align-self: end; background: var(--surface-muted); color: var(--muted); font-size: 22px; cursor: not-allowed; }
.composer-attach:disabled { opacity: .68; }
.composer-send { align-self: end; background: var(--text); color: var(--surface-solid); font-size: 18px; font-weight: 800; cursor: pointer; transition: transform .15s ease, opacity .15s ease; }
.composer-send:hover:not(:disabled) { transform: translateY(-1px); }
.composer-send:disabled { opacity: .3; cursor: wait; }
.composer-model { align-self: center; max-width: 190px; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.composer-context { display: flex; align-items: center; gap: 13px; min-height: 34px; border-top: 1px solid var(--line); padding: 5px 9px 6px 13px; color: var(--muted); font-size: 10px; }
.composer-branch::before { margin-right: 5px; content: '⑂'; }
.composer-device::before { margin-right: 5px; content: '▱'; }
.composer-context #composer-note { margin-left: auto; color: var(--faint); }
.composer-context .task-mode { flex: 0 0 auto; }
.composer-context .task-mode span { padding: 4px 8px; font-size: 10px; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); padding: 10px; }
.composer-footer > span { padding-left: 8px; color: var(--faint); font-size: 11px; }
.composer-footer .primary-button { min-height: 42px; }
.status { margin: 0 0 8px; color: var(--navy); font-size: 13px; font-weight: 700; text-transform: capitalize; }
.events { margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; text-transform: capitalize; }
.diff { max-height: 440px; overflow: auto; margin: 20px 0 0; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--bg) 86%, var(--surface-solid)); color: var(--text); padding: 18px; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.review-actions { display: flex; gap: 10px; margin-top: 14px; }
.preview-control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 9px; margin: 10px 0 2px; border: 0; border-radius: 9px; background: transparent; padding: 7px 2px; }
.preview-state-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.preview-state-dot[data-state="ready"] { background: var(--success); box-shadow: 0 0 10px color-mix(in srgb, var(--success) 55%, transparent); }
.preview-state-dot[data-state="starting"] { background: var(--cyan); }
.preview-state-dot[data-state="failed"] { background: var(--danger); }
.preview-control > div { min-width: 0; display: grid; gap: 2px; }
.preview-control small { display: none; }
.preview-control strong { font-size: 12px; }
.preview-control div > span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.preview-control .secondary-button { min-height: 36px; display: inline-flex; align-items: center; text-decoration: none; padding: 0 13px; font-size: 11px; }
.github-control { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 4px; border-top: 1px solid var(--line); padding: 8px 0 4px; }
.github-control > div { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.github-control strong { font-size: 12px; }
.github-control span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.github-control .secondary-button { min-height: 34px; padding: 0 12px; font-size: 11px; }
.github-dialog-status { color: var(--muted); font-size: 13px; line-height: 1.5; }
.github-existing { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin: 14px 0; }
.github-existing .dialog-field { margin: 0; }
.github-retarget { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; margin: 12px 0; border: 1px solid color-mix(in srgb, var(--cyan) 35%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--cyan) 7%, var(--surface-solid)); padding: 13px 14px; }
.github-retarget p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.github-retarget button { min-width: 168px; white-space: nowrap; }
.button-spinner { width: 14px; height: 14px; flex: 0 0 auto; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: progress-spin .75s linear infinite; }
button[data-pending="true"] { display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: wait; }
.github-review { display: grid; gap: 7px; margin: 16px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); padding: 12px; }
.github-review > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; }
.github-review dt { color: var(--muted); font-size: 11px; }
.github-review dd { overflow: hidden; margin: 0; font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.progress-notice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 11px; margin: 10px 0 6px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-muted); padding: 11px 12px; }
.progress-spinner { width: 14px; height: 14px; border: 2px solid color-mix(in srgb, var(--cyan) 25%, var(--line)); border-top-color: var(--cyan); border-radius: 50%; animation: progress-spin .8s linear infinite; }
.progress-notice.complete .progress-spinner, .progress-notice.failed .progress-spinner { animation: none; border: 4px solid var(--success); }
.progress-notice.failed .progress-spinner { border-color: var(--danger); }
.progress-notice > div { display: grid; gap: 2px; }
.progress-notice strong { font-size: 12px; }
.progress-notice div span { color: var(--muted); font-size: 11px; }
.progress-notice button { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; cursor: pointer; }
.progress-notice #cancel-task { color: var(--danger); }
@keyframes progress-spin { to { rotate: 360deg; } }
@media (max-width: 620px) { .github-retarget { grid-template-columns: 1fr; } .github-retarget button { width: 100%; } }
.message-thread { display: grid; grid-template-rows: minmax(0, 1fr); grid-auto-rows: max-content; align-items: start; gap: 18px; min-height: clamp(300px, 55vh, 680px); margin-top: 2px; padding: 22px 6px 12px; }
.message-thread::before { min-height: 0; content: ''; }
.thread-empty { display: grid; place-items: center; align-content: center; gap: 5px; min-height: clamp(240px, 48vh, 580px); color: var(--muted); text-align: center; }
.thread-empty strong { color: var(--text); font-size: 16px; font-weight: 650; }
.thread-empty span { font-size: 13px; }
.thread-message { width: fit-content; max-width: min(72%, 640px); font-size: 15px; line-height: 1.45; }
.user-turn { justify-self: end; border: 1px solid color-mix(in srgb, var(--cyan) 28%, var(--line)); border-radius: 18px 18px 5px 18px; background: color-mix(in srgb, var(--cyan) 10%, var(--surface-solid)); padding: 10px 13px; white-space: pre-wrap; }
.assistant-history { justify-self: start; width: min(88%, 820px); }
.assistant-history .turn-identity { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.assistant-copy { display: grid; gap: 10px; min-width: 0; }
.assistant-prose { display: grid; gap: 10px; color: var(--text); font-size: 15px; line-height: 1.6; }
.assistant-prose h1, .assistant-prose h2, .assistant-prose h3 { margin: 4px 0 0; font-weight: 750; line-height: 1.3; }
.assistant-prose h1 { font-size: 20px; }
.assistant-prose h2 { font-size: 17px; }
.assistant-prose h3 { font-size: 15px; }
.assistant-prose p { margin: 0; }
.assistant-prose ul, .assistant-prose ol { margin: 0; padding: 0 0 0 1.2em; display: grid; gap: 6px; }
.assistant-prose li { padding-left: 2px; }
.assistant-prose code { border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); padding: 1px 6px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.assistant-prose pre { margin: 0; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); padding: 12px 14px; }
.assistant-prose pre code { border: 0; background: transparent; padding: 0; font-size: 12px; }
.assistant-prose a { color: var(--cyan); text-decoration: none; }
.assistant-prose hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.plan-location { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); padding: 10px 12px; }
.plan-location strong { font-size: 12px; }
.plan-location span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.assistant-turn { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; width: min(92%, 880px); margin: 2px 0 8px; }
.assistant-mark { width: 28px; height: 28px; overflow: hidden; border-radius: 7px; }
.assistant-mark img { display: block; width: 28px; height: 28px; object-fit: contain; }
.assistant-body { min-width: 0; padding-top: 4px; }
.change-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; margin-top: 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); color: var(--muted); padding: 0 12px; font-size: 12px; font-weight: 750; cursor: pointer; }
.change-pill:hover { border-color: var(--cyan); color: var(--text); }
.change-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 74px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--line); }
.principles > div { background: var(--bg); padding: 28px clamp(12px, 3vw, 30px) 30px; }
.principles span { display: block; margin-bottom: 24px; color: var(--cyan); font-size: 10px; font-weight: 800; }
.principles strong { font-size: 14px; }
.principles p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.site-footer { width: min(1240px, calc(100% - 48px)); margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--faint); font-size: 9px; font-weight: 800; letter-spacing: .15em; }

.ide-page { height: 100dvh; overflow: hidden; background: var(--bg); }
.ide-page::before { display: none; }
.ide-page .ambient { display: none; }
.ide-shell-main { height: 100dvh; min-width: 0; overflow: hidden; margin-left: 268px; transition: margin-left .2s ease; }
.workspace-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 268px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
  padding: 16px 13px;
  backdrop-filter: blur(22px);
  transition: width .2s ease, translate .2s ease;
}
.sidebar-brand-row { display: flex; align-items: center; justify-content: space-between; min-height: 46px; gap: 8px; padding: 0 4px 10px; }
.sidebar-brand { display: flex; align-items: center; min-width: 0; flex: 1; height: 36px; }
.sidebar-brand .sidebar-lockup { display: block; height: 32px; width: auto; max-width: 196px; object-fit: contain; object-position: left center; }
[data-theme="light"] .sidebar-brand .sidebar-lockup { background: #fff; border-radius: 6px; }
.sidebar-brand .sidebar-mark { display: none; width: 32px; height: 32px; object-fit: contain; }
.sidebar-collapse { flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); color: var(--muted); font-size: 22px; cursor: pointer; }
.sidebar-new { min-height: 43px; display: flex; align-items: center; gap: 10px; border: 1px solid color-mix(in srgb, var(--cyan) 48%, var(--line)); border-radius: 11px; background: color-mix(in srgb, var(--cyan) 8%, var(--surface-solid)); padding: 0 12px; text-align: left; cursor: pointer; }
.sidebar-new span { color: var(--cyan); font-size: 18px; }
.sidebar-new b, .sidebar-settings b { font-size: 12px; }
.sidebar-content { flex: 1; min-height: 0; overflow-y: auto; padding: 17px 1px; }
.sidebar-section + .sidebar-section { margin-top: 24px; }
.sidebar-section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 28px; padding: 0 8px; color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-section-heading button { width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.sidebar-section-heading button:hover { background: var(--surface-muted); color: var(--text); }
.sidebar-list { display: grid; gap: 3px; }
.sidebar-item { position: relative; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: 9px; }
.sidebar-item.active { background: var(--surface-muted); }
.sidebar-repository-group { display: grid; gap: 2px; }
.sidebar-repository-group + .sidebar-repository-group { margin-top: 3px; }
.sidebar-repository-item { grid-template-columns: auto minmax(0, 1fr) auto; }
.sidebar-repository-group.active > .sidebar-repository-item { background: var(--surface-muted); }
.sidebar-disclosure, .sidebar-new-chat { width: 27px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--faint); padding: 0; cursor: pointer; }
.sidebar-disclosure { font-size: 20px; transition: rotate .15s ease; }
.sidebar-disclosure[aria-expanded="true"] { rotate: 90deg; }
.sidebar-new-chat { font-size: 17px; opacity: 0; }
.sidebar-repository-item:hover .sidebar-new-chat, .sidebar-new-chat:focus { opacity: 1; }
.sidebar-repository-conversations { display: grid; gap: 2px; margin: 1px 0 6px 27px; border-left: 1px solid var(--line); padding-left: 5px; }
.sidebar-conversation-item { display: block; }
.sidebar-conversation-item .sidebar-item-main { width: 100%; }
.sidebar-conversation-item .sidebar-item-icon { display: none; }
.sidebar-item-main { min-width: 0; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; color: var(--muted); padding: 9px 8px; text-align: left; cursor: pointer; }
.sidebar-item-main:hover, .sidebar-item.active .sidebar-item-main { color: var(--text); }
.sidebar-item-icon { flex: 0 0 auto; width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--cyan); font-size: 9px; font-weight: 800; }
.sidebar-item-copy { min-width: 0; display: grid; gap: 2px; }
.sidebar-item-copy strong, .sidebar-item-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item-copy strong { font-size: 12px; font-weight: 700; }
.sidebar-item-copy span { color: var(--faint); font-size: 10px; }
.sidebar-task-orb { flex: 0 0 auto; width: 13px; height: 13px; margin-right: 8px; border: 2px solid color-mix(in srgb, var(--cyan) 28%, transparent); border-top-color: var(--cyan); border-radius: 50%; animation: sidebar-task-spin .8s linear infinite; }
.sidebar-task-orb.waiting { border-color: var(--warning); animation: none; }
@keyframes sidebar-task-spin { to { rotate: 360deg; } }
.sidebar-item-actions { position: absolute; z-index: 2; top: 50%; right: 3px; display: flex; align-items: center; opacity: 0; border-radius: 7px; background: var(--surface-muted); padding: 1px; pointer-events: none; translate: 0 -50%; transition: opacity .15s ease; }
.sidebar-item:hover .sidebar-item-actions, .sidebar-item:focus-within .sidebar-item-actions { opacity: 1; pointer-events: auto; }
.sidebar-item-actions button { width: 25px; height: 27px; border: 0; border-radius: 6px; background: transparent; color: var(--faint); padding: 0; cursor: pointer; }
.sidebar-item-actions button:hover { background: var(--surface-solid); color: var(--text); }
.sidebar-empty { margin: 7px 8px; color: var(--faint); font-size: 11px; line-height: 1.45; }
.sidebar-repository-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.sidebar-repository-actions button, .sidebar-settings { min-height: 35px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; cursor: pointer; }
.sidebar-repository-actions button:hover, .sidebar-settings:hover { border-color: var(--cyan); color: var(--text); }
.sidebar-settings { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 12px; text-align: left; }
.ide-page.sidebar-collapsed .workspace-sidebar { width: 70px; }
.ide-page.sidebar-collapsed .ide-shell-main { margin-left: 70px; }
.ide-page.sidebar-collapsed .sidebar-new b, .ide-page.sidebar-collapsed .sidebar-content, .ide-page.sidebar-collapsed .sidebar-settings b { display: none; }
.ide-page.sidebar-collapsed .sidebar-brand { flex: 0 0 auto; width: 32px; }
.ide-page.sidebar-collapsed .sidebar-lockup { display: none; }
.ide-page.sidebar-collapsed .sidebar-mark { display: block; }
.ide-page.sidebar-collapsed .sidebar-brand-row { justify-content: center; }
.ide-page.sidebar-collapsed .sidebar-collapse { rotate: 180deg; }
.ide-page.sidebar-collapsed .sidebar-new, .ide-page.sidebar-collapsed .sidebar-settings { justify-content: center; padding: 0; }
.mobile-menu-toggle, .sidebar-scrim { display: none; }
.ide-page .topbar { min-height: 72px; }
.ide-page .brand { width: 10.5rem; }
.ide-page .topbar, .ide-page .site-footer { display: none; }
.ide-main { width: min(1060px, calc(100% - 34px)); height: 100dvh; min-height: 0; padding: 14px 0; }
.ide-workspace { height: 100%; min-height: 0; overflow: hidden; border: 0; border-radius: 0; background: transparent; padding: 12px 4px 8px; box-shadow: none; backdrop-filter: none; }
.ide-workspace #task-card:not(.hidden) { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.ide-workspace #task-card > .task-header,
.ide-workspace #task-card > .preview-control,
.ide-workspace #task-card > .task-form { flex: 0 0 auto; }
.ide-workspace #task-card > .message-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: 28px; scrollbar-gutter: stable; }
.ide-workspace #task-card > .message-thread { scrollbar-width: none; }
.ide-workspace #task-card > .message-thread::-webkit-scrollbar { display: none; }
.message-thread > .assistant-turn { flex: 0 0 auto; width: min(92%, 880px); max-height: none; overflow: visible; margin-bottom: 20px; padding-bottom: 12px; }
.ide-workspace .card-glow { display: none; }
.ide-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.ide-panel-header h1, .ide-workspace .task-header h1 { margin: 3px 0 0; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 590; letter-spacing: -.045em; line-height: 1.08; }
.ide-workspace .task-header { align-items: center; border-bottom: 1px solid var(--line); padding: 5px 2px 14px; }
.ide-workspace .task-header h1 { margin-top: 2px; font-size: 20px; letter-spacing: -.025em; }
.conversation-title-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.conversation-title-row h1 { max-width: min(620px, 62vw); overflow: hidden; border-radius: 5px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-title-row h1:hover { background: var(--surface-muted); }
.conversation-title-row h1:focus { overflow: visible; outline: 2px solid color-mix(in srgb, var(--cyan) 38%, transparent); background: var(--surface-solid); padding: 2px 5px; white-space: normal; }
.conversation-title-row button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--faint); cursor: pointer; }
.conversation-title-row .diagnostics-export { width: auto; padding: 0 8px; font-size: 11px; font-weight: 750; }
.conversation-title-row:hover button, .conversation-title-row button:focus { background: var(--surface-muted); color: var(--text); }
.conversation-state { display: flex; align-items: center; gap: 10px; }
.conversation-state .mode { padding: 6px 9px; }
.panel-label { margin: 0; color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.connection-state { border-radius: 999px; background: var(--surface-muted); color: var(--muted); padding: 7px 10px; font-size: 11px; font-weight: 700; }
.ide-workspace .section-copy { margin-top: 18px; }
.ide-workspace .readiness-grid { margin-top: 24px; }
.repository-control { display: grid; grid-template-columns: 110px minmax(360px, 520px) 1fr; align-items: center; gap: 12px; margin-top: 26px; border-top: 1px solid var(--line); padding-top: 22px; }
.repository-control > label { font-size: 12px; font-weight: 800; }
.repository-control > small { color: var(--faint); font-size: 11px; }
.repository-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.select-shell { position: relative; }
.select-shell > span { position: absolute; top: 50%; right: 14px; translate: 0 -54%; color: var(--muted); pointer-events: none; }
.add-repository { min-height: 46px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); color: var(--text); padding: 0 14px; font-size: 12px; font-weight: 800; cursor: pointer; }
.add-repository:hover { border-color: var(--cyan); }
.add-repository:disabled { opacity: .5; cursor: wait; }
.failure-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--line)); border-radius: 13px; background: color-mix(in srgb, var(--danger) 7%, var(--surface-solid)); padding: 15px; }
.assistant-turn .failure-panel { justify-content: flex-start; margin-top: 8px; border: 0; background: transparent; padding: 0; }
.assistant-turn .failure-panel > div { display: none; }
.failure-panel strong { font-size: 13px; }
.failure-panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.failure-panel .secondary-button { flex: 0 0 auto; min-height: 40px; }
.clarification-panel { display: grid; gap: 12px; margin-top: 12px; border: 1px solid color-mix(in srgb, var(--cyan) 32%, var(--line)); border-radius: 14px; background: var(--surface-solid); padding: 14px; }
.clarification-panel > strong { font-size: 14px; }
.clarification-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.clarification-header > strong { font-size: 14px; line-height: 1.45; }
.clarification-header button { flex: 0 0 auto; width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--surface-muted); color: var(--muted); font-size: 20px; cursor: pointer; }
.clarification-choices { display: grid; gap: 8px; }
.clarification-choice { display: grid; gap: 3px; width: 100%; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); color: var(--text); padding: 11px 12px; text-align: left; cursor: pointer; }
.clarification-choice:hover { border-color: var(--cyan); }
.clarification-choice:disabled { opacity: .55; cursor: wait; }
.clarification-choice strong { font-size: 13px; }
.clarification-choice strong small { display: inline-block; margin-left: 8px; border-radius: 999px; background: color-mix(in srgb, var(--cyan) 14%, var(--surface-solid)); color: var(--navy); padding: 3px 7px; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px; }
.clarification-choice.recommended { border-color: color-mix(in srgb, var(--cyan) 55%, var(--line)); background: color-mix(in srgb, var(--cyan) 7%, var(--surface-solid)); }
.clarification-choice span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.clarification-custom { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; border-top: 1px solid var(--line); padding-top: 11px; }
.clarification-custom input { min-width: 0; min-height: 40px; border-radius: 10px; padding: 0 11px; }
.clarification-custom button { border: 0; border-radius: 10px; background: var(--text); color: var(--surface-solid); padding: 0 15px; font-size: 12px; font-weight: 800; cursor: pointer; }
.contract-summary { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); padding: 6px 10px; }
.contract-summary small { color: var(--muted); font-size: 11px; }
.contract-summary strong { font-size: 12px; }
.review-warning { margin-top: 12px; border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line)); border-radius: 13px; background: color-mix(in srgb, var(--danger) 7%, var(--surface-solid)); padding: 12px 13px; }
.review-warning strong { font-size: 13px; }
.review-warning p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.answer-panel { margin-top: 4px; }
.ide-page .site-footer { padding-top: 22px; }

dialog { width: min(520px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 22px; background: var(--surface-solid); color: var(--text); box-shadow: 0 30px 100px rgba(0, 0, 0, .45); padding: 26px; }
dialog::backdrop { background: rgba(0, 8, 15, .65); backdrop-filter: blur(7px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.dialog-header .icon-button { font-size: 24px; line-height: 1; }
fieldset { margin: 24px 0 0; border: 0; padding: 0; }
legend { font-weight: 750; }
fieldset > p { margin: 6px 0 16px; color: var(--muted); font-size: 13px; }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.theme-options label { cursor: pointer; }
.theme-options input { position: absolute; opacity: 0; pointer-events: none; }
.theme-options span { min-height: 86px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); padding: 13px; }
.theme-options input:checked + span { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan); }
.theme-options input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--cyan) 40%, transparent); }
.theme-options b { font-size: 13px; }
.theme-options small { color: var(--faint); font-size: 10px; }
.setting-toggle { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-muted); padding: 14px; cursor: pointer; }
.setting-toggle span { display: grid; gap: 4px; }
.setting-toggle b { font-size: 13px; }
.setting-toggle small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.setting-toggle input { appearance: none; flex: 0 0 auto; width: 42px; height: 24px; border: 1px solid var(--line); border-radius: 999px; background: var(--faint); padding: 2px; cursor: pointer; }
.setting-toggle input::before { display: block; width: 18px; height: 18px; border-radius: 50%; background: white; content: ""; transition: translate .18s ease; }
.setting-toggle input:checked { background: var(--cyan); }
.setting-toggle input:checked::before { translate: 18px 0; }
.setting-toggle.unavailable { cursor: not-allowed; }
.setting-toggle input:disabled { opacity: .55; cursor: not-allowed; }
.dialog-note { margin: 18px 0 0; color: var(--faint); font-size: 11px; }
.dialog-field { display: grid; gap: 8px; margin-top: 22px; font-size: 12px; font-weight: 750; }
.dialog-field input { min-height: 46px; border-radius: 11px; padding: 0 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--cyan) 44%, transparent); outline-offset: 3px; }

@media (max-width: 980px) {
  .workspace-sidebar { width: min(294px, calc(100vw - 42px)); box-shadow: 20px 0 60px rgba(0, 0, 0, .2); }
  .ide-shell-main, .ide-page.sidebar-collapsed .ide-shell-main { margin-left: 0; }
  .ide-page.sidebar-collapsed .workspace-sidebar { width: min(294px, calc(100vw - 42px)); translate: -100% 0; }
  .ide-page.sidebar-collapsed .sidebar-brand { display: flex; flex: 1; width: auto; }
  .ide-page.sidebar-collapsed .sidebar-lockup { display: block; }
  .ide-page.sidebar-collapsed .sidebar-mark { display: none; }
  .ide-page.sidebar-collapsed .sidebar-new b, .ide-page.sidebar-collapsed .sidebar-settings b { display: inline; }
  .ide-page.sidebar-collapsed .sidebar-content { display: block; }
  .ide-page.sidebar-collapsed .sidebar-brand-row { justify-content: space-between; }
  .ide-page.sidebar-collapsed .sidebar-collapse { position: static; rotate: 180deg; background: var(--surface-solid); }
  .ide-page.sidebar-collapsed .sidebar-new, .ide-page.sidebar-collapsed .sidebar-settings { justify-content: flex-start; padding: 0 12px; }
  .workspace-sidebar { z-index: 22; }
  .mobile-menu-toggle { position: fixed; top: 12px; left: 12px; z-index: 20; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-solid); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.12); font-size: 18px; cursor: pointer; }
  .ide-page.sidebar-collapsed .mobile-menu-toggle { display: grid; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 21; border: 0; background: rgba(0, 8, 15, .36); backdrop-filter: blur(2px); }
  .ide-page:not(.sidebar-collapsed) .sidebar-scrim { display: block; }
  .sidebar-new-chat { opacity: 1; }
  .ide-main { width: min(100% - 28px, 900px); padding-top: 62px; }
}

@media (max-width: 760px) {
  .topbar, .site-footer, main { width: min(100% - 28px, 1120px); }
  .topbar { min-height: 78px; }
  .brand { width: 11.5rem; }
  .preview-badge { display: none; }
  .nav-cta { display: none; }
  main { padding-top: 72px; }
  h1 { font-size: clamp(3.2rem, 17vw, 5.5rem); }
  .hero-copy { font-size: 1rem; }
  .workspace-card { border-radius: 21px; padding: 22px; }
  .pair-form { flex-direction: column; }
  .principles { grid-template-columns: 1fr; }
  .task-header { align-items: center; }
  .composer-footer { align-items: stretch; flex-direction: column; }
  .composer-footer > span { padding: 2px 8px; }
  .composer-footer .primary-button { width: 100%; }
  .composer-model { max-width: 96px; }
  .composer-context { gap: 8px; }
  .composer-context #composer-note { display: none; }
  .principles { margin-top: 52px; }
  .hero-actions { align-items: stretch; flex-direction: column; gap: 16px; }
  .hero-button { width: 100%; }
  .text-link { justify-content: center; }
  .ide-main { width: min(100% - 20px, 1180px); height: 100dvh; min-height: 0; padding: 58px 0 8px; }
  .ide-workspace { height: 100%; min-height: 0; padding: 10px 2px; }
  .repository-control { grid-template-columns: 1fr; gap: 8px; margin-top: 16px; padding-top: 14px; }
  .repository-picker { grid-template-columns: minmax(0, 1fr) auto; }
  .add-repository { padding: 0 11px; }
  .readiness-grid { display: flex; gap: 8px; margin: 14px 0 8px; overflow-x: auto; border: 0; border-radius: 0; background: transparent; scrollbar-width: none; }
  .readiness-grid::-webkit-scrollbar { display: none; }
  .readiness-item { flex: 0 0 190px; min-height: 58px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
  .readiness-icon { display: none; }
  .readiness-item strong { max-width: 166px; font-size: 11px; }
  .workspace-detail { max-width: 166px; }
  .message-thread { min-height: 0; margin-top: 2px; padding: 12px 2px; }
  .thread-empty { min-height: 42vh; }
  .task-form { margin-top: 8px; padding-bottom: env(safe-area-inset-bottom); }
  .preview-control { grid-template-columns: auto minmax(0, 1fr) auto; margin: 0 0 8px; }
  .preview-control #preview-open { min-width: 54px; justify-content: center; padding: 0 9px; }
  .failure-panel { align-items: stretch; flex-direction: column; }
  .thread-message { width: fit-content; max-width: 88%; }
  .assistant-turn { width: 100%; max-width: 100%; }
  .theme-options { grid-template-columns: 1fr; }
  .theme-options span { min-height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
