:root {
  --bg: #0f0f0f;
  --surface: #212121;
  --surface-2: #272727;
  --ink: #f1f1f1;
  --muted: #aaa;
  --line: #303030;
  --accent: #f03;
  --shell: 1280px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; }
button, input { font: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  transform: translateY(-160%);
  background: var(--ink); color: #000;
  padding: 10px 14px; border-radius: 4px;
}
.skip-link:focus-visible { transform: translateY(0); }
.shell { width: min(calc(100% - 32px), var(--shell)); margin-inline: auto; }

/* ── 頂欄 ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: rgba(15, 15, 15, .96);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 18px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand::first-letter { color: var(--accent); }
.search-field { flex: 1; display: flex; justify-content: center; }
.search-field input {
  width: min(100%, 480px);
  background: #121212;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  padding: 8px 16px;
}
.search-field input::placeholder { color: var(--muted); }

/* ── 首頁格 ── */
.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding: 20px 0 8px;
}
.card { text-decoration: none; }
.thumb { position: relative; border-radius: 12px; overflow: hidden; background: #000; }
.thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.badge {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0, 0, 0, .85);
  font-size: 12px; padding: 1px 6px; border-radius: 4px;
}
.card h2 { font-size: 15px; margin: 10px 0 2px; }
.card .meta { color: var(--muted); font-size: 13px; margin: 0; }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }

/* ── 觀看頁 ── */
.back { display: inline-block; margin: 16px 0 8px; color: var(--muted); text-decoration: none; }
.watch-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 900px) { .watch-layout { grid-template-columns: 1fr; } }
#player { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; }
.player-col h1 { font-size: 18px; margin: 12px 0 4px; }
.meta { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.desc {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  white-space: pre-line;
  margin: 0 0 24px;
}
.upnext-col h2 { font-size: 15px; margin: 0 0 12px; }
.upnext { display: grid; gap: 12px; }
.mini { display: grid; grid-template-columns: 168px 1fr; gap: 8px; text-decoration: none; }
.mini .thumb { border-radius: 8px; }
.mini h3 { font-size: 13.5px; margin: 0 0 2px; }
.mini .meta { font-size: 12px; }

.footer { color: var(--muted); font-size: 12.5px; padding: 24px 0 32px; border-top: 1px solid var(--line); margin-top: 16px; }
