/* ============================================================
   MOJIKA — Material dark theme
   Palet mengikuti Material Design dark: dasar #131316,
   permukaan berlapis (elevation), aksen pastel Google
   (#8ab4f8 biru, #81c995 hijau, #f28b82 merah, #fdd663 kuning).
   ============================================================ */

/* ---------- Ikon: Material Symbols (lokal, offline) ---------- */
@font-face {
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 100 700;
  src: url("assets/material-symbols.woff2") format("woff2");
}
/* ---------- Font telop: Noto Sans/Serif JP (lokal, offline) ---------- */
@font-face {
  font-family: "NotoSansJP-Black";
  font-style: normal;
  font-weight: normal;
  src: url("assets/fonts/NotoSansJP-Black.ttf") format("truetype");
}
@font-face {
  font-family: "Noto Sans JP";
  font-style: normal;
  font-weight: 100 900;
  src: url("assets/fonts/NotoSansJP-VF.ttf") format("truetype-variations");
}
@font-face {
  font-family: "Noto Serif JP";
  font-style: normal;
  font-weight: 100 900;
  src: url("assets/fonts/NotoSerifJP-VF.ttf") format("truetype-variations");
}

.ms {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  display: inline-block;
  vertical-align: -4px;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
.ms.sm { font-size: 15px; vertical-align: -3px; }
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

:root {
  --bg: #131316;
  --bg-panel: #1b1c20;
  --bg-card: #222327;
  --bg-hover: #2c2e34;
  --border: #393b42;
  --text: #e4e6eb;
  --text-dim: #9da3af;
  --accent: #8ab4f8;
  --on-accent: #0b2b60;
  --red: #f28b82;
  --red-bg: rgba(242, 139, 130, 0.12);
  --yellow: #fdd663;
  --yellow-bg: rgba(253, 214, 99, 0.12);
  --blue: #8ab4f8;
  --blue-bg: rgba(138, 180, 248, 0.12);
  --green: #81c995;
  --green-bg: rgba(129, 201, 149, 0.13);
  --on-green: #0c3a1c;
  --orange: #fcad70;
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.2);
  --elev-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 14px;
  overflow: hidden;
}

/* ---------- Top bar ---------- */
#topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--bg-panel);
  box-shadow: var(--elev-1);
  position: relative;
  z-index: 10;
}
#topbar .logo {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 2px;
  color: var(--accent);
}
#topbar .logo span { color: var(--text); }
#topbar .proj {
  font-size: 13px;
  color: var(--text-dim);
  border-left: 1px solid var(--border);
  padding-left: 14px;
}
#topbar .proj b { color: var(--text); font-weight: 600; }
.nav-tabs {
  display: flex;
  gap: 2px;
  margin-left: 10px;
  background: var(--bg-card);
  border-radius: 999px;
  padding: 3px;
}
.nav-tab {
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  border: none;
  background: transparent;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { background: var(--accent); color: var(--on-accent); }
#topbar .spacer { flex: 1; }
.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-dim);
}
.stat-chip b { color: var(--text); }
.stat-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.stat-chip .ms { font-size: 15px; vertical-align: -3px; }

.btn-src {
  margin-left: 4px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-src:hover { background: var(--blue-bg); border-color: var(--accent); }
.btn-src:disabled { opacity: 0.55; cursor: wait; }

/* ---------- Layout ---------- */
#main { display: flex; height: calc(100vh - 56px); }
.screen { display: none; width: 100%; }
.screen.active { display: flex; }

/* ---------- Review screen ---------- */
#screen-review.active { display: flex; }
#left-pane {
  width: 46%;
  min-width: 420px;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid #101013;
  min-height: 0; /* izinkan anak flex menyusut agar scroll bekerja */
}
/* Isi panel kiri bisa di-scroll; footer tetap menempel di bawah */
#left-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
#right-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Video preview */
#video-box {
  position: relative;
  aspect-ratio: 16/9;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(70, 80, 120, 0.3), transparent 65%),
    linear-gradient(135deg, #20242f 0%, #14161d 55%, #0c0d12 100%);
  margin: 14px 14px 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--elev-1);
  flex-shrink: 0;
}
#real-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
#video-box.real #video-topic, #video-box.real #video-title-card { display: none; }

