:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1c2420;
  --muted: #64706a;
  --line: #e2e0d8;
  --brand: #1f5f4a;
  --brand-soft: #e3efe9;
  --accent: #b5562b;
  --accent-soft: #f7e6dc;
  --gold: #a07a12;
  --now: #c0392b;
  --chip: #eeece5;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --card: #1b201d; --ink: #e6ebe8; --muted: #93a09a; --line: #2c332f;
    --brand: #6cc3a1; --brand-soft: #1f3a30; --accent: #f0a27a; --accent-soft: #3b2a20;
    --gold: #e0c060; --now: #ff6b5b; --chip: #262c29; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --card: #1b201d; --ink: #e6ebe8; --muted: #93a09a; --line: #2c332f;
  --brand: #6cc3a1; --brand-soft: #1f3a30; --accent: #f0a27a; --accent-soft: #3b2a20;
  --gold: #e0c060; --now: #ff6b5b; --chip: #262c29; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }

.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px 4px; }
.bar h1 { font-size: 18px; margin: 0; color: var(--brand); letter-spacing: .02em; }
#person { max-width: 46%; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }

.tabs { display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .days::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: none; padding: 8px 10px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--brand); border-color: var(--brand); font-weight: 600; }

.days { display: flex; gap: 6px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; }
.days[hidden] { display: none; }
.days button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 3px 9px; text-align: center; line-height: 1.2; }
.days button small { display: block; font-size: 11px; color: var(--muted); }
.days button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.days button.on small { color: rgba(255,255,255,.8); }
.days button.today { border-color: var(--now); }

.filters { padding: 8px 16px 0; }
.filters[hidden] { display: none; }
.row { display: flex; gap: 8px; align-items: center; }
#q { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.ghost { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 10px; white-space: nowrap; }
#fcount:not(:empty) { margin-left: 4px; background: var(--accent); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 12px; }
.fpanel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-top: 8px; }
.fgroup { margin-bottom: 10px; }
.flabel { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.flabel small { font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid transparent; background: var(--chip); border-radius: 14px; padding: 3px 10px; font-size: 13px; }
.chip.on { background: var(--brand); color: #fff; }
.chips.gbf .chip b { font-weight: 600; margin-right: 3px; }
.check { display: flex; align-items: center; gap: 4px; flex: 1; font-size: 14px; }

main { padding: 8px 16px 16px; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.slot { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; display: flex; align-items: center; gap: 8px; }
.slot::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.nowline { color: var(--now); font-size: 12px; font-weight: 600; margin: 10px 0; display: flex; align-items: center; gap: 6px; }
.nowline::after { content: ""; flex: 1; height: 2px; background: var(--now); }
h2.sec { font-size: 15px; margin: 18px 0 8px; color: var(--brand); }

.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 44px 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.card.team { border-left: 4px solid var(--accent); }
.card.must { border-left: 4px solid var(--now); }
.card.live { outline: 2px solid var(--now); }
.card.past { opacity: .55; }
.card .t { font-weight: 600; line-height: 1.35; }
.card .m { font-size: 13px; color: var(--muted); margin-top: 3px; }
.card .m .room { color: var(--ink); }
.card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 11px; border-radius: 6px; padding: 1px 6px; background: var(--chip); color: var(--muted); }
.tag.g { background: var(--brand-soft); color: var(--brand); }
.tag.g.hit { background: var(--brand); color: #fff; }
.tag.k { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.must { background: var(--now); color: #fff; font-weight: 600; }
.tag.warn { background: #fde8e6; color: var(--now); }
.star { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border: 0; background: none; font-size: 20px; color: var(--line); }
.star.on { color: var(--gold); }

.topic { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.topic .t { font-weight: 600; }
.topic .m { font-size: 13px; color: var(--muted); }
.topic.mine { border-color: var(--brand); }
.topic button { margin-top: 6px; }

.room { }
.lvl { margin-bottom: 6px; }
.roomrow { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; }
.roomrow span:last-child { color: var(--muted); font-size: 13px; white-space: nowrap; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: 86vh; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dlg { padding: 16px; }
.dlg h3 { margin: 0 36px 6px 0; font-size: 17px; line-height: 1.35; }
.dlg .m { color: var(--muted); font-size: 14px; margin: 2px 0; }
.dlg .desc { font-size: 14px; margin-top: 10px; white-space: pre-line; }
.dlg .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dlg .x { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 22px; width: 36px; height: 36px; color: var(--muted); }
.dlg .note { background: var(--accent-soft); border-radius: 8px; padding: 8px; font-size: 14px; margin-top: 8px; }

.foot { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.foot .ghost { padding: 4px 10px; font-size: 13px; }

.tag.me { background: var(--gold); color: #fff; font-weight: 600; }
.tag.who { background: var(--brand-soft); color: var(--ink); }
.fl2 { display: flex; flex-direction: column; min-width: 0; }
.linkish { border: 0; background: none; padding: 0; text-align: left; color: var(--brand); font-size: 12px; }
.fl { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
.fl input { display: block; width: 100%; margin-top: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 16px; }
.chks { display: grid; gap: 6px; margin-top: 4px; font-size: 14px; }
.chks label { display: flex; gap: 6px; align-items: flex-start; }
.chks input { margin-top: 4px; }
.ghost.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.acts.status .ghost.on { background: var(--gold); color: #fff; border-color: var(--gold); }
