/* ==========================================================================
   stt.medercn.cn —— 爱柯语音识别接口测试台样式
   深色技术控制台风格，无外部依赖（不引用任何 CDN 字体/图标）
   ========================================================================== */

:root {
  --bg:          #0a0e13;
  --bg-soft:     #0f151c;
  --panel:       #121a23;
  --panel-2:     #16202b;
  --border:      #1e2b38;
  --border-2:    #2a3b4d;
  --text:        #e7eef6;
  --text-dim:    #93a4b8;
  --text-faint:  #5f7288;
  --accent:      #2fd6b0;
  --accent-dim:  #1c8d76;
  --violet:      #8b7cff;
  --amber:       #f5b544;
  --red:         #ff6b6b;
  --green:       #3ddc84;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(47, 214, 176, .09), transparent 60%),
    radial-gradient(800px 460px at 92% 0%, rgba(139, 124, 255, .08), transparent 62%);
  background-attachment: fixed;
  min-height: 100vh;
}

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

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  background: rgba(10, 14, 19, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.brand .mark {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), var(--violet));
  display: grid; place-items: center;
  color: #06110e; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 20px rgba(47, 214, 176, .22);
}

.brand h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.brand .sub { margin: 1px 0 0; font-size: 12px; color: var(--text-faint); }
.brand .sub code { font-family: var(--mono); color: var(--text-dim); }

.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--panel);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.chip.warn { border-color: rgba(245, 181, 68, .45); color: var(--amber); }
.chip.bad  { border-color: rgba(255, 107, 107, .45); color: var(--red); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.dot.ok   { background: var(--green); box-shadow: 0 0 0 3px rgba(61, 220, 132, .16); }
.dot.bad  { background: var(--red);   box-shadow: 0 0 0 3px rgba(255, 107, 107, .16); }
.dot.busy { background: var(--amber); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------------------------------------------------------------- 布局 */
.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px 26px 70px;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 1080px) { .wrap { grid-template-columns: 1fr; } }

.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.col-left { position: sticky; top: 84px; }
@media (max-width: 1080px) { .col-left { position: static; } }

/* ---------------------------------------------------------------- 面板 */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel > header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .015);
}

.panel > header .idx {
  width: 21px; height: 21px; flex: 0 0 21px;
  border-radius: 6px;
  background: rgba(47, 214, 176, .13);
  color: var(--accent);
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

.panel > header h2 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: .2px; }
.panel > header .hint { margin-left: auto; font-size: 11.5px; color: var(--text-faint); }
.panel .body { padding: 16px; }

