:root {
  --bg: #0b141c;
  --ink: #e7f1ec;
  --muted: #93a8a4;
  --faint: #6d827e;
  --line: rgba(214, 228, 223, 0.14);
  --surface: rgba(12, 22, 30, 0.72);
  --surface-strong: rgba(16, 28, 38, 0.92);
  --accent: #7eb8c9;
  --accent-rgb: 126, 184, 201;
  --moon: #f4efe4;
  --reed: #8eae96;
  --danger: #e7b1b6;
  --display: "Fraunces", "Palatino Linotype", Palatino, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --script: "Caveat", "Segoe Script", cursive;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 340;
  background: var(--bg);
  letter-spacing: 0.01em;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.shore {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.shore-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 420px at 70% -10%, rgba(var(--accent-rgb), 0.14), transparent 60%),
    linear-gradient(180deg, #121c28 0%, #0d1822 46%, #0a141c 100%);
}

#app { min-height: 100%; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px 12vh;
}
.login-card {
  width: min(420px, 100%);
  padding: 36px 34px 30px;
  border-radius: 28px;
  background: rgba(10, 18, 26, 0.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.login-mark {
  width: 42px;
  height: 42px;
}
.login-card h1 {
  font-family: var(--display);
  font-weight: 520;
  font-size: 46px;
  margin: 10px 0 0;
  letter-spacing: -0.03em;
}
.login-card .lede {
  margin: 4px 0 22px;
  color: var(--muted);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { color: var(--faint); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.field input, .field textarea, .text-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
.field input:focus, .field textarea:focus, .text-input:focus {
  border-color: rgba(var(--accent-rgb), 0.7);
}
.primary, .ghost, .icon-btn, .tab, .platform-tab, .nav-link, .swatch {
  border: 0;
  background: transparent;
}
.primary {
  width: 100%;
  margin-top: 6px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #102028;
  font-weight: 560;
}
.primary:disabled { opacity: 0.6; cursor: wait; }
.form-error { min-height: 1.2em; color: var(--danger); margin: 0 0 8px; font-size: 14px; }

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 14px;
  background: rgba(7, 14, 20, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 16px;
}
.brand svg { width: 36px; height: 36px; flex: none; }
.brand h1 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 520;
  margin: 0;
  letter-spacing: -0.03em;
}
.brand p { margin: 0; color: var(--muted); font-family: var(--script); font-size: 20px; line-height: 1; }
.who {
  margin: 0 8px 14px;
  color: var(--faint);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-label {
  margin: 14px 10px 6px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.nav-link, .channel-row, .act, .settings-btn, .watch-btn, .playlist-row {
  border: 0;
  background: transparent;
  color: inherit;
}
.nav-link, .channel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: 12px;
  color: var(--muted);
}
.nav-link:hover, .nav-link.is-active {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}
.channel-row {
  appearance: none;
  border: 1px solid transparent;
  color: var(--muted);
}
.channel-row:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
}
.channel-row.is-active {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}
.channel-row.is-live {
  color: var(--ink);
}
.channel-row.is-live .live-name { color: #f0b4bc; }
.nav-link span, .count {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
}
.platform-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 8px 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}
.platform-tab {
  border-radius: 999px;
  padding: 7px 8px;
  color: var(--muted);
}
.platform-tab.is-active {
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--ink);
}
.channel-search {
  margin: 0 4px 8px;
}
.channel-scroll {
  overflow: auto;
  padding-right: 2px;
  flex: 1;
}
.channel-row img, .avatar, .mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  flex: none;
}
.channel-row .meta { min-width: 0; }
.channel-row strong, .card-title {
  display: block;
  font-weight: 460;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-row em {
  display: block;
  font-style: normal;
  color: var(--faint);
  font-size: 12px;
}
.live-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef6d7a;
  box-shadow: 0 0 0 0 rgba(239, 109, 122, 0.6);
  animation: pulse 1.8s ease-out infinite;
  flex: none;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 6px rgba(239, 109, 122, 0); }
}
.sidebar-foot {
  display: flex;
  gap: 8px;
  padding-top: 10px;
}
.ghost {
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  border: 1px solid var(--line);
}
.ghost:hover { color: var(--ink); border-color: rgba(var(--accent-rgb), 0.45); }
.mini-form { display: flex; gap: 6px; padding: 0 8px 8px; }
.mini-form input { flex: 1; border-radius: 10px; border: 1px solid var(--line); background: transparent; padding: 7px 10px; }

