/* =========================================================================
   Flookk — a warm, quiet video platform
   1. Tokens   2. Base   3. Topbar   4. Rail   5. Components
   6. Pages    7. Player 8. Forms    9. Responsive
   ========================================================================= */

/* 1. Tokens ------------------------------------------------------------- */

:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --topbar-h: 64px;
  --rail-w: 252px;
  --rail-w-collapsed: 78px;
  --page-max: 1720px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --speed: .18s;
}

/* Dark (default) — warm charcoal, not blue-black */
html[data-theme="dark"] {
  --bg: #141010;
  --bg-elevated: #1c1715;
  --surface: #221c19;
  --surface-2: #2b2320;
  --surface-hover: #332a26;
  --border: #382e29;
  --border-soft: #2a2320;

  --text: #f6ece4;
  --text-muted: #b6a49a;
  --text-faint: #8b7a71;

  --accent: #ff8f57;
  --accent-2: #e8548a;
  --accent-soft: rgba(255, 143, 87, .14);
  --accent-text: #2a1208;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .65);
  --shadow-lg: 0 26px 60px -20px rgba(0, 0, 0, .75);
  --glow: radial-gradient(1100px 480px at 12% -12%, rgba(255, 143, 87, .10), transparent 62%),
          radial-gradient(900px 420px at 96% 6%, rgba(232, 84, 138, .09), transparent 60%);
}

/* Light — cream paper */
html[data-theme="light"] {
  --bg: #fdf8f3;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6ede4;
  --surface-hover: #f1e5da;
  --border: #e8d9cb;
  --border-soft: #f0e4d9;

  --text: #2b201a;
  --text-muted: #7c6a5f;
  --text-faint: #9c8b80;

  --accent: #e2622b;
  --accent-2: #d43b73;
  --accent-soft: rgba(226, 98, 43, .12);
  --accent-text: #fff6ef;

  --shadow-sm: 0 1px 2px rgba(88, 60, 40, .10);
  --shadow: 0 12px 30px -16px rgba(88, 60, 40, .30);
  --shadow-lg: 0 26px 60px -24px rgba(88, 60, 40, .34);
  --glow: radial-gradient(1100px 480px at 12% -12%, rgba(226, 98, 43, .10), transparent 62%),
          radial-gradient(900px 420px at 96% 6%, rgba(212, 59, 115, .07), transparent 60%);
}

/* 2. Base --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--glow);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 12px 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 200;
  background: var(--accent); color: var(--accent-text);
  padding: 10px 16px; border-radius: var(--radius-pill);
}
.skip-link:focus { left: 12px; }

.icon { flex: none; }

/* 3. Topbar ------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 16px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-left { display: flex; align-items: center; gap: 6px; flex: none; }
.topbar-right { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: var(--radius-sm); }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 4px 10px rgba(255, 138, 76, .35)); }
.brand-name {
  font-family: var(--font-display);
  font-size: 23px; font-weight: 600; letter-spacing: -.02em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  background: transparent; border: 0; border-radius: var(--radius-pill);
  color: var(--text-muted); cursor: pointer;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:active { transform: scale(.94); }

.has-dot::after {
  content: ""; position: absolute; top: 9px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 0 2px var(--bg);
}

.searchbar {
  display: flex; align-items: center;
  flex: 1 1 auto; max-width: 620px; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.searchbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.searchbar input {
  flex: 1; min-width: 0;
  padding: 11px 18px;
  background: transparent; border: 0; outline: none;
}
.searchbar input::placeholder { color: var(--text-faint); }
.searchbar input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.5); }
.searchbar button {
  display: grid; place-items: center;
  width: 58px; align-self: stretch;
  background: var(--surface-2); border: 0; border-left: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.searchbar button:hover { background: var(--accent-soft); color: var(--accent); }

.theme-icon { display: none; }
html[data-theme="dark"] .theme-icon-dark,
html[data-theme="light"] .theme-icon-light { display: block; }

.account-chip { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; }
.account-chip:hover .avatar { transform: scale(1.06); }

.avatar {
  display: grid; place-items: center;
  width: var(--avatar-size, 40px); height: var(--avatar-size, 40px);
  border-radius: 50%;
  background: linear-gradient(140deg, var(--avatar-from, #ff8a4c), var(--avatar-to, #e0457b));
  color: #fff;
  font-size: calc(var(--avatar-size, 40px) * .38);
  font-weight: 600; letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), var(--shadow-sm);
  user-select: none;
  transition: transform var(--speed) var(--ease);
}

/* 4. Rail (sidebar) ------------------------------------------------------ */