/* ---------------------------------------------------------- 拖拽/输入区 */
.drop {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .16s, background .16s;
  background: rgba(255, 255, 255, .012);
}
.drop:hover, .drop.hot {
  border-color: var(--accent);
  background: rgba(47, 214, 176, .055);
}
.drop .big { font-size: 26px; line-height: 1; margin-bottom: 9px; opacity: .85; }
.drop .t1 { font-size: 13.5px; font-weight: 600; }
.drop .t2 { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

.rec-row { display: flex; gap: 9px; margin-top: 12px; }
.rec-row .btn { flex: 1; }

.btn {
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #22b394);
  border-color: transparent;
  color: #04120e;
  font-weight: 650;
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); color: #04120e; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255,107,107,.5); color: var(--red); }
.btn.rec-on { border-color: var(--red); color: var(--red); background: rgba(255,107,107,.09); }

/* --------------------------------------------------------- 已选文件卡 */
.filecard { margin-top: 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: rgba(255,255,255,.015); }
.filecard .name { font-size: 12.5px; font-weight: 600; word-break: break-all; }
.filecard .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2.5px 7px;
  border-radius: 5px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.tag b { color: var(--text); font-weight: 600; }
#wave { width: 100%; height: 62px; display: block; margin-top: 10px; border-radius: 6px; background: rgba(0,0,0,.25); }
audio { width: 100%; margin-top: 10px; height: 32px; }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.field label .note { color: var(--text-faint); font-weight: 400; }

select, input[type="text"], input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
select:focus, input:focus { outline: none; border-color: var(--accent); }
option { background: var(--bg-soft); }

.scenarios { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.scenarios .btn { width: 100%; font-size: 12.5px; padding: 10px 8px; }
.scenario-desc { font-size: 11.5px; color: var(--text-faint); margin-top: 10px; min-height: 34px; }

/* ---------------------------------------------------------------- 结果 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: rgba(255,255,255,.018);
}
.metric .k { font-size: 11px; color: var(--text-faint); }
.metric .v { font-family: var(--mono); font-size: 17px; font-weight: 600; margin-top: 3px; letter-spacing: -.3px; }
.metric .v small { font-size: 11px; color: var(--text-faint); font-weight: 400; margin-left: 3px; }
.metric.good .v { color: var(--green); }
.metric.warn .v { color: var(--amber); }
.metric.bad  .v { color: var(--red); }

.transcript {
  font-size: 15.5px;
  line-height: 1.85;
  padding: 15px;
  border-radius: var(--radius-sm);
  background: rgba(47, 214, 176, .045);
  border: 1px solid rgba(47, 214, 176, .2);
  word-break: break-word;
  white-space: pre-wrap;
  min-height: 62px;
}
.transcript.empty { color: var(--text-faint); font-style: italic; background: rgba(255,255,255,.02); border-color: var(--border); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.row-between h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }

.checks { display: grid; gap: 7px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; }
.check .ic { flex: 0 0 16px; font-weight: 700; line-height: 1.5; }
.check.pass .ic { color: var(--green); }
.check.fail .ic { color: var(--amber); }
.check .txt { color: var(--text-dim); }
.check .txt b { color: var(--text); font-weight: 600; }

.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: 62px 1fr auto; gap: 9px; align-items: center; font-size: 12px; }
.bar .lbl { font-family: var(--mono); color: var(--text-dim); }
.bar .track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--violet)); }
.bar .num { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

details.raw { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: rgba(0,0,0,.22); }
details.raw > summary {
  padding: 9px 12px; cursor: pointer; font-size: 12.5px; color: var(--text-dim);
  list-style: none; user-select: none; display: flex; align-items: center; gap: 8px;
}
details.raw > summary::-webkit-details-marker { display: none; }
details.raw > summary::before { content: "▸"; color: var(--text-faint); transition: transform .15s; }
details.raw[open] > summary::before { transform: rotate(90deg); }
details.raw > summary:hover { color: var(--accent); }
details.raw pre {
  margin: 0; padding: 12px; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  color: #b9c9dc; overflow-x: auto; max-height: 380px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}

/* ------------------------------------------------------------ 对比表格 */
.compare-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cmp-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: rgba(255,255,255,.015); }
.cmp-card > .hd {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.02);
}
.cmp-card > .hd .ms { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-faint); font-weight: 400; }
.cmp-card > .bd { padding: 12px; font-size: 13px; line-height: 1.75; word-break: break-word; }
.cmp-card > .bd .kv { display: flex; gap: 8px; font-size: 11.5px; color: var(--text-faint); margin-bottom: 7px; flex-wrap: wrap; }
.cmp-card > .bd .kv code { font-family: var(--mono); color: var(--text-dim); }
.cmp-card.err { border-color: rgba(255,107,107,.4); }
.cmp-card.err > .hd { color: var(--red); }

