/* UHF web console — GitHub (Primer) inspired styling */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-inset: #f6f8fa;
  --bg-overlay: #ffffff;
  --fg: #1f2328;
  --fg-muted: #656d76;
  --fg-subtle: #6e7781;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --accent: #ff3800;
  --accent-hover: #e63200;
  --accent-fg: #ffffff;
  --accent-subtle: rgba(255, 56, 0, 0.12);
  --success: #1a7f37;
  --success-subtle: #dafbe1;
  --danger: #cf222e;
  --danger-subtle: #ffebe9;
  --attention: #9a6700;
  --attention-subtle: #fff8c5;
  --done: #8250df;
  --done-subtle: #fbefff;
  --header-bg: #24292f;
  --header-fg: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.7);
  --shadow: 0 1px 0 rgba(31, 35, 40, 0.04);
  --shadow-md: 0 3px 6px rgba(140, 149, 159, 0.15);
  --shadow-lg: 0 8px 24px rgba(140, 149, 159, 0.2);
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --bg-subtle: #161b22;
    --bg-inset: #010409;
    --bg-overlay: #161b22;
    --fg: #e6edf3;
    --fg-muted: #8d96a0;
    --fg-subtle: #6e7681;
    --border: #30363d;
    --border-muted: #21262d;
    --accent: #ff3800;
    --accent-hover: #ff5a2b;
    --accent-fg: #ffffff;
    --accent-subtle: rgba(255, 56, 0, 0.18);
    --success: #3fb950;
    --success-subtle: rgba(46, 160, 67, 0.15);
    --danger: #f85149;
    --danger-subtle: rgba(248, 81, 73, 0.15);
    --attention: #d29922;
    --attention-subtle: rgba(187, 128, 9, 0.15);
    --done: #a371f7;
    --done-subtle: rgba(163, 113, 247, 0.15);
    --header-bg: #161b22;
    --header-fg: #e6edf3;
    --header-muted: #8d96a0;
    --shadow: 0 0 transparent;
    --shadow-md: 0 3px 6px #010409;
    --shadow-lg: 0 8px 24px #010409;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }

main.container { flex: 1; padding-top: 24px; padding-bottom: 48px; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }

code, .mono { font-family: var(--mono); font-size: 12px; }

.text-muted { color: var(--fg-muted); }
.text-small { font-size: 12px; }
.text-danger { color: var(--danger); }
.text-bold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* Header ------------------------------------------------------------------ */

.Header {
  background: var(--header-bg);
  color: var(--header-fg);
  border-bottom: 1px solid var(--border-muted);
}

.Header-inner { display: flex; align-items: center; gap: 16px; height: 62px; }

.Header-brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--header-fg); font-weight: 700; font-size: 16px;
}
.Header-brand:hover { text-decoration: none; }

.Header-wordmark { height: 18px; width: auto; display: block; color: var(--header-fg); }
.Header-brand:hover .Header-wordmark { opacity: 0.85; }

.Header-nav { display: flex; gap: 4px; margin-left: 8px; }
.Header.is-signed-out .Header-nav { display: none; }
.Header-nav a {
  color: var(--header-fg); padding: 6px 10px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
}
.Header-nav a:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.Header-nav a.is-active { background: rgba(255, 255, 255, 0.12); }

.Header-spacer { flex: 1; }

.Header-user { display: flex; align-items: center; gap: 10px; color: var(--header-muted); font-size: 12px; }
.Header-backup {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent; color: var(--header-muted); cursor: pointer; font: inherit;
}
.Header-backup:hover { color: var(--header-fg); background: rgba(255, 255, 255, 0.08); }
.Header-backup .icon { width: 14px; height: 14px; }
.Header-user .btn { color: var(--header-fg); border-color: rgba(255, 255, 255, 0.2); background: transparent; }
.Header-user .btn:hover { background: rgba(255, 255, 255, 0.08); }

@media (max-width: 720px) {
  .Header-nav { display: none; }
  .Header-backup .mono { display: none; }
}

