/* style.css — 深色影音站模板樣式
 * 深色為主 + 淺色切換。Vanilla CSS + CSS variables，無 build step。
 * 主色：Netflix 紅 #E50914 (token 名沿用 --green)、深底 #141414。 */

/* ─── Tokens ────────────────────────────────────────────── */
:root {
  /* 背景層 (越上層越亮) */
  --bg: #141414;
  --bg-elev: #1b1b1b;
  --surface: #232323;
  --surface-2: #2b2b2b;
  --surface-hover: #353535;
  --border: #303030;
  --border-light: #404040;

  /* 文字 */
  --fg: #ffffff;
  --fg-secondary: #b3b3b3;
  --fg-tertiary: #808080;
  --fg-quaternary: #5a5a5a;

  /* 主題色：Netflix 紅 (原為綠，2026-05-28 改 Netflix 配色；變數名沿用 green) */
  --green: #e50914;
  --green-bright: #f40612;
  --green-press: #b0060f;
  --green-soft: rgba(229, 9, 20, 0.15);

  /* VIP 金 */
  --vip: #f2c98b;
  --vip-deep: #e0a85a;
  --vip-grad: linear-gradient(105deg, #ffe1b0 0%, #f2c98b 45%, #e6b06d 100%);
  --vip-ink: #5a3d12;

  --link: #4ea1ff;
  --danger: #ff4d4f;
  --star: #ffb23e;

  --overlay: rgba(0, 0, 0, 0.6);
  --scrim-l: linear-gradient(90deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.55) 35%, rgba(0,0,0,.12) 70%, rgba(0,0,0,0) 100%);
  --scrim-b: linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(0,0,0,.6) 30%, rgba(0,0,0,0) 100%);
  --scrollbar: rgba(255, 255, 255, 0.18);
  --scrollbar-hover: rgba(255, 255, 255, 0.34);

  /* 間距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* 圓角 (偏小) */
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "PingFang SC", "Microsoft JhengHei", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;

  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 40px;

  --nav-h: 60px;
  --content-max: 1760px;
  --gutter: 48px;

  --t-fast: 120ms;
  --t-base: 220ms;
  --t-slow: 380ms;
  --ease: cubic-bezier(0.33, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-card: 0 8px 28px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 18px 48px rgba(0, 0, 0, 0.7);
  --ring-green: 0 0 10px 2px rgba(255,255,255,0.17), 0 0 24px 8px rgba(255,255,255,0.07);
}

@media (max-width: 1280px) { :root { --gutter: 32px; } }
@media (max-width: 768px)  { :root { --nav-h: 88px; --gutter: 16px; } }

/* ─── Reset / Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; transition: color var(--t-fast) var(--ease); }
img { display: block; max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
input { font-family: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
svg { fill: currentColor; }
::selection { background: var(--green-soft); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); background-clip: content-box; }

/* 內容容器 */
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); }
.page { min-height: 100vh; padding-bottom: var(--space-8); }
.page--padtop { padding-top: calc(var(--nav-h) + var(--space-5)); }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 24px;
  border-radius: var(--radius-md);
  font-size: var(--text-md); font-weight: 700; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(0.97); }
.btn--play { background: var(--green); color: #fff; }
.btn--play:hover { background: var(--green-bright); color: #fff; }
.btn--ghost { background: rgba(255, 255, 255, 0.14); color: #fff; backdrop-filter: blur(4px); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }
.btn--outline { background: transparent; border: 1px solid var(--border-light); color: var(--fg); }
.btn--outline:hover { border-color: var(--fg); color: var(--fg); }
.btn--sm { height: 34px; padding: 0 16px; font-size: var(--text-base); }
.btn--block { display: flex; width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; color: var(--fg-secondary);
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }

/* ─── Top Nav ───────────────────────────────────────────── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center;
  transition: background var(--t-base) var(--ease), backdrop-filter var(--t-base);
  background: linear-gradient(180deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.28) 60%, rgba(0,0,0,0) 100%);
}
.topnav.is-solid {
  background: rgba(20, 20, 20, 0.72);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topnav__inner {
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; gap: var(--space-4);
}

/* logo */
.brand { display: inline-flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: #fe474b; padding: 4px; box-sizing: border-box;
  object-fit: contain; display: block;
  box-shadow: 0 2px 10px rgba(229, 9, 20, 0.45);
}
.brand__name {
  font-size: 22px; font-weight: 800; letter-spacing: -0.5px; color: #fff;
}
.brand__name b { color: var(--green); }

/* menu */
.topnav__menu { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.topnav__menu a {
  position: relative; padding: 0 12px; height: var(--nav-h);
  display: inline-flex; align-items: center;
  font-size: var(--text-md); font-weight: 600; color: rgba(255, 255, 255, 0.50);
  white-space: nowrap;
}
.topnav__menu a:hover { color: rgba(255,255,255,0.85); }
.topnav__menu a.active { color: #fff; font-weight: 700; }
.topnav__menu a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px;
  background: var(--green); border-radius: 3px 3px 0 0;
}
.topnav__menu a.is-vip { color: var(--vip); }

/* right cluster */
.topnav__right { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; flex-shrink: 0; }

/* search — gimytube 風格：[icon][input────][submit] */
.icon-btn--search-close { display: none; }
.search-mobile-btn { display: none; }
.search { display: flex; flex-shrink: 0; width: 300px; position: relative; }
.search__icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; fill: rgba(255,255,255,0.5); pointer-events: none;
  transition: fill var(--t-fast);
}
.search:focus-within .search__icon { fill: rgba(255,255,255,0.85); }
.search__input {
  flex: 1; min-width: 0; height: 38px; padding: 0 0 0 40px;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.15);
  border-right: 0; border-radius: var(--radius-pill) 0 0 var(--radius-pill);
  color: #fff; font-size: var(--text-base);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.search__input::placeholder { color: rgba(255,255,255,0.42); }
.search__input:focus { outline: none; border-color: var(--green); background: rgba(255,255,255,0.14); }
.search:focus-within .search__btn { border-color: var(--green); }
.search__btn {
  width: 48px; height: 38px; flex-shrink: 0;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.15);
  border-left: 0; border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  color: rgba(255,255,255,0.7); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast);
}
.search__btn svg { width: 18px; height: 18px; }
.search__btn:hover { color: rgba(255,255,255,0.95); }

/* VIP button */
.btn-vip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 18px;
  border-radius: var(--radius-pill); background: var(--vip-grad); color: var(--vip-ink);
  font-size: var(--text-base); font-weight: 800; white-space: nowrap;
  box-shadow: 0 2px 12px rgba(242, 201, 139, 0.28);
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast);
}
.btn-vip svg { width: 18px; height: 18px; }
.btn-vip:hover { filter: brightness(1.06); transform: translateY(-1px); color: var(--vip-ink); }

