:root {
  color-scheme: dark;
  --background: #05080b;
  --surface: #14212b;
  --focus: #55d5e9;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { min-height: 100vh; min-height: 100dvh; margin: 0; background: var(--background); }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.gallery {
  width: min(100%, 1440px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 44px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: clamp(14px, 2.4vw, 32px);
}

.channel {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 2px solid #26343c;
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, filter .15s ease;
}

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

.channel:hover { border-color: #87b8c4; filter: brightness(1.08); }
.channel:focus-visible, .icon-button:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 5px;
}

.player {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.player:fullscreen { width: 100vw; height: 100vh; }
.player video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }

.icon-button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  color: #fff;
  background: rgba(5, 8, 11, .8);
  cursor: pointer;
}

.icon-button:hover { background: #21323d; }
.icon-button svg { width: 27px; height: 27px; }
.close-player {
  position: absolute;
  z-index: 3;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
}

.player-message {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.loading-indicator {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.retry-player { width: 68px; height: 68px; pointer-events: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
body.is-playing { overflow: hidden; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (orientation: portrait) {
  .gallery { width: min(100%, 700px); grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .channel { transition: none; }
  .loading-indicator { animation-duration: 2s; }
}