.shell { display: flex; align-items: flex-start; }

.rail {
  position: sticky; top: var(--topbar-h);
  flex: none;
  width: var(--rail-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 10px 24px;
  scrollbar-width: thin;
  transition: width var(--speed) var(--ease);
}
.rail::-webkit-scrollbar { width: 8px; }
.rail:not(:hover)::-webkit-scrollbar-thumb { background: transparent; }

.rail-group { display: flex; flex-direction: column; gap: 2px; }
.rail-heading {
  padding: 12px 14px 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint);
}
.rail-sep { margin: 12px 8px; }

.rail-link {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14.5px;
  white-space: nowrap;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.rail-link:hover { background: var(--surface-hover); color: var(--text); }
.rail-link.is-active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}
.rail-link.is-active .icon { color: var(--accent); }
.rail-link span { overflow: hidden; text-overflow: ellipsis; }
.rail-avatar { --avatar-size: 24px; font-size: 10px; }

.rail-foot {
  margin-top: 20px; padding: 14px;
  color: var(--text-faint); font-size: 12px; line-height: 1.9;
}
.rail-foot a:hover { color: var(--accent); }
.rail-copy { margin-top: 8px; opacity: .8; }

.rail-scrim { display: none; }

/* Collapsed rail: icons only */
html.rail-collapsed .rail { width: var(--rail-w-collapsed); }
html.rail-collapsed .rail-link { flex-direction: column; gap: 6px; padding: 12px 4px; font-size: 10.5px; text-align: center; }
html.rail-collapsed .rail-link span { max-width: 100%; font-size: 10.5px; }
html.rail-collapsed .rail-heading,
html.rail-collapsed .rail-foot,
html.rail-collapsed .rail-subs { display: none; }

/* 5. Components ---------------------------------------------------------- */

.main {
  flex: 1; min-width: 0;
  padding: 22px clamp(14px, 2.6vw, 34px) 72px;
}
.page { max-width: var(--page-max); margin: 0 auto; }
.page-narrow { max-width: 1100px; margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: transform var(--speed) var(--ease), background var(--speed) var(--ease),
              border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px -10px var(--accent-2);
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 12px 26px -10px var(--accent-2); }
.btn-subtle { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-subtle:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.pill-group { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.pill-group .btn { border-radius: 0; border: 0; background: transparent; }
.pill-group .btn + .btn { border-left: 1px solid var(--border); }
.pill-group .btn:hover { background: var(--surface-hover); }
.pill-group .btn.is-on { color: var(--accent); }

.chiprow {
  display: flex; gap: 10px;
  padding: 4px 2px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
          mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.chiprow::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 16px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  transition: all var(--speed) var(--ease);
}
.chip:hover { background: var(--surface-hover); color: var(--text); transform: translateY(-1px); }
.chip.is-active {
  background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600;
}

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin: 34px 0 16px;
}
.section-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.section-sub { margin-top: 3px; color: var(--text-muted); font-size: 13.5px; }

/* Video cards */
.vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 30px 20px;
}

.vcard { display: flex; flex-direction: column; gap: 12px; }

.vcard-thumb {
  position: relative; display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.vcard-thumb .thumb-art { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.vcard:hover .vcard-thumb { transform: translateY(-3px); box-shadow: var(--shadow); }
.vcard:hover .thumb-art { transform: scale(1.045); }

.vcard-duration {
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 7px;
  background: rgba(10, 6, 4, .82);
  border-radius: 7px;
  color: #fff; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.vcard-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; opacity: 0;
  background: rgba(10, 6, 4, .28);
  transition: opacity var(--speed) var(--ease);
}
.vcard-play .icon { filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5)); }
.vcard:hover .vcard-play { opacity: 1; }