/* login / avatar */
.topnav__login {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: var(--radius-pill); border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff; font-size: var(--text-base); font-weight: 600; white-space: nowrap;
}
.topnav__login svg { width: 18px; height: 18px; flex-shrink: 0; }
.topnav__login:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); color: #fff; }
.topnav__avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.topnav__avatar img { width: 100%; height: 100%; object-fit: cover; }
.topnav__avatar svg { width: 24px; height: 24px; color: var(--fg-tertiary); }

.topnav__burger { display: none; }

/* ─── Hero Carousel ─────────────────────────────────────── */
.hero { position: relative; width: 100%; overflow: hidden; }
.hero__track { display: flex; transition: transform 0.5s var(--ease-out); }
.hero__slide {
  position: relative; flex: 0 0 100%; min-width: 100%;
  height: clamp(420px, 56vw, 680px);
}
.hero__bg { position: absolute; inset: 0; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; }
.hero__bg::after { content: ""; position: absolute; inset: 0; background: var(--scrim-l); }
.hero__bg::before { content: ""; position: absolute; inset: 0; z-index: 1; background: var(--scrim-b); }
.hero__inner {
  position: relative; z-index: 2; height: 100%;
  max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 96px;
}
.hero__content { max-width: 540px; }
.hero__title { font-size: clamp(30px, 4vw, 52px); font-weight: 800; line-height: 1.08; letter-spacing: -1px; }
.hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; color: var(--fg-secondary); font-size: var(--text-md); }
.hero__tag { padding: 2px 8px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--fg-secondary); }
.hero__desc {
  margin-top: 16px; color: var(--fg-secondary); font-size: var(--text-md); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero__actions { display: flex; gap: 14px; margin-top: 28px; }
.hero__dots { position: absolute; z-index: 3; right: var(--gutter); bottom: 40px; display: flex; gap: 8px; }
.hero__dot { width: 22px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.34); cursor: pointer; transition: background var(--t-fast), width var(--t-fast); }
.hero__dot.active { width: 34px; background: var(--green); }
.hero__arrow {
  position: absolute; z-index: 3; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, 0.4);
  display: grid; place-items: center; color: #fff; opacity: 0; transition: opacity var(--t-base), background var(--t-fast);
}
.hero__arrow svg { width: 26px; height: 26px; }
.hero:hover .hero__arrow { opacity: 1; }
.hero__arrow:hover { background: var(--green); }
.hero__arrow--prev { left: 16px; }
.hero__arrow--next { right: 16px; }

/* ─── Content Row (横向滑動列) ─────────────────────────── */
.section { margin-top: var(--space-5); }
.section--tight { margin-top: var(--space-4); }
.row__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; padding: 0 var(--gutter); max-width: var(--content-max); margin-left: auto; margin-right: auto; }
.row__title { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.4px; }
.row__title .accent { color: var(--green); }
.row__more { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; color: var(--fg-tertiary); font-size: var(--text-base); font-weight: 600; }
.row__more:hover { color: var(--green); }
.row__more svg { width: 18px; height: 18px; }

/* 照抄 iq.com light-slider：container 包 arrow + content(overflow 裁切) + 內層 move 軌道(transform 滑動) */
.row { position: relative; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); }
/* 負 margin + 等量 padding：overflow 在 padding-box 裁切 → 邊緣卡綠框(2px)落在 padding 內不被吃，第 9 張(gap 10px 外)仍切掉(比照 iq) */
.slider-content { position: relative; overflow: hidden; margin: 0 -10px; padding: 8px 10px 14px; }
.slider-move { display: flex; gap: 10px; transition: transform 0.35s var(--ease-out); will-change: transform; }
.row--rank .slider-move { gap: 28px; }

/* 箭頭放兩側 gutter(內容區塊外)、垂直置中海報、不壓卡；端點用 .slider-button-disabled 隱藏(比照 iq) */
.arrow-left, .arrow-right {
  position: absolute; top: 8px; z-index: 6;
  width: var(--gutter); height: calc(100% - 106px);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.78); cursor: pointer;
  transition: color var(--t-fast);
}
.row:hover .arrow-left, .row:hover .arrow-right { color: #fff; }
.arrow-left { left: 0; }
.arrow-right { right: 0; }
.arrow-left.slider-button-disabled, .arrow-right.slider-button-disabled { display: none; }
.arrow-left svg, .arrow-right svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.75)); }

/* ─── Card (直式海報) ──────────────────────────────────── */
.card { flex: 0 0 auto; width: 182px; }
/* 內容列一排剛好 8 張(使用者要求)：8 卡 + 7 個 gap(10px) = 100% */
.slider-move > .card { flex: 0 0 calc((100% - 70px) / 8); }
.card__thumb {
  position: relative; display: block; aspect-ratio: 3 / 4; border-radius: var(--radius-md);
  overflow: hidden; background: var(--surface);
  transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base);
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease-out); }
.card:hover .card__thumb { transform: translateY(-4px); box-shadow: var(--shadow-card), var(--ring-green); }
.card:hover .card__thumb img { transform: scale(1.06); }

/* hover 浮層 */
.card__overlay {
  position: absolute; inset: 0; z-index: 2; opacity: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.86) 0%, rgba(0,0,0,.1) 55%, rgba(0,0,0,.36) 100%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 12px;
  transition: opacity var(--t-base);
}
.card:hover .card__overlay { opacity: 1; }
.card__play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8);
  width: 54px; height: 54px; border-radius: 50%; background: rgba(229, 9, 20, 0.92); color: #fff;
  display: grid; place-items: center; opacity: 0; transition: transform var(--t-base) var(--ease-out), opacity var(--t-base);
}
.card__play svg { width: 26px; height: 26px; margin-left: 3px; }
.card:hover .card__play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.card__ov-title { font-size: var(--text-base); font-weight: 700; color: #fff; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.card__ov-meta { font-size: var(--text-sm); color: rgba(255, 255, 255, 0.7); margin-top: 3px; }

/* 角標 */
.badge {
  position: absolute; z-index: 3; top: 8px; left: 8px;
  height: 20px; padding: 0 7px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 800; display: inline-flex; align-items: center;
  background: var(--green); color: #fff;
}
.badge--vip { left: auto; right: 8px; background: var(--vip-grad); color: var(--vip-ink); }
.badge--corner { top: 0; right: 0; left: auto; border-radius: 0 var(--radius-md) 0 8px; }
.card__status {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  padding: 18px 10px 7px; text-align: left;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0) 100%);
  color: #fff; font-size: var(--text-xs); font-weight: 600;
  transition: opacity var(--t-fast);
}
.card:hover .card__status { opacity: 0; }