/* Tombol layar penuh di sudut video */
#btn-fullscreen {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 5;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: none;
  background: rgba(10, 12, 18, 0.6);
  color: #e4e6eb;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
#video-box:hover #btn-fullscreen { opacity: 1; }
#btn-fullscreen:hover { background: rgba(10, 12, 18, 0.85); }
#btn-fullscreen .ms { font-size: 20px; vertical-align: 0; }

/* Saat layar penuh: kotak video mengisi layar, telop ikut membesar */
#video-box:fullscreen {
  margin: 0;
  border-radius: 0;
  aspect-ratio: auto;
  width: 100vw; height: 100vh;
  background: #000;
}
#video-box:fullscreen #btn-fullscreen { opacity: 1; }
#video-box:fullscreen #telop-overlay { bottom: 5vh; }
#video-box:fullscreen .id-sub { font-size: 2.1vh; }
#video-title-card {
  position: absolute;
  top: 18px;
  left: 0; right: 0;
  text-align: center;
  color: #6c7386;
  font-size: 12px;
  letter-spacing: 1px;
}
#video-topic {
  position: absolute;
  top: 34%;
  left: 0; right: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: rgba(228, 230, 235, 0.2);
  letter-spacing: 2px;
}
#telop-overlay {
  position: absolute;
  bottom: 22px;
  left: 0; right: 0;
  text-align: center;
  padding: 0 16px;
  pointer-events: none;
}
/* Ukuran telop diatur applyTelopSize() di app.js: nilai slider (piksel pada
   video jadi 1920×1080) diskalakan ke lebar kotak video saat ini — juga
   berlaku otomatis saat layar penuh. */
#telop-overlay .fxline { font-size: inherit; }
#sfx-flash {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--orange);
  color: #3d2205;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
#sfx-flash.on { opacity: 1; }
#bgm-indicator {
  position: absolute;
  top: 12px; left: 12px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.65);
  color: #aab1c2;
  display: flex;
  align-items: center;
  gap: 5px;
}
#bgm-indicator .ms { font-size: 14px; vertical-align: -3px; color: var(--accent); }

/* ============================================================
   FXLINE — telop gaya Adobe Premiere (lihat data.js → TELOP_STYLES.fx)
   Digambar sebagai SVG: siluet teks bergradasi (isi + outline tebal)
   di bawah, isi putih di atasnya, plus glow hitam. Dua lapis penuh per
   baris → outline tidak pernah menabrak huruf tetangganya.
   Ukuran SVG ditetapkan dalam em oleh fitFxSvg() sehingga seluruh telop
   ikut menyesuaikan font-size induknya.
   ============================================================ */
.fxgroup { display: inline-block; text-align: center; }
.fxrow { text-align: center; line-height: 1; }
.fxline {
  display: inline-block;
  font-family: "NotoSansJP-Black", "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.fxsvg {
  display: block;
  overflow: visible;
  /* sengaja TIDAK dibatasi max-width: baris panjang harus tampil pada ukuran
     sebenarnya (wadahnya yang menggulir), supaya semua baris seukuran dan
     riset ukuran font tidak tertipu oleh baris yang diam-diam mengecil */
  /* sebelum fitFxSvg() mengukur, jangan biarkan SVG memakai ukuran bawaan 300×150 */
  width: 0; height: 0;
}
.fxsvg text {
  font-family: "NotoSansJP-Black", "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif;
  letter-spacing: 0.04em;
  white-space: pre;
}
.fxsvg .l-stroke { pointer-events: none; user-select: none; }

