:root {
  --ink: #1a1d29;
  --muted: #5f6678;
  --line: #e2e5ee;
  --ground: #f7f8fb;
  --surface: #ffffff;
  --accent: #1a1d29;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: 'Noto Sans TC', 'Noto Sans JP', system-ui, sans-serif; color: var(--ink); background: var(--ground); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.spacer { flex: 1; }
.status { padding: 48px 20px; text-align: center; color: var(--muted); }
:focus-visible { outline: 3px solid #7f95d6; outline-offset: 2px; }

/* 頁首 */
.site-head { height: 64px; display: flex; align-items: center; gap: 28px; padding: 0 40px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-size: 18px; font-weight: 700; white-space: nowrap; }
.site-nav { display: flex; gap: 22px; font-size: 14px; font-weight: 500; color: #4a5168; }
.lang-switch { display: flex; border: 1px solid #d3d7e2; border-radius: 22px; overflow: hidden; }
.lang-btn { min-height: 40px; padding: 0 16px; border: 0; background: var(--surface); color: #4a5168; font-size: 13px; font-weight: 700; cursor: pointer; }
.lang-btn.on { background: var(--ink); color: #fff; }

/* 列表頁 */
.layout { display: flex; gap: 32px; padding: 28px 40px 60px; align-items: flex-start; }
.filters { width: 260px; flex: none; }
.filters-summary { display: none; }
.filters-body { display: flex; flex-direction: column; gap: 22px; }
.f-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.f-note { margin-left: 8px; font-weight: 400; font-size: 12px; }
.inp { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #d3d7e2; border-radius: 8px; background: var(--surface); font-size: 15px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid #d3d7e2; border-radius: 20px; background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.swatch-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--c); }
.swatch.on .swatch-dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }
.btn-link { align-self: flex-start; min-height: 44px; padding: 0; border: 0; background: none; color: #2a459e; font-weight: 700; text-decoration: underline; cursor: pointer; }
.results { flex: 1; min-width: 0; }
.results-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.results-head h1 { font-size: 22px; }
.empty { padding: 40px 0; color: var(--muted); }
/* 頻道卡是橫向卡：佔兩欄寬，高度與直向卡幾乎一樣。嚴格依卡編號排列，頻道卡排在一排最後一欄時該排會留空位 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }
.card-link-wide { grid-column: span 2; }
.art.art-landscape { aspect-ratio: 88 / 63; }
.card-link { display: flex; flex-direction: column; gap: 8px; }
.card-link:hover .art { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); }
.art-wrap { position: relative; }
.art { aspect-ratio: 63 / 88; border-radius: 10px; border: 1px solid #d3d7e2; border-top: 6px solid #9aa1b2; background: linear-gradient(180deg, #eef0f6, #e2e6f0); overflow: hidden; display: flex; align-items: center; justify-content: center; transition: box-shadow 0.15s; }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-ph { padding: 8px; text-align: center; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cost { position: absolute; top: 14px; left: 8px; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.card-name { font-size: 14px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.card-sub { font-size: 12px; color: var(--muted); }

/* 色塊（標籤、配信者名、關鍵字） */
.tk { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; margin: 0 2px; border-radius: 13px; font-size: 13px; font-weight: 700; vertical-align: middle; line-height: 1.3; }
.tk-tag { background: #e6ebfa; color: #2a459e; }
.tk-liver { background: #f0e6fa; color: #5e2a8f; border-radius: 6px; }
.tk-kw { background: #fcefcf; color: #7c5200; border-radius: 6px; }
a.tk:hover { filter: brightness(0.95); text-decoration: underline; }
.color-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.color-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--c); color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 0 2px rgba(0, 0, 0, 0.6); }

.tk-missing { background: #fdecec; color: #8e1f25; }
.code-chip { display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 6px; background: #eceff6; color: #26355d; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.set-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; text-align: left; }
.set-thumb { flex: none; width: 72px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: #e8ebf3; }
.liver-chip { display: inline-flex; align-items: center; gap: 8px; }
.avatar { flex: none; width: 32px; height: 32px; object-fit: cover; border-radius: 8px; background: #e8ebf3; }

/* 篩選到彈數或配信者時，列表上方的橫額圖與頭像 */
.filter-hero { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; margin-bottom: 20px; }
.hero { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 100%; }
.hero-liver { flex-direction: row; align-items: center; gap: 14px; }
.hero-banner { display: block; width: min(640px, 100%); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: #e8ebf3; }
.hero-avatar { flex: none; width: 88px; height: 88px; object-fit: cover; border-radius: 18px; background: #e8ebf3; }
.hero-title { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }

/* 選擇欄位（彈數、配信者、標籤）與選擇視窗 */
.pick-field { display: flex; gap: 6px; }
.pick-btn { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid #d3d7e2; border-radius: 8px; background: var(--surface); text-align: left; cursor: pointer; }
.pick-btn:hover { background: #f4f6fa; }
.pick-val { min-width: 0; display: flex; }
.pick-ph { color: var(--muted); font-size: 15px; }
.pick-caret { margin-left: auto; color: var(--muted); }
.pick-clear { flex: none; width: 44px; min-height: 44px; border: 1px solid #d3d7e2; border-radius: 8px; background: var(--surface); color: #4a5168; cursor: pointer; }
.pick-clear:hover { background: #f4f6fa; }
.dlg { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); overflow: auto; color: var(--ink); background: var(--surface); }
.dlg::backdrop { background: rgba(26, 29, 41, 0.55); }
.dlg-head { padding: 20px 24px 4px; }
.dlg-head h2 { font-size: 18px; }
.pick-body { padding: 12px 24px 8px; display: flex; flex-direction: column; gap: 10px; }
.pick-search { border: 2px solid var(--ink); }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; text-align: left; }
.pick-item:hover { background: #eef1fa; }
.pick-on, .pick-on:hover { background: #e6ebfa; box-shadow: 0 0 0 2px var(--ink) inset; }
.pick-count { margin-left: auto; color: var(--muted); font-size: 13px; }
.dlg-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--ground); }
.pick-preview { flex: 1; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dlg .btn { flex: none; padding: 0 18px; cursor: pointer; font: inherit; }
.dlg .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #000; }

/* 詳情頁 */
.detail { padding: 24px 40px 60px; max-width: 1100px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.crumbs a:hover { text-decoration: underline; }
.detail-grid { display: flex; gap: 48px; align-items: flex-start; }
.detail-art { width: 340px; flex: none; display: flex; flex-direction: column; gap: 14px; }
.art-large .art-ph { font-size: 14px; }
.detail-art-wide { width: 480px; }
.prevnext { display: flex; gap: 8px; }
.btn { flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d3d7e2; border-radius: 8px; background: var(--surface); font-size: 14px; font-weight: 700; text-align: center; }
.btn:hover:not(.btn-off) { background: #f0f2f7; }
.btn-off { opacity: 0.4; }
.detail-body { flex: 1; min-width: 0; }
.detail-meta { display: flex; align-items: center; gap: 10px; }
.badge { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 13px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }
.detail-name { font-size: 30px; line-height: 1.3; margin: 4px 0 14px; overflow-wrap: anywhere; }
.info { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 20px; }
.info-row { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.info-row:last-child { border-bottom: 0; }
.info-k { width: 110px; flex: none; font-size: 13px; color: var(--muted); padding-top: 2px; }
.info-v { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.tk-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sec-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 24px 0 8px; }
.effects { display: flex; flex-direction: column; gap: 10px; }
.effect { padding: 14px 18px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 16px; line-height: 1.9; }
.eff-mark { margin-right: 4px; }
.eff-timing { margin-right: 4px; }
.eff-bracket { margin-right: 4px; color: #3c4459; }
.ja-original { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #d3d7e2; font-size: 14px; color: #4a5168; }
.ja-original summary { cursor: pointer; min-height: 32px; font-size: 13px; font-weight: 700; color: var(--muted); }

/* 手機與平板 */
@media (max-width: 900px) {
  .site-head { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 16px; padding: 8px 16px; }
  .layout { flex-direction: column; padding: 14px 16px 48px; gap: 16px; }
  .filters { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
  .filters-summary { display: flex; align-items: center; min-height: 48px; padding: 0 16px; font-weight: 700; cursor: pointer; }
  .filters-body { padding: 4px 16px 16px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
  .detail { padding: 16px 16px 48px; }
  .detail-grid { flex-direction: column; gap: 20px; }
  .detail-art { width: min(260px, 100%); align-self: center; }
  .detail-art-wide { width: min(420px, 100%); }
  .info-row { flex-direction: column; gap: 2px; }
  .info-k { width: auto; }
  .detail-name { font-size: 24px; }
}
@media (max-width: 420px) {
  .brand { font-size: 16px; }
  .grid { gap: 14px 8px; }
  .card-name { font-size: 13px; }
}
