:root {
  --bg: #0e1116;
  --bg-elevated: #161b22;
  --bg-soft: #1c232d;
  --border: #2a323d;
  --text: #e6edf3;
  --text-muted: #8b98a8;
  --accent: #4f9cf9;
  --accent-strong: #2f7fe0;
  --danger: #e5534b;
  --danger-strong: #c9403a;
  --success: #3fb950;
  --warning: #d29922;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top, #16202b 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2 {
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.05rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.muted {
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* ---------- 顶栏 ---------- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(14, 17, 22, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.nav a {
  color: var(--text-muted);
}

.nav a:hover {
  color: var(--text);
}

.logout-form {
  margin: 0;
}

.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.linkish:hover {
  color: var(--danger);
}

/* ---------- 布局 ---------- */
.container {
  flex: 1;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

.container:has(.call-page) {
  max-width: 1140px;
}

.page-head {
  margin-bottom: 1.25rem;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  margin-bottom: 1rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  background: #232c38;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06111f;
  font-weight: 600;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn.danger:hover:not(:disabled) {
  background: rgba(229, 83, 75, 0.12);
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 55vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  font-size: 1.35rem;
}

.login-form {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.login-form label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-form input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.18);
}

.login-form .btn {
  margin-top: 0.4rem;
}

.password-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.password-row input {
  flex: 1;
  min-width: 0;
}

.password-row .btn.small {
  margin-top: 0;
  white-space: nowrap;
}

.muted.small {
  font-size: 0.78rem;
  margin: 0;
}

.passcode-mask {
  -webkit-text-security: disc;
}

.form-error {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(229, 83, 75, 0.12);
  border: 1px solid rgba(229, 83, 75, 0.4);
  color: #ffb4ae;
  font-size: 0.88rem;
}

/* ---------- 通话页 ---------- */
.audio-panel audio {
  display: none;
}

.call-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 1rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 80px;
}

.label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.meta-value {
  font-size: 1.05rem;
  font-weight: 600;
}

.call-actions {
  display: flex;
  gap: 0.75rem;
}

.error-box {
  margin-top: 1rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: rgba(229, 83, 75, 0.12);
  border: 1px solid rgba(229, 83, 75, 0.4);
  color: #ffb4ae;
  font-size: 0.9rem;
}

.captions {
  display: grid;
  gap: 1rem;
}

.caption-block {
  border-left: 3px solid var(--border);
  padding-left: 0.85rem;
}

.caption-block:first-child {
  border-left-color: var(--accent);
}

.caption-block:last-child {
  border-left-color: var(--success);
}

.caption-text {
  margin: 0.3rem 0 0;
  min-height: 1.5rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.call-log {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 45vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* ---------- 历史列表 ---------- */
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.history-item a {
  display: block;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

.history-item a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.history-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.history-date {
  font-weight: 600;
}

.history-meta {
  margin-top: 0.25rem;
  display: flex;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-ongoing {
  color: var(--accent);
  border-color: rgba(79, 156, 249, 0.5);
}

.badge-finished {
  color: var(--success);
  border-color: rgba(63, 185, 80, 0.5);
}

.badge-interrupted {
  color: var(--warning);
  border-color: rgba(210, 153, 34, 0.5);
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
}

/* ---------- 通话详情 ---------- */
.transcript {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.bubble {
  max-width: 82%;
  padding: 0.6rem 0.85rem;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.bubble.user {
  align-self: flex-end;
  background: rgba(79, 156, 249, 0.12);
  border-color: rgba(79, 156, 249, 0.35);
}

.bubble.assistant {
  align-self: flex-start;
}

.bubble-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.bubble-text {
  margin: 0.2rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.score-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.score-item strong {
  font-size: 1.15rem;
}

.suggestion-text {
  margin: 0;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.not-found {
  text-align: center;
  padding: 3rem 1rem;
}

.not-found h1 {
  font-size: 3rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.not-found .detail-actions {
  justify-content: center;
}

/* ---------- 生词本 / 错题本 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.vocab-card,
.mistake-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mistake-card {
  margin-bottom: 0.75rem;
}

.vocab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.vocab-word {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.vocab-meaning {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.vocab-example {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  word-break: break-word;
}

.card-actions {
  margin-top: 0.3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn.small {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.inline-form input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.inline-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.18);
}

.form-message {
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
  color: var(--warning);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-tab {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.filter-tab:hover {
  color: var(--text);
  text-decoration: none;
}

.filter-tab.active {
  color: #06111f;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- 复习卡片 ---------- */
.review-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.review-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 1.1rem;
  text-align: center;
}

.review-word {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
  font-weight: 600;
  word-break: break-word;
}

.review-meaning,
.review-example {
  margin: 0.35rem 0;
  word-break: break-word;
}

.review-example {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.review-detail {
  margin-top: 0.75rem;
  text-align: left;
}

.review-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

/* ---------- 详细分析报告 ---------- */
.report-block {
  margin-bottom: 1rem;
}

.report-block:last-of-type {
  margin-bottom: 0.25rem;
}

.report-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}

.report-items {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.report-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}

.report-line {
  margin: 0.25rem 0;
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  word-break: break-word;
}

.report-line .label {
  flex: 0 0 auto;
  min-width: 3.4rem;
}

.corrected {
  color: var(--success);
}

.suggestion-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.panel-actions {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.6rem;
}

/* ---------- 移动端 ---------- */
@media (max-width: 480px) {

  .container {
    padding: 1.1rem 0.85rem 1.75rem;
  }

  .call-actions {
    flex-direction: column;
  }

  .call-actions .btn {
    width: 100%;
  }

  .call-meta {
    justify-content: space-between;
    gap: 0.5rem;
  }

  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bubble {
    max-width: 92%;
  }

  .nav {
    gap: 0.65rem;
    font-size: 0.85rem;
  }

  .detail-actions {
    flex-direction: column;
  }

  .detail-actions .btn {
    width: 100%;
  }
}

/* ---------- 通话体验：状态色 / 字幕气泡 / 禁用态 ---------- */
#statusText[data-state="connecting"] {
  color: var(--warning);
}

#statusText[data-state="live"] {
  color: var(--success);
}

#statusText[data-state="ended"] {
  color: var(--text-muted);
}

#timer,
#remaining {
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}

#timer {
  font-size: 1.15rem;
}

.call-actions .btn {
  min-width: 132px;
}

.call-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.6);
}

/* 通话中的面板边框提示 */
.call-page[data-call-state="live"] .audio-panel {
  border-color: rgba(63, 185, 80, 0.45);
}

.call-page[data-call-state="connecting"] .audio-panel {
  border-color: rgba(210, 153, 34, 0.45);
}

.error-box:not([hidden]) {
  display: block;
}

/* 字幕气泡：用户靠右、AI 靠左 */
.captions {
  grid-template-columns: minmax(0, 1fr);
}

.caption-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-left: none;
  padding-left: 0;
}

.caption-block:first-child {
  align-items: flex-end;
  text-align: right;
}

.caption-block:last-child {
  align-items: flex-start;
  text-align: left;
}

.caption-block .caption-text {
  display: inline-block;
  max-width: 86%;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.caption-block:first-child .caption-text {
  background: rgba(79, 156, 249, 0.14);
  border-color: rgba(79, 156, 249, 0.35);
  border-bottom-right-radius: 4px;
}

.caption-block:last-child .caption-text {
  background: rgba(63, 185, 80, 0.08);
  border-color: rgba(63, 185, 80, 0.28);
  border-bottom-left-radius: 4px;
}

.caption-text:empty::before {
  content: "…";
  color: var(--text-muted);
}

/* 对话记录气泡与复盘入口 */
.call-log .bubble {
  max-width: 88%;
}

.call-log .bubble.user {
  align-self: flex-end;
}

.call-log .bubble.assistant {
  align-self: flex-start;
}

.call-log .bubble-text {
  font-size: 0.95rem;
}

.call-log .review-link {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.call-log .review-link a {
  font-weight: 600;
}

@media (max-width: 480px) {
  .call-actions .btn {
    width: 100%;
    min-width: 0;
  }

  #timer {
    font-size: 1.25rem;
  }

  .caption-block .caption-text {
    max-width: 100%;
  }

  .call-log .bubble {
    max-width: 95%;
  }
}

/* ---------- 素材导入 ---------- */
.notice {
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(210, 153, 34, 0.4);
  background: rgba(210, 153, 34, 0.1);
  color: var(--warning);
  font-size: 0.88rem;
}

.import-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-field select,
.form-field input[type="text"],
.form-field input[type="url"],
.form-field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.form-field select:focus,
.form-field input[type="text"]:focus,
.form-field input[type="url"]:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.18);
}

.form-field textarea {
  resize: vertical;
  min-height: 12rem;
  line-height: 1.5;
}

.form-field input[type="file"] {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-message.success {
  color: var(--success);
}

.form-message.error {
  color: var(--danger);
}

.form-message a {
  color: var(--accent);
}

/* ---------- 素材库 ---------- */
.notice.success {
  border-color: rgba(63, 185, 80, 0.4);
  background: rgba(63, 185, 80, 0.1);
  color: var(--success);
}

.notice.error {
  border-color: rgba(229, 83, 75, 0.4);
  background: rgba(229, 83, 75, 0.12);
  color: #ffb4ae;
}

.notice[hidden] {
  display: none;
}

.library-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent);
  text-decoration: none;
}

.chip.active {
  color: #06111f;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.library-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 280px;
}

.library-filter select,
.library-filter input[type="search"] {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.library-filter input[type="search"] {
  flex: 1 1 160px;
  min-width: 0;
}

.library-filter select:focus,
.library-filter input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.18);
}

