:root {
  --ink: #14203b;
  --muted: #687086;
  --paper: #f7f6f2;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(20, 32, 59, 0.12);
  --violet: #6558e8;
  --violet-dark: #4e42c8;
  --violet-soft: #eeecff;
  --mint: #c9f4df;
  --amber: #ffd993;
  --shadow: 0 24px 80px rgba(32, 35, 68, 0.11);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(201, 244, 223, 0.58), transparent 25rem),
    radial-gradient(circle at 88% 12%, rgba(216, 211, 255, 0.62), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.018;
  pointer-events: none;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.topbar {
  height: 76px;
  padding: 0 clamp(22px, 4vw, 68px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 246, 242, 0.74);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--ink);
  font-family: Georgia, serif;
  font-size: 22px;
  box-shadow: 5px 5px 0 var(--mint);
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: 0.02em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }

.topbar-center { display: flex; align-items: center; gap: 14px; }
.topbar-center i { display: block; width: 42px; height: 1px; background: var(--line); }
.step { color: #9a9faf; font-size: 12px; letter-spacing: 0.02em; white-space: nowrap; }
.step b { font-size: 10px; margin-right: 5px; }
.step.is-active { color: var(--ink); }
.step.is-active b { color: var(--violet); }

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  justify-self: end;
  padding: 10px 0 10px 18px;
}
.text-button:hover { color: var(--ink); }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 18px; }
.worker-connection { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.55); font-size: 10px; white-space: nowrap; }
.worker-connection i { width: 7px; height: 7px; border-radius: 50%; background: #a7abb6; }
.worker-connection.is-online { color: #1c7351; border-color: rgba(56,162,118,.24); background: rgba(201,244,223,.38); }
.worker-connection.is-online i { background: #38a276; box-shadow: 0 0 0 3px rgba(56,162,118,.13); }
.worker-connection.is-offline { color: #9a5a38; border-color: rgba(216,145,61,.28); background: rgba(255,217,147,.24); }
.worker-connection.is-offline i { background: #d8913d; }
.topbar-actions .text-button { padding-left: 0; }
.history-button span { display: inline-grid; min-width: 20px; height: 20px; margin-left: 5px; padding: 0 5px; place-items: center; border-radius: 999px; color: var(--violet-dark); background: var(--violet-soft); font-size: 10px; font-weight: 750; }

main { min-height: calc(100vh - 76px); }

.login-view { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 40px 20px; }
.login-card { width: min(460px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.78); box-shadow: var(--shadow); }
.login-card h1 { margin: 14px 0 9px; font-family: Georgia, serif; font-size: 45px; font-weight: 500; letter-spacing: -.04em; }
.login-card > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.login-card form { display: grid; gap: 16px; margin-top: 28px; }
.login-card .primary-button { margin-top: 4px; }
.is-login .topbar { grid-template-columns: 1fr; }
.is-login .topbar-center, .is-login .topbar-actions { display: none; }

.intro {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(70px, 10vh, 118px) 0 64px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--violet-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before { content: ""; width: 21px; height: 2px; background: var(--violet); }

.intro h1, .generating h1, .plan-hero h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.045em;
  margin: 20px 0 12px;
}

.intro h1 { font-size: clamp(54px, 8vw, 92px); line-height: 0.96; }
.intro-copy { max-width: 660px; margin: 20px auto 36px; color: var(--muted); line-height: 1.75; font-size: 17px; }
.runtime-summary { width: fit-content; max-width: min(760px, 100%); margin: -18px auto 34px; padding: 8px 13px; border: 1px solid rgba(101,88,232,.16); border-radius: 999px; color: var(--violet-dark); background: rgba(238,236,255,.58); font-size: 11px; line-height: 1.5; }

.prompt-card {
  max-width: 790px;
  margin: 0 auto;
  padding: 10px;
  background: var(--card);
  border: 1px solid rgba(101, 88, 232, 0.18);
  border-radius: 26px;
  box-shadow: var(--shadow), 0 0 0 7px rgba(255,255,255,.35);
  text-align: left;
}

.prompt-card textarea, .reply-form textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.prompt-card textarea { min-height: 124px; padding: 18px 20px 10px; font-size: 17px; line-height: 1.6; }
textarea::placeholder { color: #a7aabb; }

.prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 8px 8px 20px; }
.prompt-footer > span { color: #9a9faf; font-size: 12px; }

.primary-button, .secondary-button, .send-button {
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.primary-button {
  color: white;
  background: var(--violet);
  padding: 14px 20px;
  box-shadow: 0 9px 22px rgba(101, 88, 232, .24);
}
.primary-button:hover { transform: translateY(-2px); background: var(--violet-dark); box-shadow: 0 13px 30px rgba(101, 88, 232, .3); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button span { margin-left: 10px; }
.primary-button.full { width: 100%; }

.secondary-button { padding: 13px 18px; color: var(--ink); background: white; border: 1px solid var(--line); }
.secondary-button:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20,32,59,.08); }

.examples { margin: 28px auto 0; display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; }
.examples span { color: #9a9faf; font-size: 12px; margin-right: 4px; }
.examples button {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.54);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}
.examples button:hover { border-color: rgba(101,88,232,.45); color: var(--violet-dark); background: white; }

.value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: clamp(66px, 10vh, 100px); text-align: left; }
.value-grid article { min-height: 168px; padding: 25px; border-top: 1px solid var(--line); }
.value-grid span { font-family: Georgia, serif; color: var(--violet); font-size: 15px; }
.value-grid h2 { margin: 23px 0 8px; font-size: 16px; }
.value-grid p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 13px; }

.history-view { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 90px; }
.history-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.history-heading h1 { margin: 10px 0 8px; font-family: Georgia, serif; font-size: clamp(40px, 5vw, 64px); font-weight: 500; letter-spacing: -.04em; }
.history-heading p { margin: 0; color: var(--muted); }
.history-empty { margin-top: 30px; padding: 54px 30px; text-align: center; border: 1px dashed rgba(101,88,232,.3); border-radius: var(--radius); background: rgba(255,255,255,.46); }
.history-empty strong { font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.history-empty p { margin: 10px 0 0; color: var(--muted); }
.history-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 30px; }
.history-card { position: relative; min-width: 0; padding: 24px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.7); box-shadow: 0 16px 44px rgba(20,32,59,.06); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.history-card:hover { transform: translateY(-3px); border-color: rgba(101,88,232,.36); box-shadow: 0 22px 58px rgba(20,32,59,.1); }
.history-card.is-warning { border-color: rgba(216,145,61,.34); }
.history-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; color: var(--muted); font-size: 11px; }
.history-card-top b { color: var(--violet-dark); }
.history-card > strong { display: block; font-family: Georgia, serif; font-size: 22px; font-weight: 500; line-height: 1.3; }
.history-card > small { display: block; min-height: 38px; margin-top: 7px; color: var(--muted); line-height: 1.55; }
.history-card-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.history-card-meta i { padding: 6px 9px; border-radius: 999px; color: var(--muted); background: var(--paper); font-size: 10px; font-style: normal; }
.history-card > em { position: absolute; right: 22px; bottom: 22px; color: #955b18; font-size: 11px; font-style: normal; font-weight: 750; }

.settings-view { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 110px; }
.settings-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.settings-heading h1 { margin: 11px 0 8px; font-family: Georgia, serif; font-size: clamp(42px, 5vw, 66px); font-weight: 500; letter-spacing: -.045em; }
.settings-heading p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.65; }
.settings-form { display: grid; gap: 18px; margin-top: 30px; }
.settings-card { padding: 27px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.68); box-shadow: 0 16px 48px rgba(20,32,59,.05); }
.settings-card-heading { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(300px, 1.2fr); gap: 28px; align-items: end; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.settings-card-heading > div { display: flex; align-items: baseline; gap: 12px; }
.settings-card-heading span { color: var(--violet); font-family: Georgia, serif; }
.settings-card-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.settings-card-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 23px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.wide { grid-column: span 2; }
.field > span { font-size: 12px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; outline: 0; background: rgba(255,255,255,.85); }
.field input, .field select { min-height: 44px; padding: 10px 12px; }
.field textarea { padding: 14px; resize: vertical; font: 12px/1.65 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(101,88,232,.55); box-shadow: 0 0 0 3px rgba(101,88,232,.08); }
.field small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.toggle-field { display: flex; align-items: flex-start; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(247,246,242,.7); }
.toggle-field.wide { grid-column: span 2; }
.toggle-field input { margin-top: 3px; accent-color: var(--violet); }
.toggle-field b, .toggle-field small { display: block; }
.toggle-field b { font-size: 12px; }
.toggle-field small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.runtime-paths { display: flex; flex-wrap: wrap; gap: 9px 20px; margin-top: 18px; color: var(--muted); font-size: 10px; }
.runtime-paths code { color: var(--ink); word-break: break-all; }
.prompt-editors { display: grid; gap: 16px; margin-top: 23px; }
.prompt-agent-card { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(247,246,242,.52); }
.prompt-agent-heading { display: grid; grid-template-columns: minmax(190px, .65fr) minmax(360px, 1.35fr); gap: 18px; align-items: end; }
.prompt-agent-heading > div:first-child > span, .prompt-agent-heading > div:first-child > small { display: block; }
.prompt-agent-heading > div:first-child > span { font-size: 14px; font-weight: 780; }
.prompt-agent-heading > div:first-child > small { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.prompt-agent-controls { display: grid; grid-template-columns: minmax(210px, 1.3fr) minmax(130px, .7fr); gap: 12px; }
.readonly-prompt textarea { color: #7d8292; background: rgba(20,32,59,.035); }
.reset-prompts { padding-left: 0; margin-top: 13px; }
.settings-savebar { position: sticky; bottom: 18px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 16px 14px 20px; border: 1px solid rgba(101,88,232,.18); border-radius: 17px; background: rgba(255,255,255,.9); box-shadow: 0 18px 48px rgba(20,32,59,.13); backdrop-filter: blur(18px); }
.settings-savebar span { color: var(--muted); font: 10px ui-monospace, "SFMono-Regular", Menlo, monospace; }
.compact-setting-button { align-self: end; min-height: 44px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  width: min(1220px, calc(100% - 40px));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  gap: 36px;
  padding: 48px 0;
}

.conversation-panel { min-width: 0; display: flex; flex-direction: column; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.panel-heading h1 { font-family: Georgia, serif; font-size: clamp(30px, 4vw, 44px); font-weight: 500; letter-spacing: -.035em; margin: 10px 0 0; }
.status-pill { padding: 8px 12px; border-radius: 999px; color: var(--violet-dark); background: var(--violet-soft); font-size: 12px; }

.messages { padding: 30px 0; display: flex; flex-direction: column; gap: 22px; min-height: 350px; }
.message { display: flex; gap: 13px; align-items: flex-start; animation: enter .38s ease both; }
.message.user { justify-content: flex-end; }
.message-avatar { width: 31px; height: 31px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; background: var(--ink); color: white; font-family: Georgia, serif; font-size: 13px; }
.message-bubble { max-width: min(650px, 82%); padding: 15px 18px; background: rgba(255,255,255,.74); border: 1px solid var(--line); border-radius: 7px 18px 18px 18px; line-height: 1.7; font-size: 14px; }
.message.user .message-bubble { color: white; background: var(--ink); border-color: var(--ink); border-radius: 18px 7px 18px 18px; }
.message-bubble p { margin: 0; }
.question-block { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.question-block strong { display: block; font-size: 13px; }
.question-block small { display: block; color: var(--muted); margin-top: 4px; }
.question-input-hint { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; }
.option-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.option-list button { padding: 8px 11px; border: 1px solid rgba(101,88,232,.2); background: var(--violet-soft); color: var(--violet-dark); border-radius: 9px; font-size: 12px; cursor: pointer; }
.option-list button:hover, .option-list button.is-selected { color: white; background: var(--violet); }

.thinking { display: flex; gap: 5px; align-items: center; margin: -12px 0 24px 44px; color: var(--muted); font-size: 12px; }
.thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); animation: bounce 1.2s infinite ease-in-out; }
.thinking span:nth-child(2) { animation-delay: .13s; }
.thinking span:nth-child(3) { animation-delay: .26s; }
.thinking p { margin: 0 0 0 6px; }

.reply-form { display: flex; gap: 12px; align-items: flex-end; padding: 11px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.8); box-shadow: 0 13px 40px rgba(20,32,59,.06); position: sticky; bottom: 18px; }
.reply-form textarea { min-height: 48px; max-height: 140px; padding: 12px; line-height: 1.5; }
.send-button { height: 45px; padding: 0 17px; color: white; background: var(--ink); }
.send-button:hover { background: var(--violet-dark); }
.supplement-hint { margin: 10px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.snapshot-panel { align-self: start; position: sticky; top: 110px; padding: 24px; border-radius: var(--radius); background: rgba(255,255,255,.72); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(20,32,59,.07); }
.snapshot-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); font-weight: 750; }
.snapshot-heading small { color: var(--muted); font-weight: 500; }
.snapshot-empty { color: var(--muted); line-height: 1.7; font-size: 13px; padding: 22px 0 5px; }
.snapshot-list { margin: 4px 0 0; }
.snapshot-list > div { padding: 14px 0; border-bottom: 1px solid rgba(20,32,59,.08); }
.snapshot-list dt { color: #9196a6; font-size: 11px; margin-bottom: 5px; }
.snapshot-list dd { margin: 0; font-size: 13px; line-height: 1.55; }
.confirm-card { margin-top: 20px; padding: 18px; border-radius: 16px; background: var(--violet-soft); }
.confirm-card p { margin: 0 0 16px; font-size: 13px; line-height: 1.6; }
.confirm-card small { display: block; text-align: center; color: var(--muted); margin-top: 10px; }

.generating { min-height: calc(100vh - 76px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; }
.generation-orbit { width: 92px; height: 92px; position: relative; margin-bottom: 34px; animation: rotate 8s linear infinite; }
.generation-orbit::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(101,88,232,.3); border-radius: 50%; }
.generation-orbit span, .generation-orbit i, .generation-orbit b { position: absolute; border-radius: 50%; }
.generation-orbit span { width: 18px; height: 18px; background: var(--violet); left: 5px; top: 36px; }
.generation-orbit i { width: 13px; height: 13px; background: var(--mint); right: 12px; top: 8px; }
.generation-orbit b { width: 9px; height: 9px; background: var(--amber); right: 5px; bottom: 17px; }
.generating h1 { font-size: clamp(40px, 6vw, 70px); max-width: 800px; }
.generating > p { color: var(--muted); }
.generation-profile { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 8px; }
.generation-profile span { padding: 6px 9px; border-radius: 999px; color: var(--violet-dark); background: var(--violet-soft); font-size: 10px; }
.generation-progress { width: min(430px, 80vw); height: 3px; border-radius: 3px; overflow: hidden; background: rgba(20,32,59,.08); margin-top: 26px; }
.generation-progress i { display: block; width: 40%; height: 100%; background: var(--violet); animation: progress 2.2s ease-in-out infinite; }
.generation-timeline { width: min(620px, calc(100vw - 40px)); margin-top: 30px; display: grid; gap: 8px; text-align: left; }
.generation-step { display: grid; grid-template-columns: 20px 1fr auto; gap: 11px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.66); }
.generation-step-dot { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: #c4c7d1; box-shadow: 0 0 0 4px rgba(196,199,209,.18); }
.generation-step.is-running .generation-step-dot { background: var(--violet); box-shadow: 0 0 0 4px rgba(101,88,232,.15); animation: bounce 1.2s infinite ease-in-out; }
.generation-step.is-retrying .generation-step-dot { background: #d8913d; box-shadow: 0 0 0 4px rgba(216,145,61,.14); animation: bounce .9s infinite ease-in-out; }
.generation-step.is-completed .generation-step-dot { background: #38a276; box-shadow: 0 0 0 4px rgba(56,162,118,.14); }
.generation-step.is-skipped .generation-step-dot { background: #969baa; box-shadow: 0 0 0 4px rgba(150,155,170,.14); }
.generation-step.is-warning .generation-step-dot { background: #d8913d; box-shadow: 0 0 0 4px rgba(216,145,61,.14); }
.generation-step.is-timeout .generation-step-dot { background: #c95b5b; box-shadow: 0 0 0 4px rgba(201,91,91,.14); }
.generation-step.is-failed .generation-step-dot { background: #c95b5b; box-shadow: 0 0 0 4px rgba(201,91,91,.14); }
.generation-step strong { display: block; font-size: 13px; }
.generation-step small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.generation-step-timing { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.generation-step-timing b { color: var(--violet-dark); font-size: 11px; font-variant-numeric: tabular-nums; }
.generation-step time { color: #969baa; font-size: 10px; white-space: nowrap; }

.plan-view { padding-bottom: 90px; }
.plan-hero { padding: clamp(58px, 9vw, 104px) max(24px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--line); background: linear-gradient(130deg, rgba(238,236,255,.55), rgba(201,244,223,.34)); }
.plan-hero h1 { max-width: 1120px; font-size: clamp(44px, 5vw, 64px); line-height: 1.04; white-space: nowrap; }
.plan-hero > p { max-width: 760px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.plan-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 27px; }
.plan-meta span { padding: 9px 12px; border-radius: 999px; font-size: 12px; background: rgba(255,255,255,.65); border: 1px solid var(--line); }
.plan-actions { display: flex; gap: 10px; margin-top: 28px; }
.share-actions { display: grid; gap: 9px; margin-top: 18px; }
.is-shared-plan .topbar { grid-template-columns: 1fr; }
.is-shared-plan .topbar-center, .is-shared-plan .topbar-actions, .is-shared-plan .private-plan-action { display: none; }

.plan-shell { width: min(1120px, calc(100% - 40px)); margin: 52px auto 0; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 52px; }
.generation-report { margin-bottom: 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.55); }
.model-card { display: grid; grid-template-columns: minmax(190px, .7fr) minmax(0, 1.3fr); gap: 24px; margin-bottom: 18px; padding: 22px; border: 1px solid rgba(101,88,232,.2); border-radius: var(--radius); background: rgba(238,236,255,.38); }
.model-card span { color: var(--violet-dark); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.model-card h2 { margin: 8px 0 0; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.model-card > p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 12px; }
.model-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.model-card dl > div { padding: 9px 11px; border-radius: 9px; background: rgba(255,255,255,.65); }
.model-card dt { color: var(--muted); font-size: 9px; }
.model-card dd { margin: 4px 0 0; font-size: 11px; font-weight: 700; word-break: break-word; }
.generation-report-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.generation-report-heading span { font-size: 13px; font-weight: 750; }
.generation-report-heading b { color: #38a276; font-size: 11px; }
.generation-report .generation-timeline { width: 100%; margin-top: 16px; }
.plan-sidebar { position: sticky; top: 108px; align-self: start; }
.plan-sidebar nav { display: flex; flex-direction: column; gap: 5px; }
.plan-sidebar nav a { padding: 10px 12px; border-left: 2px solid var(--line); text-decoration: none; color: var(--muted); font-size: 13px; line-height: 1.4; }
.plan-sidebar nav a:hover { color: var(--violet-dark); border-color: var(--violet); }
.outcome-card { margin-top: 28px; padding: 18px; border-radius: 15px; background: var(--ink); color: white; }
.outcome-card span, .analyst-card span { color: var(--amber); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.outcome-card p { margin: 10px 0 0; font-family: Georgia, serif; font-size: 17px; line-height: 1.5; }

.analyst-card { padding: 25px; border-radius: var(--radius); background: white; border: 1px solid var(--line); }
.analyst-card span { color: var(--violet-dark); }
.analyst-card p { color: var(--muted); margin: 12px 0 0; line-height: 1.75; font-size: 14px; }
.quality-card { display: grid; grid-template-columns: 108px 1fr; gap: 24px; align-items: start; margin-bottom: 18px; padding: 24px; border: 1px solid rgba(56,162,118,.25); border-radius: var(--radius); background: rgba(201,244,223,.3); }
.quality-card.is-warning { border-color: rgba(216,145,61,.3); background: rgba(255,217,147,.24); }
.quality-score { width: 100px; height: 100px; display: grid; place-content: center; text-align: center; border-radius: 50%; background: white; box-shadow: inset 0 0 0 7px rgba(56,162,118,.15); }
.quality-card.is-warning .quality-score { box-shadow: inset 0 0 0 7px rgba(216,145,61,.17); }
.quality-score strong { display: block; font-family: Georgia, serif; font-size: 38px; line-height: .95; }
.quality-score span { color: var(--muted); font-size: 10px; }
.quality-copy > div { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.quality-copy > div span { font-size: 12px; font-weight: 750; letter-spacing: .08em; }
.quality-copy > div b { padding: 5px 8px; border-radius: 999px; color: #1c7351; background: rgba(255,255,255,.7); font-size: 10px; }
.quality-card.is-warning .quality-copy > div b { color: #955b18; }
.quality-copy p { margin: 11px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.quality-copy ul { margin: 14px 0 0; padding: 0; display: grid; gap: 7px; list-style: none; }
.quality-copy li { padding: 9px 11px; border-radius: 9px; background: rgba(255,255,255,.66); color: var(--muted); font-size: 11px; line-height: 1.5; }
.quality-copy li b { margin-right: 7px; color: var(--ink); text-transform: uppercase; }
.stage-section { scroll-margin-top: 110px; padding: 52px 0 15px; border-bottom: 1px solid var(--line); }
.stage-kicker { color: var(--violet); font-size: 11px; font-weight: 750; letter-spacing: .1em; }
.stage-section h2 { font-family: Georgia, serif; font-size: clamp(30px, 4vw, 43px); font-weight: 500; letter-spacing: -.03em; margin: 9px 0 11px; }
.stage-description { color: var(--muted); margin: 0; line-height: 1.7; }
.milestone { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0 30px; padding: 14px 16px; border-radius: 13px; background: rgba(201,244,223,.45); font-size: 13px; line-height: 1.5; }
.milestone b { color: #1c7351; white-space: nowrap; }
.topic-card { border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.64); overflow: hidden; margin-bottom: 12px; }
.topic-summary { width: 100%; border: 0; background: transparent; padding: 18px 20px; display: grid; grid-template-columns: 75px 1fr auto; align-items: center; gap: 14px; text-align: left; cursor: pointer; }
.topic-number { color: var(--violet-dark); font-size: 11px; font-weight: 750; }
.topic-summary h3 { margin: 0; font-size: 15px; }
.topic-summary p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.topic-summary > span:last-child { color: var(--muted); font-size: 20px; transition: transform .2s ease; }
.topic-card.is-open .topic-summary > span:last-child { transform: rotate(45deg); }
.topic-detail { display: none; padding: 0 20px 22px 109px; }
.topic-card.is-open .topic-detail { display: block; }
.lesson { padding: 19px 0; border-top: 1px solid var(--line); }
.lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.lesson h4 { margin: 0; font-size: 14px; }
.lesson-time { white-space: nowrap; color: var(--muted); font-size: 11px; }
.lesson > p { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 8px 0 16px; }
.lesson-context { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-bottom: 11px; }
.lesson-context > div { padding: 11px 12px; border-radius: 10px; background: rgba(238,236,255,.62); }
.lesson-context span { display: block; margin-bottom: 4px; color: var(--violet-dark); font-size: 9px; font-weight: 750; letter-spacing: .08em; }
.lesson-context strong { display: block; font-size: 11px; font-weight: 650; line-height: 1.5; }
.skill-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.skill-list span { padding: 5px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: 9px; }
.knowledge-list { display: grid; gap: 8px; }
.knowledge-item { padding: 14px; border-radius: 12px; background: var(--paper); }
.knowledge-title { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 750; }
.knowledge-category { font-size: 9px; letter-spacing: .06em; color: var(--violet-dark); background: var(--violet-soft); padding: 4px 6px; border-radius: 5px; }
.knowledge-item p { color: var(--muted); margin: 7px 0 0; font-size: 12px; line-height: 1.6; }
.language-examples { display: grid; gap: 5px; margin-top: 10px; }
.language-examples code { padding: 8px 10px; border-left: 2px solid var(--violet); color: var(--ink); background: white; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; line-height: 1.5; white-space: normal; }
.common-mistake { color: #9a5a38 !important; }
.mastery { color: var(--ink) !important; }

.midoo-dialog { width: min(500px, calc(100% - 32px)); padding: 0; color: var(--ink); border: 1px solid rgba(101,88,232,.22); border-radius: 22px; background: var(--paper); box-shadow: 0 30px 100px rgba(20,32,59,.28); }
.midoo-dialog::backdrop { background: rgba(20,32,59,.42); backdrop-filter: blur(5px); }
.midoo-dialog form { position: relative; padding: 30px; }
.midoo-dialog h2 { margin: 13px 0 8px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.midoo-dialog form > p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dialog-close { position: absolute; top: 17px; right: 18px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; }
.dialog-result { margin: 16px 0; padding: 12px; border-radius: 10px; color: var(--violet-dark); background: var(--violet-soft); font-size: 12px; line-height: 1.55; }
.midoo-dialog .primary-button { margin-top: 18px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(380px, calc(100vw - 44px)); padding: 13px 16px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 13px; animation: enter .25s ease; }

.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounce { 0%, 70%, 100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-5px); opacity: 1; } }
@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes progress { 0% { transform: translateX(-100%); } 50% { transform: translateX(150%); } 100% { transform: translateX(350%); } }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-center { display: none; }
  .worker-connection { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .settings-card-heading { grid-template-columns: 1fr; gap: 9px; }
  .snapshot-panel { position: static; }
  .plan-shell { grid-template-columns: 1fr; }
  .plan-sidebar { position: static; }
  .plan-sidebar nav { flex-direction: row; overflow-x: auto; }
  .plan-sidebar nav a { min-width: 180px; border-left: 0; border-bottom: 2px solid var(--line); }
  .outcome-card { display: none; }
}

@media (max-width: 620px) {
  .topbar { height: 66px; padding: 0 18px; }
  .topbar-center { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-actions { gap: 10px; }
  main { min-height: calc(100vh - 66px); }
  .intro { width: min(100% - 26px, 1080px); padding-top: 58px; }
  .intro h1 { font-size: 52px; }
  .intro-copy { font-size: 15px; }
  .prompt-card textarea { min-height: 150px; padding: 15px; }
  .prompt-footer { padding-left: 7px; align-items: flex-end; }
  .prompt-footer > span { max-width: 105px; }
  .primary-button { padding: 13px 15px; }
  .value-grid { grid-template-columns: 1fr; gap: 0; }
  .history-view { width: calc(100% - 26px); padding-top: 38px; }
  .history-heading { align-items: flex-start; flex-direction: column; }
  .settings-view { width: calc(100% - 26px); padding-top: 38px; }
  .settings-heading { align-items: flex-start; flex-direction: column; }
  .settings-card { padding: 20px 16px; }
  .settings-grid, .prompt-editors { grid-template-columns: 1fr; }
  .field.wide, .toggle-field.wide, .prompt-editors .readonly-prompt { grid-column: auto; }
  .prompt-agent-heading, .prompt-agent-controls { grid-template-columns: 1fr; }
  .settings-savebar { align-items: stretch; flex-direction: column; }
  .history-list { grid-template-columns: 1fr; }
  .value-grid article { min-height: auto; padding: 22px 7px; }
  .workspace { width: calc(100% - 26px); padding-top: 30px; }
  .panel-heading { align-items: flex-start; }
  .panel-heading h1 { font-size: 32px; }
  .message-bubble { max-width: 88%; }
  .topic-summary { grid-template-columns: 65px 1fr auto; padding: 16px 14px; }
  .topic-detail { padding: 0 14px 16px; }
  .lesson-context { grid-template-columns: 1fr; }
  .plan-hero { padding-left: 20px; padding-right: 20px; }
  .plan-hero h1 { white-space: normal; }
  .plan-shell { width: calc(100% - 26px); }
  .plan-actions { flex-direction: column; align-items: stretch; }
  .quality-card { grid-template-columns: 1fr; }
  .model-card { grid-template-columns: 1fr; }
  .model-card dl { grid-template-columns: 1fr; }
  .generation-step { grid-template-columns: 16px minmax(0, 1fr); }
  .generation-step-timing { grid-column: 2; align-items: flex-start; flex-direction: row; gap: 8px; }
}
