/* Homereel styles.
   Colors live in the variables below: change them to re-theme the whole site. */

:root {
  --bg: #E7EAF4;
  --paper: #FFFFFF;
  --ink: #151A33;
  --slate: #5B6482;
  --line: #D4D9EC;
  --soft: #DDE2F2;
  --accent: #3B4BFF;
  --accent-light: #6C78FF;
  --accent-ink: #FFFFFF;
  /* The video player keeps the same look in light and dark mode. */
  --player-accent: #3B4BFF;
  --player-hi: #9BA5FF;
  --player-lo: #2231D4;
  --player-glow: rgba(34, 49, 212, .55);
  --player-bar-top: rgba(40, 45, 78, .96);
  --player-bar-bottom: rgba(14, 16, 33, .97);
  --danger: #C62F4B;
  --radius: 14px;
  --font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;

  /* Skeuomorphic shadow tokens: a soft ambient shadow plus a crisp contact
     shadow underneath gives raised elements real depth. */
  --shadow-sm: 0 1px 2px rgba(20, 24, 60, .10), 0 1px 1px rgba(20, 24, 60, .06);
  --shadow-md: 0 1px 2px rgba(20, 24, 60, .10), 0 6px 14px rgba(20, 24, 60, .14);
  --shadow-lg: 0 2px 4px rgba(20, 24, 60, .12), 0 14px 32px rgba(20, 24, 60, .18);
  --shadow-inset: inset 0 1px 1px rgba(255, 255, 255, .6), inset 0 -1px 1px rgba(20, 24, 60, .06);
  --sheen: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.12) 45%, rgba(255,255,255,0) 46%, rgba(0,0,0,.03) 100%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0E1E;
    --paper: #1B1F3B;
    --ink: #ECEFFF;
    --slate: #98A1C7;
    --line: #313765;
    --soft: #262B4E;
    --accent: #8390FF;
    --accent-light: #A4AEFF;
    --accent-ink: #0F1224;
    --danger: #FF7C93;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 1px rgba(0, 0, 0, .25);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .45);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .45), 0 16px 36px rgba(0, 0, 0, .55);
    --shadow-inset: inset 0 1px 1px rgba(255, 255, 255, .08), inset 0 -1px 1px rgba(0, 0, 0, .3);
    --sheen: linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.04) 45%, rgba(255,255,255,0) 46%, rgba(0,0,0,.1) 100%);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
small { color: var(--slate); }
.muted { color: var(--slate); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* The hidden attribute must always win over a class's own display value
   (e.g. .upload sets display:grid, which would otherwise outrank [hidden]). */
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 16px;
  padding: 12px clamp(16px, 3vw, 32px);
  background: var(--bg);
  box-shadow: 0 1px 0 var(--line), var(--shadow-sm);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 1.3rem; font-weight: 800; letter-spacing: -0.03em;
  text-decoration: none;
}
.reel { color: var(--accent); flex: none; filter: drop-shadow(0 2px 3px rgba(20,24,60,.25)); }

.account { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.account-chip {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: .9rem;
  text-decoration: none; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--paper); box-shadow: var(--shadow-sm);
}
.account-chip:hover { box-shadow: var(--shadow-md); }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-form { margin: 0; }
.auth-switch { margin-top: 18px; color: var(--slate); }
.auth-switch a { color: var(--accent); font-weight: 650; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* Settings cog + dropdown */
.menu { position: relative; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--paper); color: var(--slate);
  box-shadow: var(--shadow-sm);
}
.icon-btn:hover { color: var(--ink); box-shadow: var(--shadow-md); }
.icon-btn[aria-expanded="true"] { color: var(--accent); box-shadow: var(--shadow-inset); }
.menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  min-width: 170px; padding: 6px;
  background: var(--paper); border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.menu-dropdown[hidden] { display: none; }
.menu-item {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font: inherit; text-align: left;
  text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: var(--soft); }

.search {
  display: flex; align-items: center;
  width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--paper); border-radius: 999px;
  box-shadow: var(--shadow-inset), var(--shadow-sm);
}
.search:focus-within { box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent); }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: inherit; padding: 10px 6px 10px 18px; outline: none;
}
.search button {
  display: grid; place-items: center; border: 0; background: transparent;
  color: var(--slate); padding: 0 16px; align-self: stretch; cursor: pointer;
  border-radius: 0 999px 999px 0;
}
.search button:hover { color: var(--ink); }

/* ---------- Buttons (skeuomorphic: raised, shiny, press down on click) ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: 0; border-radius: 999px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: box-shadow .12s ease, transform .12s ease, filter .12s ease;
}
.btn::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--sheen); pointer-events: none;
}
.btn:hover { box-shadow: var(--shadow-md); filter: brightness(1.04); }
.btn:active { box-shadow: var(--shadow-inset); transform: translateY(1px); filter: brightness(.98); }
.btn-primary { background: linear-gradient(180deg, var(--accent-light), var(--accent)); color: var(--accent-ink); }
.btn-primary:disabled { opacity: .55; cursor: default; box-shadow: var(--shadow-sm); transform: none; }
.btn-soft { background: linear-gradient(180deg, var(--paper), var(--soft)); color: var(--ink); }
.btn-soft[aria-pressed="true"] { background: linear-gradient(180deg, var(--accent-light), var(--accent)); color: var(--accent-ink); }
.btn-danger { background: var(--paper); color: var(--danger); box-shadow: var(--shadow-sm), inset 0 0 0 1.5px currentColor; }
.btn[hidden] { display: none; }

/* ---------- Layout: sidebar + main content ---------- */
.layout { display: flex; align-items: flex-start; }

