:root {
  --paper: #f4efe6;
  --paper-deep: #e9dfd0;
  --panel: #fbf8f2;
  --panel-muted: #f0e9df;
  --ink: #211d19;
  --muted: #81776b;
  --muted-deep: #5d554b;
  --line: #d8ccbc;
  --line-dark: #bfae9b;
  --clay: #c86d4a;
  --clay-deep: #a65338;
  --clay-soft: rgba(200, 109, 74, .11);
  --cyan: #1caec0;
  --cyan-deep: #148797;
  --cyan-soft: rgba(28, 174, 192, .10);
  --shadow: 0 18px 45px rgba(71, 55, 39, .08);
  --ease: cubic-bezier(.32, .72, 0, 1);
  --radius: 8px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #181715;
  --paper-deep: #24211e;
  --panel: #24221f;
  --panel-muted: #2b2824;
  --ink: #f1ebe1;
  --muted: #a89e92;
  --muted-deep: #d0c4b6;
  --line: #3d3832;
  --line-dark: #5a5147;
  --clay: #df875f;
  --clay-deep: #f3a17b;
  --clay-soft: rgba(223, 135, 95, .14);
  --cyan: #53c9d7;
  --cyan-deep: #78d8e2;
  --cyan-soft: rgba(83, 201, 215, .13);
  --shadow: 0 18px 45px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: Inter, "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; letter-spacing: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; }

.app-shell { width: min(1460px, calc(100vw - 56px)); margin: 0 auto; padding: 24px 0 26px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 55px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 7px); gap: 3px; width: 35px; padding: 5px; border: 1px solid var(--line-dark); background: var(--panel); }
.brand-mark i { display: block; width: 7px; height: 7px; background: var(--ink); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(5), .brand-mark i:nth-child(9) { background: var(--clay); }
.brand-mark i:nth-child(3), .brand-mark i:nth-child(7) { background: var(--cyan); }
.brand-kicker, .eyebrow { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; letter-spacing: .16em; text-transform: uppercase; }
.brand strong { display: block; font: 600 25px/1.08 Georgia, "Times New Roman", serif; }
.topbar-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.connection { display: inline-flex; align-items: center; gap: 6px; }
.connection i, .footer-status i, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: #46ad78; box-shadow: 0 0 0 3px rgba(70, 173, 120, .12); }
.credits { display: inline-flex; align-items: center; gap: 5px; padding-left: 14px; border-left: 1px solid var(--line); }
.credits b { color: var(--ink); font-weight: 700; }
.coin { color: var(--clay); }
.icon-btn, .account-btn, .subtle-btn, .more-btn, .tool-btn, .ghost-btn, .send-btn { border: 1px solid var(--line-dark); background: var(--panel); }
.icon-btn { display: inline-grid; place-items: center; width: 31px; height: 31px; border-radius: 5px; color: var(--muted-deep); }
.icon-btn:hover, .subtle-btn:hover, .tool-btn:hover, .ghost-btn:hover { border-color: var(--clay); color: var(--clay-deep); background: var(--clay-soft); }
.account-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 33px; padding: 4px 9px 4px 5px; border-radius: 5px; font-size: 12px; font-weight: 650; }
.account-btn #accountName { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: #fff8f0; background: #6d726f; font-size: 9px; letter-spacing: .03em; }
.chevron { color: var(--muted); font-size: 15px; }

.page-grid { display: grid; grid-template-columns: minmax(245px, 286px) minmax(480px, 1fr) minmax(220px, 260px); gap: 26px; padding: 29px 0 35px; align-items: start; }
.setup-panel, .discussion-panel, .insight-panel { min-width: 0; }
.panel-heading, .discussion-head, .insight-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.panel-heading h1, .discussion-head h2, .insight-head h3 { margin: 5px 0 0; letter-spacing: -.02em; }
.panel-heading h1 { font: 600 25px/1.18 Georgia, "Times New Roman", serif; }
.discussion-head h2 { max-width: 650px; font: 600 clamp(24px, 2.5vw, 34px)/1.12 Georgia, "Times New Roman", serif; }
.insight-head h3 { font: 650 16px/1.2 Inter, "Noto Sans SC", sans-serif; }
.draft-label { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.draft-label::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }

