:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #14233b;
  --muted: #5d6b82;
  --line: #d9e1ee;
  --blue: #14407f;
  --blue-2: #2a62b5;
  --blue-soft: #e6eefa;
  --yellow: #f2b90c;
  --yellow-soft: #fff5cf;
  --yellow-ink: #6b4e00;
  --red: #b3261e;
  --red-soft: #fdecea;
  --green: #1e6b3a;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-2); }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

.top { background: var(--blue); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 20px; flex-wrap: wrap; border-bottom: 3px solid var(--yellow); }
.top img { width: 44px; height: 44px; border-radius: 50%; }
.top h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.top .sub { font-size: 13px; opacity: .85; }
.top .spacer { flex: 1; }
.top a { color: #fff; font-size: 13px; text-decoration: none; border: 1px solid rgba(255,255,255,.45); padding: 4px 10px; border-radius: 6px; }
.top a:hover { background: rgba(255,255,255,.12); }
/* 標題列：切換系統（文字連結）、本頁連結、帳號，各組以細線分隔 */
.top .top-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top .top-nav { display: flex; gap: 2px; padding-right: 14px; border-right: 1px solid rgba(255, 255, 255, .3); }
.top .top-nav:last-child { border-right: 0; padding-right: 0; }
.top .top-nav a { border: 0; font-size: 14px; padding: 6px 10px; }
.top .top-nav a.on { font-weight: 700; box-shadow: inset 0 -2px 0 var(--yellow); border-radius: 6px 6px 0 0; }
.top .top-group { display: flex; gap: 6px; align-items: center; padding-right: 14px; border-right: 1px solid rgba(255, 255, 255, .3); }
.top .top-group:last-child { border-right: 0; padding-right: 0; }
.tabs { display: flex; gap: 2px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 11px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 10px; font-size: 16px; color: var(--blue); }
.panel h3 { margin: 14px 0 6px; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

.btn { border: 1px solid var(--blue); background: var(--blue); color: #fff; border-radius: 6px; padding: 6px 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
.btn:hover { background: var(--blue-2); }
.btn.ghost { background: #fff; color: var(--blue); border-color: var(--line); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: #2b2000; font-weight: 700; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 3px 8px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
input[type=text], input[type=number], select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: #fff; }
input:focus, select:focus { outline: 2px solid var(--blue-2); outline-offset: -1px; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.pills button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pills button .n { font-size: 12px; margin-left: 4px; background: var(--yellow); color: #2b2000; border-radius: 999px; padding: 0 6px; }

.chip { display: inline-block; font-size: 12px; border-radius: 999px; padding: 0 8px; border: 1px solid var(--line); color: var(--muted); background: #fff; white-space: nowrap; }
.chip.ready { background: var(--yellow); border-color: var(--yellow); color: #2b2000; font-weight: 700; }
.chip.playing { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.reported { background: var(--yellow-soft); border-color: var(--yellow); color: var(--yellow-ink); }
.chip.done { background: #eef1f6; }
.chip.bad { background: var(--red-soft); border-color: var(--red); color: var(--red); }

/* 大會台版面 */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .desk { grid-template-columns: 1fr; } }
.side { position: sticky; top: 8px; }

/* 輪次表 */
.rounds { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.round { flex: 0 0 300px; }
.round > h3 { margin: 0 0 8px; font-size: 14px; color: var(--blue); border-bottom: 2px solid var(--blue); padding-bottom: 4px; display: flex; justify-content: space-between; }
.mc { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; background: #fff; }
.mc.ready { border-left-color: var(--yellow); background: var(--yellow-soft); }
.mc.playing { border-left-color: var(--blue); background: var(--blue-soft); }
.mc.reported { border-left-color: var(--yellow); }
.mc.done { background: #f4f6fa; color: var(--muted); }
.mc .hd { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.mc .no { font-weight: 700; color: var(--blue); }
.mc .sd { display: flex; gap: 6px; align-items: center; padding: 1px 0; }
.mc .sd .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc .sd.win .nm { font-weight: 700; color: var(--ink); }
.mc .sd .sc { font-weight: 700; width: 16px; text-align: right; }
.mc .ft { display: flex; gap: 6px; align-items: center; margin-top: 4px; font-size: 13px; flex-wrap: wrap; }
.mc .ft input.tb { width: 74px; padding: 2px 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.dot.on { background: var(--blue); border-color: var(--blue); }
.slip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.slip input { margin: 0; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 6px 0 10px; align-items: center; }
.legend span { display: inline-flex; gap: 4px; align-items: center; }

/* 球桌地圖 */
.map { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-items: end; }
.map .col { display: flex; flex-direction: column-reverse; gap: 4px; }
.tcell { display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; height: 42px; overflow: hidden; background: #fff; font-size: 12px; line-height: 1.3; text-align: left; width: 100%; }
button.tcell { cursor: pointer; }
.tcell .t { font-size: 16px; font-weight: 700; color: var(--muted); text-align: center; }
.tcell.busy { background: var(--blue-soft); border-color: var(--blue-2); }
.tcell.busy .t { color: var(--blue); }
.tcell.alert { background: var(--red-soft); border-color: var(--red); }
.tcell .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcell .ev { color: var(--blue); font-weight: 700; }
.tcell .mins { color: var(--muted); white-space: nowrap; }
.tcell .big { font-weight: 700; font-size: 14px; }
.deskbar { grid-column: 1 / -1; text-align: center; background: var(--blue); color: #fff; border-radius: 6px; padding: 3px; font-size: 13px; letter-spacing: 4px; }

/* 廣播稿、提醒 */
.call { border: 1px solid var(--yellow); background: var(--yellow-soft); border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; font-size: 14px; }
.call .tm { font-size: 12px; color: var(--yellow-ink); }
.call.old { background: #fff; border-color: var(--line); color: var(--muted); }
.alertbox { border: 1px solid var(--red); background: var(--red-soft); border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; font-size: 14px; }

/* 彈出視窗 */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 30, 60, .45); display: grid; place-items: start center; padding: 30px 12px; overflow: auto; z-index: 20; }
.modal { background: #fff; border-radius: 10px; width: min(880px, 100%); padding: 16px 18px; border-top: 4px solid var(--yellow); }
.modal h2 { margin: 0 0 4px; font-size: 17px; color: var(--blue); }
table.sc { border-collapse: collapse; width: 100%; margin-top: 8px; }
table.sc th, table.sc td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; font-size: 14px; }
table.sc th { background: var(--blue-soft); font-weight: 500; font-size: 13px; }
table.sc td.nm { text-align: left; }
table.sc td { white-space: nowrap; }
table.sc td.nm, table.sc th { white-space: normal; }
table.sc input.g { width: 40px; text-align: center; padding: 3px 2px; }
table.sc input.g.bad { border-color: var(--red); background: var(--red-soft); }
table.sc .res { font-weight: 700; }
.vs { color: var(--muted); font-size: 12px; }
.total { font-size: 28px; font-weight: 700; color: var(--blue); }

table.list { border-collapse: collapse; width: 100%; }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; font-size: 14px; }
table.list th { color: var(--muted); font-weight: 500; font-size: 13px; background: #f7f9fc; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 8px; z-index: 40; max-width: 90vw; }

/* 公開頁、裁判頁 */
.narrow { max-width: 760px; }
.card { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 12px; margin-bottom: 8px; }
.card .hd { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.card .tno { background: var(--blue); color: #fff; border-radius: 6px; padding: 0 8px; font-weight: 700; }
.duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-top: 6px; }
.duel .n { font-weight: 700; }
.duel .n.r { text-align: right; }
.duel .s { font-size: 24px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.ptline { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 4px; }
.bigin { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bigin input { width: 100%; font-size: 26px; text-align: center; padding: 10px 4px; }
.gamerow { display: grid; grid-template-columns: 44px 1fr 1fr 40px; gap: 8px; align-items: center; margin-bottom: 6px; }
.gamerow input { font-size: 22px; text-align: center; padding: 8px 2px; width: 100%; }
.gamerow input.bad { border-color: var(--red); background: var(--red-soft); }
.search { width: 100%; padding: 8px 10px !important; }
table.grp { border-collapse: collapse; width: 100%; margin-bottom: 10px; }
table.grp th, table.grp td { border: 1px solid var(--line); padding: 4px 6px; font-size: 13px; text-align: center; }
table.grp th { background: var(--blue-soft); font-weight: 500; }
table.grp td.nm { text-align: left; font-weight: 500; }

.map.tall .tcell { height: 58px; }

/* 球桌看板 */
.board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; align-items: end; }
.board .col { min-width: 0; display: flex; flex-direction: column-reverse; gap: 8px; }
.bcell { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px 12px; height: 132px; overflow: hidden; }
button.bcell { cursor: pointer; }
.bcell.busy { background: var(--blue-soft); border-color: var(--blue-2); }
.bcell.alert { background: var(--red-soft); border-color: var(--red); }
.bcell .bt { display: flex; align-items: baseline; gap: 8px; }
.bcell .bn { font-size: 24px; font-weight: 700; color: var(--muted); line-height: 1; }
.bcell.busy .bn { color: var(--blue); }
.bcell .be { color: var(--blue); font-weight: 700; }
.bcell .bx { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bcell .bs { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 1.45; }
.bcell .bs .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bcell .bs b { font-size: 22px; color: var(--blue); }
.bcell .bp { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 3px; min-height: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcell .bempty { color: var(--muted); display: grid; place-items: center; height: 80px; }
@media (max-width: 640px) {
  .bcell { padding: 6px 8px; height: 124px; }
  .bcell .bs { font-size: 14px; } .bcell .bs b { font-size: 19px; } .bcell .bn { font-size: 20px; } .bcell .bp { font-size: 12px; }
}
.wide { max-width: 1200px; }

/* 樹狀圖 */
.treebox { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px; max-height: 78vh; }
svg.tree { display: block; font-family: inherit; }
svg.tree path { fill: none; }
svg.tree .l { stroke: #9aa7bd; stroke-width: 1.3; }
svg.tree .w { stroke: var(--blue); stroke-width: 3.2; }
svg.tree text { font-size: 13px; fill: var(--ink); }
svg.tree .nm.mu { fill: var(--muted); }
svg.tree .b { font-weight: 700; }
svg.tree .sc { fill: var(--muted); }
svg.tree .sc.b { fill: var(--ink); }
svg.tree .no { font-size: 12px; fill: var(--blue-2); }
svg.tree .no.live { font-weight: 700; fill: var(--yellow-ink); }
svg.tree .tb { font-size: 11px; fill: var(--yellow-ink); font-weight: 700; }

/* 成績：每點一欄，各局直排（同點單） */
.pts { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.pt { flex: 1 0 150px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; text-align: center; }
.pt h4 { margin: 0 0 4px; font-size: 13px; color: var(--blue); }
.pt .pn { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 13px; min-height: 38px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-bottom: 4px; }
.pt .gr { display: grid; grid-template-columns: 1fr 10px 1fr; gap: 2px; align-items: center; margin-bottom: 4px; }
.pt .gr input { width: 100%; text-align: center; padding: 4px 2px; }
.pt .gr input.bad { border-color: var(--red); background: var(--red-soft); }
.pt .res { font-weight: 700; font-size: 18px; color: var(--blue); min-height: 28px; }
.pt .meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 4px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pt.solo { flex: 0 0 280px; margin: 0 auto; }

svg.tree .no { cursor: pointer; text-decoration: underline; }
[data-mid].click { cursor: pointer; }
select.bad, input.bad { border-color: var(--red) !important; background: var(--red-soft) !important; }
.tchip { background: var(--blue); color: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; }
.tcell.ptsel { height: auto; min-height: 48px; font-size: 14px; }
.tcell.ptsel.fin { background: var(--yellow-soft); border-color: var(--yellow); }
table.grp { table-layout: fixed; }
table.grp th.hd { width: 24%; }
table.grp th.wl { width: 44px; }
table.grp td.lk { cursor: pointer; color: var(--blue-2); }
table.dt { border-collapse: collapse; width: 100%; margin-top: 10px; }
table.dt th, table.dt td { border-bottom: 1px solid var(--line); padding: 6px; font-size: 14px; text-align: center; }
table.dt th { color: var(--muted); font-weight: 500; font-size: 13px; }
table.dt td.w { font-weight: 700; }
@media (max-width: 640px) { table.grp th, table.grp td { font-size: 12px; padding: 3px 2px; } table.grp th.wl { width: 26px; } }
.bcell[data-mid] { cursor: pointer; }

/* 單場明細：點單與對局紀錄 */
.dlist { border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; }
.drow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.drow:last-child { border-bottom: 0; }
.drow.idle { color: var(--muted); background: #f1f3f7; }
.drow .dn { font-size: 16px; line-height: 1.35; }
.drow .dn.r { text-align: right; }
.drow .dn.w { font-weight: 700; }
.drow .dc { text-align: center; min-width: 76px; }
.drow .ds { font-size: 20px; font-weight: 700; }
.dg { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 14px; }

table.grp td.diag { background: linear-gradient(to top right, transparent calc(50% - 0.7px), #9aa7bd calc(50% - 0.7px), #9aa7bd calc(50% + 0.7px), transparent calc(50% + 0.7px)); }
table.grp td.no { color: var(--blue-2); }
table.grp td.sc { font-weight: 700; color: var(--ink); }
.round h3 .rt { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 4px; }
.lu-free { display: inline-flex; gap: 4px; }
.lu-free input { flex: 1; min-width: 0; }

/* 大會台球桌看板 */
.wboard { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.wboard .wcell { grid-column: var(--r); grid-row: calc(var(--half) + 1 - var(--c)); }
.wboard .wdesk { grid-column: 1 / -1; grid-row: calc(var(--half) + 1); background: var(--blue); color: #fff; border-radius: 6px; text-align: center; padding: 3px; letter-spacing: 4px; font-size: 13px; }
.wcell { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 8px; cursor: pointer; min-height: 70px; min-width: 0; font-size: 13px; line-height: 1.35; }
.wcell.busy { background: var(--blue-soft); border-color: var(--blue-2); }
.wcell.rep { background: var(--yellow-soft); border-color: var(--yellow); }
.wcell.alert { background: var(--red-soft); border-color: var(--red); }
.wcell .bn { font-size: 20px; font-weight: 700; color: var(--muted); line-height: 1; }
.wcell.busy .bn { color: var(--blue); }
.wcell .be { color: var(--blue); font-weight: 700; }
.wcell .bempty { color: var(--muted); }
.wcell .ws { display: flex; gap: 4px; align-items: flex-start; }
.wcell .ws .nm { flex: 1; min-width: 0; word-break: break-all; font-weight: 500; }
.wcell .ws b { color: var(--blue); font-size: 15px; }
.wcell .wx { color: var(--muted); font-size: 12px; margin-top: auto; }
@media (min-width: 1000px) {
  .wboard { grid-template-columns: 34px repeat(var(--half), minmax(0, 1fr)); gap: 10px 6px; }
  .wboard .wcell { grid-column: calc(var(--c) + 1); grid-row: var(--r); min-height: 200px; }
  .wboard .wdesk { grid-column: 1; grid-row: 1 / 3; writing-mode: vertical-rl; display: grid; place-items: center; padding: 0; }
}

/* 大會台球桌卡片：校名、姓名、比數各一行 */
.wcell .wn { display: block; margin-top: 3px; }
.wcell .wn .sch { display: block; color: var(--muted); font-size: 12px; }
.wcell .wn .nm { display: block; font-weight: 700; font-size: 14px; word-break: break-all; }
.wcell .wsc { display: block; text-align: center; font-size: 20px; font-weight: 700; color: var(--blue); margin-top: 4px; letter-spacing: 1px; }

/* 決賽抽籤表格：冠軍、亞軍各一塊底色 */
table.drawt { border-collapse: separate; border-spacing: 0; }
table.drawt th.gtop { text-align: center; font-weight: 700; color: var(--ink); font-size: 14px; }
table.drawt .gc { background: #f1f6fd; }
table.drawt .gr { background: #fff9e6; }
table.drawt th.gc { background: #e3edfa; }
table.drawt th.gr { background: #fdf0c4; }
table.drawt .first { border-left: 12px solid #fff; }
table.drawt th.gtop.gc { border-radius: 8px 8px 0 0; }
table.drawt th.gtop.gr { border-radius: 8px 8px 0 0; }

/* 賽程時間表 */
table.tt { border-collapse: collapse; width: 100%; }
table.tt th, table.tt td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; font-size: 14px; }
table.tt th { background: var(--blue-soft); font-weight: 700; }
table.tt td.tm { color: var(--muted); font-variant-numeric: tabular-nums; }
table.tt td.dr { background: var(--yellow-soft); }
svg.tree .nm.mu { fill: #9aa3b2; }

/* 預賽表格：每列同高，斜線角度一致；手機上欄位只寫編號、隊名不換行 */
table.grp td { height: 34px; }
table.grp td.nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.grp td.nm .ix { display: inline-block; width: 1.6em; color: var(--muted); }
@media (max-width: 640px) {
  table.grp .tn { display: none; }
  table.grp th.hd { width: 30%; }
  table.grp td { height: 32px; white-space: nowrap; }
  table.grp td.no, table.grp td.sc { font-size: 11px; padding: 0; letter-spacing: -0.5px; }
  table.grp td.nm .chip { display: none; }
}
.btn[data-close] { padding: 5px 7px; }
.btn[data-close] .icon { width: 18px; height: 18px; }

/* 成績公告 */
.ann h2 { text-align: center; font-size: 19px; margin-bottom: 14px; }
.ann .ab { margin: 0 auto 16px; max-width: 420px; }
.ann .ab h3 { font-size: 15px; color: var(--blue); border-bottom: 2px solid var(--yellow); padding-bottom: 3px; margin: 0 0 6px; }
.ann .al { display: flex; font-size: 15px; line-height: 1.9; border-bottom: 1px dashed var(--line); }
.ann .ak { color: var(--muted); width: 4em; flex: none; }

/* 搜尋框 */
.sbox { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.sbox .icon { width: 18px; height: 18px; color: var(--muted); }
.sbox .search { border: 0 !important; outline: none; padding: 9px 0 !important; flex: 1; min-width: 0; background: transparent; }
.btn[data-zoom] { padding: 5px 7px; }
.btn[data-zoom] .icon { width: 18px; height: 18px; }

/* 時間表：開始、直線、結束三行同樣大小；手機可左右滑動，時間欄固定 */
.nw { white-space: nowrap; }
.ttw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tt { border-collapse: separate; border-spacing: 0; }
table.tt th, table.tt td { border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); line-height: 1.45; }
table.tt tr > :first-child { border-left: 1px solid var(--line); }
table.tt thead th { border-top: 1px solid var(--line); }
table.tt td.tm, table.tt th:first-child { position: sticky; left: 0; z-index: 1; background: #fff; width: 1%; white-space: nowrap; color: var(--ink); }
table.tt th:first-child { background: var(--blue-soft); }
.tt3 { display: flex; flex-direction: column; align-items: center; font-variant-numeric: tabular-nums; }
.tt3 .bar { width: 1px; height: 10px; background: #9aa7bd; margin: 2px 0; }
@media (max-width: 640px) {
  table.tt th, table.tt td { min-width: 84px; padding: 6px 4px; font-size: 13px; }
  table.tt td.tm, table.tt th:first-child { min-width: 0; padding: 6px 8px; box-shadow: 2px 0 3px rgba(20, 35, 59, .08); }
}

/* 公開頁分頁：電腦在上方；手機改為下方四格 */
.tabs button .icon { display: none; }
@media (max-width: 640px) {
  body:has(#tabs.ptabs) { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tabs.ptabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); padding: 0 0 env(safe-area-inset-bottom); border-top: 1px solid var(--line); border-bottom: 0; box-shadow: 0 -2px 8px rgba(20, 35, 59, .06); }
  .tabs.ptabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 12px; border-bottom: 0; border-top: 3px solid transparent; }
  .tabs.ptabs button.on { border-top-color: var(--blue); }
  .tabs.ptabs button .icon { display: block; width: 22px; height: 22px; }
}

.ftag { display: inline-block; min-width: 22px; text-align: center; font-size: 12px; color: var(--muted); background: #eef1f6; border-radius: 4px; padding: 0 5px; margin-right: 4px; font-variant-numeric: tabular-nums; }
.ftag.soft { background: transparent; border: 1px solid var(--line); }
.fside { display: inline-flex; align-items: center; margin: 0 6px; }
.fside:first-child { margin-left: 0; }
.dwo { text-align: center; font-size: 17px; font-weight: 700; color: var(--red); padding: 14px 0 6px; }

table.frt { width: auto; }
table.frt td.fs { white-space: nowrap; padding-right: 24px; }
table.frt td.fvs { color: var(--muted); font-size: 12px; text-align: center; padding: 0 10px; }
.ftag { min-width: 26px; }
.ftag.soft { min-width: 34px; }
table.dgv { margin: 12px auto 0; border-collapse: collapse; }
table.dgv td { padding: 6px 14px; text-align: center; font-size: 18px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.dgv tr:last-child td { border-bottom: 0; }
table.dgv td.gl { font-size: 16px; color: var(--muted); padding: 6px 2px; }
table.dgv td.w { font-weight: 700; color: var(--blue); }
.duel .lost { color: #9aa3b2; }
.wo-tag { color: var(--red); font-size: 12px; font-weight: 700; margin-left: 6px; border: 1px solid var(--red); border-radius: 4px; padding: 0 4px; white-space: nowrap; }

.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-solid:hover { background: #8f1d17; }

.wcell .bpt { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); background: #fff; }
.lg.busy { background: var(--blue-soft); border-color: var(--blue-2); }
.lg.rep { background: var(--yellow-soft); border-color: var(--yellow); }
.lg.alert { background: var(--red-soft); border-color: var(--red); }

.bcell.dim { opacity: .28; }
.ann mark { background: var(--yellow-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
.ann .agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 28px; }
.ann .agrid .ab { max-width: none; margin: 0 0 14px; }
.alertbox .ameta { color: #8a6a66; }

/* 公開頁球桌：寬螢幕時雙方同一列、比數置中 */
.bcell .bduel { display: none; }
@media (min-width: 900px) {
  .bcell .bs { display: none; }
  .bcell .bduel { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; margin: 12px 0 6px; }
  .bcell .bduel .nm { font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bcell .bduel .nm.r { text-align: right; }
  .bcell .bduel b { font-size: 26px; color: var(--blue); white-space: nowrap; }
  .bcell { height: 116px; }
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-left: 1px solid var(--line); background: none; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--blue); color: #fff; }
.seg button.no.on { background: var(--red); }
.alertbox.remind { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 0 12px; }
.hedit .hrow { gap: 6px; margin-bottom: 6px; flex-wrap: nowrap; }
.hedit .hrow select { width: 76px; flex: none; }
.hedit .hrow input { flex: 1; min-width: 0; }
.hedit .hrow .btn { flex: none; padding: 4px 6px; }
.hedit { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 24px; }
.hedit .ab { margin-bottom: 12px; }
.hedit h3 { font-size: 15px; margin: 0 0 8px; color: var(--blue); }

/* 簽到處 */
.ckl { display: flex; flex-direction: column; }
.ckr { display: grid; grid-template-columns: minmax(120px, 1.2fr) auto minmax(140px, 1fr); gap: 8px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ckr:last-child { border-bottom: 0; }
.ckn { font-weight: 600; }
.ckb { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; font: inherit; cursor: pointer; color: var(--muted); white-space: nowrap; }
.ckb .box { width: 20px; height: 20px; border: 1.5px solid #9aa7ba; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; background: #fff; }
.ckb .box svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 2.4; }
.ckr.ok .ckb { color: var(--blue); border-color: var(--blue-2); background: var(--blue-soft); font-weight: 600; }
.ckr.ok .ckb .box { background: var(--blue); border-color: var(--blue); }
.ckt { font-size: 12px; font-weight: 400; color: var(--muted); }
.ckm { width: 100%; min-width: 0; }
@media (max-width: 640px) {
  .ckr { grid-template-columns: 1fr auto; }
  .ckm { grid-column: 1 / -1; }
}

/* 大會提醒 */
.alertbox.notice-due { background: var(--yellow-soft); border-color: var(--yellow); margin: 0 0 10px; padding: 10px 12px; }
.alertbox.notice-due .row { gap: 10px; }
.tag-k { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; background: #fff; }
.tag-k.prep { color: var(--blue); border-color: var(--blue-2); background: var(--blue-soft); }
.tag-k.lineup { color: #7a5600; border-color: var(--yellow); background: var(--yellow-soft); font-weight: 600; }
.tag-k.draw { color: #fff; border-color: var(--blue); background: var(--blue); }
.tag-k.award { color: #7a5600; border-color: #e0b100; background: #ffe58a; }
.ntab td:first-child input { width: 64px; font-variant-numeric: tabular-nums; }
.ntab tr.past td, .ntab tr.done td { opacity: .55; }
.ntab tr.due td { background: var(--yellow-soft); }
.tabs button .badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: 2px; }

/* 紀錄組 */
table.grp td.rep { background: var(--yellow-soft); font-weight: 700; }
table.grp td.live { background: #e3f3e7; color: #1f6b3a; box-shadow: inset 0 0 0 1px #9fd3ad; }
.legend .lg.live { background: #e3f3e7; border-color: #9fd3ad; }
.rech { font-size: 15px; color: var(--blue); margin: 12px 0 6px; }
.pills button .badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; }
.wcell.idle { opacity: .6; border-style: dashed; }