/* 词级差异高亮 */
ins { background: rgba(61, 220, 132, .2); color: #b6f5cf; text-decoration: none; border-radius: 3px; padding: 0 2px; }
del { background: rgba(255, 107, 107, .18); color: #ffc0c0; text-decoration: line-through; border-radius: 3px; padding: 0 2px; }

table.cmp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.cmp-table th, table.cmp-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.cmp-table th { color: var(--text-faint); font-weight: 600; font-size: 11.5px; }
table.cmp-table td.mono { font-family: var(--mono); font-size: 11.5px; }
table.cmp-table tr:last-child td { border-bottom: none; }

.verdict {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.65;
}
.verdict.pass { background: rgba(61,220,132,.09); border: 1px solid rgba(61,220,132,.3); }
.verdict.fail { background: rgba(245,181,68,.09); border: 1px solid rgba(245,181,68,.32); }
.verdict .ic { font-size: 15px; line-height: 1.3; }
.verdict b { color: var(--text); }

.empty-state {
  padding: 46px 20px; text-align: center; color: var(--text-faint); font-size: 13px;
}
.empty-state .ic { font-size: 30px; opacity: .35; display: block; margin-bottom: 12px; }

.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ 文档摘录 */
.docref { font-size: 12.5px; color: var(--text-dim); }
.docref ul { margin: 8px 0 0; padding-left: 18px; }
.docref li { margin-bottom: 5px; }
.docref code { font-family: var(--mono); font-size: 11.5px; background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; color: var(--accent); }

/* ---------------------------------------------------------------- 提示 */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 9px; max-width: 380px; }
.toast {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.6;
  background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  box-shadow: 0 10px 28px rgba(0,0,0,.42);
  animation: slidein .2s ease-out;
}
.toast.err { border-color: rgba(255,107,107,.5); }
.toast.ok  { border-color: rgba(61,220,132,.5); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------- 表单补充：字段说明 */
.field-note { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; line-height: 1.6; }
.field-note.warn { color: var(--amber); }

/* ================================================== 字幕 / 歌词模块 */

/* 逐行歌词：点行跳转，播放时自动高亮并滚动 */
.lyrics {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.22);
  overflow: hidden;
}
.lyrics-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.lyrics-bar .btn { padding: 5px 12px; font-size: 12px; }
.lyrics-bar .pos { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.lyrics-bar .track {
  flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.09);
  overflow: hidden; cursor: pointer; min-width: 60px;
}
.lyrics-bar .track > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--violet)); }

/* position:relative 是必需的：滚动定位要靠它建立 offsetParent，
   否则子元素的 offsetTop 会相对页面上层元素计算，滚动位置会算错 */
.lyric-lines { position: relative; max-height: 320px; overflow-y: auto; padding: 6px 0; scroll-behavior: smooth; }
.lyric-line {
  display: grid; grid-template-columns: 62px 1fr; gap: 10px;
  padding: 7px 14px; cursor: pointer; border-left: 2px solid transparent;
  transition: background .12s, border-color .12s;
}
.lyric-line:hover { background: rgba(255,255,255,.035); }
.lyric-line .t { font-family: var(--mono); font-size: 11px; color: var(--text-faint); padding-top: 2px; }
.lyric-line .x { font-size: 14px; line-height: 1.6; word-break: break-word; }
.lyric-line.active {
  background: rgba(47,214,176,.09);
  border-left-color: var(--accent);
}
.lyric-line.active .t { color: var(--accent); }
.lyric-line.active .x { color: #fff; font-weight: 600; }

/* 字幕条数与时间跨度一览 */
.cue-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cue-row {
  display: grid; grid-template-columns: 34px 108px 1fr;
  gap: 10px; align-items: baseline;
  padding: 7px 11px; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.cue-row:last-child { border-bottom: none; }
.cue-row:nth-child(odd) { background: rgba(255,255,255,.012); }
.cue-row .n { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.cue-row .r { font-family: var(--mono); font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.cue-row .x { word-break: break-word; }

/* 词级时间戳 */
.word-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.word-chip {
  font-family: var(--mono); font-size: 11px; line-height: 1.5;
  border: 1px solid var(--border-2); border-radius: 5px;
  padding: 2px 6px; background: rgba(255,255,255,.03); color: var(--text-dim);
  white-space: nowrap;
}
.word-chip b { color: var(--text); font-weight: 600; }
.word-chip i { color: var(--text-faint); font-style: normal; }

pre.subtitle-src {
  margin: 0; padding: 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(0,0,0,.3); font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  color: #b9c9dc; overflow: auto; max-height: 300px; white-space: pre;
}

.dl-row { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-block; font-family: var(--mono); font-size: 10.5px;
  padding: 1px 6px; border-radius: 4px; margin-left: 6px;
  background: rgba(47,214,176,.14); color: var(--accent); border: 1px solid rgba(47,214,176,.3);
}
.badge.warn { background: rgba(245,181,68,.14); color: var(--amber); border-color: rgba(245,181,68,.32); }

footer.site {
  max-width: 1500px; margin: 0 auto; padding: 0 26px 40px;
  font-size: 11.5px; color: var(--text-faint); line-height: 1.8;
}
footer.site code { font-family: var(--mono); color: var(--text-dim); }