.main {
  min-width: 0;
  padding: 28px 34px 64px;
}
.page-kicker {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
}
.page-title {
  font-family: var(--display);
  font-weight: 520;
  font-size: clamp(36px, 4vw, 58px);
  letter-spacing: -0.035em;
  margin: 4px 0 8px;
}
.page-title em { font-style: italic; font-weight: 520; }
.lede { color: var(--muted); max-width: 46rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 28px 0 12px;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 520;
  font-size: 28px;
  margin: 0;
}

.grid, .live-grid {
  display: grid;
  gap: 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 232px);
  gap: 14px;
  justify-content: start;
}
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 280px);
  gap: 14px;
  justify-content: start;
}

.card {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(10, 18, 26, 0.55);
  border: 1px solid var(--line);
}
.card-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16/9;
  background: #101820 center/cover no-repeat;
}
.card-time, .pill {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 12px;
}
.pill.live { left: 8px; right: auto; bottom: auto; top: 8px; background: #c44755; }
.card-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.55);
}
.card-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.media-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 760px;
}
.media-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 6px;
  border-radius: 12px;
}
.media-row:hover { background: rgba(255, 255, 255, 0.035); }
.media-row .card-thumb {
  width: 168px;
  border-radius: 8px;
  overflow: hidden;
}
.media-copy { min-width: 0; }
.media-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 460;
}
.media-row .card-sub { margin-top: 2px; }
.media-row .card-actions {
  margin-top: 6px;
  background: transparent;
  padding: 0;
}
.card-body { padding: 10px 12px 12px; }
.card-title { font-size: 14px; line-height: 1.35; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-sub { color: var(--faint); font-size: 12px; margin-top: 4px; }
.card-actions {
  display: flex;
  gap: 2px;
  width: fit-content;
  margin-top: 8px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}
.act, .settings-btn, .watch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--faint);
}
.act {
  width: 28px;
  height: 26px;
  border-radius: 999px;
}
.act svg, .settings-btn svg, .watch-btn svg { width: 15px; height: 15px; display: block; }
.act:hover, .act.is-on, .watch-btn:hover, .watch-btn.is-on {
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
}
.pill.scheduled {
  left: 8px;
  right: auto;
  bottom: auto;
  top: 8px;
  max-width: calc(100% - 16px);
  background: rgba(18, 28, 38, 0.88);
  color: var(--moon);
}

.profile-banner {
  height: 280px;
  margin: -28px -34px 0;
  background: #14202a center/cover no-repeat;
  position: relative;
}
.profile-banner.empty {
  background:
    radial-gradient(500px 180px at 20% 40%, rgba(var(--accent-rgb), 0.35), transparent 70%),
    linear-gradient(180deg, #1a2a36, #101920);
}
.profile-fade {
  position: absolute;
  inset: auto 0 0 0;
  height: 140px;
  background: linear-gradient(transparent, #0c1620 92%);
}
.profile-id {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  margin-top: -54px;
  position: relative;
}
.profile-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.profile-nameblock { min-width: 0; }
.avatar-ring {
  width: 96px;
  height: 96px;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), rgba(255, 255, 255, 0.35));
  flex: none;
}
.avatar-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid #0c1620; }
.profile-id h1 {
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 42px);
  margin: 0;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kicker { margin: 0 0 4px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; }
