/* 歌詞字幕 — 共用樣式（淺色/深色自適應，編輯風） */

:root {
  --paper: #f7f5f0;
  --card: #fffdf9;
  --input-bg: #ffffff;
  --ink: #17150f;
  --muted: #6b675e;
  --faint: #a09b8f;
  --line: #e3ded2;
  --line-dark: #c9c3b4;
  --accent: #bf3b2b;
  --ok: #1c7c54;
  --warn: #8a6d1c;
  --warn-bg: #f5edd6;
  --warn-line: #e3d5a8;
  --err: #b3261e;
  --shadow: rgba(23, 21, 15, .18);
  --serif: "Songti TC", "Noto Serif TC", "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f;
    --card: #1d1a14;
    --input-bg: #12100c;
    --ink: #ece7db;
    --muted: #a49e91;
    --faint: #6f6a5e;
    --line: #2e2a22;
    --line-dark: #4a443a;
    --accent: #e0553f;
    --ok: #4cae87;
    --warn: #cfa93f;
    --warn-bg: #2a2410;
    --warn-line: #4a3f18;
    --err: #e06a5f;
    --shadow: rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 頁面切換動畫 ---------- */
/* 進場：主內容區塊由下往上逐一浮現 */
main > * { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
main > *:nth-child(2) { animation-delay: .07s; }
main > *:nth-child(3) { animation-delay: .14s; }
main > *:nth-child(4) { animation-delay: .21s; }
main > *:nth-child(n+5) { animation-delay: .28s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* 離場：點導航連結時由 common.js 加上 .leaving 再跳轉 */
body.leaving main { animation: sink .16s ease-in both; }
@keyframes sink { to { opacity: 0; transform: translateY(-10px); } }

@media (prefers-reduced-motion: reduce) {
  main > *, body.leaving main { animation: none; }
}

/* ---------- 頂欄／導航 ---------- */
header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 32px; position: sticky; top: 0; z-index: 10;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.hleft { display: flex; align-items: center; gap: 36px; min-width: 0; }
a.brand {
  display: flex; align-items: center; gap: 11px; font-family: var(--serif);
  font-weight: 900; font-size: 20px; letter-spacing: 1px;
  color: var(--ink); text-decoration: none; flex: none;
}
.logo {
  width: 32px; height: 32px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-size: 16px; border-radius: 5px;
}
nav { display: flex; gap: 28px; }
nav a {
  color: var(--muted); text-decoration: none; font-size: 15.5px; letter-spacing: 1px;
  padding: 6px 2px; position: relative; transition: color .15s;
}
nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .25s cubic-bezier(.2,.7,.3,1);
}
nav a:hover { color: var(--ink); }
nav a:hover::after { transform: scaleX(.4); }
nav a.on { color: var(--ink); font-weight: 600; }
nav a.on::after { transform: scaleX(1); }
.hright { display: flex; align-items: center; gap: 10px; flex: none; }
.chip {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line-dark);
  border-radius: 999px; padding: 5px 12px; white-space: nowrap; background: var(--card);
  text-decoration: none;
}
.chip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.chip.discord { color: var(--ink); cursor: pointer; transition: all .15s; }
.chip.discord:hover { border-color: var(--ink); }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-dark); }
a.userchip {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  border: 1px solid var(--line-dark); background: var(--card); border-radius: 999px;
  padding: 4px 13px 4px 5px; color: var(--ink); font-size: 13px; transition: border-color .15s;
}
a.userchip:hover { border-color: var(--ink); }
a.userchip img { width: 26px; height: 26px; border-radius: 50%; }
a.userchip .noimg {
  width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
a.userchip .uplan { color: var(--accent); font-size: 12px; font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 32px 20px 80px; }

/* ---------- 卡片與表單 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 28px; margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 16px; font-size: 15px; font-weight: 600; letter-spacing: .5px;
  display: flex; align-items: baseline; gap: 10px;
}
.card h2 .n { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; }

h1.page {
  font-family: var(--serif); font-weight: 900; font-size: 26px;
  letter-spacing: 1px; margin: 4px 0 22px;
}

label.title { display: block; font-size: 12.5px; color: var(--muted); margin: 18px 0 7px; letter-spacing: .5px; }
label.title:first-child { margin-top: 0; }

textarea, input[type=text], input[type=number], select {
  width: 100%; background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--line-dark); border-radius: 6px;
  padding: 11px 13px; font-size: 14px; font-family: inherit;
  transition: border-color .15s; outline: none;
}
textarea:focus, input:focus, select:focus { border-color: var(--ink); }
textarea { min-height: 150px; resize: vertical; line-height: 1.9; }
::placeholder { color: var(--faint); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 130px; }

.divider { display: flex; align-items: center; gap: 14px; color: var(--faint); font-size: 12px; margin: 14px 0; letter-spacing: 2px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.drop {
  border: 1px dashed var(--line-dark); border-radius: 6px; padding: 17px;
  text-align: center; color: var(--muted); font-size: 13.5px; cursor: pointer;
  transition: all .15s; display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--input-bg);
}
.drop:hover, .drop.active { border-color: var(--ink); color: var(--ink); }

.check { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--ink); width: 15px; height: 15px; }
.check .hint { color: var(--faint); font-size: 12px; }

details { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 15px; }
summary {
  font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 7px; list-style: none; letter-spacing: .5px;
}
summary::-webkit-details-marker { display: none; }
summary .chev { transition: transform .2s; font-size: 9px; }
details[open] summary .chev { transform: rotate(90deg); }
summary:hover { color: var(--ink); }

button.primary {
  width: 100%; margin-top: 22px; padding: 13px; font-size: 15px; font-weight: 600;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; cursor: pointer;
  letter-spacing: 2px; font-family: inherit; transition: background .15s;
}
button.primary:hover:not(:disabled) { background: var(--accent); }
button.primary:disabled { opacity: .4; cursor: not-allowed; }

button.ghost {
  background: transparent; border: 1px solid var(--line-dark); color: var(--ink);
  border-radius: 6px; padding: 8px 15px; font-size: 13px; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
button.ghost:hover { border-color: var(--ink); }

/* ---------- 進度與結果 ---------- */
.stage { display: flex; align-items: center; gap: 11px; font-size: 14px; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); border-top-color: var(--ink);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 4px; margin-top: 16px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar .fill { height: 100%; width: 0%; background: var(--ink); transition: width .6s cubic-bezier(.4,0,.2,1); }
.pct { color: var(--faint); font-size: 12px; margin-top: 7px; text-align: right; font-family: var(--mono); }
.warn { color: var(--warn); font-size: 13px; margin-top: 10px; }
.error { color: var(--err); font-size: 13.5px; white-space: pre-wrap; line-height: 1.7; }

.done-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.done-bar .okmark { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.okdot { color: var(--ok); font-weight: 700; font-size: 15px; }
a.dl {
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600;
  padding: 10px 22px; border-radius: 6px; font-size: 14px; flex: none;
  letter-spacing: 1px; transition: background .15s;
}
a.dl:hover { background: var(--ink); color: var(--paper); }
table.preview { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.preview td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; line-height: 1.7; }
td.t { color: var(--faint); white-space: nowrap; font-family: var(--mono); font-size: 12px; padding-top: 10px; }

/* ---------- 資料表（後台） ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--line-dark);
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); line-height: 1.5; }
table.data .num { font-family: var(--mono); font-size: 12px; }
.status-ok { color: var(--ok); }
.status-perm { color: var(--accent); }
.status-exp { color: var(--faint); }
.stats { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 130px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px;
}
.stat .v { font-family: var(--serif); font-weight: 900; font-size: 28px; }
.stat .k { color: var(--muted); font-size: 12px; margin-top: 4px; letter-spacing: .5px; }

/* ---------- 登入 Hero／登入門 ---------- */
.hero { padding: 72px 8px 24px; }
.hero .kicker { font-size: 12px; letter-spacing: 3px; color: var(--accent); margin-bottom: 20px; font-weight: 600; }
.hero h1 {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(34px, 6.5vw, 52px); margin: 0 0 20px; line-height: 1.35; letter-spacing: 1px;
}
.hero h1 em { font-style: normal; border-bottom: 4px solid var(--accent); padding-bottom: 2px; }
.hero p.lead { color: var(--muted); font-size: 15.5px; margin: 0 0 36px; line-height: 2; }
.gbtn {
  display: inline-flex; align-items: center; gap: 11px; background: var(--ink); color: var(--paper);
  border: 0; border-radius: 6px; padding: 13px 26px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit; letter-spacing: 1px; transition: background .15s;
}
.gbtn:hover { background: var(--accent); }
.gbtn .gicon { background: #fff; border-radius: 3px; padding: 2px; display: grid; place-items: center; }
.feats { margin-top: 64px; border-top: 1px solid var(--line-dark); }
.feat { display: flex; gap: 20px; align-items: baseline; padding: 18px 4px; border-bottom: 1px solid var(--line); }
.feat .no { font-family: var(--mono); font-size: 12px; color: var(--accent); flex: none; }
.feat h3 { margin: 0; font-size: 15px; font-weight: 600; flex: none; width: 108px; letter-spacing: .5px; }
.feat p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.8; }

.gate { text-align: center; padding: 80px 20px; }
.gate p { color: var(--muted); margin: 0 0 24px; }

/* ---------- 方案 ---------- */
.plans { display: flex; gap: 14px; margin-bottom: 26px; }
.plan-card {
  flex: 1; border: 1px solid var(--line-dark); border-radius: 8px;
  padding: 22px 16px; text-align: center; position: relative; background: var(--card);
}
.plan-card.cur { border: 2px solid var(--ink); }
.plan-card h3 { margin: 0 0 10px; font-size: 16px; font-family: var(--serif); font-weight: 900; }
.plan-card .d { color: var(--muted); font-size: 13px; line-height: 2.1; }
.plan-card .tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: 11px; background: var(--ink); color: var(--paper); font-weight: 600;
  border-radius: 999px; padding: 2px 11px; letter-spacing: 1px;
}
.msg-ok { color: var(--ok); font-size: 13px; margin-top: 10px; }
.codes-out { font-family: var(--mono); font-size: 13px; margin-top: 12px; white-space: pre; color: var(--ink); line-height: 2; }

/* ---------- 格式切換（segmented） ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-dark); border-radius: 6px; overflow: hidden; }
.seg button {
  border: 0; background: var(--input-bg); color: var(--muted); font-family: inherit;
  padding: 10px 18px; font-size: 13.5px; cursor: pointer; letter-spacing: 1px; transition: all .15s;
}
.seg button + button { border-left: 1px solid var(--line-dark); }
.seg button.on { background: var(--ink); color: var(--paper); }

.platforms { color: var(--faint); font-size: 12px; line-height: 2; margin-top: 16px; letter-spacing: .5px; }
.platforms b { color: var(--muted); font-weight: 500; }

/* ---------- 字幕編輯器 ---------- */
.playerwrap { position: relative; margin-bottom: 16px; }
.playerwrap video { width: 100%; border-radius: 8px; background: #000; display: block; }
.playerwrap audio { width: 100%; display: block; }
.ovl {
  position: absolute; left: 4%; right: 4%; bottom: 9%;
  text-align: center; pointer-events: none;
  color: #fff; font-size: clamp(14px, 2.6vw, 22px); font-weight: 600; line-height: 1.5;
  text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 8px rgba(0,0,0,.6);
}
.cues { max-height: 420px; overflow-y: auto; border-top: 1px solid var(--line); }
.cue {
  display: flex; gap: 8px; align-items: center; padding: 7px 4px;
  border-bottom: 1px solid var(--line); transition: background .12s;
}
.cue.active { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.cue input.tt {
  width: 86px; flex: none; font-family: var(--mono); font-size: 12px;
  padding: 7px 8px; text-align: center;
}
.cue .arrow { color: var(--faint); font-size: 11px; flex: none; }
.cue input.txt { flex: 1; padding: 7px 10px; font-size: 13.5px; }
.cue button.mini {
  flex: none; border: 1px solid var(--line-dark); background: transparent; color: var(--muted);
  border-radius: 5px; width: 30px; height: 30px; cursor: pointer; font-size: 12px;
  transition: all .12s; display: grid; place-items: center;
}
.cue button.mini:hover { border-color: var(--ink); color: var(--ink); }
.cue button.mini.del:hover { border-color: var(--err); color: var(--err); }
.edit-hint { color: var(--faint); font-size: 12px; margin: 10px 0 0; letter-spacing: .5px; }

.devnote {
  background: var(--warn-bg); border-bottom: 1px solid var(--warn-line);
  color: var(--warn); font-size: 12px; padding: 7px 14px; text-align: center; letter-spacing: .5px;
}
footer { text-align: center; color: var(--faint); font-size: 12px; padding: 34px 0 10px; letter-spacing: 1px; }

@media (max-width: 680px) {
  header { padding: 14px 16px; }
  .hleft { gap: 18px; }
  a.brand { font-size: 17px; }
  nav { gap: 16px; }
  nav a { font-size: 14px; }
  .plans { flex-direction: column; }
  .chip.usage { display: none; }
  .card { padding: 22px; }
  .feat h3 { width: auto; }
  .feat { flex-wrap: wrap; }
  .tablewrap { overflow-x: auto; }
}
