:root {
  --bg: #14110f; --bg2: #1d1916; --card: #241f1b; --line: #3a322b;
  --text: #f5efe8; --muted: #b3a89c; --faint: #7d7368;
  --accent: #ffb020; --accent-ink: #1a1206; --laugh: #ffb020; --mark: #ff5d73; --wave: #6f655b;
  --good: #57d68d; --bad: #ff6b6b;
  --r: 14px;
  --fd: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --fb: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fm: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fbf8f4; --bg2: #f3ede6; --card: #ffffff; --line: #e6ddd2;
    --text: #1d1813; --muted: #6b6157; --faint: #9a8f84;
    --accent: #e8930c; --accent-ink: #ffffff; --laugh: #f0a01a; --mark: #e23d56; --wave: #c9beb2;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #fbf8f4; --bg2: #f3ede6; --card: #ffffff; --line: #e6ddd2;
  --text: #1d1813; --muted: #6b6157; --faint: #9a8f84;
  --accent: #e8930c; --accent-ink: #ffffff; --laugh: #f0a01a; --mark: #e23d56; --wave: #c9beb2;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--fb); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
.wrap { max-width: 860px; margin: 0 auto; padding: 12px 16px calc(28px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--fd); font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.logo { width: 26px; height: 26px; fill: var(--accent); }
.chip { border: 1px solid var(--line); background: var(--bg2); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.intro h1 { font-family: var(--fd); font-weight: 800; font-size: clamp(30px, 8vw, 52px); line-height: 1.04; letter-spacing: -.02em; margin: 26px 0 12px; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.5; margin: 0 0 22px; max-width: 36em; }
.pick { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .pick { grid-template-columns: 2fr 1fr; } }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--r); padding: 26px 16px; background: var(--bg2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop svg { width: 30px; height: 30px; color: var(--accent); }
.drop b { font-size: 17px; }
.drop small { color: var(--muted); }
.rec { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); background: var(--card); border-radius: var(--r); padding: 18px; font-weight: 700; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mark); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mark) 25%, transparent); }
.recpanel { margin-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.rectime { font-family: var(--fm); font-size: 22px; font-weight: 700; color: var(--mark); min-width: 70px; }
#recLevel { flex: 1; min-width: 120px; height: 36px; }
.opt { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 6px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.opt input, .small-opt input { accent-color: var(--accent); margin-top: 2px; }
.privacy { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.privacy svg { width: 18px; height: 18px; color: var(--good); flex: none; }

.progress { margin: 28px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.ptitle { font-weight: 700; margin-bottom: 10px; }
.bar { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.psub { color: var(--muted); font-size: 13px; margin-top: 8px; }
.error { margin: 16px 0; padding: 14px; border-radius: var(--r); background: color-mix(in srgb, var(--bad) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); line-height: 1.45; }

.setline { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.setname { flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px dashed var(--line); font-family: var(--fd); font-weight: 600; font-size: 20px; padding: 4px 0; outline: none; }
.setname:focus { border-bottom-color: var(--accent); }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); padding: 4px 8px; border-radius: 99px; white-space: nowrap; }

.player { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.player video { width: 100%; max-height: 300px; border-radius: 10px; background: #000; display: none; margin-bottom: 8px; }
.player.showv video { display: block; }
.controls { display: flex; align-items: center; gap: 8px; }
.icon { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); font-family: var(--fm); font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: none; }
.icon.play { width: 48px; height: 48px; background: var(--text); color: var(--bg); border: 0; }
.icon.play svg { width: 22px; height: 22px; fill: currentColor; }
.time { font-family: var(--fm); font-size: 13px; color: var(--muted); flex: 1; text-align: center; white-space: nowrap; }
.joke { background: var(--mark); color: #fff; border: 0; border-radius: 999px; padding: 0 22px; height: 48px; font-family: var(--fd); font-weight: 800; font-size: 16px; flex: none; touch-action: manipulation; }
.joke:active { transform: scale(.96); }
.small-opt { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-top: 8px; }

.tlhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0 6px; flex-wrap: wrap; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.lg { width: 12px; height: 8px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.lg.wave { background: var(--wave); margin-left: 0; } .lg.laugh { background: var(--laugh); } .lg.mark { background: var(--mark); width: 3px; height: 12px; }
.zoom { display: flex; gap: 6px; }
.zoom .chip { padding: 4px 10px; }
.tlscroll { overflow-x: auto; overflow-y: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); -webkit-overflow-scrolling: touch; }
#timeline { display: block; height: 190px; touch-action: pan-x; cursor: pointer; }
.tlhint { margin-top: 2px; }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0 8px; }
.cards .card:last-child:nth-child(odd) { grid-column: span 2; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } .cards .card:last-child:nth-child(odd) { grid-column: auto; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
.card .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.card .v { font-family: var(--fd); font-weight: 800; font-size: 28px; margin-top: 6px; letter-spacing: -.02em; }
.card .s { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.wide { grid-column: span 2; }

.sectionhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.sectionhead h2 { font-family: var(--fd); font-weight: 600; font-size: 20px; margin: 0; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 8px; line-height: 1.45; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; cursor: pointer; user-select: none; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--fm); font-size: 13px; }
td.t { font-family: var(--fm); font-size: 13px; color: var(--accent); cursor: pointer; }
td.name { width: 100%; min-width: 120px; }
td.name input { width: 100%; background: transparent; border: 0; border-bottom: 1px dashed transparent; padding: 2px 0; outline: none; }
td.name input:focus { border-bottom-color: var(--accent); }
.sc { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.sc b { font-family: var(--fm); width: 28px; text-align: right; }
.sc i { flex: 1; height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; display: block; }
.sc i s { display: block; height: 100%; background: var(--laugh); text-decoration: none; }
.tier { font-size: 11px; color: var(--muted); }
.del { border: 0; background: transparent; color: var(--faint); font-size: 18px; line-height: 1; padding: 2px 6px; }
.del:hover { color: var(--bad); }
.rank { color: var(--faint); font-family: var(--fm); font-size: 12px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 14px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.compare { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 8px 0 18px; }
.compare h3 { font-family: var(--fd); font-weight: 600; font-size: 17px; margin: 0 0 10px; }
.compare canvas { width: 100%; height: 120px; display: block; margin: 8px 0; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.cmpkey { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.cmpkey i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

.how { margin: 18px 0; background: var(--bg2); border-radius: var(--r); padding: 12px 14px; }
.how summary { font-weight: 700; cursor: pointer; }
.how p, .how li { color: var(--muted); font-size: 14px; line-height: 1.55; }
.foot { color: var(--faint); font-size: 12px; text-align: center; margin-top: 26px; line-height: 1.5; }
