:root {
  --bg: #0e0d0c;
  --panel: #191715;
  --line: #2b2825;
  --text: #ece7df;
  --dim: #9a9288;
  --accent: #e8b563;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

a { color: inherit; text-decoration: none; }

.top {
  padding: 14px max(16px, env(safe-area-inset-left)) 14px max(16px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--accent);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

.empty { color: var(--dim); text-align: center; padding: 72px 0; }

/* 首頁 */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px 16px;
}

.card a { display: block; }

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}

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

.dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.card-title { display: block; margin-top: 8px; font-weight: 500; line-height: 1.4; }
.card a:hover .card-title, .card a:focus-visible .card-title { color: var(--accent); }

/* 播放頁 */
.stage {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

/* 比例來自 <video> 的 width/height 屬性(CSP 不准 inline style)。
   直式影片會被 max-height 壓住，左右留黑。 */
.stage video { width: 100%; height: auto; max-height: 78vh; display: block; background: #000; }

.watch h1 { margin: 18px 0 4px; font-size: 22px; line-height: 1.35; }
.meta { margin: 0; color: var(--dim); font-size: 14px; }
.desc { margin: 16px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.notice {
  margin: 12px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--dim);
  font-size: 14px;
}

.notice button {
  margin-left: 8px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