.source-details {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.source-details summary {
  cursor: pointer;
  color: var(--text-muted);
}

.source-details summary:hover {
  color: var(--text);
}

.source-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.source-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  align-items: baseline;
}

.source-name {
  color: var(--text);
  font-weight: 500;
}

.source-error {
  color: var(--danger);
}

.material-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.material-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.material-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.material-card h3 a {
  color: var(--text);
  word-break: break-word;
}

.material-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.material-summary {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  word-break: break-word;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- 素材详情 ---------- */
.breadcrumb {
  margin-bottom: 0.6rem;
  font-size: 0.88rem;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--text);
}

.material-content {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.6rem 0 0;
  max-height: 45vh;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
}

.inline-form select {
  flex: 1 1 140px;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.inline-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.18);
}

.reference-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 16rem;
  overflow: auto;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.reference-list label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.reference-list input[type="checkbox"] {
  margin-top: 0.25rem;
}

.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.scenario-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.scenario-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.scenario-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.scenario-sub {
  margin: 0.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.scenario-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.scenario-card .report-line {
  margin: 0.15rem 0;
  font-size: 0.9rem;
}

.phrase-list {
  margin: 0.2rem 0 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.grounding-list {
  margin-top: 0.4rem;
}

.grounding-source {
  font-size: 0.78rem;
  color: var(--accent);
}

.grounding-quote {
  margin: 0.15rem 0 0;
  padding-left: 0.6rem;
  border-left: 2px solid rgba(79, 156, 249, 0.6);
  color: var(--text-muted);
  font-size: 0.85rem;
  word-break: break-word;
}

.assumption-box {
  margin-top: 0.4rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(210, 153, 34, 0.5);
  background: rgba(210, 153, 34, 0.14);
  color: #f0cc6b;
  font-size: 0.86rem;
}

.assumption-box ul {
  margin: 0.25rem 0 0;
  padding-left: 1.15rem;
}

.warning-inline {
  margin: 0.2rem 0;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(229, 83, 75, 0.45);
  background: rgba(229, 83, 75, 0.12);
  color: #ffb4ae;
  font-size: 0.85rem;
}

.review-note {
  margin: 0.2rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.scenario-actions,
.revise-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.revise-row input[type="text"] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
}

.revise-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.18);
}

