/* AI 朗诵评测工作台 — 深色科技风（延续 MOSS 转录工作台设计语言） */
:root {
  --bg: #0a0e14;
  --panel: #11161f;
  --panel-2: #161d29;
  --border: #232c3b;
  --text: #dbe4f0;
  --text-dim: #7d8aa0;
  --accent: #22d3ee;
  --accent-2: #3b82f6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #12203a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: rgba(13, 18, 28, .8); backdrop-filter: blur(8px); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(from 180deg, var(--accent), #6366f1, var(--accent));
  box-shadow: 0 0 14px rgba(34, 211, 238, .5);
}
.title { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.subtitle { font-size: 12px; color: var(--text-dim); margin-left: 6px; }
.actions { display: flex; align-items: center; gap: 10px; }

.btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 14px;
  transition: all .15s; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; color: #04121a; font-weight: 700;
  box-shadow: 0 4px 18px rgba(34, 211, 238, .35);
}
.btn.primary:hover { filter: brightness(1.1); color: #04121a; }
.btn.primary:disabled { filter: grayscale(.7); opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--err); box-shadow: 0 0 8px var(--err); }

/* ---------- 主区 ---------- */
.workspace { flex: 1; overflow-y: auto; padding: 18px; }
.hidden { display: none !important; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.box-title { font-size: 13px; color: var(--text-dim); font-weight: 600; margin-bottom: 8px; }

/* ---------- 表单 ---------- */
.form-view { max-width: 1060px; margin: 0 auto; }
.form-grid {
  display: grid; grid-template-columns: minmax(320px, 46%) 1fr;
  gap: 16px; align-items: stretch;
}
.upload-card { padding: 10px; display: flex; flex-direction: column; }
.dropzone {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; min-height: 260px; padding: 30px;
  border: 2px dashed var(--border); border-radius: 12px; transition: all .2s; color: var(--text-dim);
  cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); background: rgba(34, 211, 238, .06); }
.dropzone:hover { border-color: var(--text-dim); }
.dz-icon { font-size: 46px; margin-bottom: 12px; }
.dropzone h2 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.dz-hint { font-size: 12px; line-height: 1.8; }
.file-preview {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; margin-top: 10px;
}
.fp-head { display: flex; align-items: center; gap: 12px; }
.fp-icon { font-size: 26px; }
.fp-info { flex: 1; min-width: 0; }
.fp-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.fp-actions { display: flex; gap: 6px; flex-shrink: 0; }
.fp-listen {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(34, 211, 238, 0.05); border: 1px solid rgba(34, 211, 238, 0.15);
}
.fp-listen-label { font-size: 12px; color: var(--accent); flex-shrink: 0; letter-spacing: 2px; }
.file-audio { flex: 1; min-width: 0; height: 34px; accent-color: var(--accent); }

.text-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.field-label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 6px; }
.req { color: var(--err); }
.ref-text {
  width: 100%; resize: vertical; min-height: 120px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 12px 14px; font-size: 15px; line-height: 1.7; outline: none;
  font-family: inherit;
}
.ref-text:focus { border-color: var(--accent); }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { flex: 1; min-width: 120px; }
select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 9px 10px; font-size: 13px; outline: none;
}
select:focus { border-color: var(--accent); }
.submit-btn { padding: 12px; font-size: 15px; border-radius: 12px; margin-top: auto; }

/* 录音行 */
.rec-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; padding: 0 4px;
}
.rec-btn { flex-shrink: 0; }
.rec-btn.recording {
  color: var(--err); border-color: var(--err);
  animation: rec-pulse 1.2s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .5); }
  50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); }
}
.rec-hint { font-size: 12px; color: var(--text-dim); }