.vcard-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(255, 255, 255, .22);
}
.vcard-progress::after {
  content: ""; position: absolute; inset: 0 auto 0 0;
  width: var(--watched, 0%);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.vcard-body { display: flex; gap: 12px; align-items: flex-start; }
.vcard-avatar { flex: none; margin-top: 2px; }
.vcard-text { min-width: 0; flex: 1; }

.vcard-title {
  font-size: 15px; font-weight: 600; line-height: 1.38;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.vcard-title a:hover { color: var(--accent); }
.vcard-channel { display: inline-block; margin-top: 6px; color: var(--text-muted); font-size: 13.5px; }
.vcard-channel:hover { color: var(--accent); }
.vcard-meta { color: var(--text-faint); font-size: 13px; }
.vcard-desc { margin-top: 8px; color: var(--text-muted); font-size: 13.5px; }

.vcard-more { width: 32px; height: 32px; opacity: 0; flex: none; }
.vcard:hover .vcard-more, .vcard-more:focus-visible { opacity: 1; }

/* Compact (sidebar) card */
.vcard-compact { flex-direction: row; gap: 11px; }
.vcard-compact .vcard-thumb { width: 172px; flex: none; border-radius: 12px; }
.vcard-compact .vcard-body { flex-direction: column; gap: 0; }
.vcard-compact .vcard-title { font-size: 14px; -webkit-line-clamp: 2; }
.vcard-compact .vcard-channel { margin-top: 5px; font-size: 12.5px; }
.vcard-compact .vcard-meta { font-size: 12.5px; }
.vcard-compact .vcard-more { display: none; }

/* List (search results) card */
.vcard-list { flex-direction: row; gap: 18px; }
.vcard-list .vcard-thumb { width: min(360px, 38vw); flex: none; }
.vcard-list .vcard-title { font-size: 18px; -webkit-line-clamp: 2; }

/* Hero */
.hero {
  position: relative;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px; align-items: center;
  margin-bottom: 12px; padding: 30px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(700px 320px at 88% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; margin-bottom: 16px;
  background: var(--accent-soft); border-radius: var(--radius-pill);
  color: var(--accent); font-size: 12.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 42px); font-weight: 600; line-height: 1.14;
}
.hero-text { margin-top: 14px; max-width: 52ch; color: var(--text-muted); font-size: 15.5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 20px; color: var(--text-faint); font-size: 13px; }
.hero-art { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); aspect-ratio: 16/9; }
.hero-art .thumb-art { width: 100%; height: 100%; }
.hero-art .vcard-duration { right: 12px; bottom: 12px; }

/* Empty state */
.empty {
  display: grid; place-items: center; gap: 10px;
  padding: 70px 20px; text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.empty-art {
  display: grid; place-items: center; width: 62px; height: 62px;
  background: var(--accent-soft); border-radius: 50%; color: var(--accent);
}
.empty-msg { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-hint { font-size: 14px; }

/* Channel row */
.channel-row {
  display: flex; align-items: center; gap: 20px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.channel-row-text { flex: 1; min-width: 0; }
.channel-row h3 { font-size: 17px; }
.channel-row-meta { color: var(--text-faint); font-size: 13px; margin-top: 2px; }
.channel-row-about { color: var(--text-muted); font-size: 13.5px; margin-top: 6px; }

/* 6. Pages --------------------------------------------------------------- */

.page-head { margin-bottom: 20px; }
.page-head h1 { font-family: var(--font-display); font-size: 30px; font-weight: 600; }
.page-head p { margin-top: 6px; color: var(--text-muted); }
.page-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }

/* Watch layout */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 402px; gap: 26px; align-items: start; max-width: var(--page-max); margin: 0 auto; }
.watch-main { min-width: 0; }

.watch-title { margin: 18px 0 14px; font-size: 21px; font-weight: 600; line-height: 1.32; }

.watch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; justify-content: space-between; }
.watch-owner { display: flex; align-items: center; gap: 13px; }
.watch-owner-name { font-size: 15.5px; font-weight: 600; }
.watch-owner-subs { color: var(--text-faint); font-size: 12.5px; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.reaction { display: inline-flex; align-items: center; }
.reaction .btn { border-radius: 0; }
.reaction .btn:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.reaction .btn:last-child { border-radius: 0 var(--radius-pill) var(--radius-pill) 0; padding-inline: 14px; }
.reaction .btn.is-on { color: var(--accent); }
.reaction-sep { width: 1px; align-self: stretch; margin: 6px 0; background: var(--border); }

.description {
  margin-top: 18px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  font-size: 14.5px;
}
.description-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-muted); font-weight: 600; font-size: 14px; }
.description-body { margin-top: 12px; color: var(--text-muted); white-space: pre-line; }
.description[data-collapsed="true"] .description-body {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.description-toggle { margin-top: 10px; background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; }
.description-toggle:hover { color: var(--accent); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { padding: 4px 11px; background: var(--surface-2); border-radius: var(--radius-pill); color: var(--text-muted); font-size: 12.5px; }
.tag:hover { color: var(--accent); background: var(--accent-soft); }

/* Comments */
.comments { margin-top: 30px; }
.comments-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.comments-count { font-size: 18px; font-weight: 600; }
.comment-form { display: flex; gap: 14px; margin-bottom: 30px; }
.comment-input { flex: 1; }
.comment-input textarea {
  width: 100%; min-height: 44px; resize: vertical;
  padding: 10px 2px;
  background: transparent; border: 0; border-bottom: 1px solid var(--border);
  outline: none;
}
.comment-input textarea:focus { border-bottom-color: var(--accent); }
.comment-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.comment { display: flex; gap: 14px; padding: 14px 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 9px; }
.comment-author { font-size: 13.5px; font-weight: 600; }
.comment-time { color: var(--text-faint); font-size: 12.5px; }
.comment-text { margin-top: 5px; font-size: 14.5px; color: var(--text); }
.comment-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--text-muted); font-size: 12.5px; }
.comment-actions .icon-btn { width: 30px; height: 30px; }

