:root {
  color-scheme: dark;
  --bg: #000;
  --fg: #eee;
  --accent: #3aa;
  --bar-h: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--bar-h);
  padding: 0 12px;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #222;
  padding-top: env(safe-area-inset-top);
}

.bar .title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bar .back {
  color: var(--fg);
  text-decoration: none;
  font-size: 15px;
}

.audio-btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid #333;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.audio-btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- grid ---- */

.grid {
  display: grid;
  gap: 2px;
  padding: 2px;
  /* columns adapt to viewport width */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

.tile {
  display: block;
  background: transparent;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.tile .label {
  padding: 6px 4px 4px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  text-align: left;
  letter-spacing: 0.01em;
  /* Match YouTube streamer's Hershey-Simplex-esque sans look with system fonts */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile .video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
}

.tile .video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.tile .video-wrap.offline::after {
  content: "loading…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 13px;
}

/* ---- focus page ---- */

.focus-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.focus {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.focus video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ---- focus modal ---- */

.focus-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  display: flex;
  flex-direction: column;
}

.focus-modal[hidden] { display: none; }

.focus-modal .bar { background: rgba(0,0,0,0.9); }

.focus-modal .back-btn {
  background: transparent;
  border: 0;
  color: var(--fg);
  font-size: 15px;
  padding: 6px 10px;
  cursor: pointer;
  margin: 0;
}

.bar-spacer { width: 60px; }

.focus-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.focus-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ---- start-to-play overlay ---- */

.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  color: var(--fg);
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.start-overlay[hidden] { display: none; }

.start-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 32px;
  border: 1px solid #333;
  border-radius: 14px;
  background: rgba(20, 20, 20, 0.85);
}

.start-overlay-title {
  font-size: 20px;
  font-weight: 600;
}

.start-overlay-sub {
  font-size: 13px;
  opacity: 0.7;
}