.sidebar {
  flex: none; width: 84px;
  position: sticky; top: 61px;
  height: calc(100vh - 61px);
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 18px 8px;
}
.side-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 100%; padding: 10px 4px; border-radius: 14px;
  text-decoration: none; color: var(--slate); font-size: .7rem; font-weight: 650;
}
.side-icon {
  display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 50%; background: var(--paper); box-shadow: var(--shadow-sm);
  transition: box-shadow .12s ease, color .12s ease;
}
.side-btn:hover .side-icon { box-shadow: var(--shadow-md); color: var(--ink); }
.side-btn.active { color: var(--ink); }
.side-btn.active .side-icon { color: var(--accent); box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent) inset; }

main { flex: 1; min-width: 0; }

/* ---------- Page frame ---------- */
.page {
  max-width: 1500px; margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 32px) 72px;
}
.page.narrow { max-width: 720px; }
.page h1 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.02em; line-height: 1.2; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px; margin-bottom: 24px;
}
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 999px; box-shadow: var(--shadow-inset); }
.tab { padding: 6px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--slate); }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { background: linear-gradient(180deg, var(--accent-light), var(--accent)); color: var(--accent-ink); box-shadow: var(--shadow-sm); }

/* ---------- Channel page ---------- */
.channel-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line);
}
.channel-info { flex: 1; min-width: 160px; }
.channel-info h1 { margin-bottom: 4px; }
.channel-head .btn { margin-left: auto; }

/* ---------- Video grid ---------- */
.grid {
  display: grid; gap: 30px 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.tile-thumb {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 16 / 9; border-radius: var(--radius); background: var(--soft);
  box-shadow: var(--shadow-md);
}
.tile-thumb img, .tile-preview {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.tile-preview { pointer-events: none; background: #000; }
.thumb-blank { position: absolute; inset: 0; background: linear-gradient(135deg, var(--soft), var(--line)); }
.badge {
  position: absolute; right: 8px; bottom: 8px; z-index: 1;
  padding: 1px 7px; border-radius: 6px;
  background: rgba(10, 12, 30, .85); color: #fff;
  font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums;
}

.tile-meta { margin-top: 10px; min-width: 0; }
.tile-meta h2 {
  font-size: 1rem; font-weight: 650; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-meta h2 a { text-decoration: none; }
.tile-meta h2 a:hover { text-decoration: underline; }
.tile-meta p { font-size: .875rem; color: var(--slate); }
.tile-meta .who { margin-top: 2px; }
.stats { display: flex; flex-wrap: wrap; gap: 0 12px; }

.tile-row { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 12px; align-items: start; }
.tile-row .tile-meta { margin-top: 0; }
.tile-row .tile-meta h2 { font-size: .9375rem; }

/* ---------- Empty states ---------- */
.empty { max-width: 420px; margin: 72px auto; text-align: center; }
.empty h2 { font-size: 1.35rem; letter-spacing: -0.01em; }
.empty p { margin: 8px 0 20px; color: var(--slate); }

/* ---------- Watch page ---------- */
.watch {
  max-width: 1500px; margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 32px) 72px;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px;
}
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.speed-dropdown { max-height: 320px; overflow-y: auto; }
.menu-label { padding: 6px 12px 2px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); }
.speed-option.active { background: var(--soft); font-weight: 700; color: var(--accent); }
.player video { display: block; width: 100%; height: 100%; object-fit: contain; }

.watch-title { margin: 16px 0 12px; font-size: 1.4rem; letter-spacing: -0.015em; line-height: 1.3; overflow-wrap: anywhere; }
.watch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.byline { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.byline:hover strong { text-decoration: underline; }
.byline small { display: block; line-height: 1.3; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.avatar {
  flex: none; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  color: var(--accent-ink); font-weight: 700; box-shadow: var(--shadow-sm);
  object-fit: cover;
}
.avatar.sm { width: 34px; height: 34px; font-size: .875rem; }
.avatar.lg {
  width: 96px; height: 96px; font-size: 2.2rem; box-shadow: var(--shadow-lg);
  border: 4px solid var(--bg); position: relative; z-index: 1;
}

.desc { margin-top: 16px; padding: 14px 18px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-inset); }
.desc-stats { font-weight: 650; }
.desc-stats .dot { margin: 0 6px; }
.desc-body { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.desc-body a { color: var(--accent); text-decoration: underline; }

.comments { margin-top: 32px; }
.comments h2 { font-size: 1.15rem; }
.comments h2 span { color: var(--slate); font-weight: 500; margin-left: 4px; }
.comment-form { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 8px; }
.comment-form-body { flex: 1; min-width: 0; display: grid; gap: 10px; justify-items: start; }
.comment-form .input { width: 100%; }
.comment-form input.input { max-width: 260px; }
.comment-list { margin-top: 8px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.comment-head { display: flex; gap: 10px; align-items: baseline; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }

.watch-side > h2 { font-size: 1.05rem; margin-bottom: 14px; }
.watch-side .tile { margin-bottom: 16px; }

/* ---------- Forms ---------- */
.input {
  display: block; width: 100%; padding: 11px 14px;
  border: 0; border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit;
  box-shadow: var(--shadow-inset), 0 0 0 1px var(--line);
}
.input:focus-visible { outline: none; box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent); }
textarea.input { resize: vertical; }

.upload { display: grid; gap: 20px; margin-top: 24px; }
.field label:not(.drop) { display: block; margin-bottom: 6px; font-weight: 650; }
.optional { color: var(--slate); font-weight: 400; }
.hint { color: var(--slate); font-size: .875rem; }

.drop {
  display: grid; gap: 4px; padding: 36px 20px; text-align: center; cursor: pointer;
  border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-inset), 0 0 0 2px dashed var(--line);
}
.drop:hover, .drop.is-over { box-shadow: var(--shadow-inset), 0 0 0 2px dashed var(--accent); background: var(--soft); }
.field:focus-within .drop { box-shadow: var(--shadow-inset), 0 0 0 2px dashed var(--accent); }
.drop-title { font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.drop-hint { color: var(--slate); font-size: .9rem; }

.thumb-pick[hidden] { display: none; }
.thumb-pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.thumb-pick-grid img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px;
  cursor: pointer; border: 3px solid transparent; display: block; background: var(--soft);
  box-shadow: var(--shadow-sm);
}
.thumb-pick-grid img:hover { box-shadow: var(--shadow-md); }
.thumb-pick-grid img.selected { border-color: var(--accent); box-shadow: var(--shadow-md); }

.visibility-options { display: grid; gap: 8px; }
.radio-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 10px; cursor: pointer; background: var(--paper);
  box-shadow: var(--shadow-inset), 0 0 0 1px var(--line);
}
.radio-chip:has(input:checked) { box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent); background: var(--soft); }
.radio-chip input { accent-color: var(--accent); }
.radio-chip span { display: flex; flex-direction: column; }
.radio-chip small { color: var(--slate); }

.progress[hidden], .error[hidden] { display: none; }
.bar { height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; box-shadow: var(--shadow-inset); }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(180deg, var(--accent-light), var(--accent)); transition: width .2s; }
.progress p { margin-top: 8px; color: var(--slate); }
.error { color: var(--danger); font-weight: 600; }
.upload .btn { justify-self: start; }

