
:root {
  --bg: #f4f5f7; --card: #ffffff; --ink: #1d2129; --muted: #7b8492;
  --line: #e5e8ee; --accent: #2f6df6; --accent-dark: #1f57cf;
  --ok: #1f9d6b; --danger: #cf4a4a; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
.sp { flex: 1 1 auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ok { color: var(--ok); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 80px; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 14px 0; box-shadow: 0 1px 2px rgba(20,30,50,.04);
}
.card-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2 { flex: 0 0 auto; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap-row { flex-wrap: wrap; }
.empty { color: var(--muted); padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
.in {
  min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font: inherit; outline: none;
}
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,109,246,.12); }
.in.small { padding: 6px 9px; font-size: 13px; }
.in.grow { flex: 1 1 260px; }
.ta { width: 100%; min-height: 160px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.sel {
  padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
  font: inherit; color: var(--ink); outline: none; max-width: 100%;
}
.sel:focus { border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font: inherit; cursor: pointer;
  white-space: nowrap; user-select: none; transition: .12s;
}
.btn:hover { border-color: #c9d0dc; background: #fafbfd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f0cccc; }
.btn.danger:hover { background: #fdf3f3; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.tiny { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn.rec { border-color: #f2c9c9; color: #b83232; }
.btn.recording { background: #b83232; border-color: #b83232; color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.paste { margin-top: 12px; }
.paste .btn { margin-top: 10px; }

/* 项目列表 */
.proj {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 8px 0;
  background: #fff;
}
.proj-main { flex: 1 1 auto; min-width: 0; color: inherit; }
.proj-t { font-weight: 650; font-size: 16px; }
.proj-m { font-size: 13px; color: var(--muted); }

/* 角色 */
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.role { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fcfcfe; }
.role-top { display: flex; align-items: center; gap: 8px; }
.rname { width: 110px; padding: 5px 8px; font-weight: 600; }
.share { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.share-in { flex: 1 1 auto; font-size: 12px; color: var(--muted); padding: 5px 8px; }
#role-name { flex: 1 1 220px; }
#autodetect { flex: 0 0 auto; }

/* 进度 */
.prog { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.prog-row { display: flex; align-items: center; gap: 10px; }
.prog-name { width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bar { flex: 1 1 auto; height: 8px; background: #eef1f5; border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4f86ff, #2f6df6); border-radius: 999px; transition: width .25s; }
.dl-role { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; border-left: 1px solid var(--line); padding-left: 10px; }

/* 台词表 */
.toolbar { margin-bottom: 12px; }
#search { flex: 1 1 200px; max-width: 320px; }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; max-height: 66vh; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; min-width: 860px; }
.tbl th {
  position: sticky; top: 0; z-index: 2; background: #f7f8fa; text-align: left;
  font-weight: 600; color: var(--muted); padding: 9px 8px; border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.tbl td { padding: 5px 8px; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
.tbl tr.done td { background: #f6fbf8; }
.tbl tr:hover td { background: #f7faff; }
.c-sel { width: 34px; }
.c-num { width: 44px; color: var(--muted); text-align: right; padding-top: 12px; }
.c-time { width: 108px; }
.c-txt { width: auto; }
.c-role { width: 128px; }
.c-st { width: 96px; padding-top: 12px; font-size: 12.5px; }
.c-act { width: 190px; white-space: nowrap; padding-top: 8px; }
.tin {
  width: 100%; padding: 5px 6px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; font: inherit; color: var(--ink); outline: none;
}
.tin:hover { border-color: var(--line); background: #fff; }
.tin:focus { border-color: var(--accent); background: #fff; }
.tin.wide { font-size: 13.5px; }
.c-time .tin { text-align: left; font-size: 12px; color: #5b6472; padding: 2px 5px; }
.c-act .btn { margin-right: 4px; }
.c-act label.btn { position: relative; }

/* 整轨 */
.tracks { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.track-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fcfcfe; }

/* 配音员 */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.line.rec { border-color: #e88a8a; box-shadow: 0 0 0 3px rgba(207,74,74,.10); }
.line.done { border-left: 4px solid var(--ok); }
.line-h { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.line-h .t { font-family: ui-monospace, Menlo, Consolas, monospace; }
.line-txt { font-size: 18px; line-height: 1.55; margin: 8px 0 10px; word-break: break-word; }
.line-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { color: var(--muted); font-size: 12px; }
.st.warn { color: #b26a00; }
.line .count { display: none; font-size: 36px; font-weight: 700; color: var(--accent); text-align: center; padding: 4px 0 8px; letter-spacing: 2px; }
.line.pre .count { display: block; }
.line.pre { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,109,246,.12); }
.rec-line { display: none; height: 4px; background: #eef1f5; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.rec-line i { display: block; height: 100%; width: 0; background: #cf4a4a; transition: width .1s linear; }
.line.rec .rec-line { display: block; }
#dub-role { font-size: 14px; padding: 4px 12px; }
#dub-bar { width: 0; }
#ref-audio { height: 34px; max-width: 260px; }
.dub-hint { margin: 8px 0 0; }

/* 登录 */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth .box {
  width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 26px 24px; box-shadow: 0 10px 30px rgba(20,30,50,.07);
}
.auth h1 { font-size: 20px; margin-bottom: 4px; }
.auth .in { width: 100%; margin: 14px 0 12px; }
.auth .err { color: var(--danger); font-size: 13px; margin: 6px 0 0; }
.auth p { margin: 0; }
.foot-note { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-item {
  background: rgba(29,33,41,.92); color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13.5px; max-width: 86vw; box-shadow: 0 6px 20px rgba(0,0,0,.18);
  transition: opacity .3s, transform .3s;
}
.toast-item.err { background: rgba(176,45,45,.95); }
.toast-item.out { opacity: 0; transform: translateY(6px); }

@media (max-width: 720px) {
  .wrap { padding: 12px 10px 60px; }
  .card { padding: 13px; border-radius: 11px; }
  .line-txt { font-size: 16.5px; }
  .tbl { min-width: 780px; }
  .roles { grid-template-columns: 1fr; }
  .prog-name { width: 70px; }
  .c-act { width: 168px; }
  .line-acts .btn { padding: 7px 12px; }
  #dub-name { width: 96px; }
  .brand { font-size: 15px; }
}