/* Mobile nav (tabs under header on small screens) */
.MobileNav { display: none; border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
.MobileNav-inner { display: flex; gap: 4px; overflow-x: auto; padding: 6px 24px; }
.MobileNav a { padding: 6px 10px; border-radius: var(--radius); color: var(--fg); font-weight: 600; white-space: nowrap; }
.MobileNav a.is-active { background: var(--accent-subtle); color: var(--accent); }
@media (max-width: 720px) { .MobileNav { display: block; } }

/* Footer ------------------------------------------------------------------ */

.Footer {
  color: var(--fg-muted); font-size: 12px; line-height: 1.6; padding: 24px;
  border-top: 1px solid var(--border-muted); max-width: 1080px;
}
.Footer p { margin: 0 0 8px; }
.Footer p:last-child { margin-bottom: 0; }

/* Page header ------------------------------------------------------------- */

.PageHeader { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.PageHeader-title { flex: 1; min-width: 0; }
.PageHeader-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.PageHeader .Breadcrumb { margin-bottom: 4px; }

.Breadcrumb { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.Breadcrumb a { color: var(--accent); }
.Breadcrumb .sep { color: var(--fg-subtle); }
.Breadcrumb .current { font-weight: 600; color: var(--fg); }

/* Boxes ------------------------------------------------------------------- */

.Box {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px;
}
/* No overflow clipping (dropdown menus must escape the box); round the edge children instead. */
.Box > :first-child { border-top-left-radius: calc(var(--radius) - 1px); border-top-right-radius: calc(var(--radius) - 1px); }
.Box > :last-child { border-bottom-left-radius: calc(var(--radius) - 1px); border-bottom-right-radius: calc(var(--radius) - 1px); }
.Toolbar + .Box > :first-child { border-top-left-radius: 0; border-top-right-radius: 0; }
.Box-header {
  background: var(--bg-subtle); border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.Box-header h3 { font-size: 14px; flex: 1; }
.Box-row {
  padding: 12px 16px; border-top: 1px solid var(--border-muted);
  display: flex; align-items: center; gap: 12px;
}
.Box-row:first-child { border-top: 0; }
.Box-header + .Box-row { border-top: 0; }
.Box-row:hover { background: var(--bg-subtle); }
.Box-row.is-selected { background: var(--accent-subtle); }
.Box-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.Box-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.Box-row-title a { color: var(--fg); }
.Box-row-title .link-title { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--fg); cursor: pointer; text-align: left; }
.Box-row-title .link-title:hover { color: var(--accent); text-decoration: underline; }
.thumb.is-playable { cursor: pointer; }
.Season-header { padding: 8px 16px; font-size: 12px; font-weight: 600; color: var(--fg-muted); background: var(--bg-subtle); border-top: 1px solid var(--border-muted); position: sticky; top: 0; z-index: 1; }
.Episode-list .Box-row { padding: 8px 16px; }
.Episode-list .Box-row.is-watched .Box-row-title { color: var(--fg-muted); font-weight: 500; }
.Dialog-note { padding: 10px 16px; font-size: 12px; color: var(--fg-muted); border-bottom: 1px solid var(--border-muted); }
.Dialog-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border-muted); font-size: 12px; color: var(--fg-muted); }
.Dialog-toolbar .spacer { flex: 1; }
.Box-row-sub { color: var(--fg-muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.Box-row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.Box-row .drag { color: var(--fg-subtle); cursor: default; }
.Box-footer { padding: 12px 16px; border-top: 1px solid var(--border-muted); background: var(--bg-subtle); color: var(--fg-muted); font-size: 12px; }
.Box-empty { padding: 40px 16px; text-align: center; color: var(--fg-muted); }
.Box-empty h3 { margin-bottom: 4px; color: var(--fg); }

.thumb {
  width: 36px; height: 36px; border-radius: 4px; object-fit: contain;
  background: var(--bg-inset); border: 1px solid var(--border-muted); flex-shrink: 0;
}
.thumb.is-placeholder { display: inline-flex; align-items: center; justify-content: center; color: var(--fg-subtle); }

.PlaylistBadge { display: inline-flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.SymbolGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.SymbolCell { display: inline-flex; align-items: center; justify-content: center; height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-subtle); color: var(--fg); cursor: pointer; }
.SymbolCell:hover { border-color: var(--accent); }
.SymbolCell.is-on { border-color: transparent; box-shadow: 0 0 0 2px var(--accent-subtle); }

.PlaylistIcon {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-subtle); color: var(--accent); font-weight: 700; font-size: 16px;
}

/* Labels ------------------------------------------------------------------ */

.Label {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 7px; height: 20px; border-radius: 999px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); color: var(--fg-muted); white-space: nowrap;
}
.Label--accent { color: var(--accent); border-color: transparent; background: var(--accent-subtle); }
.Label--success { color: var(--success); border-color: transparent; background: var(--success-subtle); }
.Label--danger { color: var(--danger); border-color: transparent; background: var(--danger-subtle); }
.Label--attention { color: var(--attention); border-color: transparent; background: var(--attention-subtle); }
.Label--done { color: var(--done); border-color: transparent; background: var(--done-subtle); }

.Counter {
  display: inline-block; min-width: 20px; padding: 0 6px; font-size: 12px; font-weight: 500;
  line-height: 18px; color: var(--fg); background: rgba(175, 184, 193, 0.2); border-radius: 999px; text-align: center;
}

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 5px 12px; font-size: 14px; font-weight: 500; line-height: 20px;
  color: var(--fg); background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; white-space: nowrap; user-select: none;
  font-family: inherit; box-shadow: var(--shadow); text-decoration: none;
}
.btn:hover { background: var(--border-muted); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { color: var(--accent-fg); background: var(--accent); border-color: rgba(31, 35, 40, 0.15); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 3px 8px; font-size: 12px; line-height: 18px; }
.btn-icon { padding: 5px 7px; }
.btn-sm.btn-icon { padding: 3px 5px; }
.btn-link { background: transparent; border-color: transparent; box-shadow: none; color: var(--accent); }
.btn-link:hover { background: transparent; text-decoration: underline; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }
.btn-sm svg { width: 14px; height: 14px; }

.BtnGroup { display: inline-flex; }
.BtnGroup .btn { border-radius: 0; margin-left: -1px; }
.BtnGroup .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.BtnGroup .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* Forms ------------------------------------------------------------------- */

.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: 5px 12px; font-size: 14px; line-height: 20px; font-family: inherit;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(208, 215, 222, 0.2);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.form-control::placeholder { color: var(--fg-subtle); }
.form-control.input-sm { padding: 3px 8px; font-size: 12px; }
.form-control.input-mono { font-family: var(--mono); font-size: 12px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; }
.form-group .note { color: var(--fg-muted); font-size: 12px; margin-top: 4px; }
.form-checkbox { display: flex; gap: 8px; align-items: flex-start; }
.form-checkbox input { margin-top: 4px; }
.form-checkbox label { font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }

input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Tabs -------------------------------------------------------------------- */

.UnderlineNav { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.UnderlineNav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: -1px;
  color: var(--fg); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500;
}
.UnderlineNav a:hover { text-decoration: none; border-bottom-color: var(--border); }
.UnderlineNav a.is-active { font-weight: 600; border-bottom-color: var(--accent); }
.UnderlineNav a svg { width: 16px; height: 16px; stroke: var(--fg-muted); }

/* Toolbar ----------------------------------------------------------------- */

.Toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 10px 12px; background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0;
}
.Toolbar + .Box { border-radius: 0 0 var(--radius) var(--radius); }
.Toolbar .search { flex: 1; min-width: 180px; max-width: 320px; }
.Toolbar .spacer { flex: 1; }
.Toolbar .selection { color: var(--fg-muted); font-size: 12px; }

