/* Parseable size/position defaults; existing styles override these on modern engines. */
html, body { background: #080d12; }
.gallery { width: 100%; max-width: 1800px; padding: 16px; grid-gap: 16px; }
.tv-grid, .radio-grid { grid-gap: 16px; }
.radio-item { background: #16212a; padding: 8px; }
.radio-mn { font-size: 20px; }
.player { top: 0; right: 0; bottom: 0; left: 0; }
.close-player { top: 18px; left: 18px; }
.fullscreen-player { top: 18px; right: 18px; }
.channel-play, .player-message { top: 0; right: 0; bottom: 0; left: 0; }
.webview-legacy .remote-focus, .webview-legacy .channel:focus,
.webview-legacy .radio-item:focus, .webview-legacy .icon-button:focus {
  outline: 3px solid #67d9e8; outline-offset: 3px;
}
.webview-legacy .radio-item:focus, .webview-legacy .radio-item.remote-focus { background: #24434d; border-color: #a5eff6; }
.webview-legacy .channel:focus .channel-play, .webview-legacy .channel.remote-focus .channel-play { opacity: 1; }
.webview-legacy .radio-item.is-playing::after { background: #67d9e8; }
.webview-legacy .radio-item.is-loading::after { border-color: rgba(103,217,232,.24); border-top-color: #67d9e8; }
.webview-legacy .channel-play, .webview-legacy .player-message,
.webview-legacy .icon-button { display: flex; align-items: center; justify-content: center; }

/* WebView before CSS Grid: same two-TV/ten-radio hierarchy without vertical scrolling. */
@supports not (display: grid) {
  .gallery, .tv-grid, .radio-grid { gap: 0 !important; grid-gap: 0 !important; }
  .gallery { display: flex; flex-direction: column; }
  .tv-grid { display: flex; flex: 2.8 1 0%; margin-bottom: 16px; }
  .channel { flex: 1 1 0%; width: 0; height: 100%; }
  .channel + .channel { margin-left: 16px; }
  .audio-list-container { flex: 1 1 0%; }
  .radio-grid { display: flex; flex-wrap: wrap; align-content: stretch; }
  .radio-item { display: flex; align-items: center; justify-content: center; width: calc(20% - 12.8px); height: calc(50% - 8px); margin-right: 16px; }
  .radio-item:nth-child(5n) { margin-right: 0; }
  .radio-item:nth-child(-n+5) { margin-bottom: 16px; }
  @media (orientation: portrait) {
    .gallery { padding: 14px; }
    .tv-grid { flex: 2.2 1 0%; flex-direction: column; margin-bottom: 12px; }
    .channel { width: 100%; height: 0; }
    .channel + .channel { margin-left: 0; margin-top: 12px; }
    .radio-item { width: calc(20% - 4.8px); height: calc(50% - 3px); margin-right: 6px; }
    .radio-item:nth-child(5n) { margin-right: 0; }
    .radio-item:nth-child(-n+5) { margin-bottom: 6px; }
  }
  @media (orientation: landscape) and (max-height: 600px) {
    .gallery { flex-direction: row; padding: 12px 14px 10px; }
    .tv-grid { flex: 1.7 1 0%; flex-direction: column; margin-bottom: 0; margin-right: 16px; }
    .channel { width: 100%; height: 0; }
    .channel + .channel { margin-left: 0; margin-top: 10px; }
    .radio-item { width: calc(25% - 6px); height: calc(33.3333% - 5.3333px); margin-right: 8px; margin-bottom: 8px; }
    .radio-item:nth-child(n) { margin-bottom: 8px; }
    .radio-item:nth-child(5n) { margin-right: 8px; }
    .radio-item:nth-child(4n) { margin-right: 0; }
    .radio-item:nth-child(n+9) { margin-bottom: 0; }
  }
  @media (orientation: landscape) and (max-width: 640px) {
    .radio-item { width: calc(33.3333% - 4px); height: calc(25% - 4.5px); margin-right: 6px; margin-bottom: 6px; }
    .radio-item:nth-child(n) { margin-bottom: 6px; }
    .radio-item:nth-child(4n), .radio-item:nth-child(5n) { margin-right: 6px; }
    .radio-item:nth-child(3n) { margin-right: 0; }
    .radio-item:nth-child(n+9) { margin-bottom: 6px; }
    .radio-item:nth-child(n+10) { margin-bottom: 0; }
  }
}
