:root {
  --bg: #0b0c10; --bg2: #14161c; --bg3: #1d2029; --line: #2a2e3a;
  --fg: #f2f3f5; --mut: #8b90a0; --acc: #ff7a1a; --acc2: #ffb36b; --ok: #3ddc84; --bad: #ff5468;
  --r: 14px; --tabh: 62px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
body { min-height: 100dvh; padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom)); }
body.has-player { padding-bottom: calc(var(--tabh) + 140px + env(safe-area-inset-bottom)); }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--mut); } .small { font-size: 13px; } .err { color: var(--bad); }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px; background: rgba(11,12,16,.85); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.top h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--bg3); color: var(--mut); }
.pill.ok { color: var(--ok); background: rgba(61,220,132,.12); }
.pill.off { color: var(--acc2); background: rgba(255,122,26,.12); }

main { padding: 6px 16px 16px; }
.tab { display: none; } .tab.active { display: block; animation: in .18s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }

.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 14px; display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; } .card .row { margin: 0; }
input[type=url], input[type=search], input[type=password], select {
  flex: 1; min-width: 0; width: 100%; background: var(--bg3); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; outline: none; -webkit-appearance: none; appearance: none; }
input:focus, select:focus { border-color: var(--acc); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--mut) 50%), linear-gradient(135deg, var(--mut) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

button { border: 0; background: none; cursor: pointer; }
.primary { background: var(--acc); color: #111; font-weight: 700; border-radius: 12px; padding: 13px; }
.primary:disabled { opacity: .5; }
.ghost { background: var(--bg3); border-radius: 10px; padding: 10px 12px; font-weight: 600; white-space: nowrap; }
.ghost.small { padding: 7px 11px; font-size: 14px; color: var(--acc2); }
.link { color: var(--acc2); font-size: 14px; }
.danger { background: rgba(255,84,104,.12); color: var(--bad); border-radius: 12px; padding: 13px; font-weight: 600; }
.wide { width: 100%; margin-top: 8px; }
.icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--mut); flex: none; font-size: 17px; }
.icon:active { background: var(--bg3); }

.seg { display: flex; background: var(--bg3); border-radius: 11px; padding: 3px; margin-bottom: 12px; } .card .seg { margin: 0; }
.seg button { flex: 1; padding: 8px; border-radius: 9px; color: var(--mut); font-weight: 600; font-size: 14px; }
.seg button.on { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.check { display: flex; gap: 8px; align-items: center; color: var(--mut); white-space: nowrap; font-size: 15px; }
.check input { accent-color: var(--acc); width: 18px; height: 18px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 2px 8px; }
.section-head h2 { margin: 0; font-size: 20px; }

.list { list-style: none; margin: 0; padding: 0; }
.item, .job { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.thumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #2a2e3a, #1b1d25); padding: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .kind { position: absolute; right: 4px; bottom: 3px; font-size: 11px; background: rgba(0,0,0,.6); border-radius: 6px; padding: 1px 5px; }
.meta { flex: 1; min-width: 0; cursor: pointer; }
.title { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sub { color: var(--mut); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 4px; background: var(--bg3); border-radius: 4px; margin-top: 7px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--acc); transition: width .3s; }
.job.error .sub { color: var(--bad); } .job.done .sub { color: var(--ok); }
.empty { text-align: center; color: var(--mut); padding: 40px 10px; }

.toggle { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.toggle input { -webkit-appearance: none; appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--bg3); position: relative; transition: .2s; flex: none; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle input:checked { background: var(--ok); } .toggle input:checked::after { left: 23px; }
.kv { display: flex; justify-content: space-between; } .kv span { color: var(--mut); }

.tabs { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: flex; height: calc(var(--tabh) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: rgba(16,17,22,.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--mut); font-size: 11px; position: relative; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--acc); }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--acc); color: #111; font: 700 11px/17px system-ui; font-style: normal; min-width: 17px; border-radius: 9px; padding: 0 4px; }

.player { position: fixed; z-index: 9; left: 8px; right: 8px; bottom: calc(var(--tabh) + env(safe-area-inset-bottom) + 8px);
  background: rgba(29,32,41,.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line); border-radius: 16px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.player audio { width: 100%; height: 40px; }
.player video { width: 100%; max-height: 30vh; border-radius: 10px; background: #000; display: block; }
.player-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.player-bar img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.player-meta { flex: 1; min-width: 0; } .player-meta .title { -webkit-line-clamp: 1; font-size: 14px; }
.player:not(.video) #player-expand { display: none; }
.player.full { top: calc(env(safe-area-inset-top) + 8px); display: flex; flex-direction: column; justify-content: center; }
.player.full video { max-height: none; flex: 1; object-fit: contain; }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.login { width: min(360px, 100%); text-align: center; justify-items: center; padding: 26px; }
.login h2 { margin: 0; } .login input, .login button { width: 100%; }

#toast { position: fixed; z-index: 30; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translate(-50%, -120%); opacity: 0; transition: .25s;
  background: var(--bg3); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; max-width: 90vw; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
#toast.show { transform: translate(-50%, 0); opacity: 1; } #toast.bad { border-color: var(--bad); color: #ffb3bd; }
