:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --panel-2: #1d2027;
  --line: #2a2e37;
  --text: #ecedf0;
  --muted: #9097a3;
  --accent: #ff8a3d;
  --accent-2: #2ec5c9;
  --danger: #ff5d5d;
  --radius: 14px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255,138,61,.12), transparent 60%),
    radial-gradient(800px 500px at -10% 10%, rgba(46,197,201,.10), transparent 60%),
    var(--bg);
  display: flex; flex-direction: column; align-items: center;
}
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

.top {
  width: min(960px, 100% - 32px); padding: 28px 0 18px;
  display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: conic-gradient(from 210deg, var(--accent-2), #3b6cff, #b14bff, var(--accent), #ffd166, var(--accent-2));
  box-shadow: 0 6px 24px rgba(255,138,61,.25), inset 0 0 0 10px rgba(14,15,18,.55);
}
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li {
  counter-increment: s; font-size: 12.5px; color: var(--muted);
  padding: 6px 10px 6px 8px; border: 1px solid var(--line); border-radius: 999px;
  display: flex; align-items: center; gap: 6px; background: var(--panel);
}
.steps li::before {
  content: counter(s); width: 18px; height: 18px; border-radius: 50%; font-size: 11px;
  display: grid; place-items: center; background: var(--panel-2); color: var(--muted);
}
.steps li.active { color: var(--text); border-color: var(--accent); }
.steps li.active::before { background: var(--accent); color: #1a0d03; }
.steps li.done { color: var(--text); }
.steps li.done::before { content: "✓"; background: var(--accent-2); color: #021617; }

main { width: min(960px, 100% - 32px); flex: 1; }
.card {
  background: linear-gradient(180deg, var(--panel), #14161a);
  border: 1px solid var(--line); border-radius: 20px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

/* Dropzone */
.drop {
  display: block; border: 1.5px dashed #3a3f4a; border-radius: var(--radius);
  background: rgba(255,255,255,.015); cursor: pointer; transition: .2s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(255,138,61,.05); }
.drop-inner { padding: 38px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.drop-inner span { color: var(--muted); font-size: 13.5px; }
.drop-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 6px;
}
.drop-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.file-picked { flex-direction: row; justify-content: space-between; align-items: center; text-align: left; padding: 14px 16px; gap: 16px; }
.file-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13.5px; text-align: left; flex: none; }

/* Options */
.options { margin-top: 22px; }
.opt-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 12.5px; }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.look {
  text-align: left; cursor: pointer; padding: 0; overflow: hidden; color: var(--text);
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel-2); font: inherit; transition: .15s;
}
.look:hover { border-color: #4a505c; transform: translateY(-1px); }
.look.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,138,61,.18); }
.look .sw { height: 46px; }
.look .tx { padding: 8px 10px 10px; }
.look b { font-size: 13.5px; display: block; }
.look small { color: var(--muted); font-size: 11.5px; line-height: 1.35; display: block; margin-top: 2px; }
.sw-segar     { background: linear-gradient(90deg, #0f2a17, #2f6b25, #8fbf3a, #f2f0e2); }
.sw-hangat    { background: linear-gradient(90deg, #3d2410, #a8642c, #f0b46a, #ffe6b8); }
.sw-natural   { background: linear-gradient(90deg, #2a3a2f, #7f8f6a, #d7cdb3, #f4efe6); }
.sw-cinematic { background: linear-gradient(90deg, #0d3a44, #1f6f78, #c98a5a, #ffcf9a); }
.sw-warm      { background: linear-gradient(90deg, #3d2410, #a8642c, #f0b46a, #ffe6b8); }
.sw-cool      { background: linear-gradient(90deg, #0f1f33, #2d5a85, #9bc3e6, #e8f3ff); }
.sw-moody     { background: linear-gradient(90deg, #1f2428, #3c4650, #6d6a63, #a59e90); }
.sw-vibrant   { background: linear-gradient(90deg, #ff2e63, #ffb400, #00d27a, #00a3ff); }
.sw-film      { background: linear-gradient(90deg, #3a3a2e, #7c7356, #c9b78f, #efe3c5); }
.sw-bw        { background: linear-gradient(90deg, #050505, #4a4a4a, #a8a8a8, #fafafa); }

.row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin: 20px 0; }
.slider { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.slider span { display: flex; justify-content: space-between; }
.slider output { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.toggle input { display: none; }
.track { width: 40px; height: 22px; border-radius: 999px; background: #3a3f4a; position: relative; transition: .2s; }
.thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle input:checked + .track { background: var(--accent-2); }
.toggle input:checked + .track .thumb { left: 21px; }

/* Buttons */
.primary, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; border-radius: 12px; padding: 13px 22px;
  cursor: pointer; text-decoration: none; transition: .15s; border: 1px solid transparent;
}
.primary { background: linear-gradient(135deg, #ffa25f, var(--accent)); color: #1d0e02; width: 100%; }
.primary:hover:not(:disabled) { filter: brightness(1.07); }
.primary:disabled { opacity: .4; cursor: not-allowed; }
.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.ghost:hover { border-color: #4a505c; background: var(--panel-2); }

/* Job */
.job-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.job-head p { margin: 6px 0 0; font-size: 14px; }
.pct { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin: 14px 0 18px; }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s; }
.error { background: rgba(255,93,93,.1); border: 1px solid rgba(255,93,93,.4); color: #ffb3b3; padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }

.compare { margin: 0 auto; position: relative; border-radius: var(--radius); overflow: hidden; background: #000; user-select: none; touch-action: none; cursor: ew-resize; }
.compare canvas { display: block; width: 100%; height: auto; pointer-events: none; }
.handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; transform: translateX(-1px); }
.handle span {
  position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; border-radius: 50%;
  transform: translate(-50%, -50%); background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.handle span::before { content: "⟷"; color: #111; font-size: 17px; display: grid; place-items: center; height: 100%; }
.tag { position: absolute; top: 12px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.tag.left { left: 12px; } .tag.right { right: 12px; }

.result { margin-top: 20px; }
.result video { width: 100%; border-radius: var(--radius); background: #000; max-height: 60vh; }
.result-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.result-actions .ghost { flex: 1 1 auto; }
.result-actions .primary { flex: 1 1 100%; }
.job-actions { margin-top: 16px; display: flex; justify-content: flex-end; }

.details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat small { color: var(--muted); font-size: 11.5px; display: block; }
.stat b { font-size: 15px; font-variant-numeric: tabular-nums; }

footer { color: var(--muted); font-size: 12px; padding: 24px 16px; text-align: center; }

.compare-wrap { margin-top: 18px; }
.analyzing { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 14px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#pick-error { margin: 16px 0 0; }
#unsupported { margin-bottom: 16px; }
.note { background: rgba(46,197,201,.08); border: 1px solid rgba(46,197,201,.35); color: #bfeff0; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.details { margin: 0 0 18px; }

@media (max-width: 600px) {
  .card { padding: 16px; }
  .steps li { font-size: 11.5px; padding: 5px 8px 5px 6px; }
}

/* Pemutar preview */
/* Video asli ada di bawah canvas (tetap "terlihat" agar browser HP tidak menurunkan fps-nya). */
.pv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; background: #000; }
.compare canvas { position: relative; z-index: 1; }
.compare .handle, .compare .tag, .compare .fps { z-index: 2; }
.player { display: flex; align-items: center; gap: 12px; margin: 12px auto 0; max-width: 100%; }
.play {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: linear-gradient(135deg, #ffa25f, var(--accent)); color: #1d0e02;
}
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.player input[type=range] { flex: 1; min-width: 0; }
.time { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fps { position: absolute; left: 12px; bottom: 12px; font: 600 11.5px ui-monospace, Menlo, monospace; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,.7); color: #7CFFB2; }

/* Pilihan resolusi */
.res-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -4px 0 20px; font-size: 14px; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.seg input:checked + span { background: var(--accent); color: #1d0e02; font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.file-meta { color: var(--accent-2) !important; font-size: 12.5px !important; font-variant-numeric: tabular-nums; }
#pick-note { margin: 16px 0 0; }

/* Label versi & opsi pemutar */
.ver { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font: 600 11px ui-monospace, Menlo, monospace; letter-spacing: 0; }
.player-opts { display: flex; justify-content: flex-end; margin-top: 10px; }
.small-toggle { font-size: 13px; color: var(--muted); gap: 8px; }
.small-toggle .track { width: 34px; height: 20px; }
.small-toggle .thumb { width: 14px; height: 14px; }
.small-toggle input:checked + .track .thumb { left: 17px; }

/* Panduan iPhone */
#pick-note p { margin: 0 0 8px; }
#pick-note ol { margin: 0 0 12px; padding-left: 20px; line-height: 1.55; }
.small-btn { padding: 9px 14px; font-size: 13.5px; }

/* PWA: safe area (status bar iPhone saat dibuka dari layar utama) */
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* Tombol install */
.install-btn {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; color: #1d0e02; border: 0;
  background: linear-gradient(135deg, #ffa25f, var(--accent));
}
.install-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Panduan install iOS */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.sheet { width: min(480px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.sheet h2 { margin-bottom: 12px; }
.sheet ol { margin: 0 0 18px; padding-left: 20px; line-height: 1.6; font-size: 14.5px; }
.sheet li { margin-bottom: 6px; }
.share-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; vertical-align: middle; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
.share-ico svg { width: 15px; height: 15px; fill: none; stroke: #4da3ff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#btn-share svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Header actions & pilihan iOS */
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tips-btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
}
.tips-btn svg, .ios-pick svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ios-pick { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ios-pick .primary small { font-weight: 500; opacity: .75; font-size: 12.5px; }
.ios-pick-help { align-self: center; margin-top: 2px; }
.sheet.tips { max-height: calc(100vh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet.tips h3 { font-size: 15px; margin: 16px 0 6px; }
.sheet.tips p { margin: 0 0 6px; font-size: 14px; line-height: 1.55; color: #c9ccd3; }
.sheet.tips ol { margin-bottom: 6px; font-size: 14px; color: #c9ccd3; }
.sheet.tips .primary { margin-top: 16px; }
.inline-link { font-size: inherit; text-decoration: underline; }

/* Tarik ke bawah untuk memuat ulang (mode aplikasi) */
.ptr {
  position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; z-index: 60;
  transform: translate(-50%, -60px); opacity: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.ptr.anim { transition: transform .25s ease, opacity .25s ease; }
.ptr-ball {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.45);
}
.ptr-ball svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.ptr.ready .ptr-ball { border-color: var(--accent); }
.ptr.ready .ptr-ball svg { stroke: var(--accent); }
.ptr.loading .ptr-ball svg { display: none; }
.ptr.loading .ptr-ball::after { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2.4px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.ptr-label { font-size: 12px; color: var(--muted); background: rgba(14,15,18,.85); padding: 3px 10px; border-radius: 999px; }
@media (display-mode: standalone) { html, body { overscroll-behavior-y: contain; } }
.ptr-pulling .top, .ptr-pulling main, .ptr-pulling footer { transform: translateY(var(--ptr, 0)); }
.ptr-anim .top, .ptr-anim main, .ptr-anim footer { transition: transform .25s ease; }
.top-actions:not(:has(> :not([hidden]))) { display: none; } /* sembunyikan wadah bila semua tombol tersembunyi */
