:root {
  --paper: #f4efe6;
  --paper-deep: #e9e1d4;
  --ink: #17221f;
  --muted: #65706b;
  --line: #cfc6b8;
  --white: #fffdf8;
  --blue: #275f78;
  --blue-soft: #dce9ec;
  --coral: #df654a;
  --coral-soft: #f4d7ce;
  --yellow: #f1c969;
  --green: #426b58;
  --shadow: 0 20px 60px rgba(50, 42, 31, .10);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(223,101,74,.12), transparent 26rem),
    radial-gradient(circle at 90% 34%, rgba(39,95,120,.11), transparent 29rem),
    var(--paper);
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(39,95,120,.28);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  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='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.17'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.site-header {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23,34,31,.18);
  position: relative;
  z-index: 3;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  color: var(--white); background: var(--coral); border: 2px solid var(--ink);
  border-radius: 12px 5px 11px 6px; transform: rotate(-3deg);
  font-family: "Noto Serif SC", serif; font-weight: 900; font-size: 23px;
  box-shadow: 4px 4px 0 var(--ink);
}
.brand strong { display: block; font-family: "Noto Serif SC", serif; font-size: 18px; letter-spacing: .03em; }
.brand small { display: block; margin-top: 2px; font: 500 9px/1.2 "DM Mono", monospace; letter-spacing: .12em; color: var(--muted); }
.header-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 4px rgba(241,201,105,.22); }
.mode-dot.model { background: var(--green); box-shadow: 0 0 0 4px rgba(66,107,88,.18); }

main { width: min(1480px, calc(100% - 48px)); margin: 0 auto; position: relative; z-index: 2; }
.setup-view { min-height: calc(100vh - 91px); display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(480px, .78fr); gap: clamp(44px, 7vw, 110px); align-items: center; padding: 54px 4vw 72px; }
.setup-copy { max-width: 720px; }
.kicker, .eyebrow { margin: 0; color: var(--coral); text-transform: uppercase; font: 500 11px/1.4 "DM Mono", monospace; letter-spacing: .16em; }
.setup-copy h1 {
  margin: 18px 0 22px;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(44px, 5vw, 78px);
  line-height: 1.1;
  letter-spacing: -.04em;
  max-width: 760px;
}
.setup-copy h1 em { display: block; font-style: normal; color: var(--blue); position: relative; width: fit-content; }
.setup-copy h1 em::after { content: ""; position: absolute; left: 2%; right: -3%; bottom: -9px; height: 9px; background: var(--yellow); border-radius: 50%; transform: rotate(-1deg); opacity: .75; z-index: -1; }
.lede { max-width: 650px; margin: 0; color: #43504b; font-size: 18px; line-height: 1.85; }
.promise-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 34px; }
.promise-grid article { padding: 17px 16px 18px; border-top: 1px solid var(--ink); background: rgba(255,253,248,.36); }
.promise-grid span { font: 500 10px/1 "DM Mono", monospace; color: var(--coral); }
.promise-grid strong { display: block; margin: 15px 0 7px; font-size: 14px; }
.promise-grid p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.truth-card { margin-top: 26px; padding: 18px 20px; display: flex; gap: 20px; align-items: baseline; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); }
.truth-card strong { color: var(--ink); white-space: nowrap; }
.truth-card p { margin: 0; font-size: 12px; line-height: 1.7; }

