/* 版面：深灰藍頂欄 + 白色次導覽 + 淺底上的柔影卡片；黃色只留給品牌與重點。
   頭像色沿用 Telegram 無頭貼時的七色 */
:root {
    --ink: #333b48;
    --ink-soft: #4a5362;
    --bar: #2c343f;
    --bar-soft: #3a4350;
    --paper: #ffffff;
    --page: #f7f9fc;
    --line: #e3e7ed;
    --hover: #f1f4f8;
    --muted: #768091;
    --yellow: #ffd23f;
    --yellow-soft: #fff6d1;
    --link: #1f7fb8;
    --chip: #e9edf3;
    --chip-hover: #dde3ec;
    --line-strong: #c5ccd8;
    --radius: 8px;
    --shadow: 0 0 28px rgba(154, 161, 171, .16);
}

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }
body {
    margin: 0; min-height: 100%; display: flex; flex-direction: column;
    font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}
body > main { flex: 1; width: 100%; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }

h1, h2, p, ul, ol, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main.container { padding-top: 28px; padding-bottom: 64px; }

/* ---------- 頁首：深色頂欄 ---------- */
.site-header { position: relative; z-index: 2; }
.topbar { background: var(--bar); color: #fff; }
.topbar .container { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: .04em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    background: var(--yellow); color: var(--bar); border-radius: 8px;
    font-weight: 900; font-size: .95rem; letter-spacing: 0;
}

.site-search { display: flex; flex: 0 1 380px; }
.site-search input {
    flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 0; border-radius: 6px 0 0 6px;
    font: inherit; font-size: .9rem; color: #fff; background: var(--bar-soft);
}
.site-search input::placeholder { color: #9aa5b5; }
.site-search button {
    height: 40px; padding: 0 16px; border: 0; border-radius: 0 6px 6px 0; cursor: pointer;
    font: inherit; font-size: .9rem; font-weight: 700; color: var(--bar); background: var(--yellow);
}
.site-search button:hover { background: #ffc400; }
.site-search input:focus-visible, .site-search button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.topbar-action {
    align-self: stretch; display: inline-flex; align-items: center; margin-left: auto; padding: 0 22px;
    background: var(--bar-soft); color: #dbe3f1; font-size: .9rem; white-space: nowrap;
}
.topbar-action:hover { color: #fff; text-decoration: none; background: #46505f; }

/* ---------- 頁首：白色次導覽 ---------- */
.subnav { background: var(--paper); box-shadow: 0 1px 12px rgba(154, 161, 171, .18); }
.subnav .container { display: flex; align-items: center; gap: 6px; height: 52px; }
.site-nav { display: flex; gap: 4px; align-self: stretch; }
.site-nav a {
    display: inline-flex; align-items: center; padding: 0 14px;
    color: var(--muted); font-size: .95rem; border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.site-nav a[aria-current] { color: var(--ink); font-weight: 700; border-bottom-color: var(--yellow); }
.tagline { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* ---------- 首頁標題 ---------- */
.hero { padding: 44px 0 8px; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.3; font-weight: 800; }
.hero h1 span { display: inline-block; }
.hero p { margin: 10px auto 0; color: var(--muted); font-size: 1rem; max-width: 36em; }
.hero strong { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* 首頁：搜尋機器人推廣 */
.bot-promo {
    display: flex; align-items: center; gap: 14px; max-width: 640px; margin: 20px auto 0; padding: 14px 16px;
    background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--yellow);
    border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; color: var(--ink);
}
.bot-promo:hover { text-decoration: none; border-color: var(--line-strong); border-left-color: #ffc400; }
.bot-promo-icon {
    flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px;
    background: var(--yellow-soft); color: var(--bar); border-radius: 50%; font-weight: 900;
}
.bot-promo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bot-promo-text b { font-size: 1rem; }
.bot-promo-text span { color: var(--muted); font-size: .88rem; }
.bot-promo-cta {
    flex: none; padding: 8px 16px; border-radius: 6px; background: var(--yellow); color: var(--bar);
    font-weight: 700; font-size: .9rem; white-space: nowrap;
}
.bot-promo:hover .bot-promo-cta { background: #ffc400; }
@media (max-width: 560px) {
    .bot-promo { flex-wrap: wrap; }
    .bot-promo-cta { width: 100%; text-align: center; }
}

.section-title { font-size: 1.25rem; font-weight: 800; margin: 44px 0 14px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 44px 0 14px; }
.section-head .section-title { margin: 0; }
.section-head a { font-size: .9rem; }

/* ---------- 白底卡片 ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

/* ---------- 分類卡片（首頁） ---------- */
.category-index { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.category-index a {
    display: flex; flex-direction: column; height: 100%; padding: 20px;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); color: var(--ink); transition: transform .15s, box-shadow .15s;
}
.category-index a:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 32px rgba(154, 161, 171, .3); }
.category-card-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.category-icon {
    display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px;
    border-radius: 10px; background: var(--hover); border: 1px solid var(--line);
    font-size: 1.5rem; line-height: 1;
}
.category-name { font-weight: 800; font-size: 1.2rem; overflow-wrap: anywhere; }
.category-stat { display: flex; justify-content: space-between; padding: 12px 0; font-size: .9rem; color: var(--muted); }
.category-stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.category-open {
    margin-top: auto; padding: 7px 0; text-align: center; font-size: .9rem;
    background: var(--hover); border: 1px solid var(--line); border-radius: 6px; color: var(--ink-soft);
}
.category-index a:hover .category-open { background: var(--yellow); border-color: var(--yellow); color: var(--bar); font-weight: 700; }
.count { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* ---------- 頻道／群組列表：一列一張卡 ---------- */
.group-list.panel { display: grid; gap: 10px; background: none; border: 0; box-shadow: none; overflow: visible; }
.group-list > li {
    position: relative; display: grid; align-items: center; gap: 16px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 14px 20px; background: var(--paper);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.group-list > li:hover { border-color: var(--line-strong); }
/* 名次標籤：凸出卡片右緣 */
.group-list.ranked > li { padding-right: 56px; }
.rank {
    position: absolute; top: 14px; right: -12px; padding: 3px 11px; border-radius: 4px;
    background: #7b8494; color: #fff; font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums;
    box-shadow: 0 3px 10px rgba(60, 70, 85, .28);
}
.rank::before { content: "#"; }
.ranked > li:nth-child(-n+3) .rank { background: var(--yellow); color: var(--bar); }

.group-title { color: var(--ink); font-weight: 700; font-size: 1.02rem; }
.group-title::after { content: ""; position: absolute; inset: 0; }   /* 整列可點 */
.group-title:hover { text-decoration: none; color: var(--link); }
.group-desc { color: var(--muted); font-size: .88rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.members { min-width: 7em; text-align: center; font-weight: 500; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.members small { display: block; margin-top: 2px; font-weight: 400; font-size: .78rem; color: var(--muted); }

.chip {
    display: inline-block; margin-top: 6px; padding: 0 8px; border-radius: 4px;
    background: var(--hover); border: 1px solid var(--line); color: var(--ink-soft); font-size: .78rem; line-height: 1.7;
}

/* 列表裡的頭像加一圈細框 */
.group-list .avatar { width: 56px; height: 56px; font-size: 1.3rem; box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--line); margin: 4px; }

/* ---------- 排行頁標題與類型切換 ---------- */
.rank-head { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0 32px; text-align: center; }
.rank-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.3; font-weight: 800; }
.rank-head p { color: var(--muted); font-size: .9rem; }
.segmented { display: inline-flex; border: 1px solid var(--ink-soft); border-radius: 4px; overflow: hidden; background: var(--paper); }
.segmented a { padding: 5px 18px; color: var(--ink); font-size: .92rem; border-left: 1px solid var(--ink-soft); }
.segmented a:first-child { border-left: 0; }
.segmented a:hover { background: var(--hover); text-decoration: none; }
.segmented a[aria-current] { background: var(--ink-soft); color: #fff; }
.page-head + .segmented { margin-bottom: 16px; }

.badge {
    display: inline-block; margin-left: 6px; padding: 0 7px; vertical-align: 2px;
    font-size: .72rem; font-weight: 500; line-height: 1.6; border-radius: 4px;
    color: var(--ink-soft); background: var(--chip); border: 1px solid var(--line);
}
.badge.channel { background: var(--yellow-soft); border-color: #f1dd8c; color: #6b5300; }

/* ---------- 頭像 ---------- */
.avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 50px; height: 50px; border-radius: 50%;
    color: #fff; font-weight: 700; font-size: 1.2rem; line-height: 1;
}
.avatar.large { width: 84px; height: 84px; font-size: 2rem; }
img.avatar { object-fit: cover; background: var(--hover); }
.tone-0 { background: #d45246; } .tone-1 { background: #e8792b; }
.tone-2 { background: #6c61df; } .tone-3 { background: #3a9e3f; }
.tone-4 { background: #2f96c9; } .tone-5 { background: #3f7fc4; }
.tone-6 { background: #d14f76; }

/* ---------- 內頁兩欄 ---------- */
.breadcrumb { color: var(--muted); font-size: .875rem; margin-bottom: 16px; }
.breadcrumb span[aria-hidden] { margin: 0 6px; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }

.side-index {
    position: sticky; top: 20px; background: var(--paper);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.side-index li + li { border-top: 1px solid var(--line); }
.side-index a {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 12px 18px; border-right: 3px solid transparent; color: var(--ink); font-size: .95rem;
}
.side-index a:hover { background: var(--hover); text-decoration: none; }
.side-index a[aria-current] { border-right-color: var(--yellow); background: var(--hover); font-weight: 700; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h1 { font-size: 1.6rem; line-height: 1.3; font-weight: 800; }
.page-head p { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 22px; color: var(--muted); font-size: .9rem; }
.pagination a { padding: 6px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.pagination a:hover { background: var(--hover); text-decoration: none; }

/* ---------- 詳情頁 ---------- */
.group-detail { padding: 28px; }
.detail-head { display: flex; gap: 20px; align-items: center; }
.detail-head h1 { font-size: 1.6rem; line-height: 1.3; font-weight: 800; overflow-wrap: anywhere; }
.handle { color: var(--muted); font-size: .95rem; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.facts div { padding: 14px 16px; text-align: center; background: var(--hover); border: 1px solid var(--line); border-radius: 6px; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: 0; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.description { max-width: 40em; white-space: pre-line; overflow-wrap: anywhere; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tags li { padding: 2px 10px; border-radius: 4px; background: var(--chip); border: 1px solid var(--line); color: var(--ink-soft); font-size: .85rem; }
.tags li::before { content: "#"; opacity: .55; }

.join-button {
    display: inline-block; margin-top: 26px; padding: 11px 28px;
    background: var(--yellow); color: var(--bar); border-radius: 6px; font-weight: 700;
}
.join-button:hover { background: #ffc400; text-decoration: none; }

/* ---------- 申請收錄 ---------- */
.add-bot { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.add-bot-option {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 22px 24px; background: var(--paper); color: var(--ink);
}
.add-bot-option .badge { margin-left: 0; }
.add-bot-option strong { font-size: 1.15rem; }
.add-bot-option small { color: var(--muted); font-size: .85rem; }
.add-bot-option:hover { background: var(--hover); text-decoration: none; }

.steps > li { display: flex; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line); }
.steps > li:first-child { border-top: 0; }
.step-no {
    display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px;
    border-radius: 50%; background: var(--yellow); color: var(--bar); font-weight: 700; font-size: .9rem;
}

/* ---------- 審核後台 ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs a {
    display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 16px;
    background: var(--chip); border: 1px solid transparent; border-radius: 999px;
    color: var(--ink-soft); font-size: .95rem;
}
.tabs a:hover { background: var(--chip-hover); text-decoration: none; }
.tabs a[aria-current] { background: var(--bar); color: #fff; font-weight: 700; }
.tabs a[aria-current] .count { color: var(--yellow); }

.notice {
    margin-bottom: 16px; padding: 10px 16px; border-left: 4px solid var(--yellow);
    background: var(--yellow-soft); border-radius: 4px; font-size: .95rem;
}

.review-list > li {
    display: grid; align-items: center; gap: 14px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 16px 20px; border-top: 1px solid var(--line);
}
.review-list > li:first-child { border-top: 0; }
.review-info strong { font-size: 1.02rem; overflow-wrap: anywhere; }
.review-meta { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.review-desc { margin-top: 4px; font-size: .9rem; white-space: pre-line; overflow-wrap: anywhere; }
.review-note { max-width: 14em; color: var(--muted); font-size: .85rem; }
.review-cats { margin-top: 6px; }
.review-cats .badge { margin: 0 4px 0 0; }
.review-cats .badge.primary-cat { background: var(--yellow); border-color: var(--yellow); color: var(--bar); }
.review-edit-cats { grid-column: 2 / -1; font-size: .9rem; }
.review-edit-cats summary { cursor: pointer; color: var(--link); }
.review-edit-cats .category-picker { margin-top: 10px; }

.review-form { display: flex; align-items: center; gap: 8px; }
/* 分類勾選 */
.category-picker { margin: 0; padding: 0; border: 0; min-width: 0; }
.category-picker legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: .95rem; }
.category-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.category-picker label {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
    font-size: .9rem; cursor: pointer;
}
.category-picker label:has(input:checked) { background: var(--yellow); border-color: var(--yellow); font-weight: 700; }
.category-picker label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.category-picker input { margin: 0; accent-color: var(--bar); }

/* 群主的設定頁 */
.edit-form { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin: 20px 0; }
.edit-hint { color: var(--muted); font-size: .9rem; }
.edit-hint + .edit-hint { margin-top: 6px; }

.review-form select, .edit-form select, .btn {
    height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px;
    font: inherit; font-size: .9rem; color: var(--ink); background: var(--hover);
}
.review-form select, .edit-form select { background: var(--paper); }
.btn { cursor: pointer; font-weight: 700; white-space: nowrap; }
.btn:hover { border-color: var(--line-strong); background: var(--chip-hover); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--bar); }
.btn.primary:hover { background: #ffc400; border-color: #ffc400; }
.review-form select:focus-visible, .btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- 回報問題 ---------- */
main.container.narrow { max-width: 720px; }
.report-form { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; padding: 28px; }
.report-form .notice { align-self: stretch; margin: 0; }
.notice.error { border-left-color: #d45246; background: #fdeeec; }
.report-target { align-self: stretch; display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--hover); border: 1px solid var(--line); border-radius: 6px; }
.report-target strong { overflow-wrap: anywhere; }
.report-reasons { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.report-reasons legend, .field > span { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: .95rem; }
.report-reasons label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.report-reasons input { margin: 0; accent-color: var(--bar); }
.field { align-self: stretch; display: flex; flex-direction: column; }
.field small { font-weight: 400; color: var(--muted); }
.field textarea, .field input {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px;
    font: inherit; font-size: .95rem; color: var(--ink); background: var(--paper);
}
.field textarea { resize: vertical; min-height: 7em; }
.field textarea:focus-visible, .field input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.report-done { padding: 36px 28px; text-align: center; }
.report-done h2 { font-size: 1.25rem; font-weight: 800; }
.report-done p { margin-top: 8px; color: var(--muted); }
.report-link { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }

.admin-nav { margin-bottom: 20px; }
.report-list > li { grid-template-columns: minmax(0, 1fr) auto; }
.report-list .badge { margin: 0 6px 0 0; }

/* ---------- 頁尾 ---------- */
.site-footer { background: var(--bar); color: #9aa5b5; font-size: .88rem; padding: 36px 0 40px; }
.site-footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer h2 { margin-bottom: 10px; color: #dbe3f1; font-size: .95rem; font-weight: 700; }
.site-footer li { margin-top: 4px; }
.site-footer a { color: #9aa5b5; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.footer-about p { max-width: 30em; margin-top: 10px; }

/* ---------- 錯誤頁（404 等） ---------- */
.error-page { padding: 48px 28px; text-align: center; }
.error-code {
    display: inline-block; padding: 8px 20px; border-radius: 12px; background: var(--yellow); color: var(--bar);
    font-size: 2.6rem; font-weight: 900; line-height: 1; letter-spacing: .04em;
}
.error-page h1 { margin-top: 12px; font-size: 1.5rem; font-weight: 800; }
.error-page > p:not(.error-code) { margin-top: 8px; color: var(--muted); }
.error-search { display: flex; gap: 8px; max-width: 420px; margin: 24px auto 0; }
.error-search input {
    flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px;
    font: inherit; font-size: .95rem; color: var(--ink); background: var(--paper);
}
.error-search input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.error-links { display: flex; gap: 20px; justify-content: center; margin-top: 20px; }

/* ---------- 成人內容年齡確認 ---------- */
html.age-gated { overflow: hidden; }
.age-gate {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
    background: var(--page);
}
.age-gate-box {
    max-width: 420px; padding: 32px 28px; text-align: center;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.age-gate-icon { font-size: 3rem; line-height: 1; }
.age-gate h2 { margin-top: 14px; font-size: 1.3rem; font-weight: 800; }
.age-gate-box > p:not(.age-gate-icon) { margin-top: 8px; color: var(--muted); }
.age-gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.age-gate-actions .btn { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.age-gate-actions .btn.primary { color: var(--bar); }

/* ---------- 手機 ---------- */
@media (max-width: 960px) {
    .tagline { display: none; }
    .category-index { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
    .topbar .container { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; gap: 10px 14px; }
    .topbar-action { align-self: center; padding: 7px 14px; border-radius: 6px; }
    .site-search { order: 3; flex: 1 1 100%; }
    .subnav .container { height: 46px; }
    .site-nav a { padding: 0 10px; }
    .hero { padding: 28px 0 4px; }
    /* 手機上分類卡片縮成一列：圖示＋名稱＋數量，不顯示按鈕 */
    .category-index { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .category-index a { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; box-shadow: none; }
    .category-index a:hover { transform: none; box-shadow: none; background: var(--hover); }
    .category-icon { width: 30px; height: 30px; border-radius: 8px; font-size: 1.05rem; }
    .category-name { font-size: .95rem; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .category-card-head { flex: 1; min-width: 0; gap: 8px; padding-bottom: 0; border-bottom: 0; }
    .category-stat { padding: 0; font-size: 0; }
    .category-stat b { font-size: .8rem; font-weight: 400; color: var(--muted); }
    .category-open { display: none; }
    .add-bot { grid-template-columns: minmax(0, 1fr); }

    .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .side-index { position: static; order: 2; background: none; border: 0; box-shadow: none; overflow: visible; }
    .side-index ul { display: flex; flex-wrap: wrap; gap: 6px; }
    .side-index li + li { border-top: 0; }
    .side-index a { padding: 4px 12px; gap: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; }
    .side-index a[aria-current] { background: var(--yellow); border-color: var(--yellow); }

    .group-list > li { padding: 12px 14px; gap: 12px; }
    .group-list.ranked > li { padding-right: 14px; }
    .rank { top: -1px; right: -1px; border-radius: 0 var(--radius) 0 6px; padding: 0 8px; font-size: .72rem; box-shadow: none; }
    .group-list .avatar { width: 44px; height: 44px; font-size: 1.1rem; }
    .rank-head { padding: 4px 0 20px; }
    .members { min-width: 0; text-align: right; font-size: .95rem; }
    .review-list > li { grid-template-columns: auto minmax(0, 1fr); padding: 14px; }
    .review-form, .review-note { grid-column: 1 / -1; max-width: none; }
    .review-form select { flex: 1; min-width: 0; }
    .page-head { flex-direction: column; gap: 2px; }
    .page-head h1 { font-size: 1.35rem; }
    .group-detail { padding: 20px; }
    .detail-head h1 { font-size: 1.3rem; }
    .avatar.large { width: 64px; height: 64px; font-size: 1.6rem; }
    .facts { gap: 8px; }
    .facts div { padding: 10px 6px; }
    .facts dd { font-size: 1rem; }
    .join-button { display: block; text-align: center; }
    .report-form { padding: 20px; }
    .report-list > li { grid-template-columns: minmax(0, 1fr); }
    .site-footer .container { grid-template-columns: 1fr 1fr; gap: 24px; }
    .footer-about { grid-column: 1 / -1; }
}

/* ---------- 深色模式 ----------
   <html data-theme="dark"> 時套用；預設跟著系統，可用頁首的按鈕切換（見 fragments.html 的 head）。
   只換顏色變數；--bar 本來就是深色（頂欄、頁尾、黃色上的字），維持不變 */
:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e3e8ef;
    --ink-soft: #c2cad6;
    --paper: #1f252e;
    --page: #161b22;
    --line: #303844;
    --hover: #262d37;
    --muted: #8f9aab;
    --yellow-soft: #3a3320;
    --link: #5cb6ea;
    --chip: #2a323d;
    --chip-hover: #343d4a;
    --line-strong: #4a5464;
    --shadow: 0 0 28px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .topbar,
[data-theme="dark"] .site-footer { background: #11151b; }
[data-theme="dark"] .site-search input,
[data-theme="dark"] .topbar-action { background: #232a34; }
[data-theme="dark"] .topbar-action:hover { background: #2e3642; }
[data-theme="dark"] .subnav { box-shadow: 0 1px 12px rgba(0, 0, 0, .4); }
[data-theme="dark"] .category-index a:hover { box-shadow: 0 6px 32px rgba(0, 0, 0, .5); }
[data-theme="dark"] .bot-promo-icon { color: var(--yellow); }
[data-theme="dark"] .badge.channel { border-color: #5a4c1e; color: #f3d77a; }
[data-theme="dark"] .segmented a[aria-current],
[data-theme="dark"] .tabs a[aria-current] { background: var(--yellow); color: var(--bar); }
[data-theme="dark"] .tabs a[aria-current] .count { color: var(--bar); }
[data-theme="dark"] .rank { background: #4a5464; }
[data-theme="dark"] .category-picker input,
[data-theme="dark"] .report-reasons input { accent-color: var(--yellow); }
[data-theme="dark"] .notice.error { background: #3a1f1d; }

/* 深淺色切換按鈕（次導覽列最右邊） */
.theme-toggle {
    display: inline-grid; place-items: center; width: 34px; height: 34px; margin-left: 8px; padding: 0;
    border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink-soft);
    cursor: pointer; font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); }
.theme-toggle:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
/* 標語藏起來之後，按鈕自己靠右 */
@media (max-width: 960px) { .theme-toggle { margin-left: auto; } }
