:root {
  --bg: #fbf7f9;
  --panel: #ffffff;
  --ink: #2b2530;
  --muted: #8a7f8c;
  --line: #eadfe6;
  --accent: #e8568f;
  --accent-soft: #fde7f0;
  --manaka: #4f7cff;
  --rinko: #f07a3a;
  --nene: #23a874;
  --calm: #6b8bb5;
  --gentle: #e0779f;
  --happy: #e3a21a;
  --serious: #5c5fd0;
  --custom: #2c9c9a;
  --radius: 12px;
  font-family: "Microsoft YaHei UI", "Yu Gothic UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; padding-bottom: 76px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; font-size: 12px; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 20px; background: linear-gradient(90deg, #ff7eb0, #f59ac0 45%, #9db4ff); color: #fff;
  box-shadow: 0 2px 10px rgba(180, 60, 110, .25);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: 1px; white-space: nowrap; }
.brand span { font-weight: 400; opacity: .9; }
.platform-tabs { display: flex; gap: 6px; }
.platform-tabs button {
  border: 0; border-radius: 999px; padding: 6px 18px; background: rgba(255, 255, 255, .22); color: #fff; font-weight: 700;
}
.platform-tabs button.active { background: #fff; color: var(--accent); }
.search { flex: 1; min-width: 160px; }
.search input { width: 100%; border: 0; border-radius: 999px; padding: 7px 16px; outline: none; color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; font-size: 13px; }
.export { position: relative; }
.export summary { list-style: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .22); font-weight: 700; }
.export summary::-webkit-details-marker { display: none; }
.export-menu {
  position: absolute; right: 0; top: 36px; display: grid; gap: 4px; min-width: 260px; padding: 10px;
  background: #fff; color: var(--ink); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
}
.export-menu a { color: var(--ink); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.export-menu a:hover { background: var(--accent-soft); }
.export-menu label { padding: 6px 8px; font-size: 13px; color: var(--muted); }

.subnav {
  position: sticky; top: 54px; z-index: 19; display: flex; gap: 4px; overflow-x: auto; padding: 0 16px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.subnav button {
  border: 0; background: none; padding: 11px 14px; white-space: nowrap; border-bottom: 3px solid transparent; color: var(--muted);
}
.subnav button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.subnav small { margin-left: 4px; font-size: 11px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; padding: 12px 20px 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px;
}
.chips button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips button small { opacity: .65; margin-left: 4px; }
.chips select { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; background: #fff; }
.filter-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); }
.filter-controls select { border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; background: #fff; }
.check { display: inline-flex; align-items: center; gap: 4px; }
.ghost { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 10px; }
.duration { display: inline-flex; align-items: center; gap: 4px; }
.duration input { width: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; background: #fff; }
.duration.active input { border-color: var(--accent); background: var(--accent-soft); }
.help { margin: 6px 20px 0; padding: 10px 14px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 13px; line-height: 2; }
.status { padding: 6px 20px; font-size: 13px; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; padding: 4px 20px 20px; align-items: start; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 10px;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(120, 60, 90, .06);
}
.card.c-manaka { border-left-color: var(--manaka); }
.card.c-rinko { border-left-color: var(--rinko); }
.card.c-nene { border-left-color: var(--nene); }
.card.current { box-shadow: 0 0 0 2px var(--accent), 0 6px 18px rgba(232, 86, 143, .18); }
.card.expanded { grid-column: 1 / -1; }
.card.missing { opacity: .6; }
.card-head { display: flex; align-items: center; gap: 10px; }
.play {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 13px;
  display: grid; place-items: center;
}
.play.playing { background: var(--ink); }
.play:disabled { background: #ccc; cursor: not-allowed; }
.file { min-width: 0; flex: 1; display: grid; }
.fname { font-weight: 700; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdir { font-size: 12px; color: var(--muted); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.fname:hover, .fdir:hover { color: var(--accent); text-decoration: underline; }
.dur { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reveal { border: 0; background: none; font-size: 15px; padding: 2px; opacity: .55; }
.reveal:hover { opacity: 1; }
.progress { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; cursor: pointer; }
.progress i, .player-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #f4eef2; color: var(--muted); }
.tag.moved { background: #e8f2ff; color: #3c6fcf; }
.tag.clean { background: #e4f7ee; color: #1f8a5c; }
.tag.review { background: #fff3dc; color: #b07800; }
.tag.asr { background: #fff0f0; color: #c24848; }
.line { display: grid; gap: 4px; padding: 8px 10px; border-radius: 8px; background: #fcf8fa; line-height: 1.55; }
.line .ja { font-size: 15px; }
.line .zh { font-size: 14px; color: #5b5160; }
.line .spk { color: var(--accent); font-weight: 700; margin-right: 6px; font-size: 13px; }
.line .zh .spk { color: #b48aa0; }
.line .empty { color: var(--muted); font-size: 13px; }
.refs { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.refs select { max-width: 100%; flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; font-size: 12px; background: #fff; }
.ratings { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rate {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 2px; font-size: 12px; min-height: 30px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rate:hover { border-color: var(--accent); }
.rate.active { color: #fff; border-color: transparent; font-weight: 700; }
.rate[data-label=calm].active { background: var(--calm); }
.rate[data-label=gentle].active { background: var(--gentle); }
.rate[data-label=happy].active { background: var(--happy); }
.rate[data-label=serious].active { background: var(--serious); }
.rate[data-label=custom] { border-style: dashed; color: var(--muted); }
.rate[data-label=custom].active { background: var(--custom); color: #fff; border-style: solid; }
.custom-input { grid-column: 1 / -1; display: flex; gap: 6px; }
.custom-input input { flex: 1; border: 1px solid var(--custom); border-radius: 8px; padding: 4px 8px; outline: none; }
.custom-input button { border: 0; border-radius: 8px; background: var(--custom); color: #fff; padding: 4px 12px; }
.rated-at { font-size: 11px; color: var(--muted); text-align: right; min-height: 14px; }
.emotion-editor { grid-column: 1 / -1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fcf8fa; }
.emotion-help { font-size: 12px; line-height: 1.6; color: #655b68; margin: 0 0 8px; }
.emotion-group { margin-bottom: 10px; font-size: 13px; }
.emotion-group summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.emotion-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.emotion-chip { border: 1px solid #d5c7d0; border-radius: 14px; padding: 5px 9px; background: #fff; font-size: 12px; }
.emotion-chip.selected { background: #267d7b; color: #fff; border-color: #267d7b; }
.emotion-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.emotion-editor .custom-input { flex-wrap: wrap; margin: 10px 0; }
.emotion-editor .custom-input input { min-width: 160px; width: 100%; }
.toggle {
  align-self: center; border: 0; background: none; color: var(--muted); font-size: 12px; padding: 2px 10px; border-radius: 999px;
}
.toggle:hover { background: var(--accent-soft); color: var(--accent); }
.toggle .arrow {
  display: inline-block; width: 7px; height: 7px; margin: 0 4px 3px 0; vertical-align: middle;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s;
}
.card.expanded .toggle .arrow { transform: rotate(-135deg); margin-bottom: -2px; }
.script { border-top: 1px dashed var(--line); padding-top: 8px; }
.script-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.script-head b { color: var(--ink); }
.script-body { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.script table { width: 100%; border-collapse: collapse; font-size: 14px; }
.script th { position: sticky; top: 0; background: #f7eff4; text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 6px 8px; z-index: 1; }
.script td { padding: 5px 8px; border-top: 1px solid #f3eaf0; vertical-align: top; line-height: 1.5; }
.script td.n { color: var(--muted); font-size: 11px; width: 44px; font-variant-numeric: tabular-nums; }
.script td.s { white-space: nowrap; color: var(--accent); font-size: 13px; width: 1%; }
.script td.s small { display: block; color: #b48aa0; }
.script td.ja { width: 40%; }
.script td.zh { width: 40%; color: #5b5160; }
.script td.v { white-space: nowrap; width: 1%; }
.script tr.focus td { background: #fff1c9; }
.script tr.narration td.ja, .script tr.narration td.zh { color: var(--muted); }
.script .mini {
  border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; padding: 2px 8px; margin: 1px;
}
.script .mini.playing { background: var(--accent); color: #fff; }
.script .mini:disabled { background: #eee; color: #aaa; }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 0 20px 20px; flex-wrap: wrap; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 10px; min-width: 36px; }
.pager button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager input { width: 70px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }

.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(120, 60, 90, .08); font-size: 13px;
}
.play.big { width: 40px; height: 40px; }
.player-info { flex: 1; min-width: 0; display: grid; gap: 6px; }
.player-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.player-bar { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; cursor: pointer; }
.player-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.player label { color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 16px;
  border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40;
}
.toast.show { opacity: .92; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .subnav { top: 0; position: static; }
  .grid { grid-template-columns: 1fr; padding: 4px 10px 20px; }
  .ratings { grid-template-columns: repeat(3, 1fr); }
}