.card__body { display: block; padding: 10px 2px 0; }
.card__title { font-size: var(--text-md); font-weight: 600; color: var(--fg); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:hover .card__title { color: var(--green); }
.card__meta { margin-top: 4px; font-size: var(--text-sm); color: var(--fg-tertiary); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* ─── Poster (直式海報) ─────────────────────────────────── */
.poster { display: block; }
.poster__thumb {
  position: relative; display: block; aspect-ratio: 3 / 4; border-radius: var(--radius-md); overflow: hidden; background: var(--surface);
  transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base);
}
/* img 絕對定位填滿容器，不參與父元素高度計算，避免 aspect-ratio 循環依賴 */
.poster__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease-out); }
.poster:hover .poster__thumb { transform: translateY(-4px); box-shadow: var(--shadow-card), var(--ring-green); }
.poster:hover .poster__thumb img { transform: scale(1.05); }
.poster__title { margin-top: 8px; font-size: var(--text-base); font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster:hover .poster__title { color: var(--green); }
.poster__meta { margin-top: 2px; font-size: var(--text-sm); color: var(--fg-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 海報網格 */
.grid {
  display: grid; gap: 24px 14px;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter);
}
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid--8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid--8 { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .grid--8 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 768px)  { .grid--8 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 10px; } }

/* ─── Ranking (排行榜 大數字) ──────────────────────────── */
.rank-card { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 4px; width: 208px; }
.rank-card__num {
  flex-shrink: 0; font-size: 72px; font-weight: 800; line-height: 0.82; font-style: italic;
  -webkit-text-stroke: 2px var(--border-light); color: transparent;
  letter-spacing: -5px;
}
.rank-card:nth-child(1) .rank-card__num,
.rank-card:nth-child(2) .rank-card__num,
.rank-card:nth-child(3) .rank-card__num {
  -webkit-text-stroke: 2px var(--green); color: var(--green-soft);
}
.rank-card .card { width: 150px; }

/* ─── Footer ────────────────────────────────────────────── */
.footer { margin-top: var(--space-8); background: var(--bg); }
.footer__inner { max-width: var(--content-max); margin: 0 auto; padding: var(--space-7) var(--gutter); }
.footer__bottom { display: flex; justify-content: center; text-align: center; color: var(--fg-quaternary); font-size: var(--text-sm); }

/* back to top */
.back-top {
  position: fixed; right: 28px; bottom: 28px; z-index: 120;
  width: 46px; height: 46px; border-radius: 50%; background: var(--surface-2); color: var(--fg);
  display: grid; place-items: center; box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(10px); transition: all var(--t-base) var(--ease);
}
.back-top svg { width: 24px; height: 24px; }
.back-top:hover { background: var(--green); }
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* ─── Chips (子分類捷徑) ────────────────────────────────── */
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 0 var(--gutter) 4px; max-width: var(--content-max); margin: 0 auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; height: 34px; padding: 0 16px; display: inline-flex; align-items: center; border-radius: var(--radius-pill); background: var(--surface); color: var(--fg-secondary); font-size: var(--text-base); font-weight: 600; transition: background var(--t-fast), color var(--t-fast); }
.chip:hover { background: var(--surface-hover); color: var(--fg); }
.chip.active { background: var(--green); color: #fff; }

/* ─── Breadcrumb ────────────────────────────────────────── */
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--fg-tertiary); font-size: var(--text-base); }
.crumb a:hover { color: var(--green); }
.crumb .sep { color: var(--fg-quaternary); }

/* ─── Pagination ────────────────────────────────────────── */
.pager { display: flex; justify-content: center; gap: 8px; margin-top: var(--space-7); }
.pager a, .pager span { min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--surface); color: var(--fg-secondary); font-size: var(--text-base); font-weight: 600; }
.pager a:hover { background: var(--surface-hover); color: var(--fg); }
.pager .active { background: var(--green); color: #fff; }

/* ─── Section title (置中含裝飾) ───────────────────────── */
.page-title { max-width: var(--content-max); margin: 0 auto var(--space-5); padding: 0 var(--gutter); }
.page-title h1 { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -0.5px; }
.page-title p { margin-top: 8px; color: var(--fg-tertiary); font-size: var(--text-base); }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .topnav__menu a { padding: 0 10px; font-size: var(--text-base); }
  .search { width: 220px; }
  .rank-card { width: 190px; }
  .rank-card .card { width: 140px; }
}
@media (max-width: 768px) {
  /* 手機 header：兩行 — 第一行 logo＋圖示鈕(48px)、第二行分類捲動(40px) */
  .topnav { height: auto; align-items: stretch; }
  .topnav__inner { flex-wrap: wrap; align-items: stretch; gap: 0; padding: 0 12px; }
  .brand { order: 1; height: 48px; }
  .brand__name { display: none; }
  .topnav__right { order: 2; gap: 4px; flex-shrink: 0; height: 48px; }
  .topnav__menu { order: 3; width: 100%; height: 40px; display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-shrink: 0; gap: 0; }
  .topnav__menu::-webkit-scrollbar { display: none; }
  .topnav__menu a { padding: 0 9px; height: 40px; font-size: var(--text-base); }
  .topnav__menu a.active::after { left: 9px; right: 9px; bottom: 0; }
  .topnav__burger { display: inline-flex; }
  /* 手機搜尋：平時隱藏欄位，只顯示圖示鈕 */
  .search { display: none; }
  .search-mobile-btn { display: inline-flex; }
  /* search-open：整個 header 變搜尋欄 */
  body.search-open .brand { display: none; }
  body.search-open .topnav__menu { display: none; }
  body.search-open .search-mobile-btn { display: none; }
  body.search-open .theme-toggle { display: none; }
  body.search-open .topnav__login { display: none; }
  body.search-open .icon-btn--search-close { display: inline-flex; flex-shrink: 0; }
  body.search-open .topnav__right { flex: 1; min-width: 0; }
  body.search-open .search { display: flex; flex: 1; width: auto; min-width: 0; }
  .btn-vip { height: 32px; padding: 0 12px; font-size: var(--text-sm); }
  .topnav__login span { display: none; }
  .topnav__login { padding: 0; width: 36px; justify-content: center; border-radius: 50%; }
  /* 手機 hero：拿掉左側深色 scrim(會讓畫面左半變黑)，改成底部漸層+文字陰影 */
  .hero__inner { padding-bottom: 80px; }
  .hero__bg::after { background: linear-gradient(0deg, rgba(0,0,0,.92) 0%, rgba(0,0,0,.55) 50%, rgba(0,0,0,0) 88%); }
  .hero__title, .hero__desc { text-shadow: 0 2px 12px rgba(0,0,0,.7); }
  .hero__actions .btn { height: 38px; padding: 0 18px; }
  .hero__dots { bottom: 24px; }
  .row__title { font-size: var(--text-xl); }
  .slider-move > .card { flex: 0 0 calc((100% - 20px) / 3); max-width: none; }
  .arrow-left, .arrow-right { display: none; }
  .slider-content { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .slider-content::-webkit-scrollbar { display: none; }
  .slider-move { transform: none !important; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); gap: 24px 12px; }
  .rank-card__num { font-size: 52px; }
}

