:root {
  --bg: #0b0b10;
  --surface: #16161e;
  --surface-2: #1f1f2a;
  --line: #2a2a38;
  --text: #f4f4f7;
  --muted: #9a9aae;
  --accent: #ff3d6e;
  --accent-2: #ffb800;
  --good: #2bd98a;
  --warn: #ffb800;
  --bad: #ff5a5a;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
#app { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 96px); }

h1 { font-size: 30px; letter-spacing: -0.02em; margin: 8px 0 4px; }
h2 { font-size: 20px; margin: 22px 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.iconbtn {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  width: 44px; height: 44px; border-radius: 12px; font-size: 20px; display: grid; place-items: center;
}
.back { background: none; border: none; color: var(--accent); font-size: 17px; padding: 10px 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.tap:active { transform: scale(0.99); }

button.primary, a.primary {
  display: block; width: 100%; text-align: center; text-decoration: none;
  background: linear-gradient(135deg, var(--accent), #ff6a3d); color: #fff; border: 0;
  font-weight: 700; font-size: 17px; padding: 15px; border-radius: 14px;
}
button.primary:disabled { opacity: 0.5; }
button.secondary, a.secondary {
  display: inline-block; text-align: center; text-decoration: none;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  font-weight: 600; font-size: 15px; padding: 11px 14px; border-radius: 12px;
}
button.danger { background: none; color: var(--bad); border: 1px solid #4a2530; padding: 11px 14px; border-radius: 12px; font-size: 15px; }
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 16px);
  width: min(688px, calc(100% - 32px)); box-shadow: 0 10px 30px rgba(255, 61, 110, 0.35);
}

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input, textarea, select {
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; font-size: 16px; font-family: inherit;
}
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: auto; transform: scale(1.3); margin-right: 10px; }
.check { display: flex; align-items: center; color: var(--text); font-size: 15px; font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 label { margin-top: 10px; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px 16px; text-align: center;
  color: var(--muted); background: var(--surface);
}
.drop strong { color: var(--text); display: block; font-size: 17px; margin-bottom: 4px; }
.drop.has { border-style: solid; border-color: var(--accent); color: var(--text); }

.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .4s; }
.status { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.done { color: var(--good); }
.pill.error { color: var(--bad); }
.pill.running, .pill.queued { color: var(--warn); }

.clips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 600px) { .clips { grid-template-columns: repeat(3, 1fr); } }
.clip { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.clip img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; }
.clip .badge {
  position: absolute; top: 8px; left: 8px; font-weight: 800; font-size: 15px; padding: 4px 9px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px);
}
.clip .rank { position: absolute; top: 8px; right: 8px; font-size: 12px; color: #fff; background: rgba(0,0,0,.55); padding: 3px 7px; border-radius: 8px; }
.clip .meta { padding: 8px 10px 10px; font-size: 12px; color: var(--muted); }
.clip .meta b { color: var(--text); display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-hi { color: var(--good); } .s-mid { color: var(--warn); } .s-lo { color: var(--muted); }

.player video { width: 100%; max-height: 70dvh; aspect-ratio: 9 / 16; background: #000; border-radius: 14px; display: block; margin: 0 auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--muted); }
.copy { position: relative; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 15px; margin-top: 6px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 90px);
  background: #fff; color: #000; font-weight: 600; padding: 12px 18px; border-radius: 99px; z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); font-size: 15px; max-width: calc(100% - 32px); text-align: center;
}
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { font-size: 46px; }
.install { background: linear-gradient(135deg, #2a1830, #1b1b2a); border-color: #4a2a48; }