/* Flash ------------------------------------------------------------------- */

.flash {
  padding: 12px 16px; border: 1px solid var(--accent); background: var(--accent-subtle);
  border-radius: var(--radius); margin-bottom: 16px; display: flex; gap: 12px; align-items: center;
}
.flash-warn { border-color: var(--attention); background: var(--attention-subtle); }
.flash-error { border-color: var(--danger); background: var(--danger-subtle); }
.flash-success { border-color: var(--success); background: var(--success-subtle); }
.flash .grow { flex: 1; }
.flash > svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }

/* Progress ---------------------------------------------------------------- */

.Progress { height: 6px; border-radius: 999px; background: var(--border-muted); overflow: hidden; width: 120px; }
.Progress > span { display: block; height: 100%; background: var(--accent); }

.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Login ------------------------------------------------------------------- */

.Login { width: 100%; margin: 24px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 760px) { .Login { grid-template-columns: 1fr; } }
.Login-qr {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md);
}
.Login-codeHolder { min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.Login-codeLabel { color: var(--fg-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.Login-code {
  font-family: var(--mono); font-size: 44px; letter-spacing: 12px; font-weight: 700; padding: 12px 12px 12px 24px;
  border: 1px dashed var(--border); border-radius: 12px; background: var(--bg-subtle);
}
.Login-progress {
  min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; animation: toast-in 0.25s ease-out;
}
.Login-progress-icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--accent-subtle); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.Login-progress-icon svg { width: 32px; height: 32px; stroke-width: 2; }
.Login-progress strong { font-size: 16px; }
.Login-steps { counter-reset: step; list-style: none; padding: 0; margin: 16px 0; }
.Login-steps li { position: relative; padding-left: 40px; margin-bottom: 14px; }
.Login-steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-subtle); color: var(--accent); font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.kbd {
  display: inline-block; padding: 1px 6px; font-family: var(--mono); font-size: 11px; line-height: 16px;
  color: var(--fg); background: var(--bg-subtle); border: 1px solid var(--border); border-bottom-color: var(--border);
  border-radius: 6px; box-shadow: inset 0 -1px 0 var(--border);
}

.Blankslate { text-align: center; padding: 64px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.Blankslate > svg { width: 32px; height: 32px; stroke: var(--fg-muted); margin-bottom: 12px; }
.Blankslate h2 { margin-bottom: 8px; }
.Blankslate p { color: var(--fg-muted); max-width: 480px; margin: 0 auto 16px; }

/* Dialog ------------------------------------------------------------------ */

dialog.Dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--bg-overlay); color: var(--fg);
  width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg);
}
dialog.Dialog--wide { width: min(860px, calc(100vw - 32px)); }
.Dialog-body.is-flush { padding: 0; }
dialog.Dialog::backdrop { background: rgba(31, 35, 40, 0.5); backdrop-filter: blur(2px); }
.Dialog-header { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border-muted); }
.Dialog-header h3 { flex: 1; }
.Dialog-body { padding: 16px; max-height: 65vh; overflow: auto; }
.Dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-muted); background: var(--bg-subtle); border-radius: 0 0 12px 12px; }
.Dialog-list { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.Dialog-list label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border-muted); cursor: pointer; }
.Dialog-list label:first-child { border-top: 0; }
.Dialog-list label:hover { background: var(--bg-subtle); }

