:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf7f2;
  --text: #2a2622;
  --muted: #7a7168;
  --border: #e6dfd5;
  --accent: #d9622b;
  --accent-text: #ffffff;
  --accent-soft: #fbe9df;
  --danger: #c0392b;
  --ok: #2e8b57;
  --mine: #fff6d9;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --radius: 12px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #181614;
  --surface: #221f1c;
  --surface-2: #2a2622;
  --text: #ece6de;
  --muted: #a0968b;
  --border: #3a342e;
  --accent: #ef7d45;
  --accent-text: #1a1310;
  --accent-soft: #3d2619;
  --danger: #ff6b5b;
  --ok: #5fcf8f;
  --mine: #3a3220;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
h2 { margin: 0 0 16px; font-size: 20px; }
h3 { margin: 0; font-size: 17px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { flex: 1; }

/* ---------- 導覽 ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; white-space: nowrap; }
#nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
#nav a, .linklike {
  padding: 6px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font: inherit;
  background: none; border: 0; cursor: pointer;
}
#nav a:hover, .linklike:hover { background: var(--surface-2); }
.theme-toggle { padding: 6px 9px; border-radius: 8px; font-size: 16px; line-height: 1; }
#nav a.active { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- 按鈕與表單 ---------- */

button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--muted); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.ghost { background: transparent; }
.danger { color: var(--danger); }
.small { padding: 3px 8px; font-size: 13px; }
.wide { width: 100%; }

input, select, textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; flex: 1; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; cursor: pointer; white-space: nowrap; }
.check input { width: auto; }
.row { display: flex; gap: 12px; }
.form-error { color: var(--danger); min-height: 1em; margin: 4px 0; }

/* ---------- 工具列 ---------- */

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .check { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 5px 14px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- 團卡片 ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 16px; }

