:root {
      color-scheme: dark;
      --bg: #050505;
      --nav: #090909;
      --surface: #111;
      --surface-2: #1f1f1f;
      --line: rgba(255,255,255,.12);
      --text: #fff;
      --muted: #a7a7a7;
      --danger: #ff7b7b;
      --radius: 8px;
      --container: min(1540px, calc(100% - 48px));
    }

    * { box-sizing: border-box; }
    [hidden] { display: none !important; }

    body {
      margin: 0;
      min-height: 100dvh;
      overflow-x: hidden;
      background: var(--bg);
      color: var(--text);
      font: 16px/1.5 Arial, Helvetica, sans-serif;
      -webkit-text-size-adjust: 100%;
    }

    .skip-link {
      position: fixed;
      top: 10px;
      left: 10px;
      z-index: 100;
      transform: translateY(-140%);
      border-radius: var(--radius);
      background: #fff;
      color: #111;
      padding: 10px 12px;
      font-weight: 900;
      text-decoration: none;
    }

    .skip-link:focus {
      transform: translateY(0);
      outline: 0;
      box-shadow: 0 0 0 3px rgba(255,255,255,.25);
    }

    header {
      position: sticky;
      top: 0;
      z-index: 20;
      background: rgba(9,9,9,.96);
      border-bottom: 1px solid var(--line);
      backdrop-filter: blur(12px);
    }

    .nav-inner, main {
      width: var(--container);
      margin: 0 auto;
    }

    .nav-inner {
      display: flex;
      flex-wrap: wrap;
      gap: 18px 30px;
      align-items: center;
      justify-content: space-between;
      min-height: 92px;
      padding: 16px 0;
    }

    .brand {
      display: grid;
      gap: 2px;
      flex: 0 1 320px;
      min-width: 210px;
      color: var(--text);
      text-decoration: none;
      font-weight: 900;
    }

    .brand-kicker {
      color: var(--muted);
      font-size: 12px;
      font-weight: 800;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .brand-title {
      font-size: clamp(21px, 1.7vw, 30px);
      line-height: 1.05;
      overflow-wrap: anywhere;
    }

    .top-search {
      position: relative;
      flex: 0 1 clamp(320px, 29vw, 520px);
      min-width: 280px;
      max-width: 520px;
    }

    .top-search input {
      width: 100%;
      min-height: 50px;
      border: 0;
      border-radius: var(--radius);
      background: #1f1f1f;
      color: var(--text);
      padding: 0 18px 0 18px;
      font-size: 16px;
      font-weight: 650;
      outline: none;
      appearance: none;
      -webkit-appearance: none;
    }

    .suggestions {
      position: absolute;
      inset-inline: 0;
      top: calc(100% + 8px);
      z-index: 30;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #111;
      box-shadow: 0 18px 48px rgba(0,0,0,.45);
      overflow: hidden;
    }

    .suggestion {
      display: grid;
      grid-template-columns: 42px minmax(0,1fr);
      gap: 10px;
      width: 100%;
      min-height: 58px;
      padding: 8px 10px;
      border: 0;
      border-bottom: 1px solid var(--line);
      background: transparent;
      color: var(--text);
      text-align: left;
      cursor: pointer;
    }

    .suggestion img {
      width: 42px;
      aspect-ratio: 2 / 3;
      object-fit: cover;
      border-radius: 4px;
      background: #222;
    }

    .suggestion strong, .suggestion span { display: block; }
    .suggestion span { color: var(--muted); font-size: 12px; }

    .nav-links {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: clamp(16px, 1.65vw, 30px);
      flex: 1 0 max-content;
      min-width: max-content;
      white-space: nowrap;
      font-size: 15px;
      font-weight: 900;
      text-transform: uppercase;
    }

    button {
      min-height: 44px;
      border: 0;
      border-radius: 7px;
      background: #fff;
      color: #111;
      padding: 0 14px;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
      touch-action: manipulation;
    }

    button:focus-visible, input:focus, select:focus {
      outline: 0;
      box-shadow: 0 0 0 3px rgba(255,255,255,.18);
    }

    .nav-links button {
      flex: 0 0 auto;
      padding: 0;
      background: transparent;
      color: var(--text);
    }

    .nav-links button.active { text-decoration: underline; text-underline-offset: 6px; }

    main { padding: 28px 0 44px; }

    .player-shell {
      width: min(1160px, 100%);
      margin: 0 auto 28px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #111;
      overflow: hidden;
    }

    .player-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
    }

    .player-meta { min-width: 0; }
    .player-meta strong, .player-meta span { display: block; }
    .player-meta span { color: var(--muted); font-size: 12px; }

    .player-watch {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      min-height: 0;
      background: #0a0a0a;
    }

    .player-watch.has-episodes {
      grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
    }

    .player-video {
      min-width: 0;
      background: #000;
    }

    iframe {
      display: block;
      width: 100%;
      aspect-ratio: 16 / 9;
      min-height: 220px;
      border: 0;
      background: #000;
    }

    .player-episodes {
      min-width: 0;
      max-height: min(72dvh, 760px);
      border-left: 1px solid var(--line);
      background: #161616;
      overflow: hidden;
    }

    .player-episodes-head {
      position: sticky;
      top: 0;
      z-index: 1;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-height: 58px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
      background: #161616;
    }

    .player-episodes-head strong {
      font-size: 15px;
      line-height: 1.2;
    }

    .player-episodes-head select {
      min-height: 40px;
      max-width: 160px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: #101010;
      color: var(--text);
      padding: 0 10px;
      font: inherit;
      font-weight: 850;
    }

    .player-episode-list {
      max-height: calc(min(72dvh, 760px) - 58px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .player-episode-list button {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
      gap: 10px;
      width: 100%;
      min-height: 58px;
      border: 0;
      border-bottom: 1px solid var(--line);
      border-radius: 0;
      background: transparent;
      color: var(--muted);
      padding: 10px 12px;
      text-align: left;
    }

    .player-episode-list button::before {
      content: "";
      width: 0;
      height: 0;
      border-top: 6px solid transparent;
      border-bottom: 6px solid transparent;
      border-left: 8px solid currentColor;
    }

    .player-episode-list button.active {
      background: #fff;
      color: #111;
    }

    .player-episode-list strong {
      display: block;
      color: inherit;
      line-height: 1.25;
    }

    .player-episode-list span {
      display: block;
      color: inherit;
      opacity: .72;
      font-size: 12px;
      line-height: 1.35;
      margin-top: 2px;
    }

    .player-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
    }

    .player-actions button, .player-actions select, .detail-actions button, .genre-chip {
      min-height: 36px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: #1b1b1b;
      color: var(--text);
      padding: 0 10px;
      font-weight: 800;
    }

    .page-head {
      display: grid;
      gap: 14px;
      margin-bottom: 20px;
    }

    .filters {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      overflow-x: auto;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }

    .filters::-webkit-scrollbar { display: none; }

    .genre-chip.active {
      background: #fff;
      color: #111;
    }

    .section {
      margin-bottom: 34px;
    }

    .section-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 12px;
    }

    .section-head h2 {
      margin: 0;
      font-size: clamp(20px, 2vw, 28px);
    }

    .rail {
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: minmax(150px, 180px);
      gap: 18px;
      overflow-x: auto;
      padding: 2px 0 14px;
      scroll-snap-type: x proximity;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }

    .rail::-webkit-scrollbar { display: none; }

    .grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
      gap: 20px;
    }

    .card {
      display: grid;
      gap: 10px;
      min-width: 0;
      border: 0;
      background: transparent;
      color: var(--text);
      padding: 0;
      text-align: left;
      scroll-snap-align: start;
    }

    .card:hover { transform: translateY(-2px); }

    .poster {
      width: 100%;
      aspect-ratio: 2 / 3;
      border-radius: var(--radius);
      background: linear-gradient(145deg, #252525, #101010);
      object-fit: cover;
      box-shadow: 0 16px 34px rgba(0,0,0,.36);
    }

    .poster-fallback {
      display: grid;
      place-items: center;
      color: var(--muted);
      font-size: 13px;
      font-weight: 800;
    }

    .card strong {
      display: block;
      color: var(--text);
      font-size: 15px;
      line-height: 1.25;
    }

    .card span {
      display: block;
      color: var(--muted);
      font-size: 12px;
    }

    .message { color: var(--muted); padding: 12px 0; }
    .error { color: var(--danger); }

    .modal {
      position: fixed;
      inset: 0;
      z-index: 60;
      display: grid;
      place-items: center;
      padding: 22px;
      background: rgba(0,0,0,.78);
    }

    .modal-card {
      width: min(1040px, 100%);
      max-height: calc(100dvh - 44px);
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: #111;
    }

    .modal-hero {
      min-height: 250px;
      background: #181818 center / cover no-repeat;
      display: grid;
      align-items: end;
      padding: 20px;
      position: relative;
    }

    .modal-hero::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, transparent, rgba(0,0,0,.82));
    }

    .modal-title {
      position: relative;
      display: grid;
      gap: 8px;
    }

    .modal-title h2 { margin: 0; font-size: clamp(26px, 4vw, 44px); }

    .modal-body {
      display: grid;
      gap: 16px;
      padding: 20px;
    }

    .detail-actions, .episode-tools {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      align-items: center;
    }

    .detail-actions .primary {
      background: #fff;
      color: #111;
    }

    .meta-line, .cast-line {
      color: var(--muted);
      font-size: 14px;
    }

    .overview {
      max-width: 780px;
      color: #ddd;
      line-height: 1.65;
    }

    .episode-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 8px;
    }

    .episode-list button {
      min-height: 42px;
      border: 1px solid var(--line);
      background: #1b1b1b;
      color: var(--text);
      text-align: left;
    }

    @media (max-width: 1320px) {
      .nav-inner {
        display: grid;
        grid-template-columns: minmax(210px, 1fr) max-content;
        min-height: auto;
        gap: 14px 18px;
      }
      .brand { min-width: 0; }
      .top-search {
        grid-column: 1 / -1;
        grid-row: 2;
        width: min(640px, 100%);
        max-width: none;
        min-width: 0;
      }
      .nav-links {
        justify-content: flex-end;
        overflow-x: auto;
        padding: 2px 0 6px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
      }
      .nav-links::-webkit-scrollbar { display: none; }
    }

    @media (max-width: 860px) {
      :root { --container: min(100% - 28px, 760px); }
      .nav-inner {
        grid-template-columns: 1fr;
        padding: 14px 0;
      }
      .brand-title { font-size: 24px; }
      .brand-kicker { font-size: 11px; }
      .top-search {
        grid-column: auto;
        width: 100%;
      }
      .top-search input { min-height: 48px; font-size: 16px; }
      .nav-links {
        justify-content: flex-start;
        gap: 18px;
        width: 100%;
        min-width: 0;
        font-size: 13px;
      }
      main { padding-top: 18px; }
      .player-head {
        align-items: stretch;
        flex-direction: column;
      }
      .player-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
      }
      .player-actions select,
      .player-actions button {
        width: 100%;
      }
      .grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 16px; }
      .rail { grid-auto-columns: minmax(140px, 160px); gap: 14px; }
      .player-watch.has-episodes {
        grid-template-columns: 1fr;
      }
      .player-episodes {
        max-height: none;
        border-left: 0;
        border-top: 1px solid var(--line);
      }
      .player-episode-list {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(210px, 70vw);
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
      }
      .player-episode-list::-webkit-scrollbar { display: none; }
      .player-episode-list button {
        min-height: 74px;
        border-right: 1px solid var(--line);
        scroll-snap-align: start;
      }
      .detail-actions,
      .episode-tools {
        display: grid;
        grid-template-columns: 1fr 1fr;
      }
      .detail-actions button,
      .episode-tools select {
        width: 100%;
      }
    }

    @media (max-width: 520px) {
      :root { --container: min(100% - 20px, 480px); }
      .nav-inner { gap: 12px; }
      .brand-title { font-size: 21px; }
      .top-search input {
        min-height: 46px;
        padding-inline: 14px;
        font-size: 16px;
      }
      .suggestions {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 132px;
        max-height: min(420px, calc(100dvh - 148px));
        overflow-y: auto;
      }
      .nav-links {
        gap: 10px;
        font-size: 12px;
      }
      .nav-links button { min-height: 40px; }
      .player-shell {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        width: calc(100% + 20px);
        margin-left: -10px;
      }
      iframe { min-height: 210px; }
      .player-episodes-head {
        align-items: stretch;
        flex-direction: column;
      }
      .player-episodes-head select {
        width: 100%;
        max-width: none;
      }
      .player-episode-list {
        grid-auto-columns: minmax(190px, 78vw);
      }
      .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
      .rail { grid-auto-columns: minmax(132px, 46vw); }
      .filters {
        flex-wrap: nowrap;
        margin-inline: -10px;
        padding-inline: 10px;
      }
      .genre-chip {
        flex: 0 0 auto;
      }
      .card strong { font-size: 13px; }
      .card span { font-size: 11px; }
      .modal { padding: 0; }
      .modal-card {
        width: 100%;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
      }
      .modal-hero {
        min-height: 210px;
      }
      .modal-body {
        padding: 16px;
      }
      .detail-actions,
      .episode-tools {
        grid-template-columns: 1fr;
      }
      .episode-list {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 340px) {
      .grid { grid-template-columns: 1fr; }
    }
  