.stat-row { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; justify-content: flex-end; }
.stat {
  min-width: 108px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(8, 14, 20, 0.72);
  border: 1px solid var(--line);
}
.stat b { display: block; font-family: var(--display); font-size: 20px; font-weight: 520; }
.stat span { color: var(--muted); font-size: 12px; }
.live-preview { margin: 18px 0 8px; }
.live-preview .live-caption { margin: 8px 2px 0; color: var(--muted); }
.tabs { display: flex; gap: 8px; margin: 8px 0 16px; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid transparent;
}
.tab.is-active { color: var(--ink); border-color: rgba(var(--accent-rgb), 0.45); background: rgba(var(--accent-rgb), 0.1); }

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-areas:
    "title title"
    "sub sub"
    "player captions"
    "now now"
    "actions actions";
  column-gap: 14px;
  row-gap: 8px;
  align-items: stretch;
}
.watch-title { grid-area: title; margin: 0; font-size: clamp(26px, 3vw, 36px); }
.watch-sub { grid-area: sub; margin: 0 0 4px; }
.act.is-on[data-act="favorite"] svg path,
.watch-btn.is-on[data-act="favorite"] svg path { fill: currentColor; }
.playlist-row { text-decoration: none; }
.player-shell { grid-area: player; }
.watch-actions { grid-area: actions; align-self: start; }
.transcript { grid-area: captions; }
.player-shell {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 16px;
  overflow: hidden;
  background: #05080c;
  border: 1px solid var(--line);
}
.player-shell.is-twitch #player-frame {
  bottom: -78px;
}
.player-frame, #player-frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-frame iframe, #player-frame iframe { width: 100%; height: 100%; border: 0; }
.caption-now {
  grid-area: now;
  margin: 0;
  min-height: 1.6em;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}
.watch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.watch-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 20, 0.55);
  font-size: 13px;
}
.transcript {
  min-height: 220px;
  height: 100%;
  overflow: auto;
  padding: 8px;
  border-radius: 16px;
  background: rgba(8, 16, 22, 0.55);
  border: 1px solid var(--line);
}
.settings-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.settings-btn svg { width: 18px; height: 18px; }
.playlist-row {
  display: flex;
  width: min(520px, 100%);
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.sign-out-row { margin-top: 8px; }
.transcript header { padding: 8px 8px 12px; }
.transcript select, select.slim {
  width: 100%;
  margin-top: 6px;
  background: #101820;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}
.cue {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}
.cue.is-active { background: rgba(var(--accent-rgb), 0.14); color: var(--ink); }
.cue time { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.notice { color: var(--muted); font-size: 14px; padding: 8px; }

.settings { display: grid; gap: 22px; max-width: 860px; }
.panel {
  padding: 18px;
  border-radius: 22px;
  background: rgba(10, 18, 26, 0.62);
  border: 1px solid var(--line);
}
.panel h2 { font-family: var(--display); font-weight: 520; margin: 0 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
}
.swatch.is-active { border-color: var(--moon); }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 46px; height: 34px; border: 0; background: transparent; padding: 0; }
.channel-admin { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.channel-admin .grow { flex: 1; min-width: 0; }
.preview-card { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.row-actions { display: flex; gap: 8px; }
.empty {
  padding: 28px 8px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 28px;
  font-weight: 520;
}
.back { color: var(--muted); font-size: 14px; }
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  z-index: 5;
  padding: 20px;
}
.modal {
  width: min(420px, 100%);
  padding: 18px;
  border-radius: 20px;
  background: #121c26;
  border: 1px solid var(--line);
}
.modal button.block {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
.modal button.block:hover { background: rgba(var(--accent-rgb), 0.12); }
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(12, 20, 28, 0.92);
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  z-index: 6;
}
.loading { color: var(--muted); padding: 24px 0; font-family: var(--display); font-size: 28px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .channel-scroll { max-height: 240px; }
  .profile-copy { flex-direction: column; align-items: flex-start; }
  .stat-row { flex-wrap: wrap; justify-content: flex-start; }
  .watch-layout { grid-template-columns: 1fr; grid-template-areas: "title" "sub" "player" "now" "actions" "captions"; }
  .transcript { max-height: 360px; }
  .main { padding: 20px 16px 48px; }
  .media-row { grid-template-columns: 132px minmax(0, 1fr); gap: 10px; }
  .media-row .card-thumb { width: 132px; }
  .profile-banner { margin: -20px -16px 0; height: 200px; }
  .profile-id h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-pip { animation: none; }
}
