:root {
  --paper: #e7eef6;
  --plate: #ffffff;
  --ink: #14233c;
  --muted: #5c6d84;
  --faint: #8b9aaf;
  --line: #d3deea;
  --brand: #1f5bb4;
  --brand-deep: #143e7a;
  --soft: #e7f0fb;
  --pulse: #0e8b78;
  --serif: "Source Serif 4", "Noto Serif SC", "Iowan Old Style", Palatino, serif;
  --sans: "Manrope", "Noto Sans SC", "Avenir Next", "PingFang SC", sans-serif;
  --shadow: 0 16px 40px rgba(20, 40, 72, 0.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(31, 91, 180, 0.16), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.45;
}

button, input { font: inherit; color: inherit; }

button {
  cursor: pointer;
  background: none;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  height: 46px;
  width: auto;
  max-width: 58%;
  display: block;
}

.lang {
  display: flex;
  padding: 4px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang button {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
}

.lang button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}

.eyebrow {
  margin: 36px 0 0;
  color: var(--brand);
  font-size: 0.92rem;
  font-weight: 700;
}

h1 {
  margin: 6px 0 0;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

.lead {
  max-width: 38rem;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.stage {
  display: grid;
  grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 32px;
}

.prompter {
  position: sticky;
  top: 18px;
  padding: 22px 22px 18px;
  background: var(--plate);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.prompter-head,
.slate-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.prompter h2,
.slate h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.source,
.count {
  margin: 0;
  color: var(--faint);
  font-size: 0.82rem;
}

.script-block {
  margin-top: 16px;
}

.script-block + .script-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sample-kicker {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.script-block.is-selected .sample-kicker { color: var(--brand); }

.script-block.is-live .sample-kicker { color: var(--pulse); }

.script-block .line {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.35vw, 1.28rem);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.015em;
}

.script-block .line + .line { margin-top: 0.7em; }

.script-block[lang="zh-Hans"] .line {
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.65;
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 10px;
}

.filter-label {
  margin: 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 700;
}

.trace {
  margin-top: 20px;
}

.trace svg {
  display: block;
  width: 100%;
  height: 36px;
}

.trace-track,
.trace-live {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.trace-track { stroke: #d5e2ef; }

.trace-live {
  stroke: var(--line);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.prompter.is-playing .trace-live { stroke: var(--pulse); }

.status {
  min-height: 2.6em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.slate-head { margin-bottom: 12px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.filters button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.voices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.voice {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.voice.is-active {
  background: var(--soft);
  border-color: #b9d0ee;
}

.voice.is-picked {
  box-shadow: inset 3px 0 0 var(--brand);
}

.play {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: white;
}

.play[aria-pressed="true"] { background: var(--pulse); }

.play:disabled {
  background: #9aafc8;
  cursor: progress;
}

.play svg { display: block; }

.who { min-width: 0; }

.name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.name {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tone {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: 0.9rem;
}

.meta {
  margin: 1px 0 0;
  color: var(--faint);
  font-size: 0.78rem;
}

.id-line {
  margin: 2px 0 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--muted);
  word-break: break-all;
}

.copy-id {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--brand-deep);
  font-size: 0.82rem;
  font-weight: 700;
}

.copy-id.is-copied {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; }
  .prompter { position: static; }
  .prompter-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .shell { width: min(1120px, calc(100% - 28px)); }
  .logo { height: 40px; }
  .lang button { padding: 8px 12px; }
  .voice { grid-template-columns: 46px minmax(0, 1fr); }
  .copy-id { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .trace-live { stroke-dashoffset: 0; }
  .prompter.is-playing .trace-live { stroke-dashoffset: 0; }
}