/* Watch sidebar */
.watch-side { display: flex; flex-direction: column; gap: 14px; }
.up-next-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.up-next-head h2 { font-size: 16px; font-weight: 600; }
.autoplay { display: inline-flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.switch { position: relative; width: 38px; height: 21px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; transition: background var(--speed) var(--ease); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--text-muted); transition: transform var(--speed) var(--ease), background var(--speed) var(--ease); }
.autoplay input { position: absolute; opacity: 0; pointer-events: none; }
.autoplay input:checked + .switch { background: var(--accent-soft); border-color: var(--accent); }
.autoplay input:checked + .switch::after { transform: translateX(17px); background: var(--accent); }

/* Channel page */
.channel-banner { position: relative; height: clamp(140px, 20vw, 220px); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.channel-banner-art { width: 100%; height: 100%; }
.channel-header { display: flex; align-items: center; gap: 26px; padding: 24px 6px 8px; flex-wrap: wrap; }
.channel-header .avatar { box-shadow: 0 0 0 4px var(--bg), var(--shadow); }
.channel-info { flex: 1; min-width: 240px; }
.channel-name { font-family: var(--font-display); font-size: 30px; font-weight: 600; }
.channel-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--text-muted); font-size: 14px; }
.channel-about { margin-top: 10px; max-width: 68ch; color: var(--text-muted); font-size: 14px; }
.tabs { display: flex; gap: 4px; margin: 22px 0 6px; border-bottom: 1px solid var(--border-soft); }
.tab {
  padding: 12px 18px;
  color: var(--text-muted); font-size: 14.5px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

/* Search */
.search-summary { margin-bottom: 18px; color: var(--text-muted); }
.search-summary strong { color: var(--text); }
.result-list { display: flex; flex-direction: column; gap: 26px; }

/* Trending list numbering */
.rank-list { display: flex; flex-direction: column; gap: 22px; counter-reset: rank; }
.rank-item { display: flex; align-items: flex-start; gap: 20px; counter-increment: rank; }
.rank-item::before {
  content: counter(rank);
  flex: none; width: 42px;
  font-family: var(--font-display); font-size: 30px; font-weight: 600;
  color: var(--text-faint); text-align: center; line-height: 1.4;
}
.rank-item .vcard { flex: 1; min-width: 0; }

/* 7. Player -------------------------------------------------------------- */

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0706;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  user-select: none;
}
.player-art { position: absolute; inset: 0; }
.player-art .thumb-art { width: 100%; height: 100%; }
.player::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6, 4, 3, .78) 0%, rgba(6, 4, 3, .12) 34%, transparent 62%);
  opacity: 0; transition: opacity .25s var(--ease); pointer-events: none;
}
.player:hover::after, .player.is-paused::after, .player:focus-within::after { opacity: 1; }