.situation-form {
  padding: 30px;
  background: rgba(255,253,248,.86);
  border: 1px solid rgba(23,34,31,.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 9px 9px 0 rgba(39,95,120,.14);
  backdrop-filter: blur(8px);
}
.form-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.form-head h2 { margin: 4px 0 0; font-family: "Noto Serif SC", serif; font-size: 28px; }
.text-button { padding: 6px 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: var(--blue); cursor: pointer; font-size: 12px; }
.field { display: block; margin-top: 15px; }
.field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.field b { font-size: 12px; }
.field small { color: var(--muted); font-size: 10px; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px;
  color: var(--ink); background: rgba(244,239,230,.62); font-size: 13px; line-height: 1.55;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field textarea:focus { border-color: var(--blue); background: var(--white); box-shadow: 0 0 0 4px rgba(39,95,120,.08); outline: 0; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.risk-field { margin: 20px 0 0; padding: 0; border: 0; }
.risk-field legend { margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.risk-field { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.risk-field legend { grid-column: 1 / -1; }
.risk-field label { position: relative; display: flex; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.risk-field label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.risk-field input { width: 14px; height: 14px; margin: 2px 0 0; accent-color: var(--blue); }
.risk-field b, .risk-field small { display: block; }
.risk-field b { font-size: 11px; }
.risk-field small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.form-error { min-height: 18px; margin-top: 12px; color: #a43e2c; font-size: 12px; }
.primary-button, .secondary-button, .dark-button {
  border: 1px solid var(--ink); border-radius: 11px; cursor: pointer; font-weight: 700;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.primary-button:hover, .secondary-button:hover, .dark-button:hover { transform: translateY(-2px); }
.primary-button:disabled, .secondary-button:disabled, .dark-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 16px; color: var(--white); background: var(--coral); box-shadow: 4px 4px 0 var(--ink); }
.start-button { width: 100%; min-height: 50px; font-size: 14px; }
.secondary-button { padding: 9px 13px; background: var(--white); }
.dark-button { padding: 9px 14px; color: var(--white); background: var(--ink); }
.privacy-note { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 9px; line-height: 1.5; }

.rehearsal-view { padding: 28px 0 40px; }
.rehearsal-toolbar { min-height: 72px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.rehearsal-toolbar h1 { margin: 5px 0 0; font-family: "Noto Serif SC", serif; font-size: clamp(25px, 3vw, 38px); }
.toolbar-actions { display: flex; align-items: center; gap: 9px; }
.branch-badge { padding: 7px 10px; border-radius: 999px; background: var(--yellow); font: 500 10px/1 "DM Mono", monospace; }
.rehearsal-grid { height: calc(100vh - 164px); min-height: 620px; display: grid; grid-template-columns: minmax(240px, .72fr) minmax(480px, 1.45fr) minmax(300px, .88fr); gap: 14px; }
.panel { min-height: 0; overflow: hidden; border: 1px solid rgba(23,34,31,.22); border-radius: 18px; background: rgba(255,253,248,.76); box-shadow: 0 9px 30px rgba(50,42,31,.06); }
.panel-title { min-height: 58px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-title span { font-family: "Noto Serif SC", serif; font-weight: 700; }
.panel-title small { font: 500 9px/1 "DM Mono", monospace; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }

.brief-panel { overflow-y: auto; }
.brief-list { margin: 0; padding: 10px 18px 0; }
.brief-list div { padding: 14px 0; border-bottom: 1px solid rgba(207,198,184,.7); }
.brief-list dt { margin-bottom: 5px; color: var(--muted); font: 500 9px/1.4 "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.brief-list dd { margin: 0; font-size: 12px; line-height: 1.7; }
.brief-list .boundary-item { margin: 8px -9px; padding: 14px 10px; border: 1px solid rgba(223,101,74,.28); border-radius: 10px; background: var(--coral-soft); }
.safety-note { margin: 16px 18px; padding: 12px; border-left: 3px solid var(--yellow); background: rgba(241,201,105,.16); font-size: 11px; line-height: 1.65; }
.uncertainty-box { margin: 0 18px 20px; color: var(--muted); font-size: 11px; }
.uncertainty-box summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.uncertainty-box ul { padding-left: 18px; line-height: 1.7; }

.conversation-panel { display: flex; flex-direction: column; background: rgba(255,253,248,.92); }
.conversation-head { flex: 0 0 auto; min-height: 58px; padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.conversation-head > div { display: flex; align-items: center; gap: 8px; }
.conversation-head strong { font-size: 12px; }
.conversation-head p { margin: 0; color: var(--muted); font-size: 10px; }
.live-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 5px rgba(223,101,74,.13); animation: live 2.2s infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 8px rgba(223,101,74,0); } }
.conversation-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 24px clamp(18px, 4vw, 54px); scroll-behavior: smooth; }
.message-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; margin-bottom: 23px; animation: arrive .3s ease both; }
.message-row.user { grid-template-columns: minmax(0, 1fr) 38px; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--white); background: var(--blue); font-family: "Noto Serif SC", serif; font-weight: 800; font-size: 13px; }
.user .avatar { order: 2; background: var(--coral); }
.message-body { max-width: 83%; }
.user .message-body { justify-self: end; text-align: right; }
.speaker { margin: 0 0 6px; color: var(--muted); font: 500 9px/1 "DM Mono", monospace; letter-spacing: .07em; }
.bubble { display: inline-block; padding: 13px 15px; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; background: var(--white); font-size: 13px; line-height: 1.75; text-align: left; }
.user .bubble { border-color: rgba(39,95,120,.35); border-radius: 14px 4px 14px 14px; background: var(--blue-soft); }
.message-tools { margin-top: 7px; }
.fork-button { padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 9px; }
.fork-button:hover { color: var(--blue); border-color: currentColor; }
.source-tag { margin-left: 8px; color: #8a918e; font: 400 8px/1 "DM Mono", monospace; }
.typing { color: var(--muted); }
.typing::after { content: "···"; display: inline-block; width: 18px; overflow: hidden; vertical-align: bottom; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { from { width: 0; } }
.reply-form { flex: 0 0 auto; padding: 15px 18px 17px; border-top: 1px solid var(--line); background: rgba(244,239,230,.7); }
.reply-form label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 700; }
.reply-form textarea { width: 100%; resize: none; border: 0; border-bottom: 1px solid var(--ink); padding: 8px 2px 10px; color: var(--ink); background: transparent; font-size: 14px; line-height: 1.65; outline: 0; }
.reply-form textarea:focus { border-color: var(--coral); }
.reply-footer { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reply-footer > span { color: var(--muted); font-size: 9px; }
.reply-footer .primary-button { padding: 9px 13px; box-shadow: 3px 3px 0 var(--ink); }

.echo-panel { overflow-y: auto; }
.signal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.signal { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(244,239,230,.48); }
.signal-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }
.signal-head b { color: var(--ink); font: 700 10px/1 "Microsoft YaHei", system-ui, sans-serif; }
.signal p { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.signal.tension .signal-head b, .signal.risk .signal-head b { color: var(--coral); }
.signal.openness .signal-head b, .signal.progress .signal-head b { color: var(--blue); }
.echo-empty { min-height: 300px; padding: 60px 30px; text-align: center; color: var(--muted); }
.echo-empty span { display: block; margin-bottom: 18px; color: var(--blue); font: 400 32px/1 "DM Mono", monospace; }
.echo-empty p { margin: 0; font-size: 12px; line-height: 1.8; }
.echo-content { padding: 4px 18px 24px; }
.echo-content article { padding: 15px 0; border-bottom: 1px solid var(--line); }
.echo-content article p:last-child { margin: 7px 0 0; font-size: 12px; line-height: 1.75; }
.echo-label { margin: 0; color: var(--muted); font: 500 9px/1.3 "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.risk-echo { color: #8b3e30; }
.coach-details { margin-top: 18px; border: 1px solid rgba(39,95,120,.3); border-radius: 12px; overflow: hidden; background: var(--blue-soft); }
.coach-details summary { padding: 13px 14px; cursor: pointer; color: var(--blue); font-size: 11px; font-weight: 700; }
.coach-question { margin: 0; padding: 0 14px 13px; font-family: "Noto Serif SC", serif; font-size: 13px; line-height: 1.65; }
.variant-list { padding: 0 10px 10px; display: grid; gap: 7px; }
.variant-button { padding: 10px; border: 1px solid rgba(39,95,120,.25); border-radius: 9px; background: var(--white); cursor: pointer; text-align: left; }
.variant-button strong { display: block; margin-bottom: 4px; color: var(--blue); font-size: 10px; }
.variant-button span { font-size: 11px; line-height: 1.55; }

.debrief-dialog { width: min(700px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--ink); border-radius: 20px; color: var(--ink); background: var(--white); box-shadow: 12px 12px 0 var(--ink); }
.debrief-dialog::backdrop { background: rgba(23,34,31,.58); backdrop-filter: blur(5px); }
.dialog-shell { position: relative; padding: 36px; overflow-y: auto; }
.dialog-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 22px; }
.dialog-shell h2 { margin: 8px 0 16px; font-family: "Noto Serif SC", serif; font-size: 36px; }
.debrief-summary { padding: 16px; border-left: 4px solid var(--coral); background: var(--coral-soft); line-height: 1.75; }
.dialog-shell section { margin-top: 24px; }
.dialog-shell h3 { margin: 0 0 10px; font-size: 13px; }
.dialog-shell ul { margin: 0; padding-left: 20px; color: #3f4a46; font-size: 12px; line-height: 1.8; }
.dialog-actions { margin-top: 28px; display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 20px); padding: 10px 14px; border-radius: 999px; color: var(--white); background: var(--ink); font-size: 11px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .setup-view { grid-template-columns: 1fr; padding-left: 2vw; padding-right: 2vw; }
  .setup-copy { max-width: 860px; }
  .situation-form { max-width: 780px; }
  .rehearsal-grid { height: auto; min-height: 0; grid-template-columns: 280px minmax(0, 1fr); }
  .brief-panel { max-height: 760px; }
  .conversation-panel { min-height: 720px; }
  .echo-panel { grid-column: 1 / -1; }
  .signal-grid { grid-template-columns: repeat(4, 1fr); }
  .echo-content { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .echo-content article { border-bottom: 0; }
  .coach-details { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .site-header, main { width: min(100% - 24px, 1480px); }
  .site-header { padding: 15px 0; }
  .header-note { font-size: 9px; }
  .setup-view { padding: 38px 0 50px; gap: 40px; }
  .setup-copy h1 { font-size: 42px; }
  .lede { font-size: 15px; }
  .promise-grid { grid-template-columns: 1fr; }
  .truth-card { align-items: flex-start; flex-direction: column; gap: 6px; }
  .situation-form { padding: 22px 17px; box-shadow: var(--shadow), 5px 5px 0 rgba(39,95,120,.14); }
  .field-pair { grid-template-columns: 1fr; gap: 0; }
  .risk-field { grid-template-columns: 1fr; }
  .rehearsal-toolbar { align-items: flex-end; }
  .rehearsal-toolbar h1 { font-size: 24px; }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .toolbar-actions .secondary-button { display: none; }
  .rehearsal-grid { display: flex; flex-direction: column; }
  .brief-panel { order: 1; max-height: none; }
  .conversation-panel { order: 2; min-height: 650px; }
  .echo-panel { order: 3; }
  .brief-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .brief-list .boundary-item { margin-left: 0; margin-right: 0; }
  .conversation-log { padding: 20px 14px; }
  .message-body { max-width: 94%; }
  .signal-grid { grid-template-columns: 1fr 1fr; }
  .echo-content { display: block; }
  .echo-content article { border-bottom: 1px solid var(--line); }
  .dialog-shell { padding: 30px 20px 24px; }
  .dialog-actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

