:root {
  --bg: #0f1012;
  --bar: #15161a;
  --surface: #1c1d21;
  --text: #f3f3f4;
  --muted: #a3a6ad;
  --line: #2a2c31;
  --placeholder: linear-gradient(135deg, #2a2c33, #383b44);
  --radius: 12px;
  --gap: 12px;
  --gutter: clamp(16px, 1.2vw, 24px);
  --topbar: 76px;
  --foot: 56px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
h1, h2 { margin: 0; font-weight: 700; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 calc(var(--gutter) + 12px);
  background: var(--bar);
}
.brand { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.divider { width: 1px; height: 24px; background: var(--line); }
.back { font-size: 16px; color: var(--muted); }
.back:hover { color: var(--text); }
.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1f2024;
  border: 1px solid #34363c;
  border-radius: 999px;
  padding: 0 18px;
  width: min(340px, 42vw);
}
.search:focus-within { border-color: #6b6e76; }
.search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 16px; padding: 10px 0; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; }

/* Tiles: image fills the tile, text over a dark fade */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--placeholder);
  isolation: isolate;
  min-height: 0;
}
.tile-media { position: absolute; inset: 0; z-index: -1; background: var(--placeholder); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.tile:hover .tile-media img { transform: scale(1.04); }
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.25) 38%, transparent 60%);
}
.tile-body { display: flex; flex-direction: column; align-items: flex-start; padding: 20px 24px; color: #fff; min-width: 0; max-width: 100%; }
.tile-kicker { font-size: 17px; font-weight: 600; }
.tile-title { font-size: clamp(22px, 2vw, 36px); font-weight: 800; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-desc { font-size: 20px; margin-top: 6px; opacity: 0.95; }
.tile-meta { font-size: 17px; margin-top: 4px; opacity: 0.92; font-variant-numeric: tabular-nums; }
.play {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #111;
  font-weight: 700;
  font-size: 18px;
  border-radius: 999px;
  padding: 8px 30px 8px 26px;
}
.play::before { content: ""; border-left: 13px solid currentColor; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.tile:hover .play { background: #e9e9e9; }

/* First screen: one big tile and four small ones */
.poster {
  height: calc(100svh - var(--topbar) - var(--foot));
  min-height: 520px;
  max-height: 1000px;
  display: grid;
  grid-template-columns: 2.55fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap) var(--gutter) 0;
}
.poster .hero { grid-row: span 2; }
.poster .hero .tile-body { padding: 0 32px 32px; }
.poster .hero .tile-title { font-size: clamp(36px, 3.6vw, 64px); }
.poster .hero .tile-kicker { font-size: 20px; margin-bottom: 4px; }
.poster .tile:not(.hero) .tile-kicker { font-size: 15px; }
.poster-foot {
  height: var(--foot);
  margin-top: var(--gap);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 calc(var(--gutter) + 16px);
  background: var(--bar);
  color: #cfd1d6;
}
.poster-foot .copyright { font-size: 14px; }
.more { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.more svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform 0.2s; }
.more:hover svg { transform: translateY(3px); }

/* All shorts */
.all { padding: 40px var(--gutter) 24px; scroll-margin-top: 8px; }
.filters { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 20px; padding: 0 4px; }
.filters h2 { font-size: 28px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { background: #1f2024; border: 1px solid #34363c; border-radius: 999px; padding: 5px 20px; cursor: pointer; }
.chip:hover { border-color: #6b6e76; }
.chip[aria-pressed="true"] { background: #fff; color: #111; border-color: #fff; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.grid .tile { aspect-ratio: 16 / 10; }
.grid .tile-title { font-size: 24px; }
.grid .tile-meta { font-size: 15px; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }
.soon {
  height: calc(100svh - var(--topbar) - var(--foot) - var(--gap));
  min-height: 360px;
  margin: var(--gap) var(--gutter) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--placeholder);
}
.soon-title { font-size: clamp(28px, 4vw, 48px); font-weight: 600; }
.soon-note { color: var(--muted); font-size: 16px; }
.empty a { text-decoration: underline; }

.footer { color: var(--muted); font-size: 14px; text-align: center; padding: 16px var(--gutter) 28px; }
body[data-page="home"] .footer { display: none; }

/* Watch page */
.back { display: none; width: 28px; height: 28px; margin-right: -8px; }
.back svg, .search-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; }
.search-icon { display: none; margin-left: auto; }
.page { flex: 1; width: 100%; padding: 18px calc(var(--gutter) + 12px) 16px; }
.watch-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 30%); gap: 36px; align-items: start; }
.watch-main { display: flex; flex-direction: column; min-width: 0; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player-note { position: absolute; inset: auto 0 0 0; margin: 0; padding: 10px 16px; background: rgba(0, 0, 0, 0.7); color: #eee; }
.info { padding-top: 10px; }
.title { font-size: clamp(28px, 2.3vw, 38px); line-height: 1.2; }
.meta { color: #d4d6db; margin: 0; font-size: 17px; font-variant-numeric: tabular-nums; }
.info h2, .chapters-block h2 { font-size: 18px; margin-top: 6px; }
.description { margin: 0; font-size: 17px; color: #e4e5e8; }
.chapters-block { margin-top: 2px; }
.chapters { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
.chapter { width: 100%; display: flex; flex-direction: column; gap: 6px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.chapter-media { position: relative; width: 100%; aspect-ratio: 16 / 5; border-radius: 10px; overflow: hidden; background: var(--placeholder); }
.chapter-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.chapter-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, 0.55), transparent 60%); }
.chapter-time { position: absolute; left: 12px; bottom: 6px; z-index: 1; color: #fff; font-size: 17px; font-variant-numeric: tabular-nums; }
.chapter-title { display: none; font-size: 17px; font-weight: 600; }
.chapter:hover .chapter-media img { transform: scale(1.05); }
.chapters li.active .chapter-media { outline: 2px solid #fff; outline-offset: -2px; }

.side { display: flex; flex-direction: column; gap: 12px; }
.side-head { display: flex; flex-direction: column; padding: 4px 4px 2px; }
.side-label { font-size: 16px; font-weight: 600; }
.side-head h2 { font-size: 32px; line-height: 1.25; }
.side-meta { color: #d4d6db; font-size: 17px; }
.episodes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.episodes .tile { aspect-ratio: 16 / 5.6; }
.episodes .tile:first-child { aspect-ratio: 16 / 6; }
.episodes .tile-body { padding: 14px 20px; }
.episodes .tile-title { font-size: 26px; }
.episodes .tile-meta { font-size: 17px; }
.episodes .tile.current { outline: 3px solid #fff; outline-offset: -3px; }
.episodes .tile.current .tile-kicker {
  position: absolute;
  top: 12px;
  left: 18px;
  font-size: 15px;
  background: rgba(20, 21, 25, 0.75);
  border-radius: 999px;
  padding: 2px 12px;
}
body[data-page="watch"] .footer { text-align: left; background: var(--bar); padding: 12px calc(var(--gutter) + 12px); margin-top: 12px; }

/* Tablet */
@media (max-width: 1100px) {
  .poster { grid-template-columns: 1fr 1fr; grid-template-rows: auto; height: auto; max-height: none; }
  .poster .hero { grid-column: span 2; grid-row: auto; aspect-ratio: 16 / 9; }
  .poster .tile:not(.hero) { aspect-ratio: 4 / 3; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .watch-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}

/* Phone */
@media (max-width: 720px) {
  :root { --topbar: 60px; --gap: 10px; --gutter: 12px; }
  .topbar { gap: 12px; padding: 0 16px; }
  .brand { font-size: 24px; }
  .search { flex: 1; width: auto; max-width: 210px; padding: 0 14px; }
  .search input { font-size: 15px; padding: 8px 0; }
  body[data-page="watch"] .divider { display: none; }
  .poster .hero { aspect-ratio: 4 / 5; }
  .poster .hero .tile-body { padding: 0 20px 22px; }
  .poster .hero .tile-title { font-size: 34px; }
  .poster .hero .tile-kicker { font-size: 15px; }
  .tile-desc { font-size: 16px; }
  .tile-meta { font-size: 14px; }
  .play { margin-top: 14px; font-size: 16px; padding: 6px 24px 6px 20px; }
  .poster .tile:not(.hero) { aspect-ratio: 1 / 1; }
  .tile-body { padding: 12px 14px; }
  .tile-title { font-size: 20px; }
  .poster-foot { grid-template-columns: 1fr; justify-items: center; height: auto; padding: 14px 16px; background: transparent; margin-top: 0; }
  .poster-foot .copyright { display: none; }
  body[data-page="home"] .footer { display: block; }
  .all { padding-top: 16px; }
  .filters { gap: 12px; }
  .filters h2 { font-size: 22px; width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .chip { white-space: nowrap; padding: 4px 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid .tile { aspect-ratio: 4 / 5; }
  .grid .tile-title { font-size: 17px; }
  .grid .tile-meta { font-size: 12px; }
  body[data-page="watch"] .search { display: none; }
  .back, .search-icon { display: block; }
  .page { padding: 0 16px 16px; }
  .player { margin: 0 -16px; border-radius: 0; }
  .info { padding-top: 14px; }
  .title { font-size: 30px; }
  .meta, .description { font-size: 16px; }
  .info h2, .chapters-block h2 { font-size: 22px; margin-top: 14px; }
  .chapters { grid-auto-columns: 38%; overflow-x: auto; margin: 4px -16px 0; padding: 0 16px 4px; scrollbar-width: none; }
  .chapter-media { aspect-ratio: 16 / 9; }
  .chapter-time { font-size: 14px; left: 10px; }
  .chapter-title { display: block; font-size: 15px; }
  .side-head { flex-direction: row; align-items: baseline; padding: 0; }
  .side-label { font-size: 22px; font-weight: 700; margin-top: 14px; }
  .side-head h2 { display: none; }
  .side-meta { margin-left: auto; font-size: 15px; color: var(--muted); }
  .episodes .tile, .episodes .tile:first-child { aspect-ratio: 16 / 7; }
  .episodes .tile-title { font-size: 24px; }
  .episodes .tile-meta { font-size: 15px; }
  .episodes .tile.current { outline: 0; }
  .episodes .tile.current .tile-kicker { position: static; background: none; padding: 0; font-size: 14px; }
  body[data-page="watch"] .footer { background: none; border-top: 1px solid var(--line); margin: 16px 16px 0; padding: 14px 0 24px; }
}