/* ---------- 进度 ---------- */
.job-card { max-width: 760px; margin: 8vh auto 0; padding: 18px 22px; }
.jc-row { display: flex; justify-content: space-between; margin-bottom: 12px; }
.jc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.jc-status { color: var(--accent); font-size: 13px; }
.bar { height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px rgba(34, 211, 238, .5);
}
.bar-fill.indeterminate { width: 40%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide {
  0% { margin-left: -40%; } 100% { margin-left: 100%; }
}
.jc-detail { margin-top: 10px; font-size: 12px; color: var(--text-dim); }

/* ---------- 结果 ---------- */
.result-view {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(320px, 34%) 1fr; gap: 16px; align-items: start;
}
.pane {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.media-box {
  background: #05070b; display: flex; align-items: center; justify-content: center;
  padding: 30px 14px;
}
.audio-cover { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }
.wave { display: flex; align-items: center; gap: 4px; height: 90px; }
.wave i {
  width: 5px; border-radius: 3px; opacity: .85;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
#player { width: min(90%, 380px); accent-color: var(--accent); }
.media-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-top: 1px solid var(--border);
}
.mm-info { flex: 1; min-width: 0; }
.m-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-text {
  font-size: 12px; color: var(--text-dim); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exports { flex-shrink: 0; }
.warnings { padding: 10px 14px; border-top: 1px solid var(--border); }
.warn-item {
  font-size: 12px; color: var(--warn); background: rgba(251, 191, 36, .08);
  border: 1px solid rgba(251, 191, 36, .3); border-radius: 8px; padding: 7px 10px; margin-bottom: 6px;
}
.warn-item:last-child { margin-bottom: 0; }

.pane.right { padding: 18px; }

/* 总分区 */
.score-hero { display: flex; align-items: center; gap: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.score-ring-wrap { position: relative; flex-shrink: 0; }
.score-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-total { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.score-unit { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.score-side { min-width: 0; }
.score-grade {
  display: inline-block; font-size: 20px; font-weight: 800; padding: 4px 16px;
  border-radius: 20px; margin-bottom: 8px;
}
.score-grade.excellent { color: #34d399; background: rgba(52, 211, 153, .12); border: 1px solid rgba(52,211,153,.4); }
.score-grade.good { color: #22d3ee; background: rgba(34, 211, 238, .12); border: 1px solid rgba(34,211,238,.4); }
.score-grade.pass { color: #fbbf24; background: rgba(251, 191, 36, .12); border: 1px solid rgba(251,191,36,.4); }
.score-grade.low { color: #f87171; background: rgba(248, 113, 113, .12); border: 1px solid rgba(248,113,113,.4); }
.score-summary { font-size: 13px; color: var(--text-dim); line-height: 1.7; }

/* 图表区 */
.charts-row { display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--border); }
#radar text { fill: var(--text-dim); font-size: 11px; }
.dim-bars { display: flex; flex-direction: column; gap: 12px; }
.dim-row { display: grid; grid-template-columns: 64px 1fr 52px; align-items: center; gap: 10px; }
.dim-label { font-size: 13px; color: var(--text-dim); }
.dim-bar { height: 9px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.dim-fill {
  height: 100%; width: 0; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s cubic-bezier(.22, 1, .36, 1);
}
.dim-value { font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* 逐字 */
.align-box { padding-top: 16px; }
.box-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.good { background: var(--ok); }
.sw.tone { background: var(--warn); }
.sw.bad { background: var(--err); }
.sw.missed { background: #556074; }
.align-text {
  font-size: 21px; line-height: 2.2; letter-spacing: 1px; padding: 6px 2px;
}
.ch { display: inline-block; cursor: pointer; padding: 0 2px; border-radius: 5px; position: relative; transition: transform .1s; }
.ch:hover { transform: translateY(-2px); background: rgba(255,255,255,.06); }
.ch.good { color: var(--ok); }
.ch.tone { color: var(--warn); }
.ch.bad { color: var(--err); text-decoration: wavy underline rgba(248,113,113,.6); }
.ch.missed { color: #556074; text-decoration: line-through; }
.ch.punct { color: var(--text-dim); cursor: default; }
.ch.punct:hover { transform: none; background: none; }
.char-detail {
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border);
  background: var(--panel-2); border-radius: 10px; font-size: 13px; line-height: 1.8;
}
.char-detail .cd-head { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.char-detail .tag {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; margin-left: 8px;
}
.tag.ok { background: rgba(52,211,153,.15); color: var(--ok); }
.tag.bad { background: rgba(248,113,113,.15); color: var(--err); }
.tag.warn { background: rgba(251,191,36,.15); color: var(--warn); }

/* ---------- 历史抽屉 ---------- */
.history {
  position: fixed; top: 0; right: 0; width: min(430px, 92vw); height: 100%;
  background: rgba(13, 18, 28, .97); border-left: 1px solid var(--border);
  z-index: 50; display: flex; flex-direction: column; padding: 16px;
  box-shadow: -12px 0 40px rgba(0, 0, 0, .5);
}
.h-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.h-search {
  width: 100%; padding: 9px 14px; border-radius: 10px; margin-bottom: 12px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); outline: none;
}
.h-search:focus { border-color: var(--accent); }
.h-list { flex: 1; overflow-y: auto; }
.h-item {
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  padding: 10px 14px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.h-item:hover { border-color: var(--accent); }
.h-item .hi-main { flex: 1; min-width: 0; }
.h-item .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-item .meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: flex; gap: 10px; align-items: center; }
.h-item .hi-score { font-size: 18px; font-weight: 800; flex-shrink: 0; }
.h-del { opacity: 0; }
.h-item:hover .h-del { opacity: 1; }
.st { padding: 1px 8px; border-radius: 12px; font-size: 11px; }
.st.done { background: rgba(52, 211, 153, .15); color: var(--ok); }
.st.failed { background: rgba(248, 113, 113, .15); color: var(--err); }
.st.processing { background: rgba(34, 211, 238, .15); color: var(--accent); }
.h-empty { text-align: center; color: var(--text-dim); font-size: 13px; padding: 40px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 22px; border-radius: 12px; font-size: 14px; z-index: 99;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .form-grid { grid-template-columns: 1fr; }
  .result-view { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .subtitle { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .workspace { padding: 10px; }
  .score-hero { flex-direction: column; text-align: center; }
  .align-text { font-size: 18px; }
  .history { width: 100vw; }
}

/* 录音试听 + 重录 */
.jc-retry { display: block; margin: 14px auto 0; }