/* mobile drawer */
.drawer__backdrop { position: fixed; inset: 0; z-index: 240; background: rgba(0,0,0,.6); opacity: 0; visibility: hidden; transition: opacity var(--t-base); }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; z-index: 250; width: 280px; max-width: 82vw; background: var(--bg-elev); transform: translateX(-100%); transition: transform var(--t-base) var(--ease); padding: var(--space-5); overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer.open + .drawer__backdrop, .drawer__backdrop.open { opacity: 1; visibility: visible; }
.drawer a { display: block; padding: 13px 12px; border-radius: var(--radius-md); color: var(--fg-secondary); font-size: var(--text-md); font-weight: 600; }
.drawer a:hover, .drawer a.active { background: var(--surface); color: var(--fg); }

/* ─── Filter / 分類篩選 ─────────────────────────────────── */
.filter { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px 22px; }
.filter__row { display: flex; align-items: flex-start; gap: 14px; padding: 11px 0; }
.filter__row + .filter__row { border-top: 1px solid var(--border); }
.filter__label { flex-shrink: 0; width: 52px; color: var(--fg-tertiary); font-weight: 700; padding-top: 6px; font-size: var(--text-base); }
.filter__opts { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.filter__opt { padding: 5px 14px; border-radius: var(--radius-pill); color: var(--fg-secondary); font-size: var(--text-base); transition: background var(--t-fast), color var(--t-fast); }
.filter__opt:hover { background: var(--surface); color: var(--fg); }
.filter__opt.active { background: var(--green-soft); color: var(--green); font-weight: 700; }

@media (max-width: 768px) {
  .filter { padding: 4px 14px; }
  .filter__label { width: 40px; font-size: var(--text-sm); }
  .filter__opts { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .filter__opts::-webkit-scrollbar { display: none; }
  .filter__opt { padding: 4px 10px; font-size: var(--text-sm); flex-shrink: 0; white-space: nowrap; }
}

/* ─── Detail 詳情頁 ─────────────────────────────────────── */
.detail__hero { position: relative; }
.detail__backdrop { position: absolute; inset: 0; z-index: 0; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 68%, transparent 97%); mask-image: linear-gradient(180deg, #000 0%, #000 68%, transparent 97%); }
/* 模糊大背景(比照 gimytv 的 .this-pic-bj)：blur 18px + opacity .7 + scale 1.08 蓋掉模糊邊緣 */
.detail__backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(18px); opacity: 0.7; transform: scale(1.08); }
.detail__backdrop::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.25) 50%, rgba(0,0,0,.45) 100%); }
.detail__backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg) 1%, rgba(20,20,20,.45) 45%, rgba(20,20,20,.25) 100%); }
.detail__hero-inner {
  position: relative; z-index: 1; max-width: var(--content-max); margin: 0 auto;
  padding: calc(var(--nav-h) + 52px) var(--gutter) 48px;
  display: flex; gap: 38px; align-items: flex-start;
}
/* 封面卡：白 10% 邊框感 + 8px padding + 大投影(比照 gimytv 的 .detail-cover-card) */
.detail__poster { width: 244px; flex-shrink: 0; padding: 8px; background: rgba(255,255,255,0.1); border-radius: 8px; box-shadow: 0 26px 80px rgba(0,0,0,0.45); }
.detail__poster img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; }
.detail__info { flex: 1; min-width: 0; padding-bottom: 4px; }
/* 麵包屑：放在右欄上方、標題之前(比照 gimytv) */
.detail__crumb { font-size: var(--text-base); color: rgba(255,255,255,0.72); margin-bottom: 16px; }
.detail__crumb a { color: rgba(255,255,255,0.72); transition: color var(--t-fast); }
.detail__crumb a:hover { color: #fff; }
.detail__crumb .sep { margin: 0 8px; color: rgba(255,255,255,0.4); }
.detail__title { font-size: clamp(28px, 3.4vw, 44px); font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.detail__sub { color: var(--fg-secondary); font-size: var(--text-lg); margin-top: 8px; }
.detail__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 16px; color: var(--fg-secondary); font-size: var(--text-md); }
.detail__meta .pill { padding: 3px 10px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); font-size: var(--text-sm); }
.detail__meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--fg-tertiary); }
.detail__meta a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
.detail__meta a:hover { color: #fff; }
.detail__cast-line { margin-top: 14px; color: var(--fg-tertiary); font-size: var(--text-base); max-width: 780px; line-height: 1.7; }
.detail__cast-line b { color: var(--fg-secondary); font-weight: 600; }
.detail__cast-line a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
.detail__cast-line a:hover { color: #fff; text-decoration: underline; }
.detail__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.act-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: var(--radius-md); background: rgba(255,255,255,.12); color: #fff; font-weight: 700; font-size: var(--text-md); transition: background var(--t-fast), transform var(--t-fast); }
.act-btn svg { width: 20px; height: 20px; }
.act-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.act-btn:active { transform: scale(.97); }
.act-btn--play { background: var(--green); }
.act-btn--play:hover { background: var(--green-bright); }
/* 詳情 hero 下緣（手機/淺色）會露出淺色頁底，半透明白底的 收藏/分享 會看不清 → 改深色玻璃底，任何底色都清楚（不動 立即播放 紅鈕、收藏中綠態、播放頁按鈕） */
.detail__actions .act-btn:not(.act-btn--play):not(.is-faved) { background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.detail__actions .act-btn:not(.act-btn--play):not(.is-faved):hover { background: rgba(0,0,0,.68); }

/* 區塊容器 */
.block { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); }
.block + .block { margin-top: var(--space-7); }
.block__title { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -.4px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }

/* 線路 / 集數 分組小標 */
.play-label { font-size: var(--text-sm); font-weight: 700; color: var(--fg-tertiary); letter-spacing: .04em; margin-bottom: 10px; }
/* 播放線路 chips：外框膠囊樣式，與下方實心集數方塊區隔；手機可左右滑 */
.source-tabs { display: flex; flex-wrap: nowrap; gap: 10px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.source-tabs::-webkit-scrollbar { display: none; }
.source-tab { flex: 0 0 auto; padding: 8px 18px; border-radius: var(--radius-pill); background: transparent; border: 1px solid var(--border); color: var(--fg-secondary); font-size: var(--text-base); font-weight: 600; white-space: nowrap; cursor: pointer; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.source-tab:hover { background: var(--surface-hover); color: var(--fg); border-color: var(--fg-tertiary); }
.source-tab.active { background: var(--green-soft); color: var(--green); border-color: var(--green); }
/* 線路 HD 標（比照 gimytube，由 app.js 在含 hd/高清 的線路後方注入） */
.player-icon { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 5px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1.5; color: #fff; letter-spacing: 0.5px; }
.player-icon--hd { background: #FF4B5B; }

/* 選集 */
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; }
.ep-tile { position: relative; height: 46px; border-radius: var(--radius-md); background: var(--surface); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--text-md); color: var(--fg-secondary); transition: background var(--t-fast), color var(--t-fast); overflow: hidden; }
.ep-tile:hover { background: var(--surface-hover); color: var(--fg); }
.ep-tile.active { background: var(--green); color: #fff; }

/* 留言板 */
.comment-box { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.comment-box__avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239aa0a6'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E") center/26px no-repeat; }
.comment-box__avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-box__input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border); color: var(--fg); font-size: var(--text-md); }
.comment-box__input::placeholder { color: var(--fg-tertiary); }
.comment-box__input:focus { outline: none; border-color: var(--green); }
.comment-box__send { flex-shrink: 0; height: 44px; padding: 0 22px; border-radius: var(--radius-pill); background: var(--green); color: #fff; font-weight: 700; font-size: var(--text-md); transition: background var(--t-fast); }
.comment-box__send:hover { background: var(--green-bright); }
.comment-list { display: flex; flex-direction: column; gap: 22px; }
.comment { display: flex; gap: 12px; }
.comment__avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--surface); }
.comment__avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment__body { flex: 1; min-width: 0; }
.comment__head { display: flex; align-items: baseline; gap: 10px; }
.comment__name { font-weight: 700; font-size: var(--text-base); color: var(--fg); }
.comment__time { font-size: var(--text-sm); color: var(--fg-tertiary); }
.comment__text { margin-top: 5px; color: var(--fg-secondary); font-size: var(--text-md); line-height: 1.6; }
.comment__actions { display: flex; gap: 18px; margin-top: 8px; }
.comment__actions button { color: var(--fg-tertiary); font-size: var(--text-sm); font-weight: 600; transition: color var(--t-fast); }
.comment__actions button:hover { color: var(--green); }

/* 留言板：管理員回覆 + 留言表單 + 空狀態 + 文章內文 */
.comment__reply { margin-top: 8px; padding: 8px 12px; background: var(--green-soft); border-radius: var(--radius-md); color: var(--green); font-size: var(--text-sm); line-height: 1.6; }
.gbook-form { margin-bottom: 28px; }
.gbook-form__input { width: 100%; min-height: 96px; padding: 12px 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); color: var(--fg); font-size: var(--text-md); line-height: 1.6; resize: vertical; font-family: inherit; }
.gbook-form__input::placeholder { color: var(--fg-tertiary); }
.gbook-form__input:focus { outline: none; border-color: var(--green); }
.gbook-form__bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.gbook-form__verify { height: 44px; width: 120px; padding: 0 14px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); color: var(--fg); }
.gbook-form__tip { color: var(--fg-tertiary); font-size: var(--text-sm); }
.empty-tip { text-align: center; color: var(--fg-tertiary); padding: 60px 20px; font-size: var(--text-md); }
.art-body { color: var(--fg-secondary); line-height: 1.9; font-size: var(--text-md); }
.art-body img { max-width: 100%; height: auto; border-radius: var(--radius-md); margin: 12px 0; }
.art-body p { margin: 0 0 14px; }

@media (max-width: 768px) {
  /* 手機詳情：大圖置中、標題/動作置中(比照 gimytube) */
  .detail__hero-inner { flex-direction: column; align-items: center; text-align: center; gap: 18px; padding-top: calc(var(--nav-h) + 24px); padding-bottom: 28px; }
  .detail__poster { width: 45%; max-width: 240px; margin: 0 auto; }
  .detail__info { width: 100%; }
  .detail__sub { margin-top: 6px; }
  .detail__meta { justify-content: center; }
  .detail__cast-line { max-width: none; }
  /* 三顆按鈕擠一排：nowrap + 等寬分配、縮 padding */
  .detail__actions { justify-content: center; flex-wrap: nowrap; gap: 8px; }
  .act-btn { flex: 1 1 0; min-width: 0; padding: 0 10px; height: 42px; font-size: var(--text-base); white-space: nowrap; }
  .act-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
  .ep-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}

/* ─── Play 播放頁 ───────────────────────────────────────── */
.play { max-width: var(--content-max); margin: 0 auto; padding: calc(var(--nav-h) + 22px) var(--gutter) 0; }
.play__grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 24px; align-items: start; }
.play__main { min-width: 0; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-lg); overflow: hidden; display: grid; place-items: center; }
.player__bg { position: absolute; inset: 0; }
.player__bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(26px) brightness(.42); transform: scale(1.12); }
.player__btn { position: relative; z-index: 1; width: 76px; height: 76px; border-radius: 50%; background: rgba(229,9,20,.94); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 32px rgba(229,9,20,.5); transition: transform var(--t-base) var(--ease-out), background var(--t-fast); }
.player__btn svg { width: 34px; height: 34px; margin-left: 4px; }
.player__btn:hover { transform: scale(1.08); background: var(--green-bright); }
.player__label { position: absolute; z-index: 1; left: 0; bottom: 0; right: 0; padding: 28px 20px 16px; font-size: var(--text-md); font-weight: 600; color: #fff; background: linear-gradient(0deg, rgba(0,0,0,.7), transparent); }

.play__meta { margin-top: 18px; }
.play__title { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -.4px; }
.play__title small { font-size: var(--text-md); color: var(--fg-secondary); font-weight: 600; margin-left: 10px; }
.play__metaline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; color: var(--fg-tertiary); font-size: var(--text-base); }
.play__metaline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--fg-tertiary); }
.play__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.play__actions .act-btn { height: 38px; padding: 0 16px; font-size: var(--text-base); background: var(--surface); color: var(--fg); }
.play__actions .act-btn:hover { background: var(--surface-hover); }
.play__intro { margin-top: 20px; }
.play__intro h3 { font-size: var(--text-lg); font-weight: 800; margin-bottom: 10px; }
.play__intro p { color: var(--fg-secondary); font-size: var(--text-md); line-height: 1.85; }
.play__intro p b { color: var(--fg); font-weight: 600; }
.play__intro .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.play__intro .tags a { padding: 5px 14px; background: var(--surface); border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--fg-secondary); }
.play__intro .tags a:hover { background: var(--surface-hover); color: var(--green); }
.play__comments { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.play__comments > h3 { font-size: var(--text-lg); font-weight: 800; margin-bottom: 16px; }

.play-side { min-width: 0; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.play-side__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.play-side__head h3 { font-size: var(--text-lg); font-weight: 800; }
.play-side__head .count { color: var(--fg-tertiary); font-size: var(--text-sm); }
.play-side .ep-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.play-side .ep-tile { height: 52px; font-size: var(--text-base); font-weight: 700; }
.play-side__rec { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.play-side__rec h3 { font-size: var(--text-lg); font-weight: 800; margin-bottom: 12px; }
.mini-card { display: flex; gap: 12px; padding: 8px 0; }
.mini-card__thumb { width: 80px; aspect-ratio: 3 / 4; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; background: var(--surface); position: relative; }
.mini-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-card__body { min-width: 0; }
.mini-card__title { font-size: var(--text-base); font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card:hover .mini-card__title { color: var(--green); }
.mini-card__meta { font-size: var(--text-sm); color: var(--fg-tertiary); margin-top: 5px; }

@media (max-width: 980px) {
  .play__grid { grid-template-columns: minmax(0, 1fr); }
  .play-side .ep-grid { max-height: none; }
}
@media (max-width: 768px) {
  /* 手機播放框貼齊 header(無上方空隙) + 滿版(去左右留白與圓角) */
  .play { padding-top: var(--nav-h); }
  .player { margin: 0 calc(-1 * var(--gutter)); border-radius: 0; }
}

/* ─── Mobile Search Bar (.msearch) ─────────────────────── */
/* 手機搜尋頁專用頂部列（桌面隱藏） */
.msearch { display: none; }

@media (max-width: 768px) {
  /* 隱藏一般 topnav，改用 msearch */
  body[data-active="search"] .topnav { display: none; }
  /* msearch：固定頂部，高度 56px */
  .msearch {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    height: 56px; padding: 0 12px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
  }
  .msearch__back {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
    color: var(--fg-secondary);
  }
  .msearch__back svg { width: 24px; height: 24px; }
  .msearch__back:hover { background: var(--surface); color: var(--fg); }
  .msearch__form {
    flex: 1; display: flex; align-items: center; gap: 10px;
    height: 40px; padding: 0 14px;
    background: var(--surface); border-radius: var(--radius-pill);
    border: 1px solid var(--border-light);
  }
  .msearch__ico { width: 18px; height: 18px; flex-shrink: 0; fill: var(--fg-tertiary); }
  .msearch__input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--fg); font-size: var(--text-base);
    caret-color: var(--green);
  }
  .msearch__input::placeholder { color: var(--fg-tertiary); }
  .msearch__clear {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%;
    background: var(--fg-quaternary); color: var(--bg);
  }
  .msearch__clear svg { width: 14px; height: 14px; fill: currentColor; }
  /* 搜尋頁 main padding 只需 56px（msearch 高度），不用雙行 nav-h */
  body[data-active="search"] .page--search { padding-top: calc(56px + var(--space-5)); }
}

/* ─── Search 搜尋結果 ───────────────────────────────────── */
.search-head { max-width: var(--content-max); margin: 0 auto var(--space-5); padding: 0 var(--gutter); }
.search-head h1 { font-size: var(--text-2xl); font-weight: 800; }
.search-head h1 em { color: var(--green); font-style: normal; }
.search-head p { margin-top: 8px; color: var(--fg-tertiary); font-size: var(--text-base); }
.result-list { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); display: flex; flex-direction: column; gap: 6px; }
.result { display: flex; gap: 20px; padding: 16px; border-radius: var(--radius-lg); transition: background var(--t-fast); }
.result:hover { background: var(--bg-elev); }
.result__thumb { position: relative; width: 136px; aspect-ratio: 3 / 4; flex-shrink: 0; border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.result__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease-out); }
.result:hover .result__thumb img { transform: scale(1.05); }
.result__thumb .badge { z-index: 2; }
.result__info { flex: 1; min-width: 0; }
.result__title { font-size: var(--text-xl); font-weight: 700; }
.result:hover .result__title { color: var(--green); }
.result__title em { color: var(--green); font-style: normal; }
.result__metaline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 9px; color: var(--fg-tertiary); font-size: var(--text-base); }
.result__metaline .score { color: var(--star); font-weight: 800; }
.result__metaline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--fg-tertiary); }
.result__desc { margin-top: 11px; color: var(--fg-secondary); font-size: var(--text-base); line-height: 1.7; max-width: 820px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result__cast { margin-top: 9px; color: var(--fg-tertiary); font-size: var(--text-sm); }
.result__actions { display: flex; gap: 10px; margin-top: 14px; }

/* ─── Ranking 排行榜 ────────────────────────────────────── */
.toplist { max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter); display: flex; flex-direction: column; }
.toprow { display: flex; align-items: center; gap: 18px; padding: 12px; border-radius: var(--radius-lg); transition: background var(--t-fast); }
.toprow:hover { background: var(--bg-elev); }
.toprow__rank { width: 46px; flex-shrink: 0; text-align: center; font-size: 30px; font-weight: 800; font-style: italic; color: var(--fg-quaternary); }
.toprow:nth-child(1) .toprow__rank, .toprow:nth-child(2) .toprow__rank, .toprow:nth-child(3) .toprow__rank { color: var(--green); }
.toprow__thumb { position: relative; width: 96px; aspect-ratio: 3 / 4; flex-shrink: 0; border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.toprow__thumb img { width: 100%; height: 100%; object-fit: cover; }
.toprow__info { flex: 1; min-width: 0; }
.toprow__title { font-size: var(--text-lg); font-weight: 700; }
.toprow:hover .toprow__title { color: var(--green); }
.toprow__meta { margin-top: 7px; color: var(--fg-tertiary); font-size: var(--text-base); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.toprow__heat { flex-shrink: 0; width: 120px; text-align: right; color: var(--fg-tertiary); font-size: var(--text-sm); }
.toprow__heat b { display: block; color: var(--fg-secondary); font-size: var(--text-md); }

@media (max-width: 768px) {
  .result { gap: 12px; padding: 10px; }
  .result__thumb { width: 100px; }
  .result__title { font-size: var(--text-md); }
  .result__desc { display: none; }
  .toprow__thumb { width: 76px; }
  .toprow__rank { width: 30px; font-size: 22px; }
  .toprow__score { display: none; }
  .toprow__heat { width: auto; }
}

/* ─── Auth 登入頁 ───────────────────────────────────────── */
.auth { position: relative; min-height: 100vh; display: grid; place-items: center; padding: calc(var(--nav-h) + 40px) 20px 64px; overflow: hidden; }
.auth__bg { position: absolute; inset: 0; z-index: 0; }
.auth__bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(28px) brightness(.32); transform: scale(1.15); }
.auth__bg::after { content: ""; position: absolute; inset: 0; background: rgba(20,20,20,.7); }
.auth__card { position: relative; z-index: 1; width: 100%; max-width: 416px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 42px 38px; text-align: center; box-shadow: var(--shadow-pop); }
.auth__logo { display: inline-flex; align-items: center; gap: 10px; }
.auth__logo .brand__mark { width: 40px; height: 40px; }
.auth__logo .brand__name { font-size: 26px; }
.auth__title { font-size: var(--text-2xl); font-weight: 800; margin-top: 22px; }
.auth__sub { color: var(--fg-tertiary); font-size: var(--text-base); margin-top: 10px; line-height: 1.6; }
.auth__divider { display: flex; align-items: center; gap: 14px; margin: 26px 0 6px; color: var(--fg-quaternary); font-size: var(--text-sm); }
.auth__divider::before, .auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth__alt { display: block; margin-top: 22px; color: var(--fg-quaternary); font-size: var(--text-sm); line-height: 1.6; }
.auth__alt a { color: var(--fg-secondary); }
.auth__alt a:hover { color: var(--fg); }
/* Google 登入鈕（GIS 官方按鈕）置中容器 */
.auth__gsi { display: flex; justify-content: center; margin-top: 32px; min-height: 44px; }
.auth__terms { margin-top: 26px; color: var(--fg-quaternary); font-size: var(--text-sm); line-height: 1.7; }
.auth__terms a { color: var(--fg-secondary); }
.auth__terms a:hover { color: var(--green); }

/* ─── Profile 個人中心 ─────────────────────────────────── */
.profile__hero { position: relative; background: var(--bg-elev); border-bottom: 1px solid var(--border); }
.profile__hero-inner { max-width: var(--content-max); margin: 0 auto; padding: calc(var(--nav-h) + 40px) var(--gutter) 32px; display: flex; align-items: center; gap: 26px; }
.profile__avatar { width: 100px; height: 100px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 3px solid var(--surface-2); background: var(--surface); }
.profile__avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile__id { flex: 1; min-width: 0; }
.profile__name { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -.5px; }
.profile__badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.member-tag { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 12px; border-radius: var(--radius-pill); background: var(--surface); color: var(--fg-secondary); font-size: var(--text-sm); font-weight: 700; }
.member-tag--vip { background: var(--vip-grad); color: var(--vip-ink); }
.profile__edit { margin-left: auto; align-self: flex-start; }

.tabs-bar { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs-bar a { position: relative; padding: 16px 18px; color: var(--fg-secondary); font-size: var(--text-md); font-weight: 600; }
.tabs-bar a:hover { color: var(--fg); }
.tabs-bar a.active { color: var(--fg); }
.tabs-bar a.active::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: -1px; height: 3px; background: var(--green); border-radius: 3px; }

.empty { text-align: center; padding: 60px 20px; color: var(--fg-tertiary); }

/* ─── Member 會員頁（資料 / 收藏 / 歷史） ──────────────────── */
.profile__avatar svg { width: 100%; height: 100%; padding: 22%; box-sizing: border-box; fill: var(--fg-tertiary); }
.member { max-width: var(--content-max); margin: 0 auto; padding: 28px var(--gutter) var(--space-8); }

/* 個人資料表單 */
.mform { max-width: 520px; }
.mform__row { margin-bottom: 18px; }
.mform__row label { display: block; margin-bottom: 8px; color: var(--fg-secondary); font-size: var(--text-sm); font-weight: 600; }
.mform__row input { width: 100%; height: 46px; padding: 0 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); color: var(--fg); font-size: var(--text-md); }
.mform__row input:focus { outline: none; border-color: var(--green); }
.mform__row input[readonly] { color: var(--fg-tertiary); cursor: default; }
.mform__actions { margin-top: 26px; }