.card, .panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { display: flex; flex-direction: column; padding: 16px; gap: 10px; min-width: 0; }
.card.closed { opacity: 0.65; }
.card > header { display: flex; justify-content: space-between; gap: 12px; }
.card h3 { display: inline; margin-left: 8px; }
.time { margin: 4px 0 0; color: var(--muted); }
.notes { margin: 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; white-space: pre-line; font-size: 14px; }
.count { font-size: 22px; font-weight: 700; text-align: right; line-height: 1.1; white-space: nowrap; }
.count.full { color: var(--ok); }
.count small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.card > footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.cat { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; vertical-align: 2px; background: var(--surface-2); color: var(--muted); }
.cat-c0 { background: #fde2e1; color: #b3261e; }
.cat-c1 { background: #dff3e4; color: #1e7b3c; }
.cat-c2 { background: #e3e8fd; color: #3849b0; }
.cat-c3 { background: #ffe7cc; color: #a85400; }
.cat-c4 { background: #efe3fb; color: #6b2fa3; }
.cat-c5 { background: #d9f2f2; color: #0f6b6b; }
.cat-c6 { background: #fbe3ef; color: #a3245f; }
.cat-c7 { background: #f1ecd8; color: #6e5a12; }
[data-theme="dark"] .cat-c0 { background: #4a1f1c; color: #ffb4ab; }
[data-theme="dark"] .cat-c1 { background: #1b3a25; color: #8fdca6; }
[data-theme="dark"] .cat-c2 { background: #232c55; color: #b6c2ff; }
[data-theme="dark"] .cat-c3 { background: #48300f; color: #ffc27a; }
[data-theme="dark"] .cat-c4 { background: #3a2550; color: #dcb8ff; }
[data-theme="dark"] .cat-c5 { background: #133d3d; color: #8ee0e0; }
[data-theme="dark"] .cat-c6 { background: #4a1d33; color: #ffb0d3; }
[data-theme="dark"] .cat-c7 { background: #3d3418; color: #e8d68a; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center { text-align: center; color: var(--ok); font-weight: 700; }
td.note { white-space: normal; color: var(--muted); font-size: 13px; min-width: 80px; }
td.name { font-weight: 600; }
tr.backup td { color: var(--muted); }
tr.mine td { background: var(--mine); }
.row-actions { text-align: right; }
.row-actions button + button { margin-left: 4px; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.tag.muted { background: var(--surface-2); color: var(--muted); }
.empty { color: var(--muted); margin: 8px 0; }
.empty.big { text-align: center; padding: 60px 0; }

/* ---------- 出團登記 ---------- */

.summary-panel { padding: 12px 16px; margin-bottom: 16px; }
table.summary { width: auto; min-width: 100%; }
table.summary td, table.summary th { padding: 4px 10px; }
table.summary tr.total td { font-weight: 700; border-top: 1px solid var(--border); }
.count-btn { min-width: 34px; padding: 2px 8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.count-btn:hover { background: var(--accent-soft); color: var(--accent); }

table.roster th.center { text-align: center; }
td.day-cell { text-align: center; color: var(--ok); padding: 6px 4px; }
.hl { background: var(--accent-soft); }
tr.mine td.hl { background: var(--mine); }
.search { width: 200px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.day { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 14px; }
.day input { width: auto; margin: 0; }
.day:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- 修改紀錄 ---------- */

.log-list { list-style: none; margin: 0 0 12px; padding: 0; }
.log-entry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.log-entry:last-child { border-bottom: 0; }
.log-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.log-head time { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 90px; }
.log-head .tag { margin-left: 0; }
.log-delete .log-head b:last-child { text-decoration: line-through; text-decoration-color: var(--danger); }
.changes { margin: 6px 0 0 100px; padding: 0; list-style: none; font-size: 14px; }
.changes li { margin: 2px 0; overflow-wrap: anywhere; }
.changes.compact { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 13px; }
.field-name { color: var(--muted); }
.changes del { color: var(--danger); text-decoration-color: var(--danger); }
.changes ins { color: var(--ok); text-decoration: none; font-weight: 600; }

/* ---------- 首頁 ---------- */

.landing { max-width: 420px; margin: 12vh auto 0; text-align: center; }
.landing-icon { font-size: 64px; line-height: 1; }
.landing h1 { margin: 12px 0 8px; font-size: 28px; }
.landing-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }
.landing-actions .button { min-width: 110px; }

.greeting { margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  display: flex; flex-direction: column; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow);
}
.stat:hover { border-color: var(--accent); }
.stat b { font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.home-grid .panel { display: flex; flex-direction: column; gap: 4px; }
.home-grid .panel h3 { margin-top: 0; }
.home-grid .panel > .button { align-self: flex-start; margin-top: 10px; }
.home-grid .my-list li { grid-template-columns: 1fr; }

/* ---------- 頁面 ---------- */

.panel { padding: 20px; }
.panel h3 { margin: 16px 0 10px; }
.auth { max-width: 400px; margin: 24px auto; }
.two-col { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; font-weight: 600; }
.my-list { list-style: none; margin: 0; padding: 0; }
.my-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.my-list li > div:last-child { display: flex; gap: 6px; }

/* ---------- 對話框與提示 ---------- */

dialog {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  opacity: 0; pointer-events: none; transition: 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
  .brand { font-size: 16px; }
  .count { font-size: 18px; }
  .search { width: 100%; }
  .stat b { font-size: 22px; }
  .changes { margin-left: 0; }
}

/* ---------- 首頁區塊 ---------- */

.notice { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.section-head h2, .section-head h3 { margin: 0; }
.section-head a { font-size: 14px; }
.intro { margin-bottom: 16px; }
.intro-text { margin: 0; white-space: pre-line; font-size: 15px; }
.home-section { display: flex; flex-direction: column; min-height: 140px; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .muted { font-size: 13px; }
.big-count { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.big-count b { font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.page-title { margin: 0; }
.small-text { font-size: 13px; margin: 0 0 8px; }

/* ---------- 活動 ---------- */

.event-list { display: grid; gap: 16px; max-width: 820px; }
.event-body { margin: 8px 0 0; white-space: pre-line; }
.event .section-head > div:last-child { display: flex; gap: 6px; }

/* ---------- 聚會報名名單 ---------- */

.attendees { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.attendees li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 0; border-bottom: 1px solid var(--border); }
.attendees li.backup b { color: var(--muted); }
.attendees .row-actions { margin-left: auto; }

/* ---------- 留言板 ---------- */

.comments { border-top: 1px solid var(--border); padding-top: 8px; }
.comments summary { cursor: pointer; color: var(--muted); font-size: 14px; user-select: none; }
.comments[open] summary { margin-bottom: 8px; }
.comment-list { list-style: none; margin: 0 0 8px; padding: 0; }
.comment-list li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.comment-list p { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 14px; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-head button { margin-left: auto; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; }

/* ---------- 帳號設定 ---------- */

.wide-auth { max-width: 560px; }
.wide-auth h3 { margin: 18px 0 10px; }
.auth-help { margin-top: 16px; font-size: 13px; }
.auth-help p { margin: 4px 0; }
.alt-rows { display: grid; gap: 6px; margin-bottom: 6px; }
.alt-row { display: grid; grid-template-columns: 1fr 1fr 80px auto; gap: 6px; align-items: center; }
.alt-row + button, .alt-rows + button { justify-self: start; align-self: flex-start; }
.tag.warn { background: #fff1c2; color: #8a6100; }
[data-theme="dark"] .tag.warn { background: #4a3a10; color: #ffd36b; }
.reminder-text { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

@media (max-width: 720px) {
  .alt-row { grid-template-columns: 1fr; }
  .big-count b { font-size: 28px; }
}

/* ---------- 可排序表頭 ---------- */

.sort-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; border: 0; background: none;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.sort-btn:hover, .sort-btn.on { color: var(--text); }
.sort-arrow { font-size: 10px; opacity: 0.5; }
.sort-btn.on .sort-arrow { opacity: 1; color: var(--accent); }

/* ---------- 留言置頂、共同主揪 ---------- */

.comment-list li.pinned { background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; border-bottom: 0; margin-bottom: 4px; }
.comment-head .spacer { flex: 1; }
.comment-head button { margin-left: 0; }
.picker-row { display: flex; gap: 6px; }
.picker-row input { flex: 1; }
.editor-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.editor-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600;
}
.editor-chip button { padding: 0 6px; border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; }

.load-error { max-width: 480px; margin: 40px auto; }
.load-error ul { padding-left: 20px; font-size: 14px; }
.event .comments { margin-top: 12px; }

/* ---------- 活動列表 ---------- */

.event-rows { list-style: none; margin: 0; padding: 0; max-width: 820px; overflow: hidden; }
.event-rows li + li { border-top: 1px solid var(--border); }
.event-rows a {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 14px 18px; color: var(--text); text-decoration: none;
}
.event-rows a:hover { background: var(--surface-2); }
.event-date { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.event-title { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.event-title small { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-count { font-size: 13px; white-space: nowrap; }
.back-link { display: inline-block; margin-bottom: 12px; font-size: 14px; }
.event-detail { max-width: 820px; }
.event-detail h2 { margin-bottom: 4px; }

@media (max-width: 720px) {
  .event-rows a { grid-template-columns: minmax(0, 1fr) auto; }
  .event-date { grid-column: 1 / -1; font-size: 12px; }
}
.mini-link { color: var(--text); text-decoration: none; } .mini-link:hover { color: var(--accent); }

/* ---------- 活動模板 ---------- */

.template-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.template-block .toolbar { margin: 10px 0; }
.deadline { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.deadline.closed { color: var(--danger); font-weight: 600; }
.range-chips { margin-bottom: 4px; }
.range-chips .chip { cursor: default; }
.range-rows { display: grid; gap: 6px; margin: 6px 0; }
.range-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.target-preview { margin: 0 0 8px; font-weight: 700; color: var(--accent); }
.target-preview.form-error { color: var(--danger); }
tr.done td { color: var(--ok); }
tr.done td.name { font-weight: 700; }
.member-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.member-inputs input[readonly] { opacity: 0.7; }
.team-members { white-space: normal; }

.scroll-chart { display: grid; gap: 4px; margin: 8px 0 14px; max-width: 480px; }
.scroll-bar { display: grid; grid-template-columns: 44px 1fr 28px; gap: 8px; align-items: center; font-size: 13px; }
.scroll-label { color: var(--muted); text-align: right; }
.scroll-track { height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.scroll-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.scroll-n { font-variant-numeric: tabular-nums; }

.entrants { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.entrant { display: inline-flex; align-items: center; gap: 2px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.entrant.me { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.entrant button { border: 0; background: none; padding: 0 0 0 4px; color: var(--muted); cursor: pointer; font-size: 15px; }
.support-box { display: grid; gap: 8px; margin: 12px 0; padding: 12px 14px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--accent-soft); }
.support-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.champion { font-size: 18px; margin: 8px 0; }

.bracket { display: flex; gap: 20px; overflow-x: auto; padding: 8px 2px 12px; }
.bracket-round { display: flex; flex-direction: column; min-width: 150px; }
.bracket-round-title { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; margin-bottom: 8px; }
.bracket-matches { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 12px; }
.bracket-match { display: grid; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.bracket-slot {
  display: block; width: 100%; padding: 6px 10px; border: 0; border-radius: 0; background: none;
  text-align: left; font: inherit; font-size: 14px; color: var(--text); cursor: default;
}
.bracket-slot + .bracket-slot { border-top: 1px solid var(--border); }
.bracket-slot.empty { color: var(--muted); font-style: italic; }
.bracket-slot.win { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.bracket-slot.win::after { content: ' ✓'; }
.bracket-slot.lose { color: var(--muted); text-decoration: line-through; }
.bracket-slot.clickable { cursor: pointer; }
.bracket-slot.clickable:hover { background: var(--surface-2); }
.bracket-slot:disabled { opacity: 1; }

@media (max-width: 720px) {
  .range-row { grid-template-columns: 1fr auto 1fr; }
  .member-inputs { grid-template-columns: 1fr; }
}

/* ---------- 首頁圖片 ---------- */

.home-banner { position: relative; margin-bottom: 16px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.home-banner img { display: block; width: 100%; height: auto; max-height: 600px; object-fit: cover; }
.banner-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.banner-actions button { box-shadow: 0 2px 8px rgb(0 0 0 / 0.2); }
.banner-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; aspect-ratio: 16 / 5; max-height: 260px; margin-bottom: 16px;
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--muted);
}
.banner-placeholder:hover { border-color: var(--accent); color: var(--accent); }
.banner-placeholder span { font-size: 13px; font-weight: 400; }
tr.selectable { cursor: pointer; user-select: none; }
tr.selectable:hover td { background: var(--surface-2); }
tr.selected.selectable:hover td { background: var(--accent-soft); }

.time-select { display: flex; align-items: center; gap: 6px; }
.time-select select { flex: 1; min-width: 0; }

/* ---------- 簽到 ---------- */

.checkin-box { display: grid; justify-items: center; gap: 6px; padding: 18px 12px; margin: 8px 0; text-align: center; }
.checkin-box p { margin: 0; }
.checkin-btn { font-size: 18px; padding: 12px 40px; border-radius: 999px; }
.checkin-done { font-size: 17px; font-weight: 700; color: var(--ok); }

/* ---------- 突襲王設定 ---------- */

.boss-settings { margin-bottom: 16px; }
.boss-list { list-style: none; margin: 0; padding: 0; }
.boss-list li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.boss-list li:last-child { border-bottom: 0; }
.boss-list .cat { justify-self: start; }
.boss-positions { font-size: 14px; }
.position-boxes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
@media (max-width: 720px) {
  .boss-list li { grid-template-columns: 1fr; gap: 4px; }
}
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; font-size: 14px; }
.ok-mark { color: var(--ok); font-weight: 700; }

/* ---------- 手機版 ---------- */

.menu-toggle { display: none; padding: 6px 10px; border-radius: 8px; font-size: 18px; line-height: 1; }
.mobile-meta { display: none; }
dialog { overflow-y: auto; }

@media (max-width: 720px) {
  /* 導覽列收進 ☰：標題、🌙、☰ 一行，展開的選單排在下面 */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .menu-toggle { display: inline-flex; }
  #nav { display: none; order: 3; width: 100%; margin: 0; padding-top: 6px; border-top: 1px solid var(--border);
    display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .topbar.menu-open #nav { display: grid; }
  #nav a, #nav .linklike { padding: 10px 6px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* iPhone 輸入框字小於 16px 時，點下去會自動放大畫面 */
  input, select, textarea { font-size: 16px; }

  main { padding: 14px 12px 48px; }
  .card { padding: 14px 12px; }

  /* 突襲報名表：職業、等級、加入者收到 ID 下方 */
  .col-wide { display: none; }
  .mobile-meta { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); white-space: normal; }
  td.name { white-space: normal; }
  .row-actions { white-space: nowrap; }

  .bulk-bar { top: 52px; }
  dialog { padding: 16px; }

  /* 勾選框的說明文字可以換行 */
  .check { white-space: normal; align-items: flex-start; }
  .check input { margin-top: 3px; flex: none; }

  /* 卡片底部：開團者一行，按鈕平均排滿一行 */
  .card > footer small { width: 100%; }
  .card > footer .spacer { display: none; }
  .card > footer button { flex: 1 1 0; padding-left: 6px; padding-right: 6px; }
}

/* ---------- 活動抽獎 ---------- */

.draw-result { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent); }
.draw-result h3 { margin: 0 0 8px; }
.draw-mine { margin: 0 0 8px; font-weight: 700; color: var(--accent); }
.draw-winners { margin: 0 0 8px; padding-left: 24px; font-size: 17px; font-weight: 700; }
.draw-winners li { padding: 2px 0; }
.draw-winners li.me { color: var(--accent); }
.draw-winners li.me::after { content: '（你）'; font-weight: 400; font-size: 14px; }
.draw-reel { padding: 28px 0; text-align: center; font-size: 26px; font-weight: 700; color: var(--accent); }
