    :root {
      --bg: #0b0d12;
      --panel: #141821;
      --border: #232a38;
      --text: #e8edf5;
      --muted: #8b95a8;
      --accent: #e11d48;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }

    [hidden] { display: none !important; }

    html, body {
      height: 100%;
      height: 100dvh;
      background: var(--bg);
      color: var(--text);
      font-family: Inter, system-ui, sans-serif;
      overflow: hidden;
    }

    body {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: auto 1fr auto auto;
      min-height: 100%;
      min-height: 100dvh;
      min-width: 0;
    }

    header, footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      padding: 0.85rem clamp(0.75rem, 3vw, 1.25rem);
      background: var(--panel);
      border-bottom: 1px solid var(--border);
      min-width: 0;
    }

    footer {
      border-bottom: 0;
      border-top: 1px solid var(--border);
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: center;
    }

    .footer-actions {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-wrap: nowrap;
      gap: 0.45rem;
      min-width: 0;
    }

    .footer-actions .btn {
      white-space: nowrap;
    }

    .skip-wrap {
      position: relative;
      display: grid;
      min-width: 0;
    }

    .skip-wrap .btn {
      width: 100%;
    }

    .next-preview {
      position: fixed;
      z-index: 25;
      display: flex;
      align-items: center;
      gap: 0.7rem;
      width: min(22rem, calc(100vw - 1rem));
      padding: 0.55rem 0.7rem;
      border: 1px solid var(--border);
      border-radius: 0.55rem;
      background: var(--panel);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
      pointer-events: none;
    }

    .next-preview .video-thumb {
      width: 7.2rem;
      height: 4.05rem;
    }

    .next-preview-title {
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      font-size: 0.88rem;
    }

    .next-preview-channel {
      margin-top: 0.2rem;
      color: var(--muted);
      font-size: 0.75rem;
    }

    footer #next { justify-self: end; }

    .now-row {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 0.55rem;
      min-width: 0;
    }

    .disclaimer {
      padding: 0.4rem 1rem;
      padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
      background: var(--panel);
      border-top: 1px solid var(--border);
      color: var(--muted);
      font-size: 0.72rem;
      text-align: center;
      line-height: 1.35;
    }

    .install-link {
      display: inline;
      margin: 0;
      padding: 0;
      border: 0;
      background: none;
      color: var(--text);
      font: inherit;
      text-decoration: underline;
      cursor: pointer;
    }

    .install-panel {
      width: min(92%, 36rem);
    }

    .install-body {
      aspect-ratio: auto;
      padding: 1rem 1.1rem 1.15rem;
      background: var(--panel);
      display: grid;
      gap: 0.75rem;
    }

    .install-body p {
      color: var(--muted);
      font-size: 0.9rem;
    }

    .install-body pre {
      margin: 0;
      padding: 0.75rem 0.85rem;
      overflow-x: auto;
      border: 1px solid var(--border);
      border-radius: 0.4rem;
      background: #0b0d12;
      color: var(--text);
      font-size: 0.78rem;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .install-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 0.45rem;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 0.65rem;
      flex-shrink: 0;
    }

    .brand img {
      height: 2.85rem;
      width: auto;
      display: block;
    }

    h1 {
      font-size: 1.05rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .meta {
      color: var(--muted);
      font-size: 0.85rem;
    }

    #now-playing {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: var(--text);
      font-size: 0.95rem;
      font-weight: 600;
      letter-spacing: 0.01em;
    }

    #now-playing.is-grid-back {
      cursor: pointer;
    }

    .countdown:not([hidden]) {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-wrap: wrap;
      gap: 0.25rem 0.65rem;
      min-width: 0;
      font-size: 0.82rem;
      text-align: center;
    }

    .countdown-label {
      min-width: 0;
      color: var(--muted);
      overflow-wrap: anywhere;
    }

    .countdown-time {
      font-variant-numeric: tabular-nums;
      font-weight: 700;
      letter-spacing: 0.04em;
    }

    .player-wrap {
      position: relative;
      min-height: 0;
      min-width: 0;
      background: #000;
    }

    #player {
      position: relative;
      height: 100%;
    }

    #player > iframe, #player > .live-grid, .offline, #yt-mount, .live-frame iframe {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      border: 0;
    }

    .offline {
      display: grid;
      place-items: center;
      text-align: center;
      overflow: hidden;
      background: #000;
    }

    .offline canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      image-rendering: pixelated;
    }

    .offline::after {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background:
        repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.72) 100%);
      animation: scan 6s linear infinite;
    }

    .offline-label {
      position: relative;
      z-index: 1;
      padding: 0.85rem 1.2rem;
      border: 2px solid #e8edf5;
      background: rgba(0, 0, 0, 0.55);
      color: #e8edf5;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      animation: flicker 2.4s steps(2, end) infinite;
    }

    .offline-label strong {
      display: block;
      font-size: 1.15rem;
      margin-bottom: 0.25rem;
    }

    .offline-label span {
      display: block;
      font-size: 0.72rem;
      letter-spacing: 0.12em;
      opacity: 0.8;
    }

    @keyframes flicker {
      0%, 92%, 100% { opacity: 1; }
      93% { opacity: 0.35; }
      95% { opacity: 1; }
      97% { opacity: 0.15; }
    }

    @keyframes scan {
      from { transform: translateY(0); }
      to { transform: translateY(3px); }
    }

    .badge {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.25rem 0.6rem;
      border-radius: 999px;
      background: #1c2330;
      border: 1px solid var(--border);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      white-space: nowrap;
      flex-shrink: 0;
      font: inherit;
      font-size: 0.75rem;
      cursor: pointer;
    }

    .badge:hover { border-color: #71809d; }

    .badge.live {
      background: #481323;
      border-color: #fb7185;
      color: #fff1f2;
      box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18);
    }

    .badge.live::before {
      content: "";
      width: 0.45rem;
      height: 0.45rem;
      border-radius: 50%;
      background: var(--accent);
      box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.2);
    }

    .badge.live-waiting {
      animation: live-pulse 1.2s ease-in-out infinite;
    }

    @keyframes live-pulse {
      50% { box-shadow: 0 0 0 7px rgba(225, 29, 72, 0.4); }
    }

    #status[hidden] { display: none !important; }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      min-width: 0;
    }

    .header-actions #next {
      max-width: 20rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: var(--muted);
      font-size: 0.75rem;
      font-weight: 400;
      letter-spacing: 0;
    }

    .btn {
      background: #1c2330;
      color: var(--text);
      border: 1px solid var(--border);
      border-radius: 0.45rem;
      padding: 0.4rem 0.75rem;
      font: inherit;
      font-size: 0.8rem;
      cursor: pointer;
      white-space: nowrap;
    }

    .btn:hover, .btn[aria-expanded="true"] {
      border-color: #3a455c;
      background: #222a38;
    }

    .guide {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: none;
    }

    .guide.open { display: block; }

    .guide-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
    }

    .guide-panel {
      position: absolute;
      top: 0;
      right: 0;
      width: min(28rem, 100%);
      height: 100%;
      background: var(--panel);
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .guide-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 1rem 1.15rem;
      border-bottom: 1px solid var(--border);
    }

    .guide-head h2 {
      font-size: 0.95rem;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .guide-list {
      overflow: auto;
      padding: 0.75rem;
      display: grid;
      gap: 0.55rem;
    }

    .guide-item {
      padding: 0.75rem 0.85rem;
      border: 1px solid var(--border);
      border-radius: 0.55rem;
      background: #10141c;
    }

    .guide-item.on-air {
      border-color: #22c55e;
      box-shadow: inset 0 0 0 1px #22c55e;
    }

    .guide-sep {
      border: 0;
      border-top: 1px solid var(--border);
      margin: 0.45rem 0.15rem;
    }

    .guide-group {
      position: relative;
      display: grid;
      grid-template-columns: 4.5rem minmax(0, 1fr);
      gap: 0.65rem;
      align-items: start;
    }

    .guide-day-separator {
      margin: 1.1rem 0 0.55rem;
      padding-bottom: 0.35rem;
      border-bottom: 1px solid var(--border);
      color: var(--muted);
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .guide-time {
      position: sticky;
      top: 0.75rem;
      z-index: 1;
      padding-top: 0.75rem;
      color: var(--muted);
      font-size: 0.72rem;
      font-variant-numeric: tabular-nums;
      letter-spacing: 0.04em;
      text-align: right;
      text-transform: uppercase;
    }

    .guide-group-items {
      display: grid;
      gap: 0.55rem;
      min-width: 0;
      padding-left: 0.65rem;
      border-left: 1px solid var(--border);
    }

    .guide-item h3 {
      font-size: 0.95rem;
      margin-bottom: 0.25rem;
      overflow-wrap: anywhere;
    }

    .guide-item p {
      color: var(--muted);
      font-size: 0.8rem;
    }

    button.guide-item, a.guide-item {
      width: 100%;
      text-align: left;
      font: inherit;
      color: inherit;
      cursor: pointer;
      text-decoration: none;
    }

    article.guide-item { cursor: default; }

    button.guide-item:hover {
      border-color: #3a455c;
    }

    a.guide-item:hover {
      border-color: #3a455c;
    }

    .channel-item p a {
      color: var(--text);
      text-transform: capitalize;
    }

    .channel-item {
      display: flex;
      align-items: center;
      gap: 0.85rem;
    }

    .channel-item > span:last-child,
    .video-item > span:last-child {
      min-width: 0;
    }

    .channel-avatar {
      width: 3.25rem;
      height: 3.25rem;
      border-radius: 0.7rem;
      overflow: hidden;
      flex-shrink: 0;
      background: #1c2330;
      border: 1px solid var(--border);
      display: grid;
      place-items: center;
      color: var(--muted);
      font-weight: 700;
      font-size: 1.05rem;
      text-transform: uppercase;
    }

    .channel-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .channel-item h3 { margin-bottom: 0.15rem; }

    .video-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .video-thumb {
      width: 7.2rem;
      height: 4.05rem;
      border-radius: 0.4rem;
      overflow: hidden;
      flex-shrink: 0;
      background: #1c2330;
    }

    .video-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .video-item h3 {
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      overflow-wrap: anywhere;
    }

    .video-now {
      display: none;
      margin: 0.15rem 0 0.2rem;
      color: #fb7185;
      font-size: 0.7rem;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .video-item.now {
      border-color: #fb7185;
      box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.45);
    }

    .video-item.now .video-now { display: block; }

    .video-item.now:hover,
    .video-item.now:focus-visible {
      border-color: #fb7185;
      background: #10141c;
      box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.45);
      opacity: 1;
      filter: none;
    }

    .video-item.played {
      opacity: 0.52;
      filter: grayscale(0.75);
    }

    .video-item.played:hover,
    .video-item.played:focus-visible {
      opacity: 1;
      filter: none;
      border-color: #3a455c;
    }

    .btn:disabled {
      opacity: 0.45;
      cursor: default;
    }

    #live-probe {
      position: fixed;
      left: -9999px;
      top: 0;
      width: 2px;
      height: 2px;
      overflow: hidden;
      opacity: 0;
      pointer-events: none;
    }

    #live-probe iframe {
      position: static;
      width: 2px;
      height: 2px;
    }

    #unmute-btn {
      position: absolute;
      z-index: 5;
      inset: 0;
      width: 100%;
      height: 100%;
      border: 0;
      border-radius: 0;
      background: rgba(0, 0, 0, 0.45);
      font-size: 0.95rem;
    }

    #unmute-btn[hidden] { display: none !important; }

    .live-toast {
      position: fixed;
      z-index: 30;
      left: 50%;
      bottom: 6rem;
      transform: translateX(-50%);
      display: flex;
      align-items: center;
      gap: 0.65rem;
      max-width: min(28rem, calc(100% - 1.5rem));
      padding: 0.75rem 0.85rem 0.75rem 1rem;
      border: 1px solid #22c55e;
      border-radius: 0.55rem;
      background: #141821;
      color: var(--text);
      font-size: 0.88rem;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    }

    .live-toast[hidden] { display: none; }

    .live-toast-msg {
      flex: 1;
      min-width: 0;
      background: none;
      border: 0;
      color: inherit;
      font: inherit;
      text-align: left;
      cursor: pointer;
    }

    .live-toast-close {
      flex-shrink: 0;
      min-height: 2rem;
      padding: 0.25rem 0.55rem;
    }

    .live-grid {
      position: absolute;
      inset: 0;
      display: grid;
      gap: 2px;
      background: #000;
    }

    .live-n-1 { grid-template-columns: 1fr; }
    .live-n-2 { grid-template-columns: 1fr 1fr; }
    .live-n-3, .live-n-4 {
      grid-template-columns: 1fr 1fr;
      grid-template-rows: 1fr 1fr;
    }

    .live-cell {
      position: relative;
      min-height: 0;
      background: #000;
      transition: opacity 0.45s ease;
    }

    .live-n-6 {
      grid-template-columns: repeat(3, 1fr);
      grid-template-rows: 1fr 1fr;
    }

    .live-n-9 {
      grid-template-columns: repeat(3, 1fr);
      grid-template-rows: 1fr 1fr 1fr;
    }

    .live-cell .offline {
      position: absolute;
      inset: 0;
    }

    .live-cell .offline-label {
      padding: 0.45rem 0.6rem;
      letter-spacing: 0.12em;
    }

    .live-cell .offline-label strong {
      font-size: 0.78rem;
    }

    .live-cell .offline-label span {
      font-size: 0.62rem;
    }

    .live-grid.focused .live-cell:not(.is-focus) {
      opacity: 0;
      pointer-events: none;
    }

    .live-grid.focused .live-cell.is-focus {
      position: absolute;
      inset: 0;
      z-index: 4;
      opacity: 1;
    }

    .live-pick {
      position: absolute;
      inset: 0;
      z-index: 3;
      border: 0;
      margin: 0;
      padding: 0;
      background: transparent;
      cursor: pointer;
    }

    .live-grid.focused .live-pick { display: none; }

    .live-frame {
      position: absolute;
      inset: 0;
    }

    .live-label {
      position: absolute;
      z-index: 2;
      left: 0.45rem;
      top: 0.45rem;
      padding: 0.15rem 0.45rem;
      border-radius: 0.3rem;
      background: rgba(0, 0, 0, 0.65);
      font-size: 0.72rem;
      pointer-events: none;
    }

    @media (max-width: 960px) {
      header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 0.55rem 0.75rem;
      }

      .brand { grid-column: 1; grid-row: 1; }

      .header-actions {
        grid-column: 2;
        grid-row: 1;
        gap: 0.5rem;
        min-width: 0;
        overflow: hidden;
      }

      .header-actions #next {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        text-align: right;
      }

      .header-actions #status,
      .header-actions #guide-btn {
        flex: 0 0 auto;
      }

      .now-row {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-start;
      }

      footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.45rem;
      }

      .footer-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
      }

      .footer-actions .countdown {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
      }

      .footer-actions > #channels-btn,
      .footer-actions > #videos-btn,
      .footer-actions > #skip-wrap {
        grid-row: 1;
      }

      footer #next {
        width: 100%;
        max-width: none;
        text-align: center;
        justify-self: unset;
      }

      footer #next {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }

    @media (max-width: 720px) {
      header {
        gap: 0.45rem 0.65rem;
        padding: 0.6rem 0.75rem;
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
      }

      .brand { grid-column: 1; grid-row: 1; }

      .header-actions {
        grid-column: 2;
        grid-row: 1;
      }

      #now-playing {
        font-size: 0.78rem;
      }

      .countdown {
        font-size: 0.72rem;
        padding: 0.35rem 0.7rem;
        text-align: center;
      }



      h1 { font-size: 0.88rem; }

      .brand img { height: 2.35rem; }

      footer {
        padding: 0.55rem 0.7rem;
        padding-bottom: max(0.55rem, env(safe-area-inset-bottom));
        padding-left: max(0.7rem, env(safe-area-inset-left));
        padding-right: max(0.7rem, env(safe-area-inset-right));
      }

      footer #next {
        font-size: 0.72rem;
      }

      .disclaimer {
        font-size: 0.65rem;
        padding: 0.35rem 0.7rem;
        padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
      }

      .btn {
        min-height: 2.55rem;
        padding: 0.5rem 0.65rem;
      }

      .footer-actions .btn {
        flex: 1 1 0;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.72rem;
        padding: 0.5rem 0.4rem;
      }

      .guide-panel {
        width: 100%;
        height: min(90dvh, 100%);
        top: auto;
        bottom: 0;
        border-left: 0;
        border-top: 1px solid var(--border);
        border-radius: 0.9rem 0.9rem 0 0;
      }

      .guide-item h3 { font-size: 0.88rem; }

      .offline-label {
        margin: 0 1rem;
        letter-spacing: 0.1em;
      }

      .live-n-2 {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
      }
    }

    @media (max-width: 380px) {
      header {
        gap: 0.3rem 0.4rem;
        padding-left: max(0.5rem, env(safe-area-inset-left));
        padding-right: max(0.5rem, env(safe-area-inset-right));
      }
      .brand { gap: 0.35rem; }
      .brand img { height: 2.05rem; }
      h1 { font-size: 0.72rem; letter-spacing: 0.02em; }

      .header-actions { gap: 0.3rem; }
      .header-actions .btn,
      .header-actions .badge {
        min-height: 2.2rem;
        font-size: 0.62rem;
        padding-left: 0.4rem;
        padding-right: 0.4rem;
      }

      .footer-actions { gap: 0.3rem; }
      .footer-actions .btn {
        font-size: 0.66rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
      }
    }

    .modal {
      position: absolute;
      inset: 0;
      z-index: 20;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .modal[hidden] {
      display: none;
    }
    .modal-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.85);
    }
    .modal-panel {
      position: relative;
      background: #111;
      border: 1px solid #333;
      border-radius: 6px;
      width: min(92%, 960px);
      max-height: 92%;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .modal-head {
      position: relative;
      z-index: 2;
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px;
      background: #1a1a1a;
      border-bottom: 1px solid #333;
      font-size: 0.95rem;
    }
    .modal-title {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding-right: 8px;
    }
    .modal-body {
      position: relative;
      flex: 1;
      min-height: 0;
      aspect-ratio: 16 / 9;
      background: #000;
    }
    .modal-body > div {
      width: 100%;
      height: 100%;
    }
