:root {
  color-scheme: dark;
  --bg: #07090e;
  --bg-raised: #101522;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --gold: #eab308;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

main, .masthead, .topbar { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 24px; }
main { flex: 1; }

.masthead {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px 32px; padding-block: 40px 32px;
}
h1, h2 { font-family: 'Outfit', sans-serif; font-weight: 700; }
.masthead h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; }

.search { flex: 1 1 260px; max-width: 360px; }
.search input {
  width: 100%; padding: 11px 16px; font: inherit; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 8px;
}
.search input::placeholder { color: var(--muted); }

.shelf { margin-bottom: 48px; }
.shelf h2 { font-size: 1.35rem; margin-bottom: 16px; }
.count { color: var(--muted); font-weight: 500; font-size: 1rem; margin-left: 4px; }

.grid { display: grid; gap: 28px 20px; }
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid-tall { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }

.card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; border-radius: 10px; }
.thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; margin-bottom: 8px;
  overflow: hidden; border-radius: 10px; background: var(--bg-raised);
}
.card-vertical .thumb { aspect-ratio: 9 / 16; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.time {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; font-size: 0.78rem; font-weight: 600;
  font-variant-numeric: tabular-nums; background: rgba(0, 0, 0, 0.8); border-radius: 5px;
}
.card-title { font-weight: 600; line-height: 1.35; }
.card:hover .card-title { color: var(--gold); }
.card-date, .meta { color: var(--muted); font-size: 0.875rem; }
.empty { color: var(--muted); padding-block: 48px; text-align: center; }

.topbar { padding-block: 20px; }
.topbar a { color: var(--muted); text-decoration: none; font-weight: 500; }
.topbar a:hover { color: var(--gold); }

.watch { max-width: 960px; padding-bottom: 48px; }
.player { aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.player-vertical { aspect-ratio: 9 / 16; max-height: 80vh; margin-inline: auto; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; }
.watch h1 { font-size: clamp(1.4rem, 3.5vw, 2rem); line-height: 1.2; margin-top: 20px; overflow-wrap: anywhere; }
.meta { margin-top: 8px; }
.meta a:hover { color: var(--gold); }
.description {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
  white-space: pre-line; overflow-wrap: anywhere; color: #cbd5e1;
}
.description a { color: var(--gold); }

footer { padding: 24px; text-align: center; font-size: 0.875rem; color: var(--muted); }
footer a { text-decoration: none; }
footer a:hover { color: var(--gold); }

@media (max-width: 640px) {
  main, .masthead, .topbar { padding-inline: 16px; }
  .masthead { padding-block: 28px 24px; }
  .search { max-width: none; }
  .grid-tall { grid-template-columns: repeat(2, 1fr); gap: 20px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .thumb img { transition: none; }
}
