:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --text: #e8ecf1;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-2: #2bd4a0;
  --danger: #ff5d5d;
  --stage-bg: 55%;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* 顶部栏 */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 16px; }
.status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.status .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); transition: background .2s;
}
.status.live .dot { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.status.error .dot { background: var(--danger); }
.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; }

/* 字幕舞台 */
.stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 40px 24px 60px;
  background:
    radial-gradient(circle at 50% 30%, #1a2030, #0b0d12 70%);
  overflow: hidden;
  min-height: 220px;
}
.subtitle {
  width: 100%;
  max-width: 980px;
  text-align: center;
}
.subtitle .line { margin: 6px 0; line-height: 1.35; }
.subtitle .line.enhanced {
  color: var(--text);
  font-weight: 600;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
  word-break: break-word;
}
.subtitle .line.raw {
  color: var(--muted);
  font-size: 0.62em;
  opacity: .85;
  word-break: break-word;
}
.subtitle .hint { color: var(--muted); font-size: 14px; opacity: .7; }

/* 转录记录 */
.log-wrap {
  background: var(--panel);
  border-top: 1px solid var(--line);
  height: 230px;
  display: flex;
  flex-direction: column;
}
.log-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; font-size: 13px; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.llm-badge {
  font-size: 12px; padding: 2px 8px; border-radius: 99px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.llm-badge.on { color: var(--accent-2); border-color: var(--accent-2); }
.log {
  flex: 1; overflow-y: auto; padding: 8px 16px;
  font-size: 14px; line-height: 1.7;
}
.log .item { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.log .item .t { color: var(--muted); font-size: 12px; margin-right: 8px; }
.log .item .e { color: var(--text); }
.log .item .r { color: var(--muted); font-size: 13px; }
.log .item .r::before { content: "原文："; opacity: .6; }
.log .empty { color: var(--muted); opacity: .6; padding: 12px 0; }

/* 设置弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(560px, 92vw);
  max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 16px; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.modal-body { padding: 14px 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); text-align: right; }

.group { margin-bottom: 18px; }
.group h3 { font-size: 14px; margin: 0 0 10px; color: var(--accent); }
.group label {
  display: block; font-size: 13px; color: var(--muted);
  margin-bottom: 10px;
}
.group label.switch-row {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text);
}
.group input[type="text"], .group input[type="password"], .group select, .group textarea {
  width: 100%; margin-top: 6px; padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 13px; font-family: inherit;
  resize: vertical;
}
.group input[type="range"] { width: 100%; margin-top: 6px; }
.group input[type="color"] { vertical-align: middle; margin-left: 8px; }
.tip { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 6px 0; }
.tip code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; font-size: 13px;
  z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.toast[hidden] { display: none; }

/* 全屏时 */
body.fullscreen .topbar, body.fullscreen .log-wrap { display: none; }
body.fullscreen { height: 100vh; }

/* 诊断面板 */
.diag {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  width: min(680px, 94%);
  background: rgba(23,26,33,.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  z-index: 20;
}
.diag[hidden] { display: none; }
.diag-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.diag-body { display: flex; flex-direction: column; gap: 6px; }
.drow { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.drow .dmark { width: 18px; text-align: center; }
.drow .dlabel { color: var(--text); min-width: 168px; }
.drow .dval { color: var(--muted); }
.drow.good .dmark { color: var(--accent-2); }
.drow.good .dval { color: var(--accent-2); }
.drow.bad .dmark { color: var(--danger); }
.drow.bad .dval { color: var(--danger); }
.drow.warn .dmark { color: #ffcf5d; }
.diag-tip { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* 大模型设置区：预设按钮 + 高亮提示 */
.preset-row { display: flex; gap: 8px; margin: 4px 0 12px; flex-wrap: wrap; }
.btn.mini { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.tip.hl { background: rgba(255,193,7,.12); border-left: 3px solid #ffc107; padding: 8px 10px; }
.tip code, .tip.hl code {
  background: rgba(255,255,255,.12); padding: 1px 5px;
  border-radius: 4px; font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace;
}