/* --- Highlight per kata: hanya warna isi yang berubah --- */
.fxsvg .l-fill .hl-penekanan { fill: #ff5340; }
.fxsvg .l-fill .hl-angka     { fill: #ffe33e; }
.fxsvg .l-fill .hl-istilah   { fill: #a5e8ff; }

/* Transport */
#transport {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 0;
  flex-shrink: 0;
  flex-wrap: wrap;          /* kontrol telop bisa turun baris di layar sempit */
}
#btn-play {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--elev-1);
}
#btn-play .ms { font-size: 24px; vertical-align: 0; }
#btn-play:hover { filter: brightness(1.1); }
#time-display { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-dim); min-width: 96px; }
#time-display b { color: var(--text); }
#transport .hint { font-size: 11px; color: var(--text-dim); }
#transport .hint .ms { font-size: 13px; vertical-align: -2px; }

/* Slider tata letak telop — semua angkanya piksel pada video jadi 1920×1080 */
#telop-ctrls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.telop-ctrl {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel);
  flex-shrink: 0;
  cursor: pointer;
}
.telop-ctrl:hover { border-color: var(--accent); }
.telop-ctrl .ms { font-size: 16px; color: var(--text-dim); }
.telop-ctrl input[type="range"] { width: 80px; accent-color: var(--accent); cursor: pointer; }
.telop-ctrl > span:last-child {
  font-size: 11.5px; color: var(--text-dim);
  font-variant-numeric: tabular-nums; min-width: 42px;
}

/* Timeline */
#timeline-wrap { padding: 10px 14px 14px; flex-shrink: 0; }
#timeline-area { display: flex; gap: 6px; }

/* Laporan kualitas audio (tahap 0) */
#audio-report {
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 9px;
  font-size: 12px;
  line-height: 1.6;
  border-left: 3px solid var(--border);
  background: var(--bg-card);
}
#audio-report.baik { border-left-color: var(--green); }
#audio-report.perhatian { border-left-color: var(--yellow); }
#audio-report.buruk { border-left-color: var(--red); }
#audio-report .ar-head { display: flex; align-items: center; gap: 7px; font-weight: 700; }
#audio-report.baik .ar-head { color: var(--green); }
#audio-report.perhatian .ar-head { color: var(--yellow); }
#audio-report.buruk .ar-head { color: var(--red); }
#audio-report .ar-stats {
  display: flex; flex-wrap: wrap; gap: 10px;
  color: var(--text-dim); font-size: 11px; margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
#audio-report .ar-stats b { color: var(--text); font-weight: 600; }
#audio-report ul { margin: 5px 0 0 16px; color: var(--text-dim); }
#audio-report li { margin-bottom: 2px; }

/* Gelombang audio sebagai latar timeline */
.tl-wave {
  position: absolute;
  left: 0; right: 0;
  top: 20px;
  height: 26px;
  pointer-events: none;
  opacity: 0.7;
}

#audio-report .ar-actions { margin-top: 8px; }
#audio-report .btn-mini.utama {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.tl-main { flex: 1; min-width: 0; }

/* Kepala jalur (kolom kiri) — sejajar dengan baris BGM / telop / SFX */
.tl-headers {
  position: relative;
  width: 26px;
  flex-shrink: 0;
  margin-top: 19px; /* offset setinggi ruler agar sejajar lane */
  height: 74px;
}
.tl-h-btn {
  position: absolute;
  left: 0;
  width: 24px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
}
.tl-h-btn .ms { font-size: 13px; vertical-align: 0; }
.tl-h-btn:hover { border-color: var(--accent); color: var(--accent); }
.tl-h-btn.off { opacity: 0.45; }
#tgl-bgm { top: -2px; }
#tgl-telop { top: 23px; }
#tgl-sfx { top: 49px; }

/* Ruler waktu di atas timeline */
#tl-ruler {
  position: relative;
  height: 17px;
  margin-bottom: 2px;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