.role-stack { margin-top: 24px; }
.role-card { padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); transition: border-color .2s ease, transform .2s var(--ease); }
.role-card:hover { border-color: var(--line-dark); transform: translateY(-1px); }
.role-card-top { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.role-avatar, .message-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff9f1; font-weight: 750; }
.role-avatar { width: 29px; height: 29px; font-size: 12px; }
.message-avatar { width: 31px; height: 31px; margin-top: 2px; font-size: 11px; }
.avatar-alpha { background: var(--clay); }
.avatar-beta { background: var(--cyan-deep); }
.avatar-user { color: var(--muted-deep); background: var(--paper-deep); }
.role-title { display: grid; gap: 0; }
.role-title span { color: var(--muted); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.role-title strong { font-size: 14px; line-height: 1.2; }
.more-btn { margin-left: auto; padding: 2px 3px 5px; border: 0; background: transparent; color: var(--muted); font-weight: 700; letter-spacing: 2px; line-height: 1; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; margin: 11px 0 5px; color: var(--muted-deep); font-size: 11px; font-weight: 700; }
.field-label em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 500; }
.select-field, .prompt-field, .topic-field, #checkpointSelect { width: 100%; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: var(--panel-muted); }
.select-field { height: 31px; padding: 0 9px; font-size: 11px; }
.select-field:focus, .prompt-field:focus, .topic-field:focus, #checkpointSelect:focus, .composer:focus { border-color: var(--clay); box-shadow: 0 0 0 3px var(--clay-soft); }
.prompt-field, .topic-field { display: block; padding: 8px 9px; resize: vertical; font-size: 11px; line-height: 1.55; }
.prompt-field::placeholder, .topic-field::placeholder, .composer::placeholder { color: var(--muted); opacity: .75; }
.role-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; }
.role-tag { display: inline-flex; padding: 3px 6px; border-radius: 3px; color: var(--clay-deep); background: var(--clay-soft); font-size: 10px; font-weight: 700; }
.role-tag-cyan { color: var(--cyan-deep); background: var(--cyan-soft); }
.rate { color: var(--muted); font-size: 9px; }
.versus-mark { display: flex; align-items: center; gap: 8px; margin: -1px 15px; color: var(--muted); }
.versus-mark span { height: 1px; flex: 1; background: var(--line); }
.versus-mark b { font: 700 9px/1 Georgia, serif; letter-spacing: .1em; }
.setup-section { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; color: var(--muted-deep); font-size: 11px; font-weight: 750; }
.section-title small { color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.suggestion-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.suggestion { padding: 4px 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted-deep); background: transparent; font-size: 10px; }
.suggestion:hover { border-color: var(--clay); color: var(--clay-deep); background: var(--clay-soft); }
.rules-section { display: grid; gap: 10px; }
.switch-row, .select-row { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 0; }
.switch-row > span, .select-row > span { display: grid; flex: 1; gap: 1px; }
.switch-row b, .select-row b { font-size: 11px; }
.switch-row small, .select-row small { color: var(--muted); font-size: 9px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 35px; height: 20px; border-radius: 20px; background: var(--line-dark); transition: background .2s ease; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); transition: transform .2s var(--ease); }
.switch-row input:checked + .switch-ui { background: var(--clay); }
.switch-row input:checked + .switch-ui::after { transform: translateX(15px); }
#checkpointSelect { width: auto; min-width: 94px; height: 29px; padding: 0 7px; font-size: 10px; }
.start-btn { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 25px; padding: 11px 12px; border: 1px solid var(--clay); border-radius: 5px; color: #fff8f0; background: var(--clay); text-align: left; box-shadow: 0 8px 18px rgba(166, 83, 56, .15); transition: background .2s ease, transform .2s var(--ease); }
.start-btn:hover { background: var(--clay-deep); transform: translateY(-1px); }
.start-btn b { display: block; font-size: 12px; }
.start-btn small { display: block; margin-top: 1px; color: rgba(255, 248, 240, .72); font-size: 9px; }
.play-icon { width: 23px; font-size: 13px; text-align: center; }
.button-arrow { margin-left: auto; font-size: 17px; }

.discussion-panel { padding-left: 1px; }
.session-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.live-dot { display: inline-block; width: 6px; height: 6px; box-shadow: none; }
.meta-divider { width: 1px; height: 13px; background: var(--line); }
.head-actions { display: flex; align-items: center; gap: 8px; }
.subtle-btn { padding: 7px 9px; border-radius: 4px; color: var(--muted-deep); font-size: 10px; }
.topic-banner { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding: 10px 12px; border-left: 2px solid var(--clay); background: var(--clay-soft); }
.topic-pin { color: var(--clay-deep); font-size: 16px; }
.topic-banner > span:nth-child(2) { display: grid; flex: 1; gap: 1px; }
.topic-banner small { color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.topic-banner b { font-size: 12px; }
.topic-banner button { padding: 3px 5px; border: 0; color: var(--clay-deep); background: transparent; font-size: 10px; font-weight: 700; }
.timeline { position: relative; display: grid; gap: 24px; padding: 28px 17px 9px 4px; }
.timeline-line { position: absolute; top: 61px; bottom: 65px; left: 19px; border-left: 1px dashed var(--line-dark); }
.time-marker { position: relative; display: flex; align-items: center; gap: 9px; padding-left: 43px; color: var(--muted); font-size: 10px; }
.time-marker i { width: 5px; height: 5px; border: 1px solid var(--line-dark); border-radius: 50%; background: var(--paper); }
.message { position: relative; display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 13px; }
.message-main { min-width: 0; }
.message-meta { display: flex; align-items: baseline; gap: 8px; min-height: 18px; }
.message-meta b { font-size: 12px; }
.message-meta span { color: var(--muted); font-size: 10px; }
.message-meta time { margin-left: auto; color: var(--muted); font-size: 9px; }
.message-body { margin-top: 7px; max-width: 680px; color: var(--muted-deep); font-size: 13px; line-height: 1.72; }
.message-alpha .message-body { color: var(--ink); }
.message-user .message-body { padding: 8px 10px; border-left: 2px solid var(--line-dark); background: var(--panel-muted); }
.message-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.quote-btn { padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 9px; }
.quote-btn:hover { color: var(--clay-deep); }
.cursor-block { display: inline-block; width: 6px; height: 13px; margin-left: 2px; vertical-align: -2px; background: var(--clay); opacity: .8; animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.typing-dots { display: flex; align-items: center; gap: 4px; height: 28px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--clay); animation: typing .9s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .14s; }.typing-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes typing { 0%, 60%, 100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.pause-notice { position: relative; display: flex; align-items: center; gap: 10px; margin: 2px 0 0 44px; padding: 11px 12px; border: 1px dashed var(--line-dark); border-radius: 5px; background: var(--panel-muted); }
.pause-symbol { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: var(--clay-deep); background: var(--clay-soft); font-size: 9px; font-weight: 750; }
.pause-notice > span:nth-child(2) { display: grid; flex: 1; gap: 1px; }
.pause-notice b { font-size: 10px; }
.pause-notice small { color: var(--muted); font-size: 9px; }
.pause-notice button { padding: 3px 0; border: 0; color: var(--clay-deep); background: transparent; font-size: 10px; font-weight: 750; white-space: nowrap; }
.pause-notice button span { font-size: 14px; }
.composer-wrap { margin-top: 7px; padding: 13px 14px 12px; border: 1px solid var(--line-dark); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.composer-tools, .composer-bottom { display: flex; align-items: center; gap: 8px; }
.composer-label { color: var(--ink); font-size: 10px; font-weight: 750; }
.syntax-hint { color: var(--muted); font-size: 9px; }
code { padding: 2px 4px; border: 1px solid var(--line); border-radius: 3px; color: var(--clay-deep); background: var(--clay-soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }
.tool-spacer { flex: 1; }
.tool-btn { padding: 4px 6px; border-radius: 3px; color: var(--muted-deep); font-size: 9px; }
.composer { display: block; width: 100%; min-height: 55px; margin-top: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; outline: 0; resize: vertical; background: var(--panel-muted); font-size: 12px; line-height: 1.6; }
.composer-bottom { justify-content: space-between; margin-top: 9px; }
.composer-tip { color: var(--muted); font-size: 9px; }
.composer-actions { display: flex; gap: 7px; }
.ghost-btn, .send-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 29px; padding: 5px 9px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.ghost-btn { color: var(--muted-deep); }
.send-btn { border-color: var(--clay); color: #fff8f0; background: var(--clay); }
.send-btn:hover { background: var(--clay-deep); }

.insight-panel { display: grid; gap: 14px; }
.insight-card { padding: 15px; border: 1px solid var(--line); background: var(--panel); }
.insight-head .more-btn { margin-top: -4px; }
.cost-status { padding: 3px 5px; border-radius: 3px; color: #3d9463; background: rgba(70, 173, 120, .10); font-size: 9px; font-weight: 700; }
.context-meter { position: relative; display: grid; place-items: center; width: 142px; height: 142px; margin: 17px auto 12px; }
.context-meter svg { width: 142px; height: 142px; transform: rotate(-90deg); }
.context-meter circle { fill: none; stroke-width: 8; }
.meter-track { stroke: var(--paper-deep); }
.meter-value { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 308; stroke-dashoffset: 191; transition: stroke-dashoffset .6s var(--ease); }
.meter-center { position: absolute; display: grid; place-items: center; gap: 1px; }
.meter-center strong { font: 600 26px/1 Georgia, serif; }
.meter-center span { color: var(--muted); font-size: 9px; }
.meter-legend { display: grid; gap: 6px; padding-top: 7px; border-top: 1px solid var(--line); }
.meter-legend span, .cost-row { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.meter-legend b, .cost-row b { margin-left: auto; color: var(--muted-deep); font-size: 10px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-alpha { background: var(--clay); }
.dot-beta { background: var(--cyan); }
.dot-user { background: var(--line-dark); }
.context-limit { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.context-limit b { color: var(--muted-deep); font-weight: 650; }
.cost-total { display: flex; align-items: baseline; gap: 5px; margin: 18px 0 11px; }
.cost-total span { font: 600 32px/1 Georgia, serif; }
.cost-total small { color: var(--muted); font-size: 10px; }
.cost-bar { height: 5px; overflow: hidden; margin-bottom: 16px; border-radius: 5px; background: var(--paper-deep); }
.cost-bar span { display: block; width: 34%; height: 100%; border-radius: 5px; background: var(--clay); transition: width .5s var(--ease); }
.cost-row + .cost-row { margin-top: 8px; }
.cost-accent { color: var(--clay-deep) !important; }
.round-count { color: var(--clay-deep); font: 600 20px/1 Georgia, serif; }
.activity-list { display: grid; gap: 12px; margin-top: 17px; }
.activity-list > div { display: flex; align-items: flex-start; gap: 8px; }
.activity-icon { display: grid; place-items: center; flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%; color: #fff8f0; font-size: 8px; font-weight: 750; }
.activity-a { background: var(--clay); }.activity-b { background: var(--cyan-deep); }.activity-pause { color: var(--clay-deep); background: var(--clay-soft); }.activity-search { color: var(--cyan-deep); background: var(--cyan-soft); }
.activity-list p { display: grid; gap: 1px; margin: 0; color: var(--muted-deep); font-size: 10px; }
.activity-list p b { font-weight: 700; }.activity-list small { color: var(--muted); font-size: 9px; }
.history-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 16px; padding: 9px 0 0; border: 0; border-top: 1px solid var(--line); color: var(--clay-deep); background: transparent; font-size: 10px; font-weight: 700; text-align: left; }
.history-btn span { font-size: 15px; }
.safety-note { display: flex; gap: 9px; padding: 11px 12px; border-left: 2px solid var(--cyan); background: var(--cyan-soft); }
.shield { color: var(--cyan-deep); font-size: 18px; line-height: 1; }
.safety-note p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }.safety-note b { color: var(--muted-deep); font-size: 10px; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.footer > span:last-child { display: flex; align-items: center; gap: 15px; }.footer a { text-decoration: none; }.footer a:hover { color: var(--clay-deep); }.footer-status { display: inline-flex; align-items: center; gap: 5px; }
.toast { position: fixed; right: 26px; bottom: 23px; z-index: 10; max-width: min(340px, calc(100vw - 40px)); padding: 10px 13px; border: 1px solid var(--line-dark); border-radius: 5px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(7px); pointer-events: none; transition: opacity .2s ease, transform .2s var(--ease); }.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .app-shell { width: min(100% - 36px, 920px); }
  .page-grid { grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); gap: 25px; }
  .insight-panel { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .safety-note { min-height: 100%; }
}
@media (max-width: 760px) {
  .app-shell { width: min(100% - 24px, 560px); padding-top: 15px; }
  .topbar { align-items: flex-start; }.topbar-meta { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }.connection { display: none; }.credits { padding-left: 0; border: 0; }
  .page-grid { display: flex; flex-direction: column; gap: 30px; padding-top: 22px; }.setup-panel, .discussion-panel, .insight-panel { width: 100%; }.setup-panel { order: 2; }.discussion-panel { order: 1; }.insight-panel { order: 3; display: grid; grid-template-columns: 1fr; }
  .discussion-head h2 { font-size: 27px; }.head-actions .subtle-btn { display: none; }.topic-banner { margin-top: 18px; }.timeline { padding-right: 0; }.message-meta time { display: none; }.pause-notice { margin-left: 44px; }.composer-tools { align-items: flex-start; flex-wrap: wrap; }.syntax-hint { max-width: 180px; }.tool-spacer { display: none; }.composer-bottom { align-items: flex-start; flex-direction: column; }.composer-actions { width: 100%; }.ghost-btn, .send-btn { flex: 1; justify-content: center; }.footer { align-items: flex-start; flex-direction: column; }.footer > span:last-child { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 430px) {
  .brand strong { font-size: 22px; }.account-btn { padding-right: 6px; }.account-btn .chevron { display: none; }.credits { font-size: 10px; }.discussion-head { gap: 8px; }.discussion-head h2 { font-size: 24px; }.message { grid-template-columns: 27px minmax(0, 1fr); gap: 10px; }.message-avatar { width: 27px; height: 27px; font-size: 10px; }.timeline-line { left: 17px; }.pause-notice { margin-left: 37px; }.pause-notice button { display: none; }.topic-banner b { font-size: 11px; }.insight-card { padding: 13px; }
}