/* Menu (details dropdown) ------------------------------------------------- */

details.Menu { position: relative; }
details.Menu > summary { list-style: none; }
details.Menu > summary::-webkit-details-marker { display: none; }
details.Menu[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 80; }
.Menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 90; min-width: 200px;
  background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 4px 0;
}
.Menu-list button, .Menu-list a {
  display: flex; width: 100%; gap: 8px; align-items: center; text-align: left;
  padding: 6px 12px; border: 0; background: transparent; color: var(--fg); font: inherit; cursor: pointer;
}
.Menu-list button:hover, .Menu-list a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.Menu-list button.danger { color: var(--danger); }
.Menu-list button.danger:hover { background: var(--danger); color: #fff; }
.Menu-list button:disabled { opacity: 0.5; cursor: not-allowed; }
.Menu-list button:disabled:hover { background: transparent; color: var(--fg); }
.Menu-list hr { border: 0; border-top: 1px solid var(--border-muted); margin: 4px 0; }
.Menu-list svg { width: 16px; height: 16px; stroke: currentColor; }

/* Toasts ------------------------------------------------------------------ */

.Toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 360px; }
.Toast {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius);
  background: var(--header-bg); color: var(--header-fg); box-shadow: var(--shadow-lg); font-size: 13px;
  animation: toast-in 0.2s ease-out;
}
.Toast--error { background: var(--danger); color: #fff; }
.Toast--success { background: var(--accent); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Grid of media type cards ------------------------------------------------ */

.Cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.Card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg);
  display: flex; gap: 12px; align-items: center; color: var(--fg);
}
.Card:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-md); }
.Card svg { width: 24px; height: 24px; stroke: var(--accent); }
.Card-main { flex: 1; min-width: 0; }
.Card-title { font-weight: 600; }
.Card-sub { color: var(--fg-muted); font-size: 12px; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }

.icon { width: 16px; height: 16px; vertical-align: text-bottom; }
.icon-muted { stroke: var(--fg-muted); }

/* Skeleton loading ------------------------------------------------------------ */

.Skeleton { pointer-events: none; user-select: none; }
.sk {
  display: block; border-radius: 4px;
  background: linear-gradient(90deg, var(--border-muted) 25%, var(--bg-subtle) 50%, var(--border-muted) 75%);
  background-size: 400% 100%; animation: sk-shimmer 1.4s ease-in-out infinite;
}
.sk-title { height: 24px; width: 180px; border-radius: 6px; }
.sk-text { height: 12px; width: 60%; margin-top: 8px; }
.sk-button { height: 32px; width: 132px; border-radius: var(--radius); }
.sk-avatar { width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0; }
.sk-thumb { width: 36px; height: 36px; border-radius: 4px; flex-shrink: 0; }
.sk-line { height: 14px; }
.sk-line.short { width: 35%; }
.sk-line.medium { width: 55%; }
.sk-line.long { width: 80%; }
.sk-sub { height: 10px; width: 45%; margin-top: 6px; }
.sk-action { width: 28px; height: 28px; border-radius: var(--radius); }
.Skeleton .Box-row:hover { background: transparent; }
@keyframes sk-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* Landing ------------------------------------------------------------------ */

