:root {
  --bg: #14111f; --card: #1f1b2e; --card2: #2a2540; --line: #3a3354; --text: #f3f0fa; --muted: #a59fbd;
  --accent: #f8586b; --accent2: #ff9a62; --ok: #3ccf91; --warn: #ffc857; --err: #ff6b6b;
  --r: 16px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding: var(--safe-t) 0 calc(var(--safe-b) + 24px); min-height: 100dvh; }
#app { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.splash { display: grid; place-items: center; height: 80dvh; font-weight: 800; font-size: 28px; letter-spacing: -.02em; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; margin: 22px 0 10px; } h3 { font-size: 15px; }
a { color: var(--accent2); }
.muted { color: var(--muted); } .small { font-size: 13px; }
header.top { display: flex; align-items: center; gap: 10px; padding: 14px 0 6px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
header.top .grow { flex: 1; min-width: 0; }
header.top .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent2)); display: grid; place-items: center; font-weight: 900; }
.iconbtn { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 12px; height: 38px; min-width: 38px; padding: 0 10px; font-size: 15px; }
button, .btn { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--card2); color: var(--text); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; }
button:disabled { opacity: .5; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { background: transparent; border: 1px solid var(--err); color: var(--err); }
.block { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; } .row > * { flex: 1; }
input, textarea, select { width: 100%; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.create { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.create button { flex-direction: column; padding: 18px 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.create button .em { font-size: 30px; }
.create button small { color: var(--muted); font-weight: 500; font-size: 12px; }
.quick { display: flex; gap: 8px; margin-top: 10px; } .quick button { flex: 1; font-size: 14px; padding: 10px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; padding: 6px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.chip.on { color: #fff; border-color: var(--accent); background: rgba(248, 88, 107, .15); }
.list { display: grid; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; color: inherit; text-decoration: none; }
.item .th { width: 58px; height: 58px; border-radius: 12px; background: var(--card2) center/cover; flex: none; display: grid; place-items: center; font-size: 24px; }
.item .meta { min-width: 0; flex: 1; }
.item .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--card2); color: var(--muted); }
.badge.done { background: rgba(60, 207, 145, .15); color: var(--ok); }
.badge.processing, .badge.queued { background: rgba(255, 200, 87, .15); color: var(--warn); }
.badge.error { background: rgba(255, 107, 107, .15); color: var(--err); }
.progress { height: 6px; border-radius: 99px; background: var(--card2); overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .3s; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92dvh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(var(--safe-b) + 18px); border-top: 1px solid var(--line); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 10px; }
.files .f { aspect-ratio: 1; border-radius: 12px; background: var(--card2) center/cover; display: grid; place-items: center; font-size: 26px; position: relative; overflow: hidden; }
.files .f span { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; background: rgba(0, 0, 0, .6); padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview { border-radius: var(--r); overflow: hidden; background: #000; display: grid; place-items: center; margin-top: 8px; }
.preview img, .preview video { width: 100%; max-height: 62dvh; object-fit: contain; display: block; }
.preview audio { width: 100%; margin: 14px; }
.plat { display: grid; gap: 10px; }
.plat .card h3 { display: flex; align-items: center; gap: 8px; }
.plat .cap { white-space: pre-wrap; background: var(--card2); border-radius: 12px; padding: 10px; margin: 10px 0; font-size: 14px; max-height: 180px; overflow: auto; }
.plat .acts { display: flex; gap: 8px; } .plat .acts > * { flex: 1; padding: 10px; font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; } .tags span { background: var(--card2); padding: 4px 10px; border-radius: 99px; font-size: 13px; }
.warnbox { border-color: var(--warn); background: rgba(255, 200, 87, .08); }
.warnbox li { margin: 4px 0; }
.dl { display: grid; gap: 8px; } .dl a { display: flex; justify-content: space-between; gap: 10px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; } .kv b { color: var(--muted); font-weight: 600; }
details summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 20px); transform: translateX(-50%) translateY(20px); background: #fff; color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.login { min-height: 90dvh; display: grid; align-content: center; gap: 4px; }
.login .logo { width: 64px; height: 64px; border-radius: 18px; font-size: 30px; margin-bottom: 12px; background: linear-gradient(135deg, var(--accent), var(--accent2)); display: grid; place-items: center; font-weight: 900; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.install { margin-top: 12px; font-size: 13px; }

/* ---------- Pemilih kualitas ---------- */
.qpick { display: grid; gap: 8px; }
.qopt { display: block; text-align: left; background: var(--card); border: 1px solid var(--line); padding: 10px 12px; }
.qopt small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 2px; }
.qopt.on { border-color: var(--accent); background: rgba(248, 88, 107, .12); }

/* ---------- Tampilan proses ---------- */
.proc { display: flex; gap: 16px; align-items: center; margin-top: 12px; background: linear-gradient(135deg, #1f1b2e, #2a1f3a); }
.ring { position: relative; width: 116px; height: 116px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: var(--card2); }
.ring .fg { stroke: url(#g) var(--accent); stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 0 400; transition: stroke-dasharray .8s ease; filter: drop-shadow(0 0 6px rgba(248, 88, 107, .5)); }
.ringtxt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ringtxt b { font-size: 26px; font-variant-numeric: tabular-nums; }
.ringtxt small { color: var(--muted); font-size: 11px; }
.procinfo { min-width: 0; }
.stages { margin-top: 10px; display: grid; gap: 2px; }
.stage { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 7px 0; font-size: 14px; color: var(--muted); }
.stage .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.stage.done { color: var(--text); } .stage.done .dot { background: var(--ok); border-color: var(--ok); color: #062; }
.stage.run { color: var(--text); font-weight: 650; } .stage.run .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.stage .sp { font-size: 12px; font-variant-numeric: tabular-nums; }
.stage .progress { grid-column: 2 / 4; margin-top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.filmstrip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.filmstrip .fr { flex: none; width: 96px; position: relative; scroll-snap-align: start; animation: pop .4s ease; }
.filmstrip img { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 10px; background: var(--card2); display: block; }
.filmstrip span { position: absolute; bottom: 4px; left: 4px; background: #000a; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
.dl a { animation: pop .4s ease; }

/* ---------- Saran musik ---------- */
.msug { padding: 10px 0; border-bottom: 1px solid var(--line); } .msug:last-of-type { border-bottom: 0; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.links .chip { text-decoration: none; color: var(--text); }
