@font-face {
  font-family: Figtree;
  src: url(/fonts/figtree-latin-ext-wght-normal.woff2) format('woff2');
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Figtree;
  src: url(/fonts/figtree-latin-wght-normal.woff2) format('woff2');
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #000;
  --panel: #121212;
  --card: #181818;
  --raise: #242424;
  --field: #2a2a2a;
  --line: #2a2a2a;
  --muted: #b3b3b3;
  --text: #fff;
  --green: #3be477;
  --green-hover: #5bee90;
  --danger: #ff8a8a;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Figtree, system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.boot { color: var(--muted); text-align: center; padding: 40vh 16px 0; margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; background: transparent; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #000; font-weight: 800; }
.btn-primary:hover { background: var(--green-hover); }
.btn-light { background: #fff; color: #000; font-weight: 800; }
.btn-light:hover { background: #e6e6e6; }
.btn-outline { border-color: #727272; }
.btn-outline:hover { border-color: #fff; }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: #ffb3b3; }
.btn-block { width: 100%; min-height: 52px; font-size: 16px; }
.icon-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.icon-btn.green { background: var(--green); }
.icon-btn.green:hover { background: var(--green-hover); }
.icon-btn.white { background: #fff; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 700; }
.input { width: 100%; height: 50px; padding: 0 14px; background: var(--panel); border: 1px solid #727272; border-radius: 6px; font-size: 16px; }
.input:hover { border-color: #a0a0a0; }
.input:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 1px #fff; }
.input-pill { height: 44px; padding: 0 16px; border-radius: 999px; background: var(--field); border-color: #4d4d4d; font-size: 14px; }
.input-code { height: 72px; text-align: center; letter-spacing: .45em; font-size: 30px; font-weight: 700; background: #1f1f1f; border-radius: 8px; }
.hint { font-size: 13px; font-weight: 500; color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 6px; background: #3b1215; color: #ffc2c2; font-size: 14px; font-weight: 600; }
.alert:empty { display: none; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 900; letter-spacing: -1px; text-decoration: none; }
.brand svg { flex: none; }
.brand .tv { color: var(--green); }
.brand-lg { align-self: center; gap: 12px; font-size: 34px; letter-spacing: -1.5px; }

/* Auth screens */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 480px; padding: 48px 56px; background: var(--panel); border-radius: 12px; display: flex; flex-direction: column; gap: 20px; }
.auth-card h1 { margin: 0; text-align: center; font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.auth-card .lead { margin: 0; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.6; }
.auth-foot { padding-top: 20px; border-top: 1px solid var(--line); text-align: center; font-size: 14px; color: var(--muted); }
.qr { align-self: center; width: 220px; height: 220px; padding: 10px; background: #fff; border-radius: 12px; }
.secret { padding: 12px; border-radius: 6px; background: #000; font-family: ui-monospace, Consolas, monospace; font-size: 14px; text-align: center; word-break: break-all; user-select: all; }
.steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.7; }
@media (max-width: 520px) { .auth-card { padding: 32px 22px; } }

/* Shell */
.shell { min-height: 100vh; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.shell-body { flex: 1; display: flex; gap: 8px; align-items: stretch; min-height: 0; }
.panel { background: var(--panel); border-radius: var(--radius); }
.sidebar { flex: 0 0 280px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.nav .brand { padding: 10px 14px 16px; }
.navlink { height: 48px; display: flex; align-items: center; gap: 16px; padding: 0 14px; border-radius: 6px; color: var(--muted); font-weight: 700; text-decoration: none; transition: color .15s; }
.navlink:hover { color: #fff; }
.navlink[aria-current='page'] { color: #fff; background: var(--raise); }
.navlink svg { flex: none; }
.side-panel { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.side-panel h2 { margin: 0 0 8px; font-size: 16px; }
.folder { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 4px 8px; border-radius: 6px; text-decoration: none; }
.folder:hover, .folder[aria-current='page'] { background: var(--raise); }
.folder-art { width: 48px; height: 48px; border-radius: 6px; flex: none; display: flex; align-items: center; justify-content: center; }
.folder b { display: block; font-weight: 600; }
.folder small { display: block; font-size: 13px; color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 20px 28px 32px; display: flex; flex-direction: column; gap: 24px; }
.main.flush { padding: 0; gap: 0; overflow: hidden; }
.pad { padding: 24px 28px 32px; display: flex; flex-direction: column; gap: 16px; }
.meta { margin: 0; font-size: 14px; color: var(--muted); }

@media (max-width: 860px) {
  .shell-body { flex-direction: column; }
  .sidebar { flex: none; }
  .nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav .brand { padding: 6px 10px; margin-right: auto; }
  .navlink { padding: 0 12px; gap: 8px; }
  .side-panel.hide-mobile { display: none; }
  .main { padding: 16px; }
  .pad { padding: 16px; }
}
@media (max-width: 480px) { .navlink span { display: none; } }

/* Placeholder colours for artwork */
.c0 { background: #3a4470; } .c1 { background: #2d6a5a; } .c2 { background: #b4623c; }
.c3 { background: #4b4e9a; } .c4 { background: #24528a; } .c5 { background: #6a3a5a; }

/* Progress bars */
progress.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 4px; border: 0; border-radius: 2px; background: #4d4d4d; overflow: hidden; }
progress.bar::-webkit-progress-bar { background: #4d4d4d; }
progress.bar::-webkit-progress-value { background: var(--green); }
progress.bar::-moz-progress-bar { background: var(--green); }
progress.bar.white::-webkit-progress-value { background: #fff; }
progress.bar.white::-moz-progress-bar { background: #fff; }
progress.bar.muted::-webkit-progress-value { background: var(--muted); }
progress.bar.muted::-moz-progress-bar { background: var(--muted); }
progress.bar.thick { height: 8px; border-radius: 4px; }

/* Home */
.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.search { width: 380px; max-width: 100%; height: 48px; padding: 0 22px; background: var(--raise); border: 1px solid transparent; border-radius: 999px; font-size: 15px; }
.search:hover { border-color: #4d4d4d; }
.search:focus { outline: none; border-color: #fff; }
h1.page { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.5px; overflow-wrap: anywhere; }
h2.section { margin: 8px 0 0; font-size: 24px; font-weight: 800; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.quick.spaced { margin-top: 24px; }
.quick a { height: 72px; display: flex; align-items: center; gap: 14px; padding-right: 12px; overflow: hidden; background: #2a2a2a; border-radius: 6px; font-weight: 700; text-decoration: none; transition: background .15s; }
.quick a:hover { background: #3a3a3a; }
.quick .art { width: 72px; height: 72px; flex: none; overflow: hidden; }
.quick .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quick .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--card); border-radius: 8px; text-decoration: none; transition: background .2s; }
.card:hover { background: #282828; }
.thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb progress.bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0; }
.play-fab { position: absolute; right: 8px; bottom: 12px; width: 48px; height: 48px; border-radius: 999px; background: var(--green); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.card:hover .play-fab, .card:focus-visible .play-fab { opacity: 1; transform: none; }
@media (hover: none) { .play-fab { opacity: 1; transform: none; } }
.card-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; color: var(--muted); }
.empty strong { color: #fff; font-size: 20px; }

/* Bottom player bar */
.playerbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; }
.pb-now { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 14px; text-decoration: none; }
.pb-now .art { width: 56px; height: 56px; flex: none; border-radius: 6px; overflow: hidden; }
.pb-now .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-now b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-now small { font-size: 12px; color: var(--muted); }
.pb-mid { flex: 2 1 360px; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.pb-mid progress { flex: 1; }
.pb-right { flex: 1 1 160px; text-align: right; font-size: 13px; color: var(--muted); }
@media (max-width: 600px) { .pb-right { display: none; } }

/* Watch */
.watch-main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.video-wrap { position: relative; background: #000; }
.video-wrap video { display: block; width: 100%; max-height: 78vh; background: #000; }
.back { position: absolute; top: 16px; left: 16px; z-index: 2; width: 44px; height: 44px; border-radius: 999px; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; }
.back:hover { background: rgba(0, 0, 0, .9); }
.watch-info { padding: 24px 28px 32px; display: flex; flex-direction: column; gap: 18px; }
.watch-info h1 { margin: 0; font-size: clamp(28px, 4vw, 48px); font-weight: 800; letter-spacing: -1.5px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.note { padding: 12px 14px; border-radius: 8px; background: #2a2414; color: #ffd58a; font-size: 14px; line-height: 1.5; }
.upnext { flex: 1 1 300px; padding: 20px; display: flex; flex-direction: column; gap: 6px; align-self: stretch; }
.upnext h2 { margin: 0 0 8px; font-size: 18px; }
.upnext a { display: flex; align-items: center; gap: 14px; padding: 8px; border-radius: 6px; text-decoration: none; }
.upnext a:hover { background: var(--raise); }
.upnext .mini { width: 96px; height: 60px; border-radius: 6px; overflow: hidden; flex: none; }
.upnext .mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upnext b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upnext small { font-size: 13px; color: var(--muted); }
.upnext .txt { min-width: 0; }

/* Downloads */
.dl-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; padding: 40px 28px 28px; background: #1e4d36; }
.dl-art { width: 140px; height: 140px; flex: none; border-radius: 8px; background: var(--green); display: flex; align-items: center; justify-content: center; box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.dl-head h1 { margin: 0; font-size: clamp(36px, 6vw, 56px); font-weight: 800; letter-spacing: -2px; line-height: 1.05; overflow-wrap: anywhere; }
.dl-head p { margin: 8px 0 0; font-size: 14px; color: #e5f5ec; }
.adders { display: flex; flex-wrap: wrap; gap: 10px; }
.adder { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--card); border-radius: 8px; }
.adder h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.adder .row { display: flex; gap: 8px; }
.adder .row .input { flex: 1; min-width: 0; }
.drop { position: relative; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 16px; background: #1f1f1f; border: 1px dashed #5a5a5a; border-radius: 999px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover { border-color: #8a8a8a; }
.drop.over { border-color: var(--green); background: rgba(59, 228, 119, .08); }
.drop:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.drop-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
.chip { flex: none; height: 34px; display: flex; align-items: center; padding: 0 16px; border-radius: 999px; background: #fff; color: #000; font-size: 13px; font-weight: 800; }
.banner { padding: 12px 16px; border-radius: 8px; background: #2a2414; color: #ffd58a; font-size: 14px; font-weight: 600; }
.banner:empty { display: none; }
.tlist { display: flex; flex-direction: column; }
.trow { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 6px; }
.trow:hover { background: #1f1f1f; }
.tnum { width: 24px; text-align: center; color: var(--muted); }
.tinfo { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow.active .tname, .trow.active .tnum { color: var(--green); }
.tstatus { font-size: 13px; color: var(--muted); }
.tstatus.ok { color: var(--green); }
.tstatus.err { color: var(--danger); }
.tactions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stats { padding: 24px; display: flex; flex-direction: column; gap: 22px; }
.stat span { display: block; font-size: 13px; color: var(--muted); }
.stat strong { font-size: 26px; font-weight: 800; }

/* Settings */
.settings { max-width: 820px; display: flex; flex-direction: column; gap: 28px; }
.box { padding: 24px; background: var(--card); border-radius: 8px; display: flex; flex-direction: column; gap: 14px; }
.box-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.settings h2 { margin: 0; font-size: 18px; }
.big { font-size: 28px; font-weight: 800; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; color: var(--muted); }
.line input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--green); flex: none; }
.num { width: 110px; height: 44px; }
.sep { padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.okline { color: var(--green); font-weight: 700; }

/* Dialog & toast */
dialog { width: 100%; max-width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; background: transparent; color: inherit; }
dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dlg { padding: 28px; display: flex; flex-direction: column; gap: 16px; background: #242424; border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
.dlg h2 { margin: 0; font-size: 22px; font-weight: 800; }
.dlg p { margin: 0; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.dlg .input { background: #1a1a1a; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--green); flex: none; }
#toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: 999px; background: #fff; color: #000; font-weight: 700; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