/* ---------- Small screens ---------- */
@media (max-width: 1000px) {
  .watch { grid-template-columns: minmax(0, 1fr); }
  .watch-side { max-width: 640px; }
}
/* Notification bell + dropdown (reuses the settings-cog menu look in every layout) */
#notif-toggle { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #e5384a; color: #fff;
  font-size: .7rem; font-weight: 800; line-height: 18px; text-align: center;
}
.notif-dropdown { width: min(380px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.notif-clear {
  border: 0; background: transparent; color: var(--accent); cursor: pointer;
  font: inherit; font-size: .85rem; font-weight: 650;
}
.notif-clear:hover { text-decoration: underline; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: min(70vh, 460px); overflow-y: auto; }
.notif-item + .notif-item { border-top: 1px solid var(--line); }
.notif-link { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; color: inherit; text-decoration: none; }
.notif-link:hover { background: var(--soft); }
.notif-item.unread .notif-link { background: color-mix(in srgb, var(--accent) 10%, var(--paper)); }
.notif-item.unread .notif-link:hover { background: color-mix(in srgb, var(--accent) 16%, var(--paper)); }
.notif-link .avatar { flex: none; }
.notif-icon {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 1rem;
}
.notif-body { min-width: 0; display: grid; gap: 2px; }
.notif-text { margin: 0; font-size: .92rem; overflow-wrap: anywhere; }
.notif-snippet { margin: 0; color: var(--slate); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { color: var(--slate); font-size: .78rem; }
.notif-empty { margin: 0; padding: 22px 14px; text-align: center; color: var(--slate); font-size: .92rem; }

/* Jumping to a comment from a notification */
.comment-flash { animation: comment-flash 2.5s ease-out; }
@keyframes comment-flash {
  from { background: color-mix(in srgb, var(--accent) 22%, transparent); }
  to { background: transparent; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
}
@media (max-width: 640px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; }
  #notif-menu { position: static; }
  .notif-dropdown { left: 12px; right: 12px; width: auto; top: 100%; }
  .search { grid-column: 1 / -1; order: 3; max-width: none; }
  .thumb-pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-row { grid-template-columns: 140px minmax(0, 1fr); }
  .channel-head .btn { margin-left: 0; }
}

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

/* ---------- Channel page: banner, overlapping avatar, optional background ---------- */
.channel-page {
  position: relative;
  background-image: var(--channel-bg, none);
  background-size: cover; background-position: center top;
}
.channel-page[style]::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: var(--bg); opacity: .82;
}
.channel-page > * { position: relative; z-index: 1; }
.channel-banner {
  height: 200px; margin: 0 clamp(16px, 3vw, 32px);
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  background-size: cover; background-position: center;
  box-shadow: var(--shadow-md);
}
.channel-head { margin-top: -38px; position: relative; z-index: 1; }
.channel-tabs { display: flex; gap: 4px; margin: -8px 0 24px; border-bottom: 1px solid var(--line); }
.channel-tab {
  padding: 10px 4px; font-weight: 650; color: var(--slate);
  border-bottom: 2px solid transparent;
}
.channel-tab.active { color: var(--ink); border-color: var(--accent); }

/* ---------- Settings page ---------- */
.settings-section {
  padding: 22px 0; border-top: 1px solid var(--line);
}
.settings-section:first-of-type { border-top: 0; padding-top: 0; }
.settings-section h2 { font-size: 1.1rem; margin-bottom: 16px; }

.profile-field {
  display: flex; align-items: center; gap: 18px; margin-bottom: 18px;
}
.profile-preview {
  flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--soft); box-shadow: var(--shadow-inset), 0 0 0 1px var(--line);
}
.profile-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-preview-avatar { width: 72px; height: 72px; border-radius: 50%; }
.profile-preview-banner { width: 160px; height: 48px; border-radius: 8px; }
.profile-preview-background { width: 160px; height: 90px; border-radius: 8px; }
.avatar-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  color: var(--accent-ink); font-weight: 700; font-size: 1.6rem;
}
.profile-field-body { flex: 1; min-width: 0; }
.profile-field-body label strong { display: block; margin-bottom: 2px; }
.profile-field-body .hint { margin-bottom: 10px; }

