:root {
  --bg: #f6f4f1; --card: #ffffff; --ink: #1c1a18; --muted: #77716a; --line: #e6e1da;
  --accent: #e8590c; --accent-ink: #ffffff; --good: #2f9e44; --bad: #e03131; --warn: #f08c00;
  --chip: #f1ede7; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  --r: 14px; --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141312; --card: #1e1c1a; --ink: #f2efea; --muted: #a39d95; --line: #2f2c29;
    --accent: #ff7a33; --chip: #2a2724; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(var(--tab-h) + env(safe-area-inset-bottom)) 0;
  overscroll-behavior-y: none; -webkit-text-size-adjust: 100%;
}
main { max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; }
h1 { font-size: 24px; margin: 8px 0 12px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 18px 0 8px; }
a { color: var(--accent); }
.center { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
.seg button { white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; background: var(--chip); font-size: 12.5px; font-weight: 600; }
.chip.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.chip.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chip.accent { background: var(--accent); color: var(--accent-ink); }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 650;
  padding: 10px 14px; border-radius: 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; justify-content: center;
  text-decoration: none; min-height: 42px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.bad { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 13.5px; }
.btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:disabled { opacity: .5; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--muted); border-top-color: transparent; animation: spin .7s linear infinite; }
.btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
label.field, .field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13.5px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
.hint { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.clip { padding: 0; overflow: hidden; }
.clip .media { display: grid; grid-template-columns: 132px 1fr; gap: 12px; padding: 12px; }
.clip video, .clip .poster { width: 132px; aspect-ratio: 9/16; border-radius: 10px; background: #000; object-fit: cover; display: block; }
.clip .poster { border: 0; padding: 0; cursor: pointer; position: relative; }
.clip .poster img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.clip .poster span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.clip .hook { font-weight: 800; font-size: 16px; line-height: 1.25; }
.clip .score { font-weight: 800; font-size: 22px; color: var(--accent); }
.clip .actions { display: grid; grid-template-columns: 1fr 1fr 1fr; border-top: 1px solid var(--line); }
.clip .actions button { border: 0; border-radius: 0; min-height: 48px; background: transparent; }
.clip .actions button + button { border-left: 1px solid var(--line); }
.progress { height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .4s; }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.empty b { display: block; font-size: 40px; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.log { font-size: 12.5px; max-height: 320px; overflow: auto; }
.log div { padding: 5px 0; border-bottom: 1px solid var(--line); }
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); z-index: 10;
}
#tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 650; position: relative; }
#tabs a b { font-size: 21px; line-height: 1; }
#tabs a.on { color: var(--accent); }
#tabs a i { position: absolute; top: 6px; left: calc(50% + 8px); background: var(--accent); color: #fff; font-style: normal; font-size: 10.5px; font-weight: 800; border-radius: 99px; padding: 0 5px; min-width: 17px; text-align: center; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
dialog.sheet { border: 0; padding: 0; width: 100%; max-width: 720px; max-height: 92vh; margin: auto auto 0; border-radius: 18px 18px 0 0; background: var(--card); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(0,0,0,.45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.sheet-head h2 { margin: 0; }
.sheet-body { padding: 6px 16px calc(20px + env(safe-area-inset-bottom)); }
.big-video { width: 100%; max-height: 62vh; aspect-ratio: 9/16; background: #000; border-radius: 12px; display: block; margin: 0 auto 12px; object-fit: contain; }
pre.caption { white-space: pre-wrap; font: inherit; font-size: 13.5px; background: var(--chip); border-radius: 10px; padding: 10px; margin: 6px 0; }
.login { max-width: 360px; margin: 10vh auto 0; }
.logo { font-size: 46px; text-align: center; }