/* 收藏/歷史卡片：海報 + 右上角移除鈕 */
.fav-item { position: relative; }
.fav-remove { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; transition: background var(--t-fast), transform var(--t-fast); }
.fav-remove svg { width: 16px; height: 16px; fill: currentColor; }
.fav-remove:hover { background: var(--green); }
.fav-remove:active { transform: scale(.92); }

/* 收藏狀態的動作鈕 */
.act-btn.is-faved { background: var(--green-soft); color: var(--green); }
.act-btn.is-faved:hover { background: var(--green-soft); }

/* 歷史頁頂列：提示 + 清除全部 */
.member__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.member__hint { color: var(--fg-tertiary); font-size: var(--text-sm); }
.member__clear { height: 36px; padding: 0 16px; font-size: var(--text-sm); background: var(--surface); color: var(--fg-secondary); border: 1px solid var(--border); }
.member__clear:hover { background: var(--surface-hover); color: var(--fg); }

@media (max-width: 768px) {
  .auth { padding-top: calc(var(--nav-h) + 20px); padding-bottom: 40px; align-items: start; min-height: 0; }
  .auth__card { padding: 32px 24px; }
  .profile__hero-inner { gap: 16px; }
  .profile__avatar { width: 72px; height: 72px; }
  .profile__name { font-size: var(--text-2xl); }
  .profile__edit { display: none; }
  .tabs-bar a { padding: 14px 12px; font-size: var(--text-base); }
}