#tl-ruler .tick {
  position: absolute;
  top: 9px;
  bottom: 0;
  border-left: 1px solid var(--border);
  pointer-events: none;
}
#tl-ruler .tick span {
  position: absolute;
  left: 3px;
  top: -9px;
  font-size: 9px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#ruler-cursor {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#timeline {
  position: relative;
  height: 74px;
  background: var(--bg-card);
  border-radius: 10px;
  cursor: grab;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
  user-select: none;          /* drag tidak menyeleksi teks sekitar */
  -webkit-user-select: none;
  touch-action: none;
}
#timeline:active { cursor: grabbing; }
.tl-zoom-label {
  position: absolute;
  right: 6px;
  bottom: 3px;
  font-size: 9.5px;
  color: var(--text-dim);
  background: rgba(10, 12, 18, 0.6);
  padding: 1px 7px;
  border-radius: 999px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.tl-bgm { position: absolute; top: 0; height: 14px; opacity: 0.9; }
.tl-bgm span {
  font-size: 9px; color: #fff; padding-left: 4px; line-height: 14px;
  white-space: nowrap; overflow: hidden; display: block;
}
.tl-telop {
  position: absolute; top: 20px; height: 26px;
  background: #46527a;
  border-radius: 4px;
  border: 1px solid #5a6898;
}
.tl-telop.approved { background: #2e6a44; border-color: #45925f; }
.tl-telop.has-diff { background: #7a3a46; border-color: #a55563; }
.tl-sfx {
  position: absolute; top: 52px;
  width: 12px; height: 12px;
  background: var(--orange);
  border-radius: 50%;
  transform: translateX(-6px);
  border: 2px solid #7a4a12;
}
.tl-sfx.deleted { display: none; }
.tl-sfx.lowconf { background: var(--yellow); }
#playhead {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: #fff;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}
.tl-legend { display: flex; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--text-dim); flex-wrap: wrap; }
.tl-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }

/* Review progress footer */
#review-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid #101013;
  display: flex;
  align-items: center;
  gap: 12px;
}
#progress-bar-wrap { flex: 1; height: 6px; background: var(--bg-card); border-radius: 999px; overflow: hidden; }
#progress-bar { height: 100%; width: 0%; background: var(--green); transition: width 0.3s; }
#progress-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
#btn-approve-all {
  background: var(--green);
  color: var(--on-green);
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--elev-1);
}
#btn-approve-all:hover { filter: brightness(1.08); }