.player-center {
  position: absolute; inset: 0; display: grid; place-items: center;
  z-index: 2;
  background: transparent; border: 0; cursor: pointer;
}
.player-center-btn {
  display: grid; place-items: center;
  width: 84px; height: 84px;
  background: rgba(20, 12, 9, .5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  color: #fff;
  transition: transform .25s var(--ease), opacity .25s var(--ease), background .25s var(--ease);
}
.player-center-btn:hover { background: rgba(255, 143, 87, .5); transform: scale(1.06); }
.player:not(.is-paused) .player-center-btn { opacity: 0; transform: scale(.7); }

.player-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 14px 12px;
  color: #fff;
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.player:hover .player-controls,
.player.is-paused .player-controls,
.player:focus-within .player-controls { opacity: 1; transform: none; }

.scrub {
  position: relative; height: 16px; display: flex; align-items: center; cursor: pointer;
}
.scrub-track { position: relative; width: 100%; height: 4px; background: rgba(255, 255, 255, .28); border-radius: 99px; transition: height .15s var(--ease); }
.scrub:hover .scrub-track { height: 6px; }
.scrub-buffer { position: absolute; inset: 0 auto 0 0; width: 62%; background: rgba(255, 255, 255, .22); border-radius: 99px; }
.scrub-fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }
.scrub-knob {
  position: absolute; top: 50%; left: 0;
  width: 13px; height: 13px; margin-left: -6px;
  background: #fff; border-radius: 50%;
  transform: translateY(-50%) scale(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  transition: transform .15s var(--ease);
}
.scrub:hover .scrub-knob, .player.is-paused .scrub-knob { transform: translateY(-50%) scale(1); }

.player-row { display: flex; align-items: center; gap: 4px; }
.player-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: transparent; border: 0; border-radius: 50%;
  color: #fff; cursor: pointer; opacity: .92;
  transition: background var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.player-btn:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.player-btn:active { transform: scale(.92); }
.player-time { margin-left: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: .9; }
.player-spacer { flex: 1; }
.player-volume { display: flex; align-items: center; gap: 6px; }
.player-volume input {
  width: 0; opacity: 0; accent-color: var(--accent);
  transition: width var(--speed) var(--ease), opacity var(--speed) var(--ease);
}
.player-volume:hover input, .player-volume input:focus-visible { width: 74px; opacity: 1; }
.player-badge {
  position: absolute; top: 14px; left: 14px; z-index: 3;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  background: rgba(20, 12, 9, .55); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: var(--radius-pill);
  color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  opacity: 0; transition: opacity .25s var(--ease);
}
.player:hover .player-badge, .player.is-paused .player-badge { opacity: 1; }

/* 8. Forms --------------------------------------------------------------- */

.card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 20px; }
.card h2 { font-size: 18px; font-weight: 600; }
.card-sub { margin-top: 6px; color: var(--text-muted); font-size: 14px; }

.field { margin-top: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 600; }
.field input[type="text"], .field input[type="url"], .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field-hint { margin-top: 6px; color: var(--text-faint); font-size: 12.5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.dropzone {
  display: grid; place-items: center; gap: 12px;
  padding: 56px 24px; text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.dropzone h3 { font-size: 17px; }
.dropzone p { color: var(--text-muted); font-size: 14px; }

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 22px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  border-radius: var(--radius);
  color: var(--text); font-size: 14px;
}
.notice .icon { color: var(--accent); margin-top: 2px; }

/* 9. Responsive ---------------------------------------------------------- */

@media (max-width: 1300px) {
  .watch { grid-template-columns: minmax(0, 1fr) 340px; }
  .vcard-compact .vcard-thumb { width: 150px; }
}

@media (max-width: 1080px) {
  .watch { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
}

@media (max-width: 900px) {
  .rail {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 55;
    width: var(--rail-w) !important;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    transform: translateX(-102%);
    transition: transform .24s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  html.rail-open .rail { transform: none; }
  html.rail-collapsed .rail-heading,
  html.rail-collapsed .rail-foot,
  html.rail-collapsed .rail-subs { display: revert; }
  html.rail-collapsed .rail-link { flex-direction: row; gap: 16px; padding: 10px 14px; font-size: 14.5px; text-align: left; }
  html.rail-collapsed .rail-link span { font-size: 14.5px; }
  .rail-scrim {
    display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 50;
    background: rgba(8, 5, 4, .55); backdrop-filter: blur(2px);
  }
  .rail-scrim[hidden] { display: none; }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 26px 16px; }
}

@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand-name { display: none; }
  .topbar-right .icon-btn:not([data-toggle-theme]) { display: none; }
  .main { padding: 16px 14px 60px; }
  .vgrid { grid-template-columns: 1fr; }
  .vcard-list, .vcard-compact { flex-direction: column; }
  .vcard-list .vcard-thumb, .vcard-compact .vcard-thumb { width: 100%; }
  .vcard-list .vcard-title { font-size: 16px; }
  .rank-item { gap: 12px; }
  .rank-item::before { width: 26px; font-size: 22px; }
  .field-row { grid-template-columns: 1fr; }
  .watch-bar { align-items: flex-start; }
  .hero { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Real media, when a file exists in assets/media/ */
.player video {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #0a0706;
}
.btn.icon-only { padding-inline: 12px; }