.success { color: #1a8a4a; font-weight: 600; }
@media (prefers-color-scheme: dark) { .success { color: #5fe0a0; } }

.toggle-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch {
  flex: none; width: 44px; height: 26px; border-radius: 999px;
  background: var(--soft); box-shadow: var(--shadow-inset);
  position: relative; transition: background .15s ease;
}
.toggle-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--paper); box-shadow: var(--shadow-sm);
  transition: transform .15s ease;
}
.toggle-row input:checked + .toggle-switch { background: var(--accent); }
.toggle-row input:checked + .toggle-switch::after { transform: translateX(18px); }
.toggle-row input:focus-visible + .toggle-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-copy small { display: block; }

.danger-zone h2 { color: var(--danger); }

@media (max-width: 640px) {
  .channel-banner { height: 120px; }
  .channel-head { margin-top: -28px; flex-wrap: wrap; }
  .avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
  .profile-field { flex-wrap: wrap; }
}

/* ---------- Edit page ---------- */
.thumb-current {
  width: 220px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--soft); box-shadow: var(--shadow-sm); margin-bottom: 10px;
}
.thumb-current img, .thumb-current .thumb-blank { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-actions { display: flex; gap: 10px; }

/* ---------- Analytics page ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-top: 18px;
}
.stat-card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stat-card strong { font-size: 1.4rem; letter-spacing: -0.02em; }
.stat-card span { color: var(--slate); font-size: .85rem; }

/* ---------- Image cropper modal ---------- */
.cropper-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(10, 12, 30, .55); padding: 20px;
}
.cropper-box {
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 20px; max-width: 420px; width: 100%;
}
.cropper-title { font-weight: 700; margin-bottom: 12px; }
.cropper-frame {
  margin: 0 auto; overflow: hidden; border-radius: 10px;
  box-shadow: var(--shadow-inset), 0 0 0 1px var(--line);
  max-width: 100%; touch-action: none;
}
.cropper-canvas { display: block; cursor: grab; touch-action: none; max-width: 100%; }
.cropper-canvas:active { cursor: grabbing; }
.cropper-zoom-label {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  font-size: .875rem; font-weight: 650;
}
.cropper-zoom { flex: 1; accent-color: var(--accent); }
.cropper-actions { margin-top: 16px; }
.cropper-error { margin-top: 10px; }

/* ---------- Playlists ---------- */
.playlist-badge { display: inline-flex; align-items: center; gap: 4px; }
.playlist-item { position: relative; }
.playlist-item-controls {
  display: flex; gap: 6px; margin-top: 8px;
}
.playlist-item-controls .icon-btn { width: 32px; height: 32px; }
.playlist-remove { color: var(--danger); }

.playlist-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.playlist-sort {
  width: auto; padding-right: 32px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%235B6482" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>');
  background-repeat: no-repeat; background-position: right 10px center;
}

.playlist-check-list { max-height: 260px; overflow-y: auto; display: grid; gap: 2px; }
.playlist-check-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; cursor: pointer;
}
.playlist-check-row:hover { background: var(--soft); }
.playlist-check-row input { accent-color: var(--accent); width: 18px; height: 18px; }

/* ---------- Playlist queue panel (watch page) ---------- */
.queue-panel { padding: 4px; }
.queue-head { padding: 10px 10px 14px; }
.queue-title {
  display: block; font-weight: 700; font-size: 1.05rem; text-decoration: none;
  line-height: 1.3; margin-bottom: 4px;
}
.queue-title:hover { text-decoration: underline; }
.queue-sub { color: var(--slate); font-size: .85rem; }
.queue-sub a { color: inherit; text-decoration: none; }
.queue-sub a:hover { text-decoration: underline; }
.queue-controls { display: flex; gap: 8px; margin-top: 10px; }
.queue-toggle { width: 34px; height: 34px; }
.queue-toggle.active { color: var(--accent); box-shadow: var(--shadow-inset), 0 0 0 2px var(--accent) inset; }

.queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.queue-item a {
  display: grid; grid-template-columns: 22px 120px minmax(0, 1fr);
  align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-decoration: none;
}
.queue-item a:hover { background: var(--soft); }
.queue-item.current a { background: var(--soft); box-shadow: var(--shadow-inset); }
.queue-index {
  display: flex; align-items: center; justify-content: center;
  color: var(--slate); font-size: .8rem; font-variant-numeric: tabular-nums;
}
.queue-item.current .queue-index { color: var(--accent); }
.queue-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--soft); }
.queue-thumb img, .queue-thumb .thumb-blank { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.queue-thumb .badge { font-size: .7rem; padding: 0 5px; }
.queue-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.queue-item-title {
  font-size: .875rem; font-weight: 650; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.queue-item.current .queue-item-title { color: var(--accent); }
.queue-meta small { font-size: .8rem; }

@media (max-width: 640px) {
  .queue-item a { grid-template-columns: 18px 96px minmax(0, 1fr); }
}


/* Ratings: like/dislike buttons or star row, plus the shared summary line */
.rating { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.rating-likes { display: flex; gap: 8px; }
.rating-stars { display: flex; gap: 2px; padding: 4px 8px; border-radius: 999px; background: linear-gradient(180deg, var(--paper), var(--soft)); }
.rating-stars[hidden], .rating-likes[hidden] { display: none; }
.star-btn { background: none; border: 0; padding: 2px; cursor: pointer; color: var(--slate); line-height: 0; border-radius: 6px; }
.star-btn svg { fill: transparent; transition: fill .12s, transform .12s; }
.star-btn.on { color: #F5A623; }
.star-btn.on svg { fill: currentColor; }
.star-btn:hover svg { transform: scale(1.12); }
.star-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rating-meta { color: var(--slate); font-size: .875rem; }

.radio-group { display: grid; gap: 10px; margin-top: 10px; }
.radio-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.radio-row input { margin-top: 4px; accent-color: var(--accent); }
.radio-row small { display: block; color: var(--slate); }


/* Watch page: queue on top, More videos underneath */
.watch-side-col { display: flex; flex-direction: column; gap: 28px; min-width: 0; }

/* Analytics button (only the original publisher sees it) */
.btn-analytics { background: #c1ffab; color: #12301a; }

/* Download quality menu */
.download-dropdown { left: 0; right: auto; min-width: 250px; max-width: calc(100vw - 32px); max-height: 360px; overflow-y: auto; }
.download-dropdown .menu-note { padding: 8px 12px; color: var(--slate); font-size: .9rem; }
.download-dropdown .menu-item small { color: var(--slate); margin-left: 6px; }
.download-dropdown .menu-divider { margin: 4px 8px; border: 0; border-top: 1px solid var(--line); }
.download-progress { padding: 8px 12px 10px; }
.download-progress .bar { margin: 8px 0; }
.download-progress p { font-size: .9rem; }
.download-progress .error { font-size: .9rem; }

/* Batch upload */
.batch-list { display: grid; gap: 16px; margin-top: 4px; }
.batch-list:empty { display: none; }
.batch-card { padding: 16px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-md); display: grid; gap: 12px; }
.batch-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.batch-name { font-weight: 700; overflow-wrap: anywhere; }
.batch-head small { display: block; color: var(--slate); }
.batch-status { color: var(--slate); font-size: .9rem; white-space: nowrap; }
.batch-status.ok { color: #1a8a4a; font-weight: 600; }
.batch-status.bad { color: var(--danger); font-weight: 600; }
.batch-remove { border: 0; background: transparent; color: var(--slate); cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.batch-remove:hover { background: var(--soft); color: var(--ink); }
.batch-details[hidden] { display: none; }
.batch-details { display: grid; gap: 12px; }
.batch-card .bar { margin-top: 2px; }
.batch-card.is-published { opacity: .75; }
.batch-count { color: var(--slate); font-size: .9rem; }


/* Edit button (only the original publisher sees it) */
.btn-edit { background: #5dc3da; color: #08303a; }

/* Autoplay toggle next to "More videos" */
.watch-side .side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.watch-side .side-head h2 { font-size: 1.05rem; margin: 0; }
.autoplay-toggle { gap: 8px; }
.autoplay-toggle small { color: var(--slate); }

/* End of video: replay button or "Up next" countdown, laid over the player */
.end-screen {
  position: absolute; inset: 0 0 52px 0; z-index: 1;
  display: grid; place-items: center; padding: 16px;
  background: rgba(8, 10, 24, .62);
}
.end-screen[hidden], .replay-btn[hidden], .up-next[hidden] { display: none; }
.replay-btn {
  display: grid; justify-items: center; gap: 6px;
  width: 96px; height: 96px; align-content: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: linear-gradient(180deg, var(--paper), var(--soft)); color: var(--accent);
  box-shadow: var(--shadow-lg);
  font: inherit; font-weight: 700; font-size: .85rem;
}
.replay-btn:hover { filter: brightness(1.05); }
.replay-btn:active { box-shadow: var(--shadow-inset); transform: translateY(1px); }
.up-next { display: grid; justify-items: center; gap: 12px; max-width: min(420px, 100%); color: #fff; text-align: center; }
.up-next-label { font-size: 1.05rem; }
.up-next-label strong { font-size: 1.5rem; }
.up-next-card {
  display: flex; gap: 12px; align-items: center; width: 100%; padding: 8px;
  border-radius: 12px; background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; text-align: left;
}
.up-next-card:hover { background: rgba(255, 255, 255, .22); }
.up-next-card img, .up-next-card .thumb-blank { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: #000; }
.up-next-meta { display: grid; gap: 2px; min-width: 0; }
.up-next-meta strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.up-next-meta small { color: rgba(255, 255, 255, .75); }
.up-next-actions { display: flex; gap: 10px; }

/* Settings sub-headings */
.settings-subhead { margin: 18px 0 6px; font-size: 1rem; }
.settings-subhead:first-of-type { margin-top: 8px; }

/* Upload page: Upload button with Upload defaults beside it */
.upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }


/* ===== Custom video player: 2011-style bar, blue instead of red ===== */
.player { --ctl-h: 52px; }
.end-screen { bottom: var(--ctl-h); }

.player:not(.has-custom) .controls,
.player:not(.has-custom) .pb-mini { display: none; }
.big-play { display: none; }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  color: #e4e7ff; user-select: none; -webkit-user-select: none;
  background: linear-gradient(180deg, var(--player-bar-top) 0%, var(--player-bar-bottom) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 -2px 10px rgba(0, 0, 0, .35);
  transition: opacity .25s ease, transform .25s ease;
}
.player.is-idle .controls { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player.is-idle { cursor: none; }

/* seek bar */
.pb { position: relative; height: 14px; cursor: pointer; touch-action: none; outline: none; }
.pb-track {
  position: absolute; left: 0; right: 0; top: 3px; height: 8px; overflow: hidden;
  background: linear-gradient(180deg, #04050d, #161932);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .9);
}
.pb-buffer { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: rgba(255, 255, 255, .22); }
.pb-played {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  background: linear-gradient(180deg, var(--player-hi) 0%, var(--player-accent) 55%, var(--player-lo) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.pb-knob {
  position: absolute; top: 0; left: 0; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, color-mix(in srgb, var(--player-hi) 35%, #fff) 55%, var(--player-hi) 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .25);
  transition: transform .1s;
}
.pb:hover .pb-knob, .pb:focus-visible .pb-knob { transform: scale(1.2); }
.pb:focus-visible .pb-track { outline: 2px solid var(--player-hi); outline-offset: 1px; }
.pb-tip {
  position: absolute; bottom: 20px; transform: translateX(-50%); padding: 3px 7px; border-radius: 5px;
  background: #0b0d1f; color: #fff; font-size: .75rem; font-variant-numeric: tabular-nums; pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5); white-space: nowrap;
}
.pb-tip[hidden] { display: none; }

/* buttons row */
.ctl-row { display: flex; align-items: center; gap: 2px; height: 38px; padding: 0 10px 0 6px; }
.ctl-btn {
  width: 38px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: #aeb5e6;
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.ctl-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.ctl-btn:focus-visible { outline: 2px solid var(--player-hi); outline-offset: -2px; color: #fff; }
.ctl-play .i-pause, .player.is-playing .ctl-play .i-play { display: none; }
.player.is-playing .ctl-play .i-pause { display: block; }
.ctl-btn .i-exit, .player.is-fullscreen .ctl-btn .i-enter { display: none; }
.player.is-fullscreen .ctl-btn .i-exit { display: block; }

/* volume: speaker icon + slider with a little rectangular knob */
.vol { display: flex; align-items: center; }
.ctl-btn[data-level="high"] .i-mute-x, .ctl-btn[data-level="low"] .i-mute-x,
.ctl-btn[data-level="low"] .i-wave-2, .ctl-btn[data-level="off"] .i-wave-1, .ctl-btn[data-level="off"] .i-wave-2 { display: none; }
.vol-slider { position: relative; width: 64px; height: 18px; margin: 0 10px 0 2px; cursor: pointer; touch-action: none; outline: none; }
.vol-track {
  position: absolute; left: 0; right: 0; top: 7px; height: 4px; overflow: hidden;
  background: linear-gradient(180deg, #04050d, #161932); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .9);
}
.vol-fill { height: 100%; width: 100%; background: linear-gradient(180deg, var(--player-hi), var(--player-accent) 60%, var(--player-lo)); }
.vol-knob {
  position: absolute; top: 2px; left: 100%; width: 8px; height: 14px; margin-left: -4px; border-radius: 2px;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--player-hi) 70%, #fff)); box-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}
.vol-slider:focus-visible .vol-knob { outline: 2px solid var(--player-hi); outline-offset: 1px; }

.ctl-time { font-size: .8rem; font-variant-numeric: tabular-nums; color: #aeb5e6; margin-left: 4px; white-space: nowrap; }
.ctl-time #ctl-cur { color: #fff; }
.ctl-spacer { flex: 1; }

/* thin progress line that stays visible when the controls slide away */
.pb-mini { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 2; background: rgba(255, 255, 255, .15); opacity: 0; transition: opacity .25s; pointer-events: none; }
.pb-mini span { display: block; height: 100%; width: 0; background: linear-gradient(180deg, var(--player-hi), var(--player-accent)); }
.player.is-idle .pb-mini { opacity: 1; }

/* big play button on the poster, before the first play */
.player.has-custom.is-fresh .big-play {
  display: grid; place-items: center; position: absolute; left: 50%; top: 50%; z-index: 2;
  width: 84px; height: 84px; margin: -42px 0 0 -42px; padding-left: 4px;
  border: 0; border-radius: 50%; cursor: pointer; color: #fff;
  background: radial-gradient(circle at 50% 22%, var(--player-hi) 0%, var(--player-accent) 58%, var(--player-lo) 100%);
  box-shadow: 0 8px 22px var(--player-glow), inset 0 2px 0 rgba(255, 255, 255, .45);
  transition: transform .12s;
}
.player.has-custom.is-fresh .big-play:hover { transform: scale(1.06); }
.player.has-custom.is-fresh .big-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.player:fullscreen { aspect-ratio: auto; border-radius: 0; }
.player:-webkit-full-screen { aspect-ratio: auto; border-radius: 0; }
.player.is-fullscreen { border-radius: 0; }

@media (max-width: 480px) {
  .vol-slider { display: none; }
  .ctl-btn { width: 34px; }
}


/* ===== Settings > Appearance ===== */
.layout-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 10px 0 4px; }
.layout-card { position: relative; display: block; cursor: pointer; }
.layout-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.layout-card-body {
  display: grid; gap: 2px; align-content: start; height: 100%; padding: 10px;
  border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}
.layout-card:hover .layout-card-body { box-shadow: var(--shadow-md), 0 0 0 1px var(--line); }
.layout-card input:checked + .layout-card-body { box-shadow: 0 0 0 2px var(--accent), var(--shadow-md); }
.layout-card input:focus-visible + .layout-card-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout-card strong { margin-top: 6px; }
.layout-card small { color: var(--slate); }
.layout-blurb { margin-top: 4px; font-size: .8rem; color: var(--slate); line-height: 1.35; }
.layout-art { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); display: block; }
.layout-art .a-page { fill: var(--bg); }
.layout-art .a-paper { fill: var(--paper); }
.layout-art .a-thumb { fill: var(--soft); stroke: var(--line); stroke-width: .5; }
.layout-art .a-line { fill: var(--line); }
.layout-art .acc { fill: var(--accent); }
.layout-art .acc-soft { fill: color-mix(in srgb, var(--accent) 35%, var(--paper)); }
.layout-art .tint { fill: color-mix(in srgb, var(--accent) 16%, var(--paper)); }
.layout-art .dark { fill: #262626; }

.color-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.color-input { width: 52px; height: 42px; padding: 3px; border: 0; border-radius: 10px; cursor: pointer; background: var(--paper); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.color-hex { width: 120px; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.swatch {
  width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer; background: var(--sw);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .45), inset 0 -2px 3px rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .25);
}
.swatch:hover { transform: scale(1.1); }
.swatch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

#appearance-form { gap: 10px; margin-top: 8px; }
#appearance-form .settings-subhead { margin-bottom: 0; }
#appearance-form .hint { margin: 0; }


/* ===== Your videos (the Videos tab) ===== */
.mv-count { margin-left: 6px; padding: 1px 10px; border-radius: 999px; background: var(--soft); color: var(--slate); font-size: .85rem; font-weight: 600; vertical-align: middle; }
#my-videos { --mv-top: 61px; }
.mv-toolbar {
  position: sticky; top: var(--mv-top); z-index: 6;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--paper); box-shadow: var(--shadow-md), 0 0 0 1px var(--line);
}
.mv-selectall { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; cursor: pointer; }
.mv-selectall input, .mv-pick { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.mv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mv-dropdown { left: 0; right: auto; min-width: 260px; max-height: 340px; overflow-y: auto; }
.mv-actions .menu:last-of-type .mv-dropdown { left: auto; right: 0; }
.mv-dropdown .menu-item { display: grid; gap: 1px; }
.mv-dropdown .menu-item small { color: var(--slate); }
.mv-dropdown .menu-note { padding: 8px 12px; color: var(--slate); font-size: .9rem; }
.mv-dropdown .menu-divider { margin: 6px 8px; border: 0; border-top: 1px solid var(--line); }
.mv-newpl { display: flex; gap: 8px; padding: 4px 8px 6px; }
.mv-newpl .input { padding: 8px 10px; }
.mv-newpl .btn { padding: 8px 14px; }

.mv-confirm {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin-bottom: 12px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--paper); box-shadow: 0 0 0 2px var(--danger);
}
.mv-confirm p { flex: 1; min-width: 240px; }
.mv-confirm-actions { display: flex; gap: 8px; }
.mv-status { margin-bottom: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--soft); }
.mv-status.ok { background: color-mix(in srgb, #1a8a4a 14%, var(--paper)); color: var(--ink); box-shadow: inset 4px 0 0 #1a8a4a; }
.mv-status.bad { background: color-mix(in srgb, var(--danger) 12%, var(--paper)); box-shadow: inset 4px 0 0 var(--danger); }

.mv-list { display: grid; gap: 10px; }
.mv-row {
  display: grid; grid-template-columns: 28px 168px minmax(0, 1fr) 92px 110px; align-items: center; gap: 14px;
  padding: 10px 14px 10px 12px; border-radius: var(--radius);
  background: var(--paper); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}
.mv-row.is-selected { background: color-mix(in srgb, var(--accent) 9%, var(--paper)); box-shadow: 0 0 0 2px var(--accent); }
.mv-check { display: grid; place-items: center; }
.mv-thumb { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 9; border-radius: calc(var(--radius) - 4px); background: var(--soft); }
.mv-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mv-info { min-width: 0; }
.mv-info h2 { font-size: 1rem; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.mv-info h2 a { text-decoration: none; }
.mv-info h2 a:hover { text-decoration: underline; }
.mv-desc { margin-top: 2px; font-size: .875rem; color: var(--slate); overflow-wrap: anywhere; }
.mv-links { margin-top: 4px; display: flex; gap: 14px; font-size: .85rem; }
.mv-links a { color: var(--accent); font-weight: 650; text-decoration: none; }
.mv-links a:hover { text-decoration: underline; }
.mv-stats { display: grid; font-size: .85rem; color: var(--slate); text-align: right; }
.vis-pill { justify-self: center; padding: 3px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.vis-public { background: color-mix(in srgb, #1a8a4a 16%, var(--paper)); color: #1a8a4a; }
.vis-unlisted { background: color-mix(in srgb, #c27a00 16%, var(--paper)); color: #a86400; }
.vis-private { background: var(--soft); color: var(--slate); }
@media (prefers-color-scheme: dark) {
  .vis-public { color: #5fe0a0; }
  .vis-unlisted { color: #ffc15c; }
}
@media (max-width: 760px) {
  .mv-row { grid-template-columns: 28px 120px minmax(0, 1fr); }
  .mv-row .vis-pill { grid-column: 3; justify-self: start; }
  .mv-row .mv-stats { grid-column: 3; text-align: left; grid-auto-flow: column; justify-content: start; gap: 12px; }
}


/* Playback speed lives in the control bar now; its menu opens upward */
.speed-menu { position: relative; display: flex; }
.controls .speed-dropdown {
  top: auto; bottom: calc(100% + 24px); left: auto; right: -6px; min-width: 190px;
  background: #14172b; color: #e4e7ff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .1);
}
.controls .speed-dropdown .menu-label { color: #9aa0c8; }
.controls .speed-dropdown .menu-item { color: #e4e7ff; }
.controls .speed-dropdown .menu-item:hover { background: rgba(255, 255, 255, .1); }
.controls .speed-dropdown .speed-option.active { background: rgba(255, 255, 255, .08); color: var(--player-hi); font-weight: 700; }
.ctl-btn.is-changed { color: var(--player-hi); }

/* ===== Playlist popup (watch page "Save" and Videos tab "Add to playlist") ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(10, 12, 30, .55); }
.modal-box {
  display: flex; flex-direction: column; width: min(520px, 100%); max-height: min(680px, 100%); overflow: hidden;
  border-radius: calc(var(--radius) + 6px); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.modal-title { font-size: 1.3rem; }
.modal-x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--slate); font-size: 1.8rem; line-height: 1; cursor: pointer; }
.modal-x:hover { background: var(--soft); color: var(--ink); }
.modal-x:focus-visible { outline: 2px solid var(--accent); }
.modal-sub { padding: 2px 24px 0; color: var(--slate); overflow-wrap: anywhere; }
.pl-view { display: flex; flex-direction: column; gap: 14px; min-height: 0; padding: 16px 24px 22px; overflow-y: auto; }
.pl-view[hidden] { display: none; }
.pl-list { display: grid; gap: 2px; max-height: min(340px, 42vh); overflow-y: auto; margin: 0 -10px; padding: 0 10px; }
.pl-row {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  width: 100%; padding: 13px 12px; border: 0; border-radius: var(--radius);
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.pl-row:hover { background: var(--soft); }
.pl-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pl-check {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  background: var(--paper); box-shadow: inset 0 0 0 2px var(--line); color: var(--accent-ink);
}
.pl-row.is-on .pl-check { background: linear-gradient(180deg, var(--accent-light), var(--accent)); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); }
.pl-name { font-size: 1.02rem; font-weight: 650; overflow-wrap: anywhere; }
.pl-meta { color: var(--slate); font-size: .85rem; }
.pl-empty { padding: 14px 4px; color: var(--slate); }
.pl-new-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 12px 6px; margin-top: -4px;
  border: 0; border-top: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer;
}
.pl-new-btn:hover { text-decoration: underline; }
.pl-new-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-plus {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--soft); color: var(--accent); font-size: 1.2rem; line-height: 1;
}
.pl-status { padding: 9px 14px; border-radius: var(--radius); background: var(--soft); font-size: .92rem; }
.pl-status.ok { background: color-mix(in srgb, #1a8a4a 14%, var(--paper)); box-shadow: inset 4px 0 0 #1a8a4a; }
.pl-status.bad { background: color-mix(in srgb, var(--danger) 12%, var(--paper)); box-shadow: inset 4px 0 0 var(--danger); }
.pl-status[hidden] { display: none; }
.pl-actions { display: flex; justify-content: flex-end; gap: 10px; }
.pl-picker select.input { width: 100%; }
@media (max-width: 480px) { .pl-view { padding: 14px 16px 18px; } .modal-head { padding: 16px 16px 0; } .modal-sub { padding: 2px 16px 0; } }

/* Visibility choices: the radio sits beside its text. (".field label" used to override the
   chip's own layout and stack the radio on top of the text.) */
.field label.radio-chip { display: flex; margin: 0; font-weight: inherit; }

/* New-playlist view: the three visibility choices sit in one compact row */
.pl-picker .visibility-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pl-picker .field label.radio-chip { gap: 8px; padding: 10px 12px; font-weight: 650; }
.pl-picker .radio-chip small { display: none; }
.pl-picker .radio-chip input { margin: 0; flex: none; }


/* ===== Comments: replies, like / dislike, the uploader's heart ===== */
.avatar.xs { width: 20px; height: 20px; font-size: .65rem; box-shadow: none; }
.comment-main { flex: 1; min-width: 0; }
.comment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; margin-left: -8px; }
.comment-actions button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 999px;
  background: transparent; color: var(--slate); font: inherit; font-size: .875rem; font-weight: 650; cursor: pointer;
}
.comment-actions button:hover { background: var(--soft); color: var(--ink); }
.comment-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.comment-actions .cm-vote.is-on { color: var(--accent); }
.comment-actions .cm-vote.is-on svg { fill: color-mix(in srgb, var(--accent) 25%, transparent); }
.cm-like-count { min-width: 1ch; font-variant-numeric: tabular-nums; }
.comment-actions .cm-heart svg { fill: transparent; }
.comment-actions .cm-heart.is-on { color: #e0245e; }
.comment-actions .cm-heart.is-on svg { fill: currentColor; }
.cm-hearted { position: relative; display: inline-flex; padding: 4px 8px; }
.cm-hearted-icon { position: absolute; right: 2px; bottom: 0; fill: #e0245e; stroke: var(--paper); stroke-width: 2.5; paint-order: stroke; }
.cm-reply-form { display: grid; gap: 8px; margin-top: 8px; }
.cm-reply-form .input { width: 100%; }
.cm-reply-actions { display: flex; justify-content: flex-end; gap: 8px; }
.cm-reply-actions .btn { padding: 8px 16px; }
.cm-replies-toggle {
  margin: 6px 0 0 -8px; padding: 6px 10px; border: 0; border-radius: 999px; background: transparent;
  color: var(--accent); font: inherit; font-size: .875rem; font-weight: 700; cursor: pointer;
}
.cm-replies-toggle:hover { background: var(--soft); }
.cm-replies-toggle[hidden], .comment-replies[hidden] { display: none; }
.comment-replies { margin-top: 4px; }
.comment.is-reply { border-top: 0; padding: 10px 0 4px; }

/* Comments: refresh + sort controls */
.comments-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.comments-tools { display: flex; align-items: center; gap: 8px; }
.comments-tools .icon-btn { width: 36px; height: 36px; }
.icon-btn:disabled { opacity: .6; cursor: default; }
.icon-btn.is-loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sort-item::before { content: ""; display: inline-block; width: 1.3em; }
.sort-item[aria-checked="true"] { font-weight: 700; color: var(--accent); }
.sort-item[aria-checked="true"]::before { content: "\2713"; }

/* Back / Forward buttons (only drawn inside the desktop window) */
.brand-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.desktop-nav { display: flex; gap: 6px; }
.desktop-nav .icon-btn { width: 34px; height: 34px; }

/* Channel names under videos are links */
.tile-meta .who a { text-decoration: none; }
.tile-meta .who a:hover { text-decoration: underline; color: var(--ink); }

/* Admin tools */
.cm-delete { border: 0; background: transparent; color: var(--slate); font: inherit; font-size: .85rem; font-weight: 650; cursor: pointer; padding: 6px 10px; border-radius: 999px; }
.cm-delete:hover { color: var(--danger); background: var(--soft); }

/* Admin: remove-a-video page and dashboard */
.admin-remove-card { display: flex; gap: 14px; align-items: center; margin: 16px 0; padding: 12px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-sm); }
.admin-remove-card img, .admin-remove-card .thumb-blank { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; }
.admin-remove-title { font-weight: 650; overflow-wrap: anywhere; }
.admin-all { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--soft); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.admin-card { display: grid; gap: 14px; align-content: start; padding: 16px; border-radius: 16px; background: var(--paper); box-shadow: var(--shadow-sm); transition: opacity .15s; }
.admin-card h2 { font-size: 1rem; }
.admin-card.is-loading { opacity: .55; }
.range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range .input { width: auto; min-width: 0; }
.range-custom { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-value { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.admin-pair { display: grid; gap: 10px; }
.admin-pair > div { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 8px; }
.admin-tag { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); min-width: 3.2em; }
.pair-name { overflow-wrap: anywhere; font-size: 1.15rem; }
.pair-name a { text-decoration: none; }
.pair-name a:hover { text-decoration: underline; }
.pair-value { color: var(--slate); font-size: .9rem; white-space: nowrap; }
.admin-label { color: var(--slate); font-size: .875rem; margin-top: 6px; }
.admin-note { color: var(--slate); font-size: .8rem; margin-top: 6px; }


/* Scheduled publishing (Your videos) */
.vis-scheduled { background: #fff3cf; color: #7a5a00; }
.vis-scheduled small { display: block; font-weight: 600; font-size: .72rem; }
.mv-sched { display: block; }
.mv-sched h3 { margin: 0 0 4px; }
.mv-sched-grid { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 10px 0 6px; }
.mv-sched-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .85rem; }
.mv-sched-grid input, .mv-sched-grid select { padding: 6px 8px; font: inherit; font-weight: 400; }
.mv-sched[hidden] { display: none; }
.mv-sched { box-shadow: 0 0 0 2px var(--accent, #3b4bff); }