/* Right pane: sub tabs */
#sub-tabs {
  display: flex;
  gap: 2px;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sub-tab {
  padding: 9px 16px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sub-tab .badge {
  background: var(--red);
  color: #4a1210;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}
#panel-scroll { flex: 1; overflow-y: auto; padding: 12px 16px 40px; }
.sub-panel { display: none; }
.sub-panel.active { display: block; }

/* Hint bar */
.hint-bar {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
  line-height: 1.6;
}
.hint-bar b { color: var(--text); }
.hint-bar .ms { font-size: 14px; vertical-align: -3px; }

/* Telop rows */
.telop-row {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--elev-1);
  border: 1px solid transparent;
}
.telop-row:hover { background: var(--bg-hover); }
.telop-row.playing { border-color: var(--accent); }
.telop-row.approved { border-left: 3px solid var(--green); }
.row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-dim);
}
.t-id { font-weight: 700; color: var(--text-dim); }
.t-time { font-variant-numeric: tabular-nums; }
.tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tag .ms { font-size: 12px; vertical-align: -2px; }
.tag-diff { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.tag-pause { background: var(--blue-bg); color: var(--blue); }
.tag-conf-low { background: var(--yellow-bg); color: var(--yellow); }
.tag-conf-ok { background: var(--green-bg); color: var(--green); }
.tag-vol-naik { background: rgba(252, 173, 112, 0.16); color: var(--orange); }
.tag-vol-turun { background: rgba(157, 163, 175, 0.16); color: var(--text-dim); }
.row-head .flex-sp { flex: 1; }
.btn-approve {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-approve .ms { font-size: 13px; vertical-align: -2px; }
.btn-approve:hover { border-color: var(--green); color: var(--green); }
.btn-approve.on { background: var(--green); border-color: var(--green); color: var(--on-green); }

.telop-text-line {
  /* Tetap gelap pekat: pratinjau telop putih ber-outline butuh latar seperti video */
  padding: 8px 8px 6px;
  background: #101116;
  border-radius: 8px;
  overflow-x: auto;
}
.telop-text-line .fxline { font-size: 21px; }
.tok { cursor: pointer; }
/* tspan tidak menerima filter — pakai fill-opacity sebagai umpan balik hover */
.tok:hover { fill-opacity: 0.65; }
.style-sel {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 6px;
  font-size: 11px;
  cursor: pointer;
}
.style-sel:hover { border-color: var(--accent); }

.diff-box {
  margin-top: 8px;
  background: var(--red-bg);
  border: 1px solid rgba(242, 139, 130, 0.4);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}
.diff-box .diff-title { color: var(--red); font-weight: 700; margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.diff-box .diff-title .ms { font-size: 15px; }
.diff-box .diff-alt { color: var(--text); font-size: 13px; }
.diff-box .diff-note { color: var(--text-dim); margin-top: 3px; }
.diff-box .diff-actions { margin-top: 7px; display: flex; gap: 6px; }
.btn-mini {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-mini .ms { font-size: 13px; vertical-align: -2px; }
.btn-mini:hover { background: var(--bg-hover); border-color: var(--accent); }

/* SFX rows */
.sfx-row {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--elev-1);
  border: 1px solid transparent;
}
.sfx-row.playing { border-color: var(--accent); }
.sfx-row.approved { border-left: 3px solid var(--green); }
.sfx-row.deleted { opacity: 0.45; }
.sfx-row.deleted .sfx-body { text-decoration: line-through; }
.sfx-body { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sfx-body select {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
}
.btn-sfx-play {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--orange);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-sfx-play .ms { font-size: 18px; vertical-align: 0; }
.btn-sfx-play:hover { border-color: var(--orange); }
.sfx-vol { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); }
.sfx-vol input { width: 80px; accent-color: var(--accent); }
.btn-del {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-del .ms { font-size: 14px; vertical-align: -2px; }
.btn-del:hover { border-color: var(--red); color: var(--red); }
.sfx-reason {
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 6px 9px;
  border-left: 3px solid var(--accent);
}
.sfx-reason b { color: var(--text); }
.momen-chip { background: var(--blue-bg); color: var(--blue); font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 700; }

/* BGM panel */
.bgm-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--elev-1);
}
.bgm-color { width: 14px; height: 40px; border-radius: 4px; }
.bgm-info b { display: block; font-size: 14px; }
.bgm-info span { font-size: 12px; color: var(--text-dim); }
.bgm-time { margin-left: auto; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---------- Pipeline screen ---------- */
#screen-pipeline.active { display: block; overflow-y: auto; }
.pipe-wrap { max-width: 860px; margin: 0 auto; padding: 28px 24px 60px; }
.pipe-wrap h1 { font-size: 20px; margin-bottom: 4px; font-weight: 600; }
.pipe-wrap .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.stage-card {
  display: flex;
  gap: 14px;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--elev-1);
  border: 1px solid transparent;
}
.stage-card.current { border-color: var(--accent); }
.stage-no {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green-bg);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stage-no .ms { font-size: 19px; vertical-align: 0; }
.stage-card.current .stage-no { background: var(--accent); color: var(--on-accent); }
.stage-body { flex: 1; }
.stage-body b { font-size: 15px; }
.stage-body .tool { color: var(--accent); font-size: 12px; margin-left: 8px; }
.stage-body p { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.stage-meta { text-align: right; font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.stage-meta b { color: var(--text); display: block; }
.cost-note {
  margin-top: 18px;
  background: var(--green-bg);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
}
.cost-note b { color: var(--green); }

/* ---------- Export screen ---------- */
#screen-export.active { display: block; overflow-y: auto; }
.export-wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px 60px; }
.export-wrap h1 { font-size: 20px; margin-bottom: 4px; font-weight: 600; }
.export-wrap .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.export-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--elev-1);
  border: 1px solid transparent;
}
.export-card:hover { background: var(--bg-hover); }
.export-card.selected { border-color: var(--accent); }
.export-card b { font-size: 15px; display: block; margin-bottom: 6px; }
.export-card p { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.export-card .fmt { color: var(--orange); font-size: 11px; font-weight: 700; }
#export-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--elev-1);
}
.btn-primary .ms { font-size: 17px; vertical-align: -3px; }
.btn-primary:hover { filter: brightness(1.1); }
#export-preview {
  width: 100%;
  height: 380px;
  background: #16171b;
  color: #9fc6a5;
  border-radius: 12px;
  padding: 14px;
  font-family: Consolas, monospace;
  font-size: 12px;
  white-space: pre;
  overflow: auto;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}
