@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --bg: #f3f5f1;
  --glow: rgba(198, 239, 98, .72);
  --panel: #ffffff;
  --panel-2: #f7f8f4;
  --line: rgba(22, 28, 16, .1);
  --text: #171a16;
  --muted: #5d675c;
  --lime: #c6ef62;
  --ink: #17210c;
  --shadow: 0 14px 34px rgba(23, 26, 22, .07);
  --input: #f6f7f4;
  --input-line: #d5dccf;
  --icon-bg: #eef6d6;
  --icon-fg: #3d5610;
  --danger: #b42318;
  --bar: rgba(243, 245, 241, .9);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b10;
  --glow: rgba(199, 243, 107, .18);
  --panel: #151922;
  --panel-2: #10141c;
  --line: rgba(255, 255, 255, .1);
  --text: #f5f6f4;
  --muted: #9aa3b2;
  --lime: #c7f36b;
  --ink: #14200a;
  --shadow: 0 16px 40px rgba(0, 0, 0, .32);
  --input: #0d1118;
  --input-line: #2c3342;
  --icon-bg: #1c2614;
  --icon-fg: #d4f48a;
  --danger: #ffb4a8;
  --bar: rgba(9, 11, 16, .9);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(880px 380px at 8% -12%, var(--glow), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
.app-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bar);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 18px Manrope, sans-serif; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--lime);
  color: var(--ink);
}
.brand span span { font-weight: 500; color: var(--muted); }
.app-bar-side { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.theme-toggle, .text-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.theme-toggle:hover, .text-button:hover { border-color: #b7d85a; }
.login-view, .app-view { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 88px; }
.app-view.watching { width: min(1480px, calc(100% - 28px)); padding: 16px 0 20px; }
.app-view.watching #section-view { display: flex; flex-direction: column; align-items: flex-start; min-height: calc(100vh - 120px); }
.app-view.watching .section-head, .app-view.watching #section-body { width: 100%; }
.app-view.watching #section-title { font-size: 28px; margin: 0 0 12px; }
.latest-shelf { margin: 0 0 14px; }
.latest-shelf h2 { margin: 0 0 8px; font: 700 12px/1 Manrope, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.latest-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.latest-card { flex: 0 0 150px; display: grid; gap: 8px; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 8px; cursor: pointer; box-shadow: var(--shadow); }
.latest-card img, .latest-card .media-fallback { width: 100%; height: 190px; object-fit: cover; border-radius: 12px; background: var(--icon-bg); }
.latest-card span { font-size: 13px; font-weight: 700; line-height: 1.3; }
.login-card, .settings-card, .facts article {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.login-card { width: min(460px, 100%); margin: 18px auto; border-radius: 28px; padding: 34px; }
.home-head { margin-bottom: 8px; }
.home-label { margin: 22px 0 12px; font: 700 13px/1 Manrope, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.section-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.section-head h1 { margin: 0; }
.account-view #section-body { max-width: 860px; }
.facts strong { font: 700 22px/1.3 Manrope, sans-serif; }
.eyebrow { margin: 0; color: #6d8f16; letter-spacing: .16em; font-size: 11px; font-weight: 700; }
html[data-theme="dark"] .eyebrow { color: var(--lime); }
h1 { font: 700 42px/1.05 Manrope, sans-serif; letter-spacing: -1.5px; margin: 8px 0; }
.lede { color: var(--muted); line-height: 1.6; margin: 0 0 8px; }
label { display: grid; gap: 6px; margin: 12px 0; font-size: 12px; font-weight: 700; color: var(--text); }
input, .search {
  width: 100%;
  border: 1px solid var(--input-line);
  background: var(--input);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 500;
}
input:focus, .search:focus { outline: 3px solid rgba(198, 239, 98, .45); border-color: #b6dc55; }
.check { grid-template-columns: auto 1fr; align-items: center; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: #8fb82e; }
.primary {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 800;
  padding: 14px 16px;
  cursor: pointer;
}
.primary:disabled { opacity: .6; cursor: wait; }
.form-message { min-height: 18px; color: var(--danger); font-size: 13px; }
.form-message:empty { display: none; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.player-card {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px;
  min-height: 168px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.player-card:hover, .player-card:focus-visible {
  transform: translateY(-3px);
  border-color: #b7d85a;
  box-shadow: 0 18px 36px rgba(23, 26, 22, .12);
  outline: none;
}
.card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--icon-bg);
  color: var(--icon-fg);
}
.card-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.player-card-live .card-icon { background: var(--lime); color: var(--ink); }
.card-copy { display: grid; gap: 6px; }
.card-copy span { font: 700 22px/1.1 Manrope, sans-serif; letter-spacing: -.4px; }
.card-copy small { color: var(--muted); line-height: 1.45; font-size: 14px; }
.back-button { margin-bottom: 8px; }
.watch-layout {
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(280px, 1fr) minmax(340px, 1.05fr);
  gap: 12px;
  flex: 1;
  height: auto;
  min-height: 480px;
}
.watch-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.watch-pane > h2 {
  margin: 0 0 10px;
  font: 700 12px/1 Manrope, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.category-list, .item-list { display: grid; gap: 8px; align-content: start; overflow: auto; min-height: 0; flex: 1; padding-right: 4px; }
.category-list button, .item-list button, .episode {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.category-list button.active, .item-list button.active, .episode.active { border-color: #b7d85a; background: var(--icon-bg); }
.item-list button:hover, .episode:hover, .category-list button:hover { border-color: #b7d85a; }
.media-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.item-list .fav-toggle, .player-meta .fav-toggle { width: auto; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; box-shadow: none; }
.fav-toggle[aria-pressed="true"] { background: var(--lime); color: var(--ink); border-color: transparent; }
.media-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: center; }
.media-card.live-row { grid-template-columns: 42px minmax(0, 1fr); }
.media-card img, .media-fallback { width: 54px; height: 74px; object-fit: cover; border-radius: 10px; background: var(--icon-bg); }
.media-card img.logo-live, .media-fallback.logo-live { width: 42px; height: 42px; object-fit: contain; background: var(--panel); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.facts article, .settings-card { border-radius: 20px; padding: 18px; }
.facts span, .settings-card p { display: block; color: var(--muted); font-size: 12px; margin: 0 0 4px; }
.settings-card strong, .facts strong { display: block; margin-bottom: 12px; }
.search { margin: 0 0 10px; }
.player-dock { display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1; }
.player-frame { position: relative; background: #050608; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; }
.player-dock video { width: 100%; height: 100%; background: #050608; display: block; }
.player-placeholder { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 16px; text-align: center; color: #c5c8ce; }
.player-placeholder[hidden], .player-dock video[hidden] { display: none; }
.player-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.player-meta strong { min-width: 0; }
.empty { color: var(--muted); padding: 20px 0; }
h2 { font: 700 18px Manrope, sans-serif; margin: 18px 0 8px; }
@media (max-width: 1100px) {
  .watch-layout { grid-template-columns: 1fr; height: auto; }
  .category-list, .item-list { max-height: 280px; }
}
@media (max-width: 800px) {
  .card-grid, .facts { grid-template-columns: 1fr; }
  .app-bar { padding: 12px 16px; }
  .login-view, .app-view, .app-view.watching { width: min(100% - 28px, 1480px); }
  h1 { font-size: 32px; }
  .player-card { min-height: 0; flex-direction: row; align-items: center; gap: 14px; padding: 16px; }
  .card-copy span { font-size: 18px; }
}
