:root {
  color-scheme: light;
  --navy: #142039;
  --ink: #202b40;
  --muted: #596171;
  --canvas: #f6f3eb;
  --paper: #fffefb;
  --line: #d9d7cf;
  --cobalt: #214dcc;
  --coral: #a9382c;
  --teal: #09685d;
  --violet: #6541a6;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.65; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea, fieldset { min-width: 0; }
button, h1, h2, h3, p, span, legend { overflow-wrap: anywhere; }
button { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 4px; }
.masthead :focus-visible { outline-color: white; }
.skip-link { position: absolute; z-index: 10; top: -100px; left: 16px; padding: 12px 20px; background: white; color: var(--navy); }
.skip-link:focus { top: 12px; }
.masthead { background: var(--navy); color: white; border-top: 5px solid #ec816e; }
.header-inner { max-width: 1240px; margin: auto; padding: 24px 36px 34px; position: relative; }
.brand-line { display: flex; gap: 12px; align-items: center; font-size: .76rem; letter-spacing: .12em; color: #d3dcec; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; background: #ec816e; border-radius: 9px; color: var(--navy); font-size: 1.3rem; font-weight: 900; letter-spacing: -.08em; }
.edition { margin-left: auto; font-size: .65rem; }
h1 { margin: 17px 0 5px; font-size: clamp(1.5rem, 3.8vw, 2.5rem); letter-spacing: .025em; line-height: 1.4; }
.tagline { margin: 0; font-size: 1rem; color: #e8edfa; font-weight: 600; }
.tagline span { display: inline-block; }
.disclosure { margin: 14px 0 0; color: #c4cee1; font-size: .78rem; }
.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; max-width: 1240px; margin: 0 auto; padding: 32px 36px 40px; align-items: start; }
.settings-panel, .conversation-panel { min-width: 0; }
.settings-panel { background: var(--paper); padding: 22px; border: 1px solid var(--line); border-radius: 14px; }
.eyebrow { display: block; font-size: .65rem; font-weight: 800; letter-spacing: .14em; color: var(--muted); }
h2 { font-size: 1.22rem; margin: 3px 0 0; line-height: 1.5; }
.section-heading { margin-bottom: 22px; }
label { display: block; font-size: .8rem; font-weight: 700; }
label > span { margin-left: 6px; }
textarea, input, select { width: 100%; border: 1px solid #a6a8b0; border-radius: 7px; background: white; color: var(--ink); padding: 10px; font-size: 1rem; line-height: 1.45; }
textarea { display: block; resize: vertical; min-height: 82px; max-height: 240px; margin-top: 9px; }
input, select { min-height: 44px; }
.field-help { font-size: .71rem; color: var(--muted); margin: 6px 0 10px; }
.field-error { margin: 4px 0; font-size: .76rem; font-weight: 600; color: #a12325; }
.field-error:empty { display: none; }
[aria-invalid="true"] { border: 2px solid #b42b2f; }
.error-summary { border: 1px solid #b42b2f; background: #fff0ec; color: #8e2124; padding: 12px; border-radius: 8px; font-size: .83rem; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.chip { border: 1px solid #bfc2ca; background: white; color: #3d485f; border-radius: 20px; min-height: 36px; padding: 6px 11px; font-size: .73rem; font-weight: 600; }
.chip[aria-pressed="true"] { background: #e9eeff; border-color: var(--cobalt); color: #183fae; }
.chip:hover { border-color: var(--cobalt); background: #eef1fa; }
.participant-heading { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.participant-heading label { flex: 1; }
.participant-heading select { width: 72px; padding: 7px; font-size: .85rem; }
.speaker-0 { --speaker: var(--coral); --tint: #fff0ea; --face: #f0a18a; }
.speaker-1 { --speaker: var(--teal); --tint: #eaf6f0; --face: #82c9b3; }
.speaker-2 { --speaker: var(--violet); --tint: #f2edff; --face: #bca3ed; }
.agent-editor { margin: 14px 0 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-left: 3px solid var(--speaker); border-radius: 8px; background: var(--tint); }
.agent-editor legend { padding: 0 5px; font-size: .67rem; color: var(--speaker); font-weight: 800; }
.agent-name { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.agent-name > div { flex: 1; min-width: 0; }
.agent-editor label { font-size: .67rem; margin-bottom: 3px; }
.agent-editor select { font-size: .78rem; padding: 9px 6px; }
.avatar { width: 48px; height: 48px; display: inline-block; flex: 0 0 auto; position: relative; background: var(--face, #f0a18a); border: 2px solid var(--speaker, #a9382c); border-radius: 18px 18px 15px 15px; transform: rotate(-4deg); }
.avatar::before { content: ""; position: absolute; top: 15px; left: 12px; width: 4px; height: 5px; border-radius: 4px; background: var(--navy); box-shadow: 13px 0 var(--navy); }
.avatar::after { content: ""; position: absolute; top: 26px; left: 16px; width: 12px; height: 7px; border: 2px solid var(--navy); border-top: 0; border-radius: 0 0 12px 12px; }
.face-skeptical { transform: rotate(4deg); border-radius: 13px; }
.face-skeptical::after { top: 29px; height: 0; border-bottom: 0; border-radius: 0; transform: rotate(-10deg); }
.face-mediator { transform: none; border-radius: 50%; }
.face-playful { border-radius: 19px 12px 19px 12px; transform: rotate(7deg); }
.face-playful::before { height: 3px; transform: rotate(-8deg); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 46px; border: 1px solid transparent; border-radius: 8px; padding: 11px 15px; font-size: .83rem; font-weight: 750; line-height: 1.4; }
.primary { background: var(--cobalt); color: white; }
.primary:hover:not(:disabled) { background: #163bab; }
.secondary { color: var(--navy); background: white; border-color: #9da5b6; }
.secondary:hover:not(:disabled) { background: #e9edfa; }
.quiet { color: #414d64; background: transparent; border-color: #babec7; }
.quiet:hover { background: #e9e6df; }
button:disabled { cursor: default; color: #616777; background: #e4e5e9; border-color: #d1d3da; }
#start { width: 100%; margin-top: 20px; }
.settings-note { text-align: center; margin: 10px 0 0; line-height: 1.8; }
.conversation-panel { padding: 4px 0 0; }
.conversation-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.status { border: 1px solid #b9bfcc; border-radius: 20px; background: #fffefb; padding: 5px 10px; font-size: .73rem; font-weight: 700; flex-shrink: 0; }
.status[data-status="running"] { color: #183fae; border-color: #768ddb; background: #eaf0ff; }
.status[data-status="paused"] { color: #7c4a0a; border-color: #b59562; background: #fff1d9; }
.status[data-status="complete"] { color: var(--teal); border-color: #69a18e; background: #eaf6f0; }
.conversation-topic { margin: 22px 0 20px; font-size: clamp(1.15rem, 2vw, 1.5rem); line-height: 1.6; }
.progress-heading { display: flex; justify-content: space-between; gap: 10px; font-size: .74rem; color: var(--muted); font-weight: 600; }
progress { width: 100%; height: 5px; display: block; border: 0; border-radius: 10px; margin: 8px 0 14px; accent-color: var(--cobalt); background: #dce0e9; }
progress::-webkit-progress-bar { background: #dce0e9; border-radius: 10px; }
progress::-webkit-progress-value { background: var(--cobalt); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--cobalt); border-radius: 10px; }
.turn-rail { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px; }
.turn-rail li { display: grid; place-items: center; height: 33px; border: 1px solid #c7cbd4; border-radius: 7px; background: #eeeee9; color: #677080; font-size: .73rem; font-weight: 800; }
.turn-rail li.done { color: var(--speaker); border-color: var(--speaker); background: var(--tint); }
.turn-rail li[aria-current] { box-shadow: 0 3px 0 var(--speaker); }
.state-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.metric { display: flex; align-items: center; justify-content: space-between; gap: 5px; border-top: 2px solid #9ca6b8; padding: 7px 9px; font-size: .73rem; background: var(--paper); }
.metric strong { font-size: 1.25rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric.agreement { color: var(--teal); border-color: var(--teal); }
.metric.disagreement { color: var(--coral); border-color: var(--coral); }
.metric.digression { color: var(--violet); border-color: var(--violet); }
.feed { height: 610px; max-height: 72vh; min-height: 340px; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 12px; background: #eeece5; padding: 18px; scroll-behavior: auto; }
.empty-state { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 25px 4px; }
.avatar-group { display: flex; gap: 13px; margin: 0 0 30px; }
.avatar-group .avatar:nth-child(2) { margin-top: -10px; }
.empty-state h3 { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.7; letter-spacing: .04em; margin: 16px 0 14px; }
.empty-state p { font-size: .85rem; color: #525c6d; line-height: 2; margin: 0; }
.empty-hint { font-size: .72rem; color: #405071; margin-top: 28px; padding: 10px 14px; border: 1px dashed #a8b2c7; border-radius: 7px; }
.messages { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.message { min-width: 0; animation: arrive 180ms ease-out; }
.message-card { background: var(--paper); border: 1px solid #d7d7d3; border-left: 4px solid var(--speaker); border-radius: 10px; padding: 17px; box-shadow: 0 2px 3px #14203906; }
.message-head { display: flex; align-items: center; gap: 10px; }
.mini { width: 40px; height: 40px; }
.mini::before { top: 12px; left: 9px; box-shadow: 11px 0 var(--navy); }
.mini::after { top: 23px; left: 12px; width: 11px; height: 6px; }
.mini.face-skeptical::after { height: 0; top: 25px; }
.identity { flex: 1; min-width: 0; }
.identity h3 { margin: 0; color: var(--speaker); font-size: .93rem; line-height: 1.4; }
.personality-label { font-size: .65rem; color: var(--muted); }
.state { flex-shrink: 0; font-size: .67rem; font-weight: 700; padding: 3px 8px; border-radius: 5px; background: #e9edf5; color: #394967; }
.state-agreement { color: var(--teal); background: #e0f1e9; }
.state-disagreement { color: var(--coral); background: #ffe7df; }
.state-digression { color: var(--violet); background: #eee5ff; }
.message-text { font-size: .88rem; line-height: 1.95; white-space: pre-wrap; margin: 13px 0 10px; }
.turn-label { font-size: .62rem; letter-spacing: .04em; color: var(--muted); }
.completion { padding: 22px 10px 4px; font-size: .83rem; text-align: center; }
.completion p { color: var(--muted); font-size: .77rem; line-height: 1.9; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 18px; }
.controls .primary { flex: 1; }
.playback-note { margin: 10px 0 18px; }
.explanation { border-top: 1px solid #c8c9cd; border-bottom: 1px solid #c8c9cd; padding: 15px 0; font-size: .78rem; color: #46536a; }
summary { cursor: pointer; color: var(--navy); font-weight: 700; min-height: 28px; }
.explanation p { margin: 13px 0 0; line-height: 1.9; }
.site-footer { max-width: 1168px; margin: auto; padding: 20px 0 30px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .71rem; }
.script-notice { margin: 20px; padding: 12px; border: 1px solid #a12325; color: #a12325; background: white; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@keyframes arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 300px minmax(0, 1fr); gap: 20px; padding: 26px 24px; }
  .header-inner { padding-inline: 24px; }
  .settings-panel { padding: 17px; }
  .feed { padding: 12px; }
  .message-card { padding: 13px; }
  .site-footer { margin-inline: 24px; }
  .metric { padding-inline: 6px; }
}
@media (max-width: 740px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 20px 16px 30px; }
  .header-inner { padding: 20px 20px 26px; }
  .edition { display: none; }
  .settings-panel { padding: 18px; }
  .conversation-panel { padding-top: 0; }
  .feed { height: 560px; max-height: 70vh; min-height: 300px; }
  .site-footer { margin-inline: 16px; flex-wrap: wrap; }
  .controls .button { padding-inline: 12px; }
}
@media (max-width: 360px) {
  .workspace { padding-inline: 12px; }
  .header-inner { padding-inline: 16px; }
  .settings-panel { padding: 14px; }
  .state-counts { gap: 5px; }
  .metric { font-size: .68rem; padding-inline: 5px; }
  .turn-rail { gap: 4px; }
  .feed { padding: 8px; }
  .message-card { padding: 11px; }
  .message-head { gap: 7px; }
  .controls .button { font-size: .75rem; padding-inline: 9px; }
  .empty-state p { font-size: .77rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .avatar { border-color: CanvasText; }
  .turn-rail li[aria-current] { outline: 2px solid Highlight; }
  .message-card { border-left-width: 4px; }
}