.scenario-edit-form {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.scenario-edit-form[hidden] {
  display: none;
}

.badge-new {
  color: var(--accent);
  border-color: rgba(79, 156, 249, 0.5);
}

.badge-classified {
  color: var(--success);
  border-color: rgba(63, 185, 80, 0.5);
}

.badge-scenario {
  color: var(--warning);
  border-color: rgba(210, 153, 34, 0.5);
}

.badge-rejected {
  color: var(--danger);
  border-color: rgba(229, 83, 75, 0.5);
}

.badge-archived {
  color: var(--text-muted);
}

.badge-blocked {
  color: var(--danger);
  border-color: rgba(229, 83, 75, 0.6);
  background: rgba(229, 83, 75, 0.12);
}

.moderation-alert {
  border: 1px solid rgba(229, 83, 75, 0.45);
  background: rgba(229, 83, 75, 0.08);
}

.moderation-alert h2 {
  color: #ffb4ae;
}

@media (max-width: 480px) {
  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .library-filter {
    flex: 1 1 auto;
  }

  .scenario-actions .btn {
    flex: 1 1 auto;
  }
}

/* ---------- 通话页两栏响应式布局 ---------- */
.call-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.call-page-head .page-head-titles {
  flex: 1 1 auto;
}

.call-page-head .due-info {
  margin: 0;
  padding: 0.45rem 0.85rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
}

.call-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.call-main-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.call-side-col {
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  .call-layout {
    display: grid;
    grid-template-columns: minmax(360px, 450px) minmax(400px, 1fr);
    gap: 1.5rem;
    align-items: start;
  }

  .call-main-col {
    position: sticky;
    top: 4.5rem;
    z-index: 2;
  }

  .scenario-picker {
    max-height: calc(100vh - 5.5rem);
    display: flex;
    flex-direction: column;
  }

  .scenario-list-scroll {
    overflow-y: auto;
    padding-right: 0.35rem;
    margin-top: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
}

.scenario-list-scroll::-webkit-scrollbar {
  width: 6px;
}
.scenario-list-scroll::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

/* 场景筛选与搜索 */
.scenario-picker-top {
  margin-bottom: 0.5rem;
}

.scenario-picker-top h2 {
  margin-bottom: 0.2rem;
}

.scenario-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.scenario-search {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.scenario-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 156, 249, 0.2);
}

.level-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.level-pill {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.level-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

.level-pill.active {
  background: rgba(79, 156, 249, 0.16);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.badge-level[data-level="A2"] {
  border-color: rgba(63, 185, 80, 0.4);
  color: var(--success);
}

.badge-level[data-level="B1"] {
  border-color: rgba(79, 156, 249, 0.4);
  color: var(--accent);
}

.badge-level[data-level="B2"] {
  border-color: rgba(210, 153, 34, 0.4);
  color: var(--warning);
}

.scenario-empty-hint {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* 麦克风与思考动效 */
.mic-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mic-status-text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.mic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  transition: background 0.2s ease;
}

.mic-status-text[data-mic="denied"] .mic-dot {
  background: var(--danger);
}

.call-page[data-call-state="live"] .mic-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: mic-pulse 1.6s infinite ease-in-out;
}

.call-page[data-call-state="connecting"] .mic-dot {
  background: var(--warning);
  animation: mic-pulse 0.9s infinite ease-in-out;
}

@keyframes mic-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.ai-wave {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  vertical-align: middle;
  margin-left: 6px;
}

.ai-wave span {
  display: inline-block;
  width: 3px;
  height: 10px;
  background: var(--success);
  border-radius: 2px;
  animation: ai-wave-bar 0.9s ease-in-out infinite;
}

.ai-wave span:nth-child(2) {
  animation-delay: 0.2s;
  height: 15px;
}

.ai-wave span:nth-child(3) {
  animation-delay: 0.4s;
  height: 8px;
}

@keyframes ai-wave-bar {
  0%, 100% { transform: scaleY(0.35); opacity: 0.45; }
  50% { transform: scaleY(1); opacity: 1; }
}

.log-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.log-panel-header h2 {
  margin: 0;
}

.log-panel .call-log {
  max-height: 280px;
  overflow-y: auto;
}

/* ---------- 通话页：场景选择 ---------- */
.scenario-now {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.scenario-now strong {
  font-size: 0.98rem;
}

.scenario-picker h2 {
  margin-bottom: 0.25rem;
}

.scenario-group {
  margin-top: 0.75rem;
}

.scenario-group-title {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}

.scenario-option {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.scenario-option:hover {
  border-color: var(--accent);
}

.scenario-option:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 156, 249, 0.25);
}

.scenario-option.selected {
  border-color: var(--accent);
  background: rgba(79, 156, 249, 0.16);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.scenario-option-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.scenario-option-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}

.scenario-option-goal {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
  word-break: break-word;
}

.scenario-option.scenario-random {
  grid-column: 1 / -1;
}

.badge-topic {
  color: var(--accent);
  border-color: rgba(79, 156, 249, 0.5);
}

.badge-free {
  color: var(--text-muted);
}

.scenario-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  margin-top: 0.4rem;
}

.scenario-detail p {
  margin: 0;
}

/* ---------- 通话页：话题与提示按钮 ---------- */
.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ---------- 设置页：音色卡片 ---------- */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
}