.Landing { width: 100%; }
.Landing-hero { padding: 40px 0 32px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; align-items: center; }
@media (max-width: 860px) { .Landing-hero { grid-template-columns: 1fr; } .Hero-visual { display: none; } }
.Landing-eyebrow { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; color: var(--accent); }
.Landing-hero h1 { font-size: clamp(32px, 6vw, 52px); line-height: 1.05; letter-spacing: -0.02em; margin: 12px 0 16px; }
.Landing-lead { font-size: 17px; color: var(--fg-muted); max-width: 640px; margin-bottom: 20px; }
.btn-lg { padding: 9px 18px; font-size: 15px; }
.Landing-section { padding: 32px 0; border-top: 1px solid var(--border-muted); }
.Landing-section h2 { font-size: 26px; letter-spacing: -0.01em; margin-bottom: 6px; }
.Landing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 20px; }
.Landing-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; background: var(--bg-subtle); }
.Landing-card:hover { border-color: var(--accent); }
.Landing-card-icon {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-subtle); color: var(--accent); margin-bottom: 10px;
}
.Landing-card h3 { font-size: 15px; margin-bottom: 4px; }
.Landing-card p { color: var(--fg-muted); font-size: 13px; margin: 0; }
.Landing-steps { counter-reset: step; list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.Landing-steps li { position: relative; padding-left: 44px; }
.Landing-steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.Landing-steps strong { display: block; margin-bottom: 4px; font-size: 15px; }
.Landing-steps p { color: var(--fg-muted); margin: 0; }
.Landing-split { display: grid; grid-template-columns: 3fr 2fr; gap: 32px; align-items: center; }
.Landing-split p { color: var(--fg-muted); }
@media (max-width: 760px) { .Landing-split { grid-template-columns: 1fr; } }
.Landing-keybox { border: 1px solid var(--border); border-radius: 12px; padding: 20px; background: var(--bg-subtle); display: flex; flex-direction: column; gap: 14px; }
.Landing-keybox-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.Landing-keybox-row svg { color: var(--accent); }
.Landing-keybox-row .mono { padding: 2px 8px; border: 1px dashed var(--border); border-radius: 6px; }
.Landing-keybox-arrow { color: var(--fg-subtle); }
.Landing-keybox-note { font-size: 12px; color: var(--fg-muted); border-top: 1px solid var(--border-muted); padding-top: 12px; }
.Landing-cta { text-align: center; padding-bottom: 8px; }
.Landing-cta h2 { font-size: 30px; }
.Landing-cta .btn { margin-top: 8px; }

/* Hero animation (tvOS Home tab mock) ------------------------------------------- */

.Hero-visual { position: relative; }
.Hero-glow { position: absolute; inset: -10% -10% -20%; background: radial-gradient(60% 60% at 60% 50%, var(--accent-subtle), transparent 70%); z-index: 0; pointer-events: none; }
.Hero-screen {
  --tv-bg: #16181d; --tv-surface: #24272e; --tv-text: #f2f3f5; --tv-muted: #8d93a0; --tv-bone: #3a3e47;
  position: relative; z-index: 1; border: 1px solid var(--border); border-radius: 14px; background: var(--tv-bg); color: var(--tv-text);
  box-shadow: var(--shadow-lg); aspect-ratio: 16 / 11; display: grid; grid-template-columns: 44px 1fr; overflow: hidden; font-size: 10px;
}
.Hero-sidebar { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 0; background: linear-gradient(180deg, #1b1e24, #14161b); }
.Hero-navDot { width: 18px; height: 18px; border-radius: 50%; background: var(--tv-surface); flex-shrink: 0; }
.Hero-navDot.is-system { background: #33363e; }
.Hero-navDot:nth-child(2) { margin-bottom: 10px; }
.Hero-rows { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 0 14px; min-height: 0; overflow: hidden; }
.Hero-row { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
.Hero-rowHead { display: flex; align-items: baseline; justify-content: space-between; padding-right: 14px; }
.Hero-rowTitle { font-weight: 700; font-size: 10px; color: var(--tv-muted); letter-spacing: 0.01em; }
.Hero-viewAll { font-size: 8px; font-weight: 600; color: var(--tv-muted); }
.Hero-tiles { display: flex; gap: 7px; }
.Hero-tile { position: relative; display: flex; flex-direction: column; flex-shrink: 0; gap: 4px; transition: opacity 0.3s; }
.Hero-art { position: relative; display: block; border-radius: 6px; overflow: hidden; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.Hero-badge { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 3px; background: var(--accent); opacity: 0.9; }
.Hero-progress { position: absolute; left: 6px; right: 6px; bottom: 5px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.28); overflow: hidden; }
.Hero-progress > span { display: block; height: 100%; background: #fff; border-radius: 2px; }
.Hero-progress--thin { position: static; height: 2px; margin: 0 0 2px; background: rgba(255, 255, 255, 0.15); }
.Hero-caption { display: flex; flex-direction: column; gap: 3px; padding: 0 2px; }
.Hero-tile-label { display: block; height: 5px; border-radius: 3px; background: var(--tv-text); opacity: 0.85; width: 55%; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.4s; }
.Hero-tile-sub { display: block; height: 4px; border-radius: 2px; background: var(--tv-muted); opacity: 0.7; width: 30%; }
.Hero-tile--wide { width: 31%; }
.Hero-tile--wide .Hero-art { aspect-ratio: 16 / 9; }
.Hero-tile--channel { width: 17%; }
.Hero-tile--channel .Hero-art { aspect-ratio: 16 / 9; border-radius: 6px 6px 0 0; box-shadow: none; }
.Hero-tile--channel .Hero-caption { background: var(--tv-surface); border-radius: 0 0 6px 6px; padding: 4px 5px 6px; margin-top: -4px; }
.Hero-tile--channel .Hero-tile-label { width: 70%; }
.Hero-logo { position: absolute; left: 50%; top: 50%; width: 30%; height: 28%; transform: translate(-50%, -50%); border-radius: 3px; background: currentColor; opacity: 0.85; }
.Hero-tile--poster { width: 13.5%; }
.Hero-tile--poster .Hero-art { aspect-ratio: 2 / 3; }
.Hero-tile--poster .Hero-tile-label { position: absolute; left: 6px; right: 6px; bottom: 6px; width: auto; opacity: 0.9; }
.Hero-tile.is-new .Hero-art { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.Hero-tile.is-renamed .Hero-tile-label { width: 92%; background: var(--accent); opacity: 1; }
.Hero-tile.is-fav .Hero-badge { background: #fff; }
.Hero-tile.is-fav .Hero-badge::after {
  content: "★"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 7px; line-height: 1; color: var(--accent); animation: hero-pop 0.4s ease-out;
}
@keyframes hero-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Playlist loading status bar ---------------------------------------------------- */

.LoadBar { position: sticky; top: 0; z-index: 60; background: var(--bg-subtle); border-bottom: 1px solid var(--border); }
.LoadBar-inner { display: flex; align-items: center; gap: 10px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; }
.LoadBar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.LoadBar-track { height: 3px; background: var(--border-muted); }
.LoadBar-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Exports ---------------------------------------------------------------------- */

.ExportURL { display: flex; align-items: center; gap: 8px; }
.ExportURL code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-inset); }
.Quota { display: inline-flex; align-items: center; gap: 6px; }
.Quota-bar { width: 60px; height: 4px; border-radius: 2px; background: var(--border-muted); overflow: hidden; }
.Quota-bar span { display: block; height: 100%; background: var(--accent); }
.Quota.is-full .Quota-bar span { background: var(--danger); }
.Picker-items { border-top: 1px solid var(--border-muted); background: var(--bg-inset); max-height: 320px; overflow: auto; }
.Picker-items label { display: flex; gap: 10px; align-items: center; padding: 6px 16px 6px 44px; cursor: pointer; font-size: 13px; }
.Picker-items label:hover { background: var(--bg-subtle); }

/* Unpublished export drafts banner ---------------------------------------------- */

.DraftBanner { position: sticky; top: 0; z-index: 55; background: var(--attention-subtle); border-bottom: 1px solid var(--attention); }
.DraftBanner-row { display: flex; align-items: center; gap: 10px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; }
.DraftBanner-text { flex: 1; min-width: 0; }