.export-stats { display: flex; gap: 10px; margin-bottom: 14px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.export-stats .stat-chip b { color: var(--text); }

/* ---------- Terjemahan & transkrip ---------- */
#lang-toggle, .lang-mini {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  margin-left: 6px;
}
#lang-toggle button, .lang-mini button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
#lang-toggle button.active, .lang-mini button.active { background: var(--accent); color: var(--on-accent); }

/* Terjemahan Indonesia kecil di atas telop (overlay video) */
.id-sub {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
  background: rgba(8, 10, 16, 0.55);
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 7px;
  max-width: 92%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
/* Highlight kosa kata Indonesia — warna senada highlight Jepangnya */
.idw-penekanan { color: #ff8577; font-weight: 800; }
.idw-angka     { color: #ffdf57; font-weight: 800; }
.idw-istilah   { color: #8fdcff; font-weight: 800; }

/* Tombol toggle aktif (BGM live / sub Indonesia) */
.btn-sfx-play.active { border-color: var(--accent); color: var(--accent); }

/* Sub-teks terjemahan di baris telop */
.telop-id-sub {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 4px 8px;
  background: var(--bg-panel);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

/* Panel transkrip */
.turn-row {
  display: flex;
  gap: 10px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--elev-1);
}
.turn-spk {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}
.turn-spk.s0 { background: var(--blue-bg); color: var(--blue); }
.turn-spk.s1 { background: var(--green-bg); color: var(--green); }
.turn-text { font-size: 13.5px; line-height: 1.7; }

/* ---------- Render final ---------- */
#render-box {
  margin-top: 20px;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--elev-1);
  border: 1px solid var(--border);
}
.render-head { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.render-head .ms { color: var(--accent); }
.render-sub { font-size: 12.5px; color: var(--text-dim); margin: 6px 0 12px; line-height: 1.6; }
.render-row { display: flex; align-items: center; gap: 14px; }
#render-progress-wrap {
  flex: 1;
  height: 8px;
  background: var(--bg-panel);
  border-radius: 999px;
  overflow: hidden;
  display: none;
}
#render-progress { height: 100%; width: 0%; background: var(--accent); transition: width 0.5s; }
#render-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
#render-result { margin-top: 10px; font-size: 13px; }
#render-result a { color: var(--green); font-weight: 600; }

/* ---------- Layar Uji A/B ---------- */
#screen-ab.active { display: block; overflow-y: auto; }
.ab-wrap { max-width: 1400px; margin: 0 auto; padding: 28px 24px 60px; }
.ab-wrap h1 { font-size: 20px; margin-bottom: 4px; font-weight: 600; }
.ab-wrap .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; line-height: 1.6; }

.ab-config {
  display: flex; gap: 20px; flex-wrap: wrap;
  background: var(--bg-card); border-radius: 14px;
  padding: 16px; box-shadow: var(--elev-1); margin-bottom: 14px;
}
.ab-field label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 8px;
}
.ab-field select {
  background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; min-width: 220px;
}
.ab-models { flex: 1; min-width: 320px; }
#ab-model-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ab-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; cursor: pointer;
  background: var(--bg-panel); user-select: none;
}
.ab-chip:hover { border-color: var(--accent); }
.ab-chip.on { background: var(--blue-bg); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ab-chip.disabled { opacity: 0.4; cursor: not-allowed; }
.ab-chip .harga { color: var(--text-dim); font-size: 10px; font-weight: 400; }
.ab-chip.on .harga { color: var(--accent); }

.ab-actions { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.ab-blind { font-size: 12.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ab-blind input { accent-color: var(--accent); }
#ab-status { font-size: 12.5px; color: var(--text-dim); }

.ab-grid { display: grid; gap: 14px; align-items: start; }
.ab-col {
  background: var(--bg-card); border-radius: 14px;
  box-shadow: var(--elev-1); overflow: hidden;
  border: 1px solid transparent;
}
.ab-col.menang { border-color: var(--green); }
.ab-col-head { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ab-col-head b { font-size: 14px; display: block; }
.ab-col-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.ab-col-meta .murah { color: var(--green); font-weight: 700; }
.ab-col-meta .cepat { color: var(--accent); font-weight: 700; }
.ab-col-body { padding: 10px 14px 14px; max-height: 62vh; overflow-y: auto; }
.ab-col-err { color: var(--red); font-size: 12.5px; padding: 14px; }

.ab-item { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; line-height: 1.65; }
.ab-item:last-child { border-bottom: none; }
.ab-item .waktu { color: var(--text-dim); font-size: 10.5px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.ab-item .jp { font-family: "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif; }
.ab-item .badge-style {
  font-size: 9.5px; padding: 1px 6px; border-radius: 999px; margin-left: 5px; font-weight: 700;
}
.ab-item .badge-style.ao { background: rgba(74,159,224,0.22); color: #8ab4f8; }
.ab-item .badge-style.midori { background: rgba(107,194,74,0.22); color: #81c995; }
.ab-item .hl-mark { color: var(--yellow); font-weight: 700; }
.ab-item .alasan { color: var(--text-dim); font-size: 11.5px; display: block; margin-top: 2px; }

.ab-vote { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); }
.ab-vote button {
  flex: 1; border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); border-radius: 8px; padding: 6px;
  font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.ab-vote button:hover { border-color: var(--green); color: var(--green); }
.ab-vote button.on { background: var(--green); border-color: var(--green); color: var(--on-green); }

/* ---------- Modal video lokal ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  width: 520px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--elev-2);
}
.modal h3 { font-size: 16px; margin-bottom: 4px; font-weight: 600; }
.modal-sub { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; word-break: break-all; }
#video-file-list { overflow-y: auto; flex: 1; }
.vfile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.vfile:hover { border-color: var(--accent); background: var(--bg-hover); }
.vfile .ms { color: var(--text-dim); }
.vfile .vname { font-weight: 600; flex: 1; word-break: break-all; }
.vfile .vmeta { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.vfile .vtag {
  font-size: 10px; font-weight: 700;
  background: var(--green-bg); color: var(--green);
  border-radius: 999px; padding: 2px 8px;
  display: inline-flex; align-items: center; gap: 3px;
}
.vfile .vtag .ms { font-size: 12px; color: var(--green); }
.vfile-empty { color: var(--text-dim); font-size: 13px; padding: 14px; text-align: center; line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layar tunggu satu-klik ---------- */
#genie {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: radial-gradient(ellipse at 50% 35%, #1c2233 0%, #101218 55%, #0a0b0f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: genie-masuk 0.35s ease;
}
@keyframes genie-masuk { from { opacity: 0; } to { opacity: 1; } }

.genie-box { width: min(440px, 88vw); text-align: center; }

/* Gelombang suara yang menenangkan */
.genie-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 64px;
  margin-bottom: 26px;
}
.genie-wave i {
  display: block;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8ab4f8, #5b8de0);
  animation: genie-denyut 1.5s ease-in-out infinite;
}
.genie-wave i:nth-child(1) { height: 16px; animation-delay: 0s; }
.genie-wave i:nth-child(2) { height: 28px; animation-delay: 0.1s; }
.genie-wave i:nth-child(3) { height: 44px; animation-delay: 0.2s; }
.genie-wave i:nth-child(4) { height: 58px; animation-delay: 0.3s; }
.genie-wave i:nth-child(5) { height: 64px; animation-delay: 0.4s; }
.genie-wave i:nth-child(6) { height: 58px; animation-delay: 0.5s; }
.genie-wave i:nth-child(7) { height: 44px; animation-delay: 0.6s; }
.genie-wave i:nth-child(8) { height: 28px; animation-delay: 0.7s; }
.genie-wave i:nth-child(9) { height: 16px; animation-delay: 0.8s; }
@keyframes genie-denyut {
  0%, 100% { transform: scaleY(0.35); opacity: 0.45; }
  50%      { transform: scaleY(1);    opacity: 1; }
}

.genie-title { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: 0.3px; }
.genie-step {
  margin-top: 7px;
  font-size: 13.5px;
  color: var(--accent);
  min-height: 20px;
  animation: genie-halus 0.4s ease;
}
@keyframes genie-halus { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.genie-bar {
  margin: 20px auto 0;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.genie-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5b8de0, #8ab4f8);
  transition: width 0.6s ease;
}

.genie-list { margin-top: 22px; text-align: left; display: inline-block; }
.gl-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: #6b7385;
  padding: 5px 0;
  transition: color 0.3s;
}
.gl-item .ms { font-size: 17px; }
.gl-item.aktif { color: var(--text); font-weight: 600; }
.gl-item.aktif .ms { color: var(--accent); animation: genie-putar 1.4s linear infinite; }
.gl-item.selesai { color: #7f8798; }
.gl-item.selesai .ms { color: var(--green); }
.gl-item.gagal .ms { color: var(--red); }
@keyframes genie-putar { to { transform: rotate(360deg); } }

.genie-hint {
  margin-top: 24px;
  font-size: 11.5px;
  color: #5f6779;
  line-height: 1.7;
}
.genie-batal {
  margin-top: 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 11.5px;
  cursor: pointer;
}
.genie-batal:hover { border-color: var(--accent); color: var(--accent); }

/* Tombol utama di bilah atas */
.btn-src.utama {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 700;
}
.btn-src.utama:hover { filter: brightness(1.08); background: var(--accent); }

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(90px);
  background: #e4e6eb;
  color: #1b1c20;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.25s;
  z-index: 99;
  box-shadow: var(--elev-2);
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- Halaman login ---------- */
#login {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 30%, rgba(138, 180, 248, 0.08), transparent 70%),
    var(--bg);
}
.login-box {
  width: 320px;
  padding: 34px 30px 28px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-logo {
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--accent);
  text-align: center;
}
.login-logo span { color: var(--text); }
.login-sub {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  margin-bottom: 10px;
}
.login-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.login-field:focus-within { border-color: var(--accent); }
.login-field .ms { color: var(--text-dim); font-size: 20px; }
.login-field input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
#login-error {
  color: var(--red);
  font-size: 12.5px;
  min-height: 16px;
  text-align: center;
}
#login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
#login-submit:hover { filter: brightness(1.08); }
#login-submit:disabled { opacity: 0.6; cursor: default; }