/* ═══ Light theme 淺色模式 ═══════════════════════════════════
 * 預設深色(:root)；首訪跟隨系統(head inline 腳本)；手動切換記 localStorage。
 * scrim/hero/卡片遮罩維持深色(壓在圖片上)，不在此覆寫。 */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --surface: #ebedf1;
  --surface-2: #e1e4ea;
  --surface-hover: #d8dce3;
  --border: #e4e6ec;
  --border-light: #d2d6df;
  --fg: #16181f;
  --fg-secondary: #585d6c;
  --fg-tertiary: #888d9c;
  --fg-quaternary: #a7abb9;
  --green-soft: rgba(229, 9, 20, 0.13);
  --overlay: rgba(0, 0, 0, 0.4);
  --scrollbar: rgba(0, 0, 0, 0.2);
  --scrollbar-hover: rgba(0, 0, 0, 0.34);
  --ring-green: 0 0 10px 3px rgba(25,30,45,0.18), 0 0 24px 8px rgba(25,30,45,0.09);
  --shadow-card: 0 6px 22px rgba(25, 30, 45, 0.12);
  --shadow-pop: 0 16px 40px rgba(25, 30, 45, 0.18);
}

/* 導覽列圖示鈕: 透明態(浮在 hero)/深色實心=白；淺色實心=深 */
.topnav .icon-btn { color: rgba(255, 255, 255, 0.9); }
.topnav .icon-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* nav 滾動實心態在淺色模式為白底深字 (透明態維持白字，因壓在深色 hero 上)
 * 註：淺色模式下 *非 hero 頁* (category/search/top/play/user/login) 即使沒滾動，
 *     header 也直接套 is-solid 樣式，避免白字浮在白底上看不見。 */
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: none; }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .brand__name { color: var(--fg); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .topnav__menu a { color: var(--fg-tertiary); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .topnav__menu a:hover { color: var(--fg-secondary); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .topnav__menu a.active { color: var(--green); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .search__icon { fill: var(--fg-tertiary); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .search:focus-within .search__icon { fill: var(--fg-secondary); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .search__input { background: var(--bg-elev); border-color: var(--border); color: var(--fg); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .search__input::placeholder { color: var(--fg-tertiary); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .search__btn { background: var(--surface); border-color: var(--border); color: var(--fg-secondary); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .search:focus-within .search__btn { border-color: var(--green); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .topnav__login { border-color: var(--border-light); color: var(--fg); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .topnav__login:hover { border-color: var(--fg); background: var(--surface); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .icon-btn { color: var(--fg-secondary); }
[data-theme="light"] :is(.topnav.is-solid, body:not([data-active="index"]):not([data-active="detail"]) .topnav) .icon-btn:hover { background: var(--surface); color: var(--fg); }

/* 內容列左右捲動箭頭淺色 */
[data-theme="light"] .arrow-left, [data-theme="light"] .arrow-right { color: rgba(20, 22, 28, 0.6); }
/* msearch 淺色模式 */
[data-theme="light"] .msearch { background: rgba(255,255,255,0.95); border-bottom-color: var(--border); }
[data-theme="light"] .msearch__back { color: var(--fg-secondary); }
[data-theme="light"] .msearch__form { background: rgba(0,0,0,0.06); border-color: var(--border); }
[data-theme="light"] .msearch__input { color: var(--fg); }
[data-theme="light"] .msearch__ico { fill: var(--fg-tertiary); }
[data-theme="light"] .arrow-left:hover, [data-theme="light"] .arrow-right:hover { color: #000; }
[data-theme="light"] .arrow-left svg, [data-theme="light"] .arrow-right svg { filter: drop-shadow(0 1px 3px rgba(255, 255, 255, 0.8)); }

/* 主題切換鈕 太陽/月亮 圖示互換 */
[data-theme-toggle] .ico-moon { display: none; }
[data-theme="light"] [data-theme-toggle] .ico-sun { display: none; }
[data-theme="light"] [data-theme-toggle] .ico-moon { display: inline; }
@media (max-width: 768px) { .topnav .theme-toggle { width: 36px; height: 36px; } .topnav .theme-toggle svg { width: 18px; height: 18px; } }

/* 手機抽屜內的主題切換列 */
.drawer__toggle { display: block; width: 100%; text-align: left; margin-top: 8px; padding: 13px 12px; border-radius: var(--radius-md); border-top: 1px solid var(--border); color: var(--fg-secondary); font-size: var(--text-md); font-weight: 600; }
.drawer__toggle:hover { background: var(--surface); color: var(--fg); }

/* hero / 詳情 backdrop 是壓在深色大圖上的 banner — 淺色模式仍維持深底白字
 * (文字本來用 --fg 等變數，淺色模式會變深字疊在深圖上看不見；backdrop 也會淡成白底把字吃掉) */
[data-theme="light"] .detail__backdrop::after { background: linear-gradient(0deg, #141414 2%, rgba(20,20,20,.5) 45%, rgba(20,20,20,.25) 100%); }
[data-theme="light"] .hero__title,
[data-theme="light"] .detail__title { color: #fff; }
[data-theme="light"] .hero__desc,
[data-theme="light"] .hero__meta,
[data-theme="light"] .detail__sub,
[data-theme="light"] .detail__meta { color: rgba(255, 255, 255, 0.86); }
[data-theme="light"] .detail__cast-line { color: rgba(255, 255, 255, 0.66); }
[data-theme="light"] .detail__cast-line b { color: rgba(255, 255, 255, 0.86); }
[data-theme="light"] .hero__tag,
[data-theme="light"] .detail__meta .pill { border-color: rgba(255, 255, 255, 0.32); color: rgba(255, 255, 255, 0.86); }
[data-theme="light"] .detail__meta .dot { background: rgba(255, 255, 255, 0.5); }