.voice-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem 0.95rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.voice-card.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.voice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.voice-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
}

.voice-card p {
  margin: 0;
}

.voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.voice-player {
  width: 100%;
  max-width: 420px;
  margin-bottom: 0.9rem;
}




/* ---------- 设置页：服务商密钥与能力路由 ---------- */
.settings-section {
  margin-top: 1.5rem;
}

.settings-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.provider-grid,
.route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
  margin-top: 0.6rem;
}

.provider-card,
.route-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.provider-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.provider-head h3,
.route-card h3 {
  margin: 0 auto 0 0;
  font-size: 1rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.45rem;
  align-items: center;
}

.field-row > span {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.field-row input,
.field-row select {
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
}

.route-card .field-row > input,
.route-card .field-row > select {
  grid-column: 1 / -1;
}

.route-actions,
.custom-voice-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.85rem 0;
}

.custom-voice-bar input {
  flex: 1 1 240px;
  max-width: 360px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.badge.is-ok {
  border-color: var(--accent);
  color: var(--accent);
}

.badge.is-warn {
  border-color: #d97706;
  color: #d97706;
}

/* ---------- 复盘：二级导航与趋势 ---------- */
.review-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.review-tab {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.review-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79, 156, 249, 0.12);
}

.trend-panel {
  margin-bottom: 1rem;
}

