:root {
  color-scheme: dark;
  --ink: #fff3c5;
  --muted: #c8b993;
  --line: rgba(235, 202, 128, 0.24);
  --panel: rgba(19, 28, 25, 0.95);
  --panel-soft: rgba(10, 21, 18, 0.78);
  --gold: #edc45f;
  --green: #52d8ad;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 900px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(8, 18, 15, 0.72), rgba(7, 15, 13, 0.88)),
    url("./assets/scenes/tea-sea-morning.png") center / cover fixed no-repeat;
}

button,
input,
textarea { font: inherit; }

button,
.bar-actions a {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

button:hover,
.bar-actions a:hover { border-color: rgba(255, 221, 139, 0.68); background: rgba(255, 255, 255, 0.09); }

.voice-lab { min-height: 100vh; }

.voice-bar {
  min-height: 66px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 24, 22, 0.96);
}

.voice-bar strong { display: block; font-size: 21px; }
.voice-bar span { color: var(--muted); font-size: 12px; }

.bar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.bar-actions a,
.bar-actions button {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}
.bar-actions .primary { color: #15211d; background: var(--gold); }
.voice-bar .backup-status {
  flex: 1 1 100%;
  min-height: 16px;
  color: var(--muted);
  text-align: right;
}
.voice-bar .backup-status[data-state="success"] { color: var(--green); }
.voice-bar .backup-status[data-state="error"] { color: #ff9b83; }

.voice-toolbar {
  min-height: 66px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 21, 18, 0.9);
}

.voice-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; }
.voice-tabs button { min-width: 98px; min-height: 34px; border: 0; font-weight: 850; }
.voice-tabs button[aria-selected="true"] { color: #17231f; background: var(--gold); }
.speaker-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; }
.speaker-switch[hidden] { display: none; }
.speaker-switch button { min-width: 94px; min-height: 34px; border: 0; font-size: 11px; font-weight: 850; }
.speaker-switch button[aria-pressed="true"] { color: #11251f; background: var(--green); }
.voice-toolbar p { margin: 0; color: var(--muted); font-size: 12px; }

.voice-workspace {
  display: grid;
  grid-template-columns: minmax(640px, 1fr) 340px;
  min-height: calc(100vh - 132px);
}

.voice-editor { padding: 14px 18px 24px; background: var(--panel); }

.settlement-preview {
  margin: 0 0 14px;
  padding: 13px 14px;
  border: 1px solid rgba(237, 196, 95, 0.38);
  border-radius: 7px;
  background: rgba(4, 13, 11, 0.58);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}
.settlement-preview[hidden] { display: none; }
.settlement-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.settlement-preview-heading strong { display: block; color: #f2d680; font-size: 15px; }
.settlement-preview-heading span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.settlement-preview-heading .preview-play {
  min-width: 108px;
  height: 38px;
  color: #11251f;
  border: 0;
  background: var(--green);
  font-size: 12px;
  font-weight: 900;
}
.settlement-preview-builder {
  margin-top: 11px;
  display: grid;
  grid-template-columns: 92px auto minmax(310px, 1fr) auto 92px auto;
  gap: 8px;
  align-items: center;
}
.settlement-preview-builder > label { display: grid; gap: 4px; }
.settlement-preview-builder label > span,
.settlement-preview-builder legend { color: #d8c58f; font-size: 10px; font-weight: 800; }
.settlement-preview-builder input {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(5, 13, 11, 0.8);
  text-align: center;
  font-weight: 850;
}
.settlement-preview-builder fieldset { min-width: 0; margin: 0; padding: 5px 7px 7px; border: 1px solid var(--line); border-radius: 6px; }
.settlement-preview-builder legend { padding: 0 4px; }
.settlement-mingtang-options { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.settlement-mingtang-options button {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 850;
}
.settlement-mingtang-options button[aria-pressed="true"] { color: #15211d; border-color: transparent; background: var(--gold); }
.settlement-preview-phrase { padding-top: 15px; color: #f0d58c; font-size: 13px; font-weight: 900; }
.settlement-preview-text {
  min-height: 30px;
  margin: 10px 0 0;
  padding: 7px 10px;
  color: #fff2c4;
  border-left: 3px solid var(--gold);
  background: rgba(237, 196, 95, 0.075);
  font-size: 12px;
  font-weight: 850;
}
.settlement-recording-heading {
  margin-top: 12px;
  padding-top: 11px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(237, 196, 95, 0.2);
}
.settlement-recording-heading strong { display: block; color: #f2d680; font-size: 13px; }
.settlement-recording-heading > div > span {
  display: block;
  max-width: 720px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.settlement-group-progress {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
}
.settlement-group-switch {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(116px, 1fr));
  gap: 5px;
}
.settlement-group-switch button {
  min-height: 46px;
  padding: 6px 9px;
  display: grid;
  align-content: center;
  gap: 2px;
  text-align: left;
}
.settlement-group-switch button strong { color: #efe1b3; font-size: 11px; }
.settlement-group-switch button span { color: var(--muted); font-size: 9px; }
.settlement-group-switch button[aria-pressed="true"] {
  color: #12251f;
  border-color: transparent;
  background: var(--green);
}
.settlement-group-switch button[aria-pressed="true"] strong,
.settlement-group-switch button[aria-pressed="true"] span { color: #12251f; }
.voice-list-heading,
.voice-row {
  display: grid;
  grid-template-columns: 112px minmax(160px, 1fr) 52px 310px;
  gap: 8px;
  align-items: center;
}

.voice-list-heading {
  min-height: 30px;
  padding: 0 10px;
  color: #d8c58f;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
}

.voice-list { display: grid; }
.voice-row {
  min-height: 67px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(235, 202, 128, 0.12);
  background: rgba(255, 255, 255, 0.008);
}
.voice-row:hover { background: rgba(255, 255, 255, 0.028); }
.voice-row.recording { background: rgba(229, 147, 52, 0.1); box-shadow: inset 3px 0 #ffb449; }

.voice-name { display: flex; align-items: center; gap: 8px; color: #f1d68d; font-size: 12px; font-weight: 850; }
.card-chip {
  width: 30px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #161310;
  border: 2px solid #d2c09c;
  border-radius: 4px;
  background: #fffdf5;
  font: 900 21px "STKaiti", "KaiTi", serif;
}
.card-chip.red { color: #c5281d; }

.voice-row input {
  width: 100%;
  height: 36px;
  padding: 0 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(5, 13, 11, 0.72);
}

.voice-row > button { height: 34px; padding: 0; font-size: 11px; font-weight: 800; }
.audio-controls { display: grid; grid-template-columns: 66px 66px 66px minmax(0, 1fr); gap: 5px; align-items: center; }
.audio-controls button { height: 30px; padding: 0; font-size: 10px; }
.audio-controls .record-button { border-color: rgba(255, 147, 86, 0.5); }
.voice-row.recording .record-button { color: #24170d; background: #ffb449; }
.audio-status { overflow: hidden; color: #8e9f98; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.voice-row.has-audio .audio-status { color: var(--green); }
.delete-audio:disabled { opacity: 0.34; cursor: default; }

.voice-output {
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--panel-soft);
}
.voice-output h2 { margin: 0 0 8px; color: #f0d58c; font-size: 16px; }
.voice-output p { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.voice-output textarea {
  position: sticky;
  top: 18px;
  width: 100%;
  height: calc(100vh - 235px);
  min-height: 360px;
  padding: 12px;
  resize: vertical;
  color: #e9ddb9;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(5, 12, 10, 0.82);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 1120px) {
  .voice-workspace { grid-template-columns: 1fr; }
  .voice-output { border-top: 1px solid var(--line); border-left: 0; }
  .voice-output textarea { position: static; height: 330px; min-height: 330px; }
  .voice-list-heading,
  .voice-row { grid-template-columns: 104px minmax(150px, 1fr) 48px 286px; }
  .settlement-preview-builder { grid-template-columns: 82px auto minmax(260px, 1fr) auto 82px auto; }
  .settlement-group-switch { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