.trend-summary {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.trend-summary .stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.trend-summary strong {
  font-size: 1.2rem;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  min-height: 72px;
  padding: 0.4rem 0;
  overflow-x: auto;
}

.trend-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  min-width: 34px;
}

.trend-fill {
  width: 18px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.trend-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.badge-model {
  border-color: rgba(139, 152, 168, 0.45);
  color: var(--text-muted);
}

/* ---------- 通话页：今日建议 / 错题回流 ---------- */
.today-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border-color: rgba(79, 156, 249, 0.35);
}

.today-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.today-copy strong {
  font-size: 1.05rem;
}

.today-copy p {
  margin: 0;
}

.focus-list {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.focus-list li {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.focus-original {
  text-decoration: line-through;
  opacity: 0.75;
}

.focus-arrow {
  margin: 0 0.35rem;
}

.focus-corrected {
  color: var(--success);
}

.scenario-all {
  margin-top: 0.5rem;
}

.scenario-all summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.35rem 0;
}

/* ---------- 评分：目标达成 / 指标 / 留痕 ---------- */
.goal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.7rem 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.goal-badge {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
}

.goal-badge.goal-ok {
  color: var(--success);
  border-color: rgba(63, 185, 80, 0.5);
}

.goal-badge.goal-miss {
  color: var(--danger);
  border-color: rgba(229, 83, 75, 0.5);
}

.goal-badge.goal-unknown {
  color: var(--warning);
  border-color: rgba(210, 153, 34, 0.5);
}

.goal-evidence {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.provenance {
  margin-top: 0.4rem;
}

.quick-tip-panel {
  border-color: rgba(63, 185, 80, 0.35);
}

.quick-tip-text {
  margin: 0;
  font-size: 1rem;
}

.quick-tip-inline {
  margin: 0.6rem 0 0;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--success);
  background: rgba(63, 185, 80, 0.08);
  border-radius: 8px;
}

/* ---------- 设置：高级折叠与告警 ---------- */
.advanced-settings {
  margin-top: 0.6rem;
}

.advanced-settings summary {
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.35rem 0;
}

.warnings {
  border: 1px solid rgba(210, 153, 34, 0.45);
  background: rgba(210, 153, 34, 0.08);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.8rem;
}

.warnings p {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: var(--warning);
}

.mistake-generator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.mistake-generator h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.mistake-generator .notice {
  flex-basis: 100%;
  margin: 0;
}
