:root {
  --bg: #f3f0e8;
  --panel: #fffdf8;
  --ink: #2a2e35;
  --muted: #6c727c;
  --line: #e2ddd0;
  --brand: #2f4a66;
  --accent: #d9822b;
  --ok: #2e9d5b;
  --bad: #d6453d;
  --miss: #9a8f7d;
  --you: #f2b705;
  --target: #e5484d;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* 輸入框在 iOS 有固有寬度（size=20），放進 flex／grid 會把外框撐開 */
input, select, textarea { min-width: 0; max-width: 100%; }
img, canvas, video { max-width: 100%; }
body { background: var(--bg); color: var(--ink); display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 8px 16px;
  background: var(--brand); color: #fff; flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { font-size: 28px; }
.brand b, .brand h1 { font-size: 18px; letter-spacing: 1px; display: block; margin: 0; font-weight: 700; line-height: 1.3; }
/* 畫面上看不到、螢幕報讀器和搜尋引擎讀得到 */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { margin: 0; padding: 6px 10px; background: #fff4dc; color: var(--ink); border-radius: 8px; font-size: 14px; }
.brand small { opacity: .7; font-size: 12px; }
.clockbox { display: flex; align-items: center; gap: 10px; margin-left: auto; }
#clock {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 26px; font-weight: 700;
  background: #13263a; color: #7dffa8; padding: 2px 12px; border-radius: 8px; letter-spacing: 2px;
  text-shadow: 0 0 6px rgba(125,255,168,.5);
}
#dayLabel { font-size: 13px; opacity: .85; }
.daybar { width: 90px; height: 6px; background: rgba(255,255,255,.2); border-radius: 3px; overflow: hidden; }
.daybar i { display: block; height: 100%; width: 0; background: var(--accent); }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: rgba(255,255,255,.12); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; color: #fff; padding: 6px 10px; min-width: 34px; }
.seg button:hover { background: rgba(255,255,255,.15); }
.seg button.on { background: var(--accent); }

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px;
  transition: transform .08s, background .15s;
}
.btn:hover:not(:disabled) { background: #f6f2e8; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: #c4721f; }
.btn.danger { background: #fff1f0; border-color: #f2b8b5; color: var(--bad); font-weight: 700; }
.btn.danger.on { background: var(--bad); color: #fff; }
.btn.ghost { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.card .btn.ghost { background: #f4f1ea; color: var(--ink); }
.btn.small { padding: 4px 8px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 8px; }
.mini { border: 0; background: none; padding: 0 2px; font-size: 13px; }

/* ---------- layout ---------- */
main { flex: 1; display: flex; min-height: 0; }
#mapArea { flex: 1; position: relative; min-width: 0; display: flex; }
#mapWrap {
  flex: 1; overflow: auto; background: #5d6670; cursor: grab;
  overscroll-behavior: contain;
}
#mapWrap.dragging { cursor: grabbing; }
#map { padding: 12px; width: max-content; }
#map svg { display: block; border-radius: 6px; box-shadow: 0 6px 30px rgba(0,0,0,.35); user-select: none; }

#panel {
  width: 360px; flex: none; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px;
  border-left: 1px solid var(--line);
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.card .row { display: flex; gap: 8px; }
.card .row .btn { flex: 1; }
.hint { color: var(--muted); font-size: 12.5px !important; margin-top: 8px !important; }

#setupCard { border: 2px solid var(--accent); }

.avatar { width: 44px; height: 44px; border-radius: 50%; position: relative; flex: none; box-shadow: 0 0 0 3px var(--tc, var(--target)); }
.avatar i { position: absolute; inset: 9px; border-radius: 50%; }
.tname { font-weight: 700; font-size: 17px; }
.tmeta { color: var(--muted); font-size: 13px; }
/* 監控名單：最多 3 位，每位一個顏色（跟地圖上的圈圈同色） */
.watchhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.watchhead b { font-size: 15px; }
.watchhead small { color: var(--muted); font-weight: 600; }
.watchhead .btn { margin-left: auto; }
.card .watchhead .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.who { display: flex; flex-direction: column; gap: 4px; }
.wchip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; cursor: pointer; }
.wchip:hover { background: #f6f3ec; }
.wchip .whotext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wchip .mini { font-size: 14px; opacity: .55; width: 26px; height: 26px; border-radius: 6px; }
.wchip .mini:hover { opacity: 1; background: #ece6d8; }
.who.multi .avatar { width: 34px; height: 34px; box-shadow: 0 0 0 2.5px var(--tc); }
.who.multi .avatar i { inset: 7px; }
.who.multi .tname { font-size: 15px; color: var(--tc); }
.who.multi .tmeta { font-size: 12px; }
.wadd { border: 1.5px dashed #d6cfbf; background: none; border-radius: 10px; padding: 7px; color: var(--muted); font-weight: 700; font-size: 14px; }
.wadd:hover { border-color: var(--accent); color: var(--accent); }
.wadd.on { border-style: solid; background: var(--accent); border-color: var(--accent); color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.dot.big { width: 14px; height: 14px; margin-right: 8px; vertical-align: 2px; }
.score { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; text-align: center; }
.score div { background: #f6f3ec; border-radius: 8px; padding: 6px 0; }
.score b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.score span { font-size: 11px; color: var(--muted); }
.score .ok b { color: var(--ok); } .score .bad b { color: var(--bad); } .score .miss b { color: var(--miss); }

.actgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.actgrid button {
  display: flex; align-items: center; gap: 6px; text-align: left; font-size: 13.5px;
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px;
}
.actgrid button:hover:not(:disabled) { border-color: var(--accent); background: #fff8ee; }
.actgrid button .e { font-size: 18px; width: 22px; text-align: center; }
.actgrid button.hic .e { font-size: 13px; font-weight: 900; color: var(--bad); }
.actgrid button.flash-ok { animation: flashOk .5s; }
.actgrid button.flash-bad { animation: flashBad .5s; }
@keyframes flashOk { 0% { background: #c8f2d6; } 100% { background: #fff; } }
@keyframes flashBad { 0% { background: #ffd2cf; } 100% { background: #fff; } }

.log { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; font-size: 13px; }
.log.small { max-height: 160px; }
.log li { padding: 4px 6px; border-bottom: 1px dashed var(--line); display: flex; gap: 8px; }
.log li time { font-family: ui-monospace, Menlo, monospace; color: var(--muted); flex: none; }
.log li.ok { color: var(--ok); }
.log li.wrong { color: var(--bad); }
.log li.miss { color: var(--miss); }
.log li.info { color: var(--brand); }
.log li.empty { color: var(--muted); justify-content: center; }
.radar .log li.near { font-weight: 700; }

/* ---------- map overlays ---------- */
#banner {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: max-content; max-width: 90%;
  background: rgba(20,30,45,.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 15px; box-shadow: 0 4px 20px rgba(0,0,0,.3); pointer-events: none;
}
#tooltip {
  position: fixed; z-index: 20; pointer-events: none; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.15); white-space: nowrap;
}
#tooltip b { font-size: 14px; }

/* ---------- SVG ---------- */
.roomlabel { font-size: 14px; font-weight: 700; fill: #4a525d; }
.roomlabel.small { font-size: 11px; font-weight: 600; }
.grouplabel { font-size: 20px; font-weight: 800; fill: #fff; }

#screens .scr { fill: #8fd0ff; }
#screens .glow { fill: #8fd0ff; opacity: .22; }
#screens g[data-scr="lock"] .scr, #screens g[data-scr="lock"] .glow { fill: #2a3d6e; }
#screens g[data-scr="off"] .scr { fill: #111; } #screens g[data-scr="off"] .glow { opacity: 0; }
#screens g[data-scr="saver"] .scr, #screens g[data-scr="saver"] .glow { fill: #b48cff; }
#screens g[data-scr="stock"] .scr, #screens g[data-scr="stock"] .glow { fill: #ff4040; }
#screens g[data-scr="shop"] .scr, #screens g[data-scr="shop"] .glow { fill: #ff9a2e; }
#screens g[data-scr="video"] .scr, #screens g[data-scr="video"] .glow { fill: #ff3b6b; }
#screens g[data-scr="code"] .scr, #screens g[data-scr="code"] .glow { fill: #39ff7a; animation: flicker .25s steps(2) infinite; }
@keyframes flicker { 50% { opacity: .4; } }

.agent { transition: opacity .5s; }
.agent.gone { opacity: 0; }
.agent .body { transform-box: fill-box; transform-origin: center; }
.agent.anim-shake .body { animation: shake .18s infinite; }
.agent.anim-nod .body { animation: nod 1.6s ease-in-out infinite; }
.agent.anim-grow .body { animation: grow 1s ease-in-out infinite; }
.agent.anim-comb .body { animation: comb .5s ease-in-out infinite; }
.agent.walking .body { animation: bob .35s ease-in-out infinite; }
@keyframes shake { 0%,100% { transform: translateX(-1.5px); } 50% { transform: translateX(1.5px); } }
@keyframes nod { 0%,100% { transform: scale(1); } 50% { transform: scale(.88); } }
@keyframes comb { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes grow { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes bob { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.ring { fill: none; stroke-width: 3; }
.ring.you { stroke: var(--you); }
.ring.target { stroke: var(--tc, var(--target)); stroke-dasharray: 5 3; animation: spin 4s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.seatmark { stroke-width: 3; }
.seatmark.you { fill: rgba(242,183,5,.18); stroke: var(--you); }
.seatmark.target { fill: rgba(229,72,77,.14); fill: color-mix(in srgb, var(--tc, var(--target)) 14%, transparent); stroke: var(--tc, var(--target)); stroke-dasharray: 8 5; }
.tag { font-size: 11px; font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.tag.you { fill: #9a7300; } .tag.target { fill: var(--tc, var(--target)); }

.bubble { transition: opacity .2s; }
.bubble .b { opacity: 0; transition: opacity .2s; }
.bubble.show .b { opacity: 1; }
.bubble rect.bg { fill: #fff; stroke: #c9ced6; }
.bubble text.em { font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.bubble .hic { opacity: 0; }
.bubble .hic text { font-size: 14px; font-weight: 900; fill: #d6453d; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.bubble .hic circle { fill: none; stroke: #d6453d; stroke-width: 2; }
.bubble.hicOn .hic { animation: hicPop 1.2s ease-out forwards; }
.bubble.hicOn .hic circle { animation: wave 1.2s ease-out forwards; transform-box: fill-box; transform-origin: center; }
/* 第二組一模一樣的動畫：兩組輪流切換就能重播，不用強迫重排 */
.bubble.hicOn2 .hic { animation: hicPop2 1.2s ease-out forwards; }
.bubble.hicOn2 .hic circle { animation: wave2 1.2s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes hicPop { 0% { opacity: 0; transform: translateY(6px); } 10% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes hicPop2 { 0% { opacity: 0; transform: translateY(6px); } 10% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes wave { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(3.2); opacity: 0; } }
@keyframes wave2 { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(3.2); opacity: 0; } }
.poof { font-size: 22px; text-anchor: middle; dominant-baseline: central; animation: poof 1s forwards; pointer-events: none; }
@keyframes poof { 0% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

#hits rect { fill: transparent; cursor: pointer; }
#hits rect:hover { fill: rgba(255,255,255,.18); stroke: #fff; stroke-width: 2; }
body.picking #hits rect:hover { fill: rgba(242,183,5,.35); stroke: var(--you); stroke-width: 3; }
body.picking-target #hits rect:hover { fill: rgba(229,72,77,.3); stroke: var(--target); }
body.accusing #hits rect:hover { fill: rgba(214,69,61,.35); stroke: var(--bad); stroke-width: 3; }
body.accusing #mapWrap { cursor: crosshair; }
#marks .accused { font-size: 22px; text-anchor: middle; dominant-baseline: central; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: #222b36; color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); animation: toastIn .25s, toastOut .4s calc(var(--toast-ms, 2700ms) - 450ms) forwards; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); } .toast.gold { background: linear-gradient(90deg,#d9822b,#f2b705); font-weight: 700; font-size: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,22,32,.55); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.sheet { background: var(--panel); border-radius: 16px; max-width: 640px; width: 100%; min-width: 0; max-height: 90vh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 22px 24px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.sheet .close { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 18px; color: var(--muted); }
.sheet h2 { margin: 0 0 4px; }
.sheet h4 { margin: 16px 0 6px; }
.sheet p, .sheet li { line-height: 1.6; font-size: 14.5px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet th, .sheet td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.sheet td.num, .sheet th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .rank { font-size: 22px; font-weight: 800; color: var(--accent); margin: 8px 0; }
.sheet .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
.stamp { display: inline-block; border: 3px solid var(--bad); color: var(--bad); padding: 2px 10px; border-radius: 6px; font-weight: 800; transform: rotate(-4deg); }

/* ---------- share ---------- */
.send-preview { display: block; width: 100%; max-width: 320px; margin: 12px auto; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.sheet.has-head { padding-top: 0; max-width: 560px; }
.sheet.has-head > .close { display: none; }
.sheethead {
  display: flex; align-items: center; justify-content: space-between; margin: 0 -24px 14px; padding: 14px 24px;
  border-bottom: 1px solid var(--line); font-size: 14px; color: var(--accent); font-weight: 700;
}
.sheethead button { border: 0; background: none; color: var(--ink); font-size: 14px; padding: 6px 0 6px 12px; }
.sendlead { margin: 0 0 12px !important; font-size: 15px !important; }
.sendcard { border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.12); }
.sendcard .pic { display: block; width: 100%; aspect-ratio: 1200 / 520; object-fit: cover; background: #5d6670; border-bottom: 3px solid var(--accent); }
.sendcard .txt { padding: 12px 16px 12px; }
.sendcard .kicker { font-size: 11.5px; font-weight: 700; color: var(--ok); }
.sendcard .ttl { font-size: 24px; font-weight: 800; line-height: 1.25; margin: 2px 0 4px; }
.sendcard .meta { font-size: 13px; color: var(--ink); }
.sendcard .foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.sendcard .foot span { flex: 1 1 auto; }
.sendcard .foot b { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, Menlo, monospace; font-weight: 600; color: var(--ink); white-space: nowrap; }
.sendbar { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.sendbar button { border: 1px solid #cfc8b8; border-radius: 4px; background: #fff; color: var(--ink); padding: 12px 8px; font-size: 15px; }
.sendbar button:hover { background: #fff8ee; border-color: var(--accent); }
.sendbar button b { font-weight: 500; }
.sendgrid button { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: left; }
.sendgrid .ic {
  flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 800; font-family: -apple-system, sans-serif;
}
.urlrow { display: flex; gap: 6px; }
.urlrow input {
  flex: 1; min-width: 0; font: 13px ui-monospace, Menlo, monospace; color: var(--ink); background: #f6f2e8;
  border: 1px solid var(--line); border-radius: 4px; padding: 10px;
}
.sendbar .urlrow button { flex: none; padding: 0 14px; font-weight: 700; color: var(--accent); border-color: var(--accent); }
.copystat { font-size: 12.5px; color: var(--ok); font-weight: 700; min-height: 0; }
.copystat:empty { display: none; }
.sendbar button.main { background: var(--accent); border-color: var(--accent); color: #fff; padding: 12px 8px 10px; }
.sendbar button.main:hover { background: #c4721f; }
.sendbar button.main b { display: block; font-size: 17px; font-weight: 800; }
.sendbar button.main .lb { display: block; }
.sendbar button.main small { display: block; font-size: 12px; opacity: .85; margin-top: 3px; }
.sendgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.send-note { font-size: 12.5px !important; color: var(--muted); margin-top: 10px !important; }

/* ---------- 外型升級 ---------- */
.lookline { margin-top: 8px; font-size: 13px; color: var(--accent); font-weight: 700; }
.miniscore em { font-style: normal; font-size: 15px; margin-left: 3px; }
.aura { animation: aura 0.9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes aura { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.15); opacity: 1; } }
.spikes { stroke: #e0a100; stroke-width: .8; }
.shades { fill: #111; stroke: #111; stroke-width: .8; }
.sparks path { fill: none; stroke: #1e8fff; stroke-width: 2.2; stroke-linejoin: round; animation: spark .3s steps(2) infinite; }
.sparks path:nth-child(2) { animation-delay: .15s; }
@keyframes spark { 50% { opacity: 0; } }

/* ---------- 感冒傳染 ---------- */
.flu-line { margin: 0 0 6px; }
.flu-line .m-rate { display: none; }
.flu-guess { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13.5px; font-weight: 700; color: #2f7a40; }
.flu-guess input {
  width: 64px; font: inherit; font-size: 16px; text-align: center; color: var(--ink); background: #fff;
  border: 1.5px solid #7bc96f; border-radius: 8px; padding: 4px 6px;
}
.flu-guess input:focus { outline: none; border-color: #3f8f4f; box-shadow: 0 0 0 3px rgba(63,143,79,.2); }
.flu-guess input:disabled { background: #f4f1ea; border-color: var(--line); }
.flu-guess small { flex-basis: 100%; font-size: 12px; font-weight: 500; color: var(--muted); }
/* 手機版：點選式的猜人數（不叫出鍵盤） */
.flu-guess.tap { flex-wrap: nowrap; gap: 6px; }
.flu-guess.tap .lbl { white-space: nowrap; }
.flu-guess .fg-step, .flu-guess .fg-pick {
  height: 40px; border-radius: 10px; border: 1.5px solid #7bc96f; background: #fff; color: #2f7a40; font-weight: 800;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.flu-guess .fg-step { width: 40px; flex: none; font-size: 22px; line-height: 1; padding: 0; }
.flu-guess .fg-pick { min-width: 64px; padding: 0 10px; display: inline-flex; align-items: baseline; justify-content: center; gap: 2px; background: #eef7ee; }
.flu-guess .fg-pick b { font-size: 20px; color: #3f8f4f; font-variant-numeric: tabular-nums; }
.flu-guess .fg-pick span { font-size: 12px; }
.flu-guess .fg-pick::after { content: '▾'; font-size: 11px; margin-left: 3px; color: #7bc96f; align-self: center; }
.flu-guess .fg-step:active:not(:disabled), .flu-guess .fg-pick:active:not(:disabled) { transform: scale(.92); background: #dff1df; }
.flu-guess.tap small { flex-basis: auto; white-space: nowrap; }
.sheet .guess-grid { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 8px; margin: 12px 0 4px; }
.sheet .guess-grid button {
  min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 20px; font-weight: 800;
  color: var(--ink); font-variant-numeric: tabular-nums; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sheet .guess-grid button.on { background: #3f8f4f; border-color: #3f8f4f; color: #fff; box-shadow: 0 3px 10px rgba(63,143,79,.35); }
.sheet .guess-grid button:active { transform: scale(.94); }
.sheet .guess-big { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin: 6px 0 0; color: #2f7a40; }
.sheet .guess-big b { font-size: 46px; font-weight: 800; color: #3f8f4f; min-width: 1.4ch; text-align: center; font-variant-numeric: tabular-nums; }
.sheet .guess-big span { font-size: 18px; font-weight: 700; }
.sheet .guess-big small { font-size: 13px; color: var(--muted); margin-left: 4px; }
.sheet .guess-total { background: #eef7ee; border-radius: 8px; padding: 8px 12px; color: #2f7a40; }
.sheet .guess input#gVal {
  width: 96px; font-size: 40px; font-weight: 800; color: #3f8f4f; text-align: center; font-variant-numeric: tabular-nums;
  border: 2px solid #7bc96f; border-radius: 12px; padding: 2px 4px; background: #fff;
}
.sheet .titlebadge {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0 0 10px; padding: 8px 16px;
  border-radius: 12px; background: linear-gradient(90deg, #2f8f4a, #3fb6a8); color: #fff; font-size: 20px; font-weight: 800;
  box-shadow: 0 4px 14px rgba(47,143,74,.35);
}
.sheet .titlebadge small { font-size: 12.5px; font-weight: 600; opacity: .92; }
.flu-rate { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.flu-rate span { color: var(--muted); flex: none; }
.flu-rate .track { flex: 1; height: 8px; background: #eee6d6; border-radius: 4px; overflow: hidden; }
.flu-rate .track i { display: block; height: 100%; background: linear-gradient(90deg, #7bc96f, #e5a53b, #d6453d); }
.flu-rate b { color: #3f8f4f; font-size: 16px; }
.toast.flu { background: #3f8f4f; font-weight: 700; }
.float { text-anchor: middle; dominant-baseline: central; font-weight: 900; paint-order: stroke; stroke: #fff; stroke-width: 4px; pointer-events: none; animation: floatUp 1.5s ease-out forwards; }
.float.sneeze { font-size: 14px; fill: #2f8f4a; stroke-width: 3px; animation-duration: 1.1s; }
.float.sorry { font-size: 12px; fill: #5a6270; font-weight: 700; }
.float.cheer { font-size: 20px; stroke-width: 0; }
.float.pts { font-size: 22px; fill: #d9822b; }
.float.bonk { font-size: 26px; fill: #e5484d; font-style: italic; animation-name: bonk; }
body.compact .float.sneeze { font-size: 22px; }
body.compact .float.sorry { font-size: 18px; }
body.compact .float.cheer { font-size: 28px; }
body.compact .float.pts { font-size: 30px; }
body.compact .float.bonk { font-size: 34px; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(6px); } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-18px); } }
@keyframes bonk { 0% { opacity: 0; transform: scale(.3); } 20% { opacity: 1; transform: scale(1.4); } 80% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }
#marks .sickmark { font-size: 18px; text-anchor: middle; dominant-baseline: central; }
.sheet .guess { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0 6px; }
.sheet .guess button { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 24px; font-weight: 800; }
.sheet .guess output { font-size: 44px; font-weight: 800; color: #3f8f4f; min-width: 2.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.sheet .guess span { font-size: 16px; color: var(--muted); margin-left: -6px; }
.sheet #gRange { width: 100%; accent-color: #3f8f4f; }
.sheet.noclose > .close { display: none; }

/* ---------- 奧客 PM ---------- */
.pm .body { transform-box: fill-box; transform-origin: center; }
.pm.walking .body { animation: bob .3s ease-in-out infinite; }
.pm.ranting .body { animation: rage .14s infinite; }
.pm .pm-mad { font-size: 13px; text-anchor: middle; dominant-baseline: central; animation: madPulse .5s ease-in-out infinite; }
.pm .pm-ko { display: none; font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.pm .pm-face, .pm .pm-zz { display: none; }
/* 昏倒：整個人躺平變淡、臉變 😵、頭上轉星星、冒 z */
.pm.ko .body { transform: rotate(90deg) scale(.95); opacity: .6; }
.pm.ko .pm-mad { display: none; }
.pm.ko .pm-ko { display: inline; animation: spin 1.2s linear infinite; transform-box: fill-box; transform-origin: center; }
.pm.ko .pm-face { display: inline; font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.pm.ko .pm-zz { display: inline; font-size: 12px; font-weight: 900; fill: #5a6270; paint-order: stroke; stroke: #fff; stroke-width: 3px; animation: zz 1.6s ease-out infinite; }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(9px, -12px); } }
.pm.ko .tag.pmtag { fill: #5a6270; }
/* 辭職：垂頭喪氣地走出去 */
.pm.quit .pm-mad { display: none; }
.pm.quit .body { opacity: .85; }
.pm .tag.pmtag { fill: #b3202a; font-size: 11px; }
.pm.caught .tag.pmtag { fill: #7a1018; }
@keyframes rage { 0%,100% { transform: translate(-1.5px, 0) scale(1.06); } 50% { transform: translate(1.5px, 0) scale(1.1); } }
@keyframes madPulse { 50% { transform: scale(1.3); } }
.pmbub { opacity: 0; transition: opacity .15s; pointer-events: none; }
.pmbub.show { opacity: 1; }
.pmbub rect.bg { fill: #fff0ef; stroke: #e5484d; stroke-width: 1.5; }
.pmbub path.tail { fill: #fff0ef; stroke: #e5484d; stroke-width: 1.5; }
.pmbub text { font-size: 13px; font-weight: 800; fill: #b3202a; text-anchor: middle; dominant-baseline: central; }
.pmhit { fill: transparent; cursor: pointer; }
.pmhit:hover { fill: rgba(229,72,77,.18); stroke: var(--target); stroke-width: 2; stroke-dasharray: 4 3; }
#office g.batmode .pmhit { cursor: crosshair; }
#office g.batmode .pmhit:hover { fill: rgba(242,183,5,.25); stroke: var(--you); }
#banner.pmalert { background: rgba(179,32,42,.94); font-weight: 700; animation: alertPulse 1s ease-in-out infinite; }
@keyframes alertPulse { 50% { box-shadow: 0 0 0 6px rgba(229,72,77,.35), 0 4px 20px rgba(0,0,0,.3); } }

/* 史詩級神人 */
.cape { fill: #d62839; stroke: #ffd23a; stroke-width: 1.2; }
.crown { fill: #ffd23a; stroke: #b8860b; stroke-width: .8; }

.mobile-only { display: none !important; }
button { touch-action: manipulation; }
#mapWrap { touch-action: pan-x pan-y; display: flex; }
#map { margin: auto; }
#followBtn.on { background: var(--target); }
.stack { display: contents; }
.actgrid button .s { display: none; }
#clock.ff::after { content: '⏩'; font-size: .55em; margin-left: 4px; vertical-align: middle; }

/* 手機版精簡辦公室：縮小顯示，字要大一點 */
.roomlabel.big { font-size: 19px; font-weight: 800; }
body.compact .tag { font-size: 14px; }
body.compact .grouplabel { font-size: 22px; }

@media (max-width: 900px) {
  .mobile-only { display: revert !important; }
  .desktop-only, #speedSeg, #followBtn, #toMe { display: none !important; }
  html, body { height: 100%; }
  body { height: 100dvh; overflow: hidden; -webkit-tap-highlight-color: transparent; }
  main { flex-direction: column; min-height: 0; flex: 1; }
  #mapArea { flex: 1; min-height: 0; }
  #map { padding: 6px; }

  /* 上方：只放狀態（時鐘、分數）與不常用的按鈕 */
  .topbar { gap: 8px; padding: 5px 10px; padding-top: max(5px, env(safe-area-inset-top)); flex-wrap: nowrap; }
  .brand { display: none; }
  .clockbox { margin-left: 0; gap: 7px; }
  #dayLabel { font-size: 12px; white-space: nowrap; }
  .daybar { display: none; }
  #clock { font-size: 21px; padding: 3px 8px; letter-spacing: 1px; white-space: nowrap; }
  .miniscore { display: flex !important; align-items: baseline; gap: 2px; background: rgba(255,255,255,.14); padding: 4px 9px; border-radius: 999px; }
  .miniscore b { font-size: 17px; font-variant-numeric: tabular-nums; }
  .miniscore span { font-size: 11px; opacity: .8; }
  .controls { margin-left: auto; gap: 4px; flex-wrap: nowrap; }
  .controls .btn.ghost { width: 40px; height: 40px; padding: 0; font-size: 18px; border-radius: 11px; }
  .controls .lbl, .controls #accountBtn .lbl { display: none; }

  /* 放大後回到全覽 */
  #fitBtn {
    position: absolute; right: 10px; bottom: 10px; z-index: 6; display: block !important;
    width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92);
    box-shadow: 0 3px 12px rgba(0,0,0,.3); font-size: 22px; font-weight: 800; color: var(--ink);
  }

  /* 下方：操作面板（高度跟著內容，地圖吃掉剩下的空間） */
  #panel {
    width: 100%; flex: none; max-height: 62dvh; border-left: 0; border-top: 1px solid var(--line);
    padding: 7px 7px calc(7px + env(safe-area-inset-bottom)); gap: 7px; overflow-y: auto; background: var(--bg);
    overscroll-behavior: contain;
  }
  body.setup .stack, body.setup #targetCard { display: none !important; }
  /* 上面是日誌／雷達的小視窗，下面永遠是記錄按鈕，兩邊都不用切換就按得到 */
  .stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .stack > .feedtabs { grid-row: 1; display: flex !important; gap: 5px; }
  .stack > .card[data-tab="log"], .stack > .card[data-tab="radar"], .stack > .card[data-tab="flu"] {
    grid-row: 2; grid-column: 1; height: 76px; overflow-y: auto; padding: 2px 8px; overscroll-behavior: contain;
  }
  .stack > #actCard { grid-row: 3; }
  #panel[data-tab="log"] .stack > .card:is([data-tab="radar"], [data-tab="flu"]),
  #panel[data-tab="radar"] .stack > .card:is([data-tab="log"], [data-tab="flu"]),
  #panel[data-tab="flu"] .stack > .card:is([data-tab="log"], [data-tab="radar"]) { visibility: hidden; }
  .stack > .card[data-tab="log"] h3, .stack > .card[data-tab="radar"] h3, .stack > .card[data-tab="flu"] h3, .radar .hint, .flu .hint, #accuseBtn { display: none; }
  .flu-line { font-size: 13px !important; margin: 4px 0 !important; }
  .flu-line .m-rate { display: inline; }
  .flu .flu-rate { display: none; }
  .flu-guess { margin-top: 0; padding-top: 3px; font-size: 13px; flex-wrap: nowrap; }
  .flu-guess .fg-step, .flu-guess .fg-pick { height: 38px; }
  .flu-guess .fg-step { width: 44px; }
  .flu .flu-line { margin: 2px 0 3px !important; }
  .flu-guess input { width: 54px; padding: 2px 4px; }
  .flu-guess small { flex-basis: auto; white-space: nowrap; font-size: 11px; }
  .feedtabs button { padding: 0 10px; }
  .stack .log { font-size: 13px; }
  .stack .log li { padding: 4px 2px; }
  .feedtabs button {
    position: relative; height: 30px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line);
    background: #fff; font-size: 13px; font-weight: 700; color: var(--muted);
  }
  .feedtabs button.on { color: var(--accent); border-color: var(--accent); background: #fff4e6; }
  .feedtabs i { position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }

  .card { padding: 10px; }
  .card h3 { font-size: 15px; margin-bottom: 6px; }
  .card .row .btn, #startBtn, #accuseBtn { min-height: 50px; font-size: 16px; }

  /* 目標＋操作列：一行 */
  #targetCard { display: flex !important; align-items: center; gap: 6px; padding: 5px 5px 5px 8px; }
  #targetCard[hidden] { display: none !important; }
  .watchhead { display: none; }
  /* 名單：一位時跟以前一樣（頭像＋名字），多位時變成一排小頭像，點頭像開選單 */
  .who { flex: 1; min-width: 0; flex-direction: row; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px; }
  .who::-webkit-scrollbar { display: none; }
  .wchip { flex: 1; min-width: 0; gap: 7px; padding: 0; }
  .wchip:hover { background: none; }
  .wchip .mini { display: none; }
  .whotext { min-width: 0; flex: 1; }
  .avatar { width: 30px; height: 30px; box-shadow: 0 0 0 2.5px var(--tc, var(--target)); }
  .avatar i { inset: 6px; }
  .who.multi { gap: 4px; }
  .who.multi .wchip { flex: none; width: 44px; flex-direction: column; gap: 2px; }
  .who.multi .avatar { width: 26px; height: 26px; box-shadow: 0 0 0 2.5px var(--tc); }
  .who.multi .avatar i { inset: 5px; }
  .who.multi .whotext { width: 100%; flex: none; }
  .who.multi .tname { font-size: 11px; font-weight: 800; text-align: center; line-height: 1.1; }
  .who.multi .tmeta { display: none; }
  .wchip:active .avatar { transform: scale(.9); }
  .wadd { flex: none; width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 19px; line-height: 1; border-color: var(--accent); color: var(--accent); background: #fff8ee; }
  .wadd span { display: none; }
  .wadd.on { font-size: 18px; }
  .tname { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tmeta { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #renameBtn, #switchBtn, .score, .lookline { display: none; }
  .strip { display: flex !important; gap: 5px; flex: none; }
  .strip button {
    width: 44px; height: 44px; padding: 0; border-radius: 12px; border: 1.5px solid var(--line); background: #fff;
    font-size: 20px; font-weight: 800; position: relative;
  }
  .strip button.on { background: #fff4e6; border-color: var(--accent); }
  .strip button.main { background: var(--accent); border-color: var(--accent); color: #fff; }
  .strip button.danger { border-color: #f2b8b5; background: #fff1f0; }
  .strip button.danger.on { background: var(--bad); }
  .strip #speedCycle { font-size: 15px; white-space: nowrap; }
  .strip button:active:not(:disabled) { transform: scale(.92); }
  .strip i { position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
  .strip i.cnt {
    width: auto; height: auto; top: -6px; right: -5px; min-width: 17px; padding: 0 4px; border-radius: 999px;
    font-size: 11px; font-style: normal; line-height: 17px; color: #fff;
  }

  /* 記錄按鈕：全部一次看完，不用捲 */
  #actCard { padding: 5px; }
  #actCard h3, #actCard .hint { display: none; }
  .actgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .actgrid button {
    flex-direction: column; justify-content: center; text-align: center; gap: 3px; min-width: 0;
    padding: 5px 0 4px; min-height: 54px; font-size: min(10.5px, 2.8vw); line-height: 1.15; border-radius: 10px;
    border-width: 1.5px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
  }
  .actgrid button .n { display: none; }
  .actgrid button .s { display: block; white-space: nowrap; }
  .actgrid button .e { font-size: 22px; width: auto; line-height: 1; }
  .actgrid button.hic .e { font-size: 15px; line-height: 22px; }
  .actgrid button:active:not(:disabled) { transform: scale(.93); background: #fff1de; border-color: var(--accent); }
  .log.small { max-height: none; }

  #toasts { top: auto; bottom: calc(var(--panel-h, 40dvh) + 10px); }
  .toast { font-size: 14px; padding: 8px 14px; }
  #banner { top: 10px; bottom: auto; font-size: 14px; padding: 9px 16px; max-width: calc(100% - 24px); white-space: normal; text-align: center; }

  .modal { padding: 0; align-items: flex-end; }
  .sheet { border-radius: 18px 18px 0 0; max-height: 92dvh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .sheet .close { width: 44px; height: 44px; right: 6px; top: 6px; font-size: 20px; }
  .sheet .actions .btn { flex: 1 1 100%; min-height: 50px; font-size: 16px; }
  .sheethead { margin: 0 -16px 12px; padding: 12px 16px; }
  .sheethead button { min-height: 32px; }
  .sendbar button { min-height: 48px; }
  .sendcard .ttl { font-size: 21px; }
}

@media (max-width: 370px) {
  #dayLabel { display: none; }
  .actgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .strip { gap: 4px; }
  .strip button { width: 40px; }
}

/* 矮的手機（iPhone SE 之類）：日誌只留兩行、按鈕矮一點，全部記錄按鈕不用捲就按得到 */
@media (max-width: 900px) and (max-height: 720px) {
  .stack > .card[data-tab="log"], .stack > .card[data-tab="radar"], .stack > .card[data-tab="flu"] { height: 52px; }
  .feedtabs button { height: 26px; font-size: 12px; }
  .actgrid button { min-height: 46px; gap: 2px; padding: 3px 0; }
  .actgrid button .e { font-size: 19px; }
  .actgrid button.hic .e { font-size: 13px; line-height: 19px; }
}

/* 開著視窗時提示訊息移到最上面，不要壓在分享按鈕上 */
body:has(.modal:not([hidden])) #toasts { top: max(12px, env(safe-area-inset-top)); bottom: auto; }

/* IG 限動教學：存好圖之後告訴使用者怎麼發 */
.igguide { background: #fff4e6; border: 1.5px solid var(--accent); border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.igguide[hidden] { display: none; }
.igguide b { display: block; color: var(--ink); }
.igguide ol { margin: 6px 0 0; padding-left: 20px; }
.igguide .igopen {
  display: block; margin-top: 10px; padding: 11px; border-radius: 6px; text-align: center; text-decoration: none;
  color: #fff; font-weight: 800; background: linear-gradient(45deg, #f9a825, #e1306c 50%, #833ab4);
}

/* ---------- 登入與雲端存檔 ---------- */
#accountBtn .lbl { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.sheet.acct { max-width: 420px; padding: 0 0 18px; overflow-x: hidden; }
.sheet.acct > .close { color: rgba(255,255,255,.8); z-index: 1; }
.sheet.acct > #modalBody > * { margin-left: 22px; margin-right: 22px; }
.sheet.acct > #modalBody > .acct-hero { margin: 0 0 16px; }
.acct-hero {
  text-align: center; color: #fff; padding: 26px 22px 20px;
  background: linear-gradient(160deg, #2f4a66 0%, #3d5f82 60%, #4b6f93 100%);
  position: relative; overflow: hidden;
}
.acct-hero::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.sheet .acct-hero h2 { margin: 10px 0 2px; font-size: 21px; letter-spacing: .5px; }
.sheet .acct-hero p { margin: 0; font-size: 13.5px; opacity: .85; }
.acct-badge {
  width: 58px; height: 58px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 30px;
  background: #fff; box-shadow: 0 0 0 5px rgba(255,255,255,.18), 0 6px 18px rgba(0,0,0,.2);
}
.acct-badge.avatar-letter { background: var(--accent); color: #fff; font-size: 26px; font-weight: 800; }
.acct-perks { list-style: none; padding: 0; margin-top: 0; margin-bottom: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.sheet .acct-perks li { display: flex; align-items: center; gap: 12px; line-height: 1.35; }
.acct-perks i, .acct-status i {
  font-style: normal; flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; background: #f4f1ea;
}
.acct-perks b, .acct-status b { display: block; font-size: 14.5px; }
.acct-perks small, .acct-status small { color: var(--muted); font-size: 12.5px; }
.acct-quota { background: #fff8ee; border: 1px solid #f1d9b8; border-radius: 12px; padding: 10px 14px 9px; margin-bottom: 16px; }
.acct-quota-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; }
.acct-quota-top b { color: #9a5a14; }
.acct-quota-top span { color: var(--muted); font-variant-numeric: tabular-nums; }
.acct-quota-top em { font-style: normal; font-weight: 800; color: var(--accent); font-size: 16px; }
.acct-bar { height: 7px; border-radius: 99px; background: #f1e4d0; overflow: hidden; margin: 7px 0 6px; }
.acct-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f2b705, var(--accent)); }
.acct-quota small { color: #8a6a44; font-size: 12px; }
.acct-quota.full { background: #fff1f0; border-color: #f2b8b5; }
.acct-quota.full .acct-quota-top b { color: var(--bad); }
.acct-quota.full .acct-bar { background: #f8d6d4; }
.acct-quota.full .acct-bar i { background: var(--bad); }
.acct-quota.full small { color: #a8403a; }
.acct-gsi { display: flex; justify-content: center; min-height: 44px; }
.sheet .acct-msg { text-align: center; font-weight: 700; color: var(--brand); margin-top: 10px; margin-bottom: 0; font-size: 14px; }
.sheet .acct-msg.bad { color: var(--bad); background: #fff1f0; border-radius: 10px; padding: 8px 12px; }
.acct-dev {
  display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 10px;
  border: 1px dashed #c9c2b2; border-radius: 10px; font-size: 12.5px; color: var(--muted);
}
.acct-dev span { flex: none; }
.acct-dev input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; color: var(--ink); }
.sheet .acct-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 14px; margin-bottom: 0; }
.acct-status { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #eef7ee; line-height: 1.35; }
.acct-status i { background: #fff; }
.acct-status.warn { background: #fff8ee; }
.acct-actions { display: flex; gap: 8px; margin-top: 14px; }
.acct-actions .btn { flex: 1; min-height: 44px; font-size: 15px; }
.acct-actions #logoutBtn { flex: 0 0 34%; color: var(--bad); }

/* ---------- 上班設定：幾點上班、玩幾分鐘、連線比賽 ---------- */
.cfg { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.cfgrow { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.cfgrow > span { flex: none; width: 6.2em; color: var(--ink); }
.cfgrow select { flex: 1; min-width: 0; height: 36px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-weight: 600; padding: 0 8px; }
.seg2 { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.seg2 button { height: 36px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; font-weight: 700; font-size: 13.5px; padding: 0; }
.seg2 button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.cfgnote { margin: 0 !important; font-size: 12.5px !important; color: var(--muted); min-height: 1.4em; }
#roomBtn { margin-top: 0; background: #fff4e6; border: 1.5px solid var(--accent); color: #9a5a12; font-weight: 800; }
#roomBtn.on { background: linear-gradient(90deg, #d9822b, #f2b705); color: #fff; }

/* ---------- 倒數與加班 ---------- */
#timeLeft { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 800; font-size: 15px; background: rgba(255,255,255,.14); padding: 3px 8px; border-radius: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#timeLeft.low { background: var(--bad); animation: alertPulse 1s ease-in-out infinite; }
#clock.ot { color: #ffb86b; text-shadow: 0 0 6px rgba(255,184,107,.55); }
#otTag { font-size: 12px; font-weight: 800; background: #6c3bd1; padding: 3px 7px; border-radius: 999px; white-space: nowrap; }
#otTag[hidden] { display: none; }
.toast.ot { background: #4b2a8a; font-weight: 700; }
.toast.boss { background: #c9578a; font-weight: 700; }
.toast.rainbow { background: linear-gradient(90deg, #ff4d6d, #ffb703, #3ddc84, #38b6ff, #9b5de5); }

/* ---------- 訊息列（地圖下方）＋突發狀況按鈕 ---------- */
#dock { display: flex; align-items: stretch; gap: 6px; min-height: 46px; }
.dockmsg {
  flex: 1; min-width: 0; display: flex; align-items: center; padding: 4px 10px; border-radius: 10px;
  background: #222b36; color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.3;
}
.dockmsg span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dockmsg.pop { animation: dockPop .35s ease-out; }
@keyframes dockPop { 0% { transform: scale(.97); filter: brightness(1.6); } 100% { transform: none; filter: none; } }
.dockmsg.idle { background: #e9e4d8; color: var(--ink); font-weight: 500; }
.dockmsg.mode { background: var(--brand); }
.dockmsg.ok { background: var(--ok); } .dockmsg.bad, .dockmsg.pm { background: #b3202a; }
.dockmsg.gold { background: linear-gradient(90deg, #d9822b, #f2b705); font-weight: 800; }
.dockmsg.rainbow { background: linear-gradient(90deg, #ff4d6d, #ffb703, #3ddc84, #38b6ff, #9b5de5); }
.dockmsg.flu { background: #3f8f4f; } .dockmsg.ot { background: #4b2a8a; }
.dockmsg.boss { background: #c9578a; } .dockmsg.boss.hot { animation: alertPulse 1s ease-in-out infinite; }
.dockacts { display: flex; gap: 5px; flex: none; }
.dockacts:not(:has(button:not([hidden]))) { display: none; }
.dockacts button {
  width: 58px; border-radius: 11px; border: 1.5px solid var(--line); background: #fff; padding: 2px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 19px; line-height: 1.05; position: relative;
}
.dockacts button[hidden] { display: none; }
.dockacts button b { font-size: 10.5px; font-weight: 800; margin-top: 1px; }
.dockacts button i { font-style: normal; font-size: 10px; font-weight: 800; color: var(--accent); }
.dockacts button:active:not(:disabled) { transform: scale(.92); }
#actComb { border-color: #e7a6c9; background: #fff0f7; animation: wiggle 1.2s ease-in-out infinite; }
#actPaci { border-color: #9ad0f5; background: #eef8ff; }
#actBonk.hot { border-color: var(--bad); background: #ffe7e5; animation: alertPulse 1s ease-in-out infinite; }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } 60% { transform: rotate(0); } }

/* ---------- 新外型：黃金鬥士、六翼天使、通靈神人 ---------- */
.saber .blade { fill: #e9fbff; stroke: #7fe3ff; stroke-width: 1.4; filter: drop-shadow(0 0 2px #7fe3ff); animation: saber .6s ease-in-out infinite; }
@keyframes saber { 50% { stroke: #fff; } }
.wings path { fill: url(#wingGrad); stroke: #e0a100; stroke-width: 1; filter: drop-shadow(0 0 1.5px rgba(255,255,255,.9)); }
.wings { animation: flap 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes flap { 50% { transform: scaleX(1.12) translateY(-1px); } }
.rainbow circle { fill: none; stroke-width: 2.4; opacity: .9; }
.rainbow .rb-ring { animation: spin 3s linear infinite; transform-box: fill-box; transform-origin: center; }
.rainbow .rb-ribbons { animation: spin 6s linear infinite reverse; transform-box: fill-box; transform-origin: center; }
.rainbow .rb-ribbons path { fill: none; stroke-width: 2.2; stroke-linecap: round; opacity: .85; }
.halo { fill: none; stroke: #fff6b0; stroke-width: 2.2; filter: drop-shadow(0 0 2px #fff); animation: halo 1.4s ease-in-out infinite; }
@keyframes halo { 50% { stroke: #ffb3f0; transform: translateY(-1px); } }
.longhair { stroke: rgba(0,0,0,.25); stroke-width: .8; }
.baldspot { fill: #f3cda6; stroke: #d9ae86; stroke-width: .6; }
.shed { fill: none; stroke-width: 1.2; stroke-linecap: round; animation: shed 1.4s ease-in forwards; }
@keyframes shed { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(26px) rotate(25deg); } }
.pm .pm-box { display: none; font-size: 14px; text-anchor: middle; dominant-baseline: central; }
.pm.quit .pm-box { display: inline; }
.pm.quit .body { animation: bob .6s ease-in-out infinite; }
.pmbub.loud rect.bg { fill: #fff6d6; stroke: #d9822b; stroke-width: 2; }
.pmbub.loud text { fill: #9a4a00; font-size: 14px; }

/* ---------- 巨嬰老闆 ---------- */
.boss .body { transform-box: fill-box; transform-origin: center; }
.boss.walking .body { animation: waddle .45s ease-in-out infinite; }
.boss.murmur .body { animation: tantrum .3s ease-in-out infinite; }
.boss .boss-face { font-size: 17px; text-anchor: middle; dominant-baseline: central; }
.boss .boss-paci { display: none; font-size: 11px; text-anchor: middle; dominant-baseline: central; }
.boss.paci .boss-paci { display: inline; }
.boss .boss-ko { display: none; }
.boss.ko .boss-ko { display: inline; animation: spin 1.2s linear infinite; transform-box: fill-box; transform-origin: center; }
.boss.ko .body { transform: rotate(90deg); opacity: .65; }
.boss.atyou .body ellipse { stroke: var(--bad); stroke-width: 3; }
.boss .tag.bosstag { fill: #c9578a; }
.boss.atyou .tag.bosstag { fill: var(--bad); }
.bossbub rect.bg { fill: #fff0f7; stroke: #c9578a; }
.bossbub path.tail { fill: #fff0f7; stroke: #c9578a; }
.bossbub text { fill: #8a2d5c; }
.bosshit:hover { fill: rgba(201,87,138,.18); stroke: #c9578a; }
@keyframes waddle { 0%,100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes tantrum { 0%,100% { transform: translate(-1px, 0) scale(1.04); } 50% { transform: translate(1px, 0) scale(.98); } }

/* ---------- 連線排行 ---------- */
.rankhead { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.rankhead b { color: var(--ink); letter-spacing: 1px; }
.rankhead .mini { color: var(--brand); font-weight: 700; text-decoration: underline; }
.ranklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.ranklist li { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; grid-template-areas: "no nm sc" "no st sc"; align-items: center; column-gap: 6px; padding: 4px 6px; border-radius: 8px; background: #f8f5ee; font-size: 13.5px; }
.ranklist li.empty { display: block; color: var(--muted); background: none; }
.ranklist li.me { background: #fff4d6; box-shadow: inset 0 0 0 1.5px var(--you); }
.ranklist .no { grid-area: no; text-align: center; font-weight: 800; }
.ranklist .nm { grid-area: nm; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranklist .st { grid-area: st; font-size: 11.5px; color: var(--muted); }
.ranklist li.run .st { color: var(--ok); font-weight: 700; }
.ranklist .sc { grid-area: sc; font-size: 17px; font-variant-numeric: tabular-nums; }
.rankcard { display: none; }
body.inroom .rankcard { display: block; }
.roomname { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin: 10px 0; }
.roomname input, .roomjoin input, .roomlink input { flex: 1; min-width: 0; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 10px; font: inherit; }
.roomjoin input { text-transform: uppercase; letter-spacing: 4px; font-weight: 800; font-size: 18px; text-align: center; }
.roomopts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.roomopt { min-width: 0; }
.roomopt { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fffdf8; }
.roomopt h4 { margin: 0 0 4px; }
.roomopt .hint { margin: 0 0 4px !important; }
.roomjoin, .roomlink { display: flex; gap: 6px; }
.roomcode { text-align: center; margin: 6px 0 10px; }
.roomcode small { display: block; color: var(--muted); }
.roomcode b { display: block; font-size: 44px; letter-spacing: 10px; color: var(--brand); font-family: ui-monospace, Menlo, monospace; }
.roomcode span { font-size: 13px; color: var(--muted); }
.roomlink { margin-bottom: 10px; }
.roomresult { background: #fff4e6; border: 1.5px solid var(--accent); border-radius: 10px; padding: 8px 12px; margin: 6px 0; font-size: 14px; }
.roomresult .mini { color: var(--brand); font-weight: 700; text-decoration: underline; margin-left: 6px; }
.miniscore i { font-style: normal; font-size: 11.5px; font-weight: 800; margin-left: 4px; }
.miniscore i[hidden] { display: none; }

/* ---------- 手機（iPhone 16 Pro 393×852 為基準） ---------- */
@media (max-width: 900px) {
  /* 地圖上不放人名、對話泡泡，全部改到下方訊息列 */
  body.compact .tag, body.compact .pmbub { display: none; }
  #banner { display: none !important; }
  #toasts { top: max(12px, env(safe-area-inset-top)); bottom: auto; }
  #dock { order: -1; min-height: 44px; height: 44px; }
  .dockmsg { font-size: 13px; padding: 3px 10px; }
  .dockacts button { width: 54px; font-size: 18px; }
  /* 頂欄：iPhone 16 Pro（393 寬）也要一行塞得下，絕不撐寬畫面 */
  html, body { overflow-x: hidden; }
  .topbar { overflow: hidden; }
  body:not(.setup) #dayLabel { display: none; }
  .clockbox { gap: 4px; min-width: 0; }
  #clock { font-size: 18px; padding: 3px 5px; }
  #timeLeft { font-size: 12.5px; padding: 4px 5px; }
  .miniscore b { font-size: 15.5px; }
  body.inroom .miniscore em, body.inroom .miniscore span { display: none; }
  .miniscore { white-space: nowrap; flex: none; }
  .controls .btn.ghost { width: 35px; height: 38px; font-size: 17px; }
  #clock { font-size: 17.5px; }
  #otTag { display: none; }
  .miniscore { padding: 4px 7px; }
  .cfg { margin-top: 8px; padding-top: 8px; gap: 6px; }
  .cfgrow select, .seg2 button { height: 40px; }
  #roomBtn { min-height: 44px; }
  #setupCard .cfgnote { font-size: 12px !important; }
  /* 日誌／雷達／感冒／排行：固定位置、不浮動、不滑來滑去 */
  .stack > .card.feed { grid-row: 2; grid-column: 1; height: 76px; overflow-y: auto; padding: 2px 8px; overscroll-behavior: contain; display: block; }
  .stack > .card.feed:not(.cur) { visibility: hidden; }
  .stack > .card.feed h3 { display: none; }
  .stack > .card.flu { overflow: hidden; touch-action: manipulation; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
  .stack > .card.flu #fluBody .flu-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 !important; }
  .stack > .card.flu .flu-guess { border-top: 0; padding-top: 0; }
  .stack > .card.rankcard .rankhead { font-size: 11.5px; margin: 2px 0; }
  .stack > .card.rankcard .ranklist li { padding: 2px 6px; font-size: 12.5px; grid-template-areas: "no nm st sc"; grid-template-columns: 1.6em minmax(0, 1fr) auto auto; }
  .stack > .card.rankcard .ranklist .st { font-size: 10.5px; }
  .feedtabs { gap: 4px !important; }
  .feedtabs button { flex: 1; padding: 0 4px !important; white-space: nowrap; }
  body:not(.inroom) .feedtabs #rankTab { display: none; }
  #panel { overflow-x: hidden; }
}
@media (max-width: 900px) and (max-height: 720px) {
  .stack > .card.feed { height: 52px; }
  #dock { height: 40px; min-height: 40px; }
}

/* ---------- 換辦公室：主題配色 ---------- */
#office .deco { font-size: 22px; text-anchor: middle; dominant-baseline: central; opacity: .9; }
body.compact #office .deco { font-size: 26px; }
#office.moving { animation: officeMove .7s ease-in-out; }
@keyframes officeMove { 0% { opacity: 1; } 35%, 50% { opacity: .15; filter: blur(2px); } 100% { opacity: 1; } }

/* 科技新創：深色地板、白色升降桌、螢光隔板 */
#office[data-theme="tech"] .obase { fill: #1d2129; }
#office[data-theme="tech"] .cp1 { fill: #353b48; }
#office[data-theme="tech"] .cp2 { fill: #313744; }
#office[data-theme="tech"] .cpl { stroke: #414858; }
#office[data-theme="tech"] .ft1 { fill: #d7dce4; }
#office[data-theme="tech"] .ft2 { stroke: #bfc6d1; }
#office[data-theme="tech"] .wd1 { stop-color: #f7f8fa; }
#office[data-theme="tech"] .wd2 { stop-color: #e2e6ec; }
#office[data-theme="tech"] .dtop { stroke: #b6bec9; }
#office[data-theme="tech"] .ch1 { fill: #6a4cf0; }
#office[data-theme="tech"] .ch2 { fill: #4a2fc0; }
#office[data-theme="tech"] .pt1 { fill: #2bd9c9; stroke: #149488; }
#office[data-theme="tech"] .pt2 { fill: #3fe6d7; stroke: #149488; }
#office[data-theme="tech"] .glb { fill: #7c3aed; }
#office[data-theme="tech"] .rm { fill: #eef1f6; }
#office[data-theme="tech"] .owall { stroke: #0f1218; }

/* 金融總部：深藍地毯、胡桃木桌、金色隔板 */
#office[data-theme="bank"] .obase { fill: #232838; }
#office[data-theme="bank"] .cp1 { fill: #2e4775; }
#office[data-theme="bank"] .cp2 { fill: #2a416c; }
#office[data-theme="bank"] .cpl { stroke: #3a5587; }
#office[data-theme="bank"] .ft1 { fill: #f1ece1; }
#office[data-theme="bank"] .ft2 { stroke: #d9cdb2; }
#office[data-theme="bank"] .wd1 { stop-color: #93633d; }
#office[data-theme="bank"] .wd2 { stop-color: #714629; }
#office[data-theme="bank"] .dtop { stroke: #4d2e18; }
#office[data-theme="bank"] .ch1 { fill: #1b1b20; }
#office[data-theme="bank"] .ch2 { fill: #0e0e12; }
#office[data-theme="bank"] .pt1 { fill: #c9a44c; stroke: #8c6d22; }
#office[data-theme="bank"] .pt2 { fill: #d8b65e; stroke: #8c6d22; }
#office[data-theme="bank"] .glb { fill: #b8860b; }
#office[data-theme="bank"] .rm { fill: #f4efe3; }
#office[data-theme="bank"] .owall { stroke: #151a28; }

/* 文青共享空間：木地板、淺木桌、綠色隔板 */
#office[data-theme="cozy"] .obase { fill: #7a5c3e; }
#office[data-theme="cozy"] .cp1 { fill: #c9a27a; }
#office[data-theme="cozy"] .cp2 { fill: #c19970; }
#office[data-theme="cozy"] .cpl { stroke: #b08860; }
#office[data-theme="cozy"] .ft1 { fill: #efe5d0; }
#office[data-theme="cozy"] .ft2 { stroke: #dccfb3; }
#office[data-theme="cozy"] .wd1 { stop-color: #f2e2c4; }
#office[data-theme="cozy"] .wd2 { stop-color: #e5cda4; }
#office[data-theme="cozy"] .ch1 { fill: #6b8f5e; }
#office[data-theme="cozy"] .ch2 { fill: #557548; }
#office[data-theme="cozy"] .pt1 { fill: #8fbf86; stroke: #5f8f56; }
#office[data-theme="cozy"] .pt2 { fill: #9ccc92; stroke: #5f8f56; }
#office[data-theme="cozy"] .glb { fill: #5f8f56; }
#office[data-theme="cozy"] .rm { fill: #f6f0e3; }
#office[data-theme="cozy"] .owall { stroke: #4e3a26; }
/* 深色地板上，直接寫在地上的字（電梯廳、影印區、公布欄）加白邊才看得清楚 */
#office[data-theme="tech"] .roomlabel, #office[data-theme="bank"] .roomlabel { paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; }

/* 換辦公室的選單 */
.offices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.officecard {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 12px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; cursor: pointer;
}
.officecard .e { font-size: 28px; line-height: 1; }
.officecard b { font-size: 15px; }
.officecard small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.officecard:hover { border-color: var(--brand); }
.officecard.on { border-color: var(--you); background: #fff8e1; }
@media (max-width: 420px) { .offices { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 下班：收包包 ---------- */
.agent.anim-pack .body { animation: pack .5s ease-in-out infinite; }
@keyframes pack { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px) scale(1.05); } }

/* ---------- 大老闆（緊急需求） ---------- */
.ob .body { transform-box: fill-box; transform-origin: center; }
.ob.walking .body { animation: bob .32s ease-in-out infinite; }
.ob.yelling .body { animation: rage .16s infinite; }
.ob .ob-face { font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.ob .ob-mega { font-size: 12px; text-anchor: middle; dominant-baseline: central; }
.ob.yelling .ob-mega { animation: madPulse .4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.ob .tag.obtag { fill: #1f2a44; font-size: 11px; }
.ob.atyou .body ellipse { stroke: var(--bad); stroke-width: 3; }
.ob.atyou .tag.obtag { fill: var(--bad); }
.obbub rect.bg { fill: #eef2fb; stroke: #1f2a44; }
.obbub path.tail { fill: #eef2fb; stroke: #1f2a44; }
.obbub text { fill: #1f2a44; }
.toast.ob { background: #1f2a44; font-weight: 700; }
.dockmsg.ob { background: #1f2a44; } .dockmsg.ob.hot { animation: alertPulse 1s ease-in-out infinite; }
#actSave { border-color: #8fb3e8; background: #eef4ff; animation: wiggle 1.2s ease-in-out infinite; }
#actNoOT.hot { border-color: var(--bad); background: #ffe7e5; animation: alertPulse 1s ease-in-out infinite; }

/* ---------- 連擊、任務 ---------- */
#combo { font-style: normal; font-weight: 800; color: #e8590c; }
.miniscore .mcombo { font-style: normal; font-weight: 800; display: inline-flex; flex-direction: column; align-self: center; line-height: 1.1; margin-left: 3px; }
.miniscore .mcombo span { font-size: 10px; opacity: 1; color: #ffd08a; }
.miniscore .mcombo:empty { display: none; }
.quests { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.quests li { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; background: #f6f3ec; font-size: 13px; overflow: hidden; }
.quests li span, .quests li b { position: relative; z-index: 1; }
.quests li b { font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.quests li i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(242,183,5,.28); transition: width .3s; }
.quests li.done { background: #e3f6e8; color: var(--ok); }
.quests li.done i { background: transparent; }
.quests li.dossier { background: #eef4ff; }
.quests li.dossier i { background: rgba(80,130,220,.22); }
.quests li.empty { background: none; color: var(--muted); }
.quest h3 small { font-size: 12px; color: #e8590c; font-weight: 800; margin-left: 4px; }
@media (max-width: 900px) {
  .quests { margin: 0; gap: 2px; }
  .quests li { padding: 2px 6px; font-size: 11.5px; }
}
.statrow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 8px 0; text-align: center; }
.statrow div { background: #f6f3ec; border-radius: 8px; padding: 6px 0; }
.statrow b { display: block; font-size: 16px; }
.statrow span { font-size: 11px; color: var(--muted); }
/* 手機上班中頂欄放分數和連擊，換辦公室改到開工前的設定裡 */
@media (max-width: 900px) { body.running #officeBtn { display: none; } }

/* ---------- 生涯職等徽章（頂欄） ---------- */
.careerbtn {
  display: inline-flex; align-items: center; gap: 4px; flex: none; border: 0; border-radius: 999px; padding: 4px 10px 4px 6px;
  background: linear-gradient(90deg, rgba(242,183,5,.28), rgba(217,130,43,.28)); color: #fff; font-size: 13px; white-space: nowrap;
  box-shadow: inset 0 0 0 1.5px rgba(255,214,120,.55);
}
.careerbtn > span:first-child { font-size: 17px; line-height: 1; }
.careerbtn b { font-weight: 800; color: #ffe08a; }
.careerbtn .lbl { opacity: .9; font-weight: 600; }
.careerbtn:active { transform: scale(.95); }
#menuBtn { font-size: 20px; font-weight: 800; }

/* ---------- 解鎖成就／打破紀錄的小卡 ---------- */
#achPop {
  position: fixed; left: 50%; top: 70px; z-index: 60; transform: translateX(-50%); pointer-events: none;
  display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 10px; border-radius: 16px; max-width: calc(100vw - 24px);
  background: linear-gradient(135deg, #2b2140, #3f2c63); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 2px #f2b705;
}
#achPop[hidden] { display: none; }
#achPop.show { animation: achIn 2.6s ease forwards; }
#achPop.pb { background: linear-gradient(135deg, #1f5f3a, #2e9d5b); box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 2px #b9f5cf; }
#achPop .e { font-size: 34px; line-height: 1; filter: drop-shadow(0 0 6px rgba(255,214,120,.8)); }
#achPop > span:last-child { display: flex; flex-direction: column; min-width: 0; }
#achPop small { font-size: 11.5px; font-weight: 800; color: #ffd36b; letter-spacing: .5px; }
#achPop.pb small { color: #d4ffe2; }
#achPop b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#achPop em { font-style: normal; font-size: 12px; opacity: .85; }
@keyframes achIn {
  0% { opacity: 0; transform: translate(-50%, -16px) scale(.85); }
  10% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  16% { transform: translate(-50%, 0) scale(1); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* ---------- 連線比賽：倒數開工、表情 ---------- */
#countdown { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; background: rgba(15,22,32,.6); backdrop-filter: blur(2px); }
#countdown[hidden] { display: none; }
.cdbox { text-align: center; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 20px; }
.cdbox small { font-size: 15px; font-weight: 800; color: #ffd36b; }
.cdbox b { font-size: 120px; line-height: 1; font-weight: 900; text-shadow: 0 6px 30px rgba(0,0,0,.4); font-variant-numeric: tabular-nums; }
.cdbox b.beat { animation: cdBeat .9s ease-out; }
.cdbox span { font-size: 14px; opacity: .9; }
@keyframes cdBeat { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.92); } }
#emoLayer { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.emofly { position: absolute; bottom: 38%; font-size: 44px; display: flex; flex-direction: column; align-items: center; animation: emoFly 2.6s ease-out forwards; filter: drop-shadow(0 3px 6px rgba(0,0,0,.3)); }
.emofly small { font-size: 12px; font-weight: 800; color: #fff; background: rgba(20,30,45,.8); padding: 1px 8px; border-radius: 999px; margin-top: -2px; white-space: nowrap; }
@keyframes emoFly { 0% { opacity: 0; transform: translateY(30px) scale(.5); } 15% { opacity: 1; transform: translateY(0) scale(1.15); } 25% { transform: scale(1); } 100% { opacity: 0; transform: translateY(-200px) scale(1); } }
.emobar { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 6px 0; }
.emobar::-webkit-scrollbar { display: none; }
.emobar button { flex: none; width: 38px; height: 34px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: 19px; padding: 0; }
.emobar button:active { transform: scale(.88); background: #fff4e6; }
.podium { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 8px; margin: 4px 0; border-radius: 10px; background: linear-gradient(90deg, #fff4d6, #fff9ec); font-size: 13px; }
.podium small { flex-basis: 100%; font-weight: 800; color: #9a5a12; }
.podium span.me { font-weight: 800; color: var(--accent); }
.ranklist li.feedli { display: flex; flex-direction: column; gap: 2px; background: none; font-size: 12px; color: var(--muted); padding: 4px 2px; }
.rhline { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rhline .mini { margin-left: auto; }
.miniscore i.up { color: #7dffa8; } .miniscore i.down { color: #ffb3ad; }
.toast.room { background: #6c3bd1; font-weight: 700; }
.dockmsg.room { background: #6c3bd1; }
.gobig { min-height: 50px; font-size: 17px !important; margin: 0 0 10px !important; }
.roomrow { display: flex; gap: 6px; }
.roomrow .btn { flex: 1; min-height: 40px; }
#roomBtn { margin-top: 0; }
#goBtn { background: #2e9d5b; border-color: #2e9d5b; color: #fff; font-weight: 800; }
#goBtn:disabled { opacity: .6; }
.roomresult .btn.small { display: block; width: 100%; margin-top: 6px; background: #2e9d5b; border-color: #2e9d5b; color: #fff; font-weight: 800; min-height: 40px; }
.dailybox { border: 1.5px solid #9ec5f0; background: #f2f8ff; border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.dailybox .dhead { margin-bottom: 4px; }
.dailybox .mini { color: var(--brand); font-weight: 700; text-decoration: underline; margin-left: 4px; }
.dailybox .ranklist li { background: #fff; }
.dtabs { margin: 8px 0; }
.dsum { font-size: 13.5px !important; margin: 4px 0 8px !important; }

/* ---------- 下班報告：XP、升官、成就 ---------- */
.progbox { border: 1.5px solid #e9c46a; background: linear-gradient(180deg, #fffaf0, #fff4dc); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.pbline { font-size: 14px; margin-bottom: 6px; }
.pbline.new { font-size: 15.5px; color: #1f7a45; background: #e3f6e8; border-radius: 8px; padding: 6px 10px; animation: dockPop .6s ease-out; }
.promo { font-size: 15px; font-weight: 700; padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; color: #fff; background: linear-gradient(90deg, #d9822b, #f2b705); box-shadow: 0 4px 14px rgba(217,130,43,.35); animation: dockPop .6s ease-out; }
.career { display: flex; align-items: center; gap: 10px; }
.career .e { font-size: 30px; width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.career > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.career b { font-size: 16px; }
.career small { color: var(--muted); font-size: 12.5px; }
.career em { font-style: normal; font-weight: 900; color: var(--accent); font-size: 18px; white-space: nowrap; }
.career.big .e { width: 56px; height: 56px; font-size: 38px; }
.career.big b { font-size: 19px; }
.xpbar { height: 10px; background: #efe4cc; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.xpbar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f2b705, #d9822b); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.xpnote { color: var(--muted); font-size: 12px; }
.achnew { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.achnew small { flex-basis: 100%; font-weight: 800; color: #6c3bd1; }
.achchip { background: #3f2c63; color: #fff; border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 700; }
.ranksteps { display: flex; justify-content: space-between; gap: 2px; margin: 6px 0 2px; }
.ranksteps span { font-size: 16px; filter: grayscale(1); opacity: .35; }
.ranksteps span.on { filter: none; opacity: 1; }
.ranksteps span.cur { transform: scale(1.35); filter: drop-shadow(0 0 4px rgba(242,183,5,.9)); }
.achcount { color: var(--accent); font-size: 14px; }
.achgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 8px; }
.achcard { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 12px; background: #f1eee6; color: var(--muted); border: 1.5px solid transparent; }
.achcard .e { font-size: 24px; line-height: 1.2; }
.achcard b { font-size: 14px; color: var(--ink); opacity: .6; }
.achcard small { font-size: 11.5px; line-height: 1.35; }
.achcard em { font-style: normal; font-size: 11px; font-weight: 800; margin-top: 2px; }
.achcard.on { background: #fff; border-color: #e9c46a; box-shadow: 0 2px 10px rgba(217,130,43,.15); color: var(--ink); }
.achcard.on b { opacity: 1; }
.achcard.on em { color: var(--accent); }

/* ---------- 手機選單 ---------- */
.menucareer { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 12px; padding: 10px 12px; border: 1.5px solid #e9c46a; border-radius: 14px; background: #fffaf0; text-align: left; }
.menucareer .e { font-size: 30px; }
.menucareer b { display: block; font-size: 16px; }
.menucareer small { color: var(--muted); font-size: 12.5px; }
.menucareer i { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--p); background: linear-gradient(90deg, #f2b705, #d9822b); }
.menugrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.menugrid button { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font-size: 15px; font-weight: 700; text-align: left; }
.menugrid button span { font-size: 24px; flex: none; }
.menugrid button:active { transform: scale(.96); background: #fff4e6; }

@media (max-width: 900px) {
  /* 頂欄：只留時鐘、倒數、分數（或職等）＋ 📤 ☰，393 寬一行塞得下、不會疊在一起 */
  #officeBtn, #accountBtn, #soundBtn, #helpBtn, #achBtn, #dailyBtn { display: none !important; }
  .clockbox { flex: 1 1 auto; overflow: hidden; }
  .controls { flex: none; margin-left: 0; }
  body.setup .miniscore { display: none !important; }
  body:not(.setup) .careerbtn { display: none; }
  .careerbtn { padding: 4px 9px 4px 6px; font-size: 12.5px; }
  .careerbtn .lbl { display: none; }
  #achPop { top: calc(env(safe-area-inset-top) + 58px); }

  /* 上班設定：「開始上班」黏在面板底部，不用捲就按得到 */
  body.setup #startBtn {
    position: sticky; bottom: 0; z-index: 3; margin-top: 10px;
    box-shadow: 0 -8px 14px 4px var(--panel), 0 4px 14px rgba(217,130,43,.35);
  }
  body.setup #startBtn:not(:disabled) { animation: startGlow 1.6s ease-in-out infinite; }
  /* 還不能按的時候不要半透明（會跟後面的按鈕疊字），改成實心灰 */
  body.setup #startBtn:disabled { opacity: 1; background: #ebe5d8; border-color: #ebe5d8; color: #9b927f; box-shadow: 0 -8px 14px 4px var(--panel); }
  .roomrow .btn { min-height: 44px; }

  /* 排行分頁：房號＋表情擠成一行（表情可以左右滑），下面留給名次 */
  .stack > .card.rankcard { padding-top: 3px; }
  .stack > .card.rankcard .rankhead { margin: 0 0 3px; display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 1; background: var(--panel); padding-bottom: 2px; }
  .stack > .card.rankcard .rhline { flex: none; flex-wrap: nowrap; white-space: nowrap; font-size: 12px; }
  .stack > .card.rankcard .rhline .rhmeta { display: none; }
  .stack > .card.rankcard .rhline .mini { margin-left: 4px; }
  .stack > .card.rankcard .emobar { flex: 1; min-width: 0; margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .stack > .card.rankcard .emobar::-webkit-scrollbar { display: none; }
  .stack > .card.rankcard .emobar button { flex: none; width: 30px; height: 26px; font-size: 15px; }
  .stack > .card.rankcard .podium { padding: 3px 6px; font-size: 12px; margin: 2px 0; }
  .sheet.menu h2 { margin-bottom: 0; }
  .achgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@keyframes startGlow { 50% { box-shadow: 0 -8px 14px 4px var(--panel), 0 4px 22px rgba(217,130,43,.7); } }
@media (max-width: 360px) { .careerbtn b { display: none; } }

/* ---------- 手機：按鈕加大、好按（2026-11 改版） ---------- */
/* 原則：面板總高度維持不變（地圖不變小），省下來的空間給按鈕；點擊範圍至少 44×44 */
@media (max-width: 900px) {
  /* 頂欄 📤 ☰：44×44，上下留白收一點 */
  .topbar { padding-top: max(3px, env(safe-area-inset-top)); padding-bottom: 3px; }
  .controls .btn.ghost { width: 44px; height: 44px; font-size: 19px; }

  #panel { padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 5px; }
  #targetCard { padding: 4px 4px 4px 8px; }
  /* ＋ 多盯一位、暫停／速度／指認 */
  .wadd { width: 44px; height: 44px; font-size: 21px; }
  .strip button { width: 44px; height: 44px; }
  /* 日誌／任務／雷達／感冒分頁：44 高 */
  .feedtabs button { height: 44px; font-size: 14px; }
  .stack > .card.feed { height: 68px; }
  .flu-guess .fg-step, .flu-guess .fg-pick { height: 44px; }

  /* 記錄按鈕：字放大，分三色、同類排在一起 */
  .actgrid button { min-height: 56px; font-size: min(12.5px, 3.3vw); font-weight: 600; }
  .actgrid button.k-away { order: 1; background: #edf4ff; border-color: #bcd3f2; }
  .actgrid button.k-desk { order: 2; background: #fff7e3; border-color: #ead7a4; }
  .actgrid button.k-time { order: 3; background: #f2ecff; border-color: #cdbdf2; }
  .actgrid button:active:not(:disabled) { background: #fff1de; border-color: var(--accent); }

  /* 突發狀況按鈕：不能按就藏起來；跟著梳放在訊息列右邊 */
  .dockacts button:disabled { display: none; }
  .dockacts:not(:has(button:not([hidden]):not(:disabled))) { display: none; }
  .dockacts button { width: 64px; }
  /* 老闆／大老闆的按鈕能按時，整條訊息列換成大按鈕 */
  #dock.takeover .dockmsg, #dock.takeover #actComb { display: none; }
  #dock.takeover .dockacts { flex: 1; min-width: 0; gap: 6px; }
  #dock.takeover .dockacts button {
    flex: 1 1 0; width: auto; min-width: 0; flex-direction: row; gap: 6px; font-size: 22px; color: #fff;
    border: 0; border-radius: 12px; animation: alertPulse 1s ease-in-out infinite; box-shadow: 0 3px 10px rgba(0,0,0,.2);
  }
  #dock.takeover .dockacts button b { font-size: 0; margin: 0; }
  #dock.takeover .dockacts button b::before { content: attr(data-long); font-size: 16px; white-space: nowrap; }
  #dock.takeover .dockacts button i { font-size: 14px; color: #ffe08a; }
  #dock.takeover #actPaci { background: #1c7ed6; }
  #dock.takeover #actBonk { background: #e5484d; }
  #dock.takeover #actNoOT { background: #e5484d; }
  #dock.takeover #actSave { background: #3b6fd8; }
}
@media (max-width: 370px) {
  .strip button { width: 44px; }
  #dock.takeover .dockacts button b::before { font-size: 14px; }
}
/* 矮的手機（iPhone SE 之類）：地圖已經很擠，按鈕看起來小一點，但點擊範圍往外延伸到 44 */
@media (max-width: 900px) and (max-height: 720px) {
  #panel { padding: 5px 5px calc(5px + env(safe-area-inset-bottom)); }
  #dock { height: 44px; min-height: 44px; }
  #targetCard { padding: 2px 2px 2px 6px; }
  .feedtabs button { height: 34px; font-size: 13px; }
  .feedtabs button::before { content: ''; position: absolute; inset: -6px 0; }
  .stack > .card.feed { height: 56px; }
  /* 感冒卡片內容剛好塞滿，不裁切，猜測按鈕的點擊範圍才能伸出卡片外 */
  .stack > .card.flu { gap: 2px; overflow: visible; }
  .flu-guess .fg-step, .flu-guess .fg-pick { height: 34px; position: relative; }
  .flu-guess .fg-step::before, .flu-guess .fg-pick::before { content: ''; position: absolute; inset: -6px 0; }
  #actCard { padding: 3px; }
  .actgrid { gap: 4px; }
  .actgrid button { min-height: 48px; }
}

/* ---------- 今日任務、出勤月曆（progress.js） ---------- */
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.todaybox { display: block; margin: 8px 0 2px; padding: 7px 9px; border: 1.5px solid #e9c46a; border-radius: 10px; background: linear-gradient(180deg, #fffaf0, #fff4dc); cursor: pointer; text-align: left; }
.todaybox:hover { border-color: var(--accent); }
.todaybox:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tdhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13.5px; }
.tdhead i { font-style: normal; color: var(--accent); }
.tdhead span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tdq { margin-top: 5px; gap: 3px; }
.tdq li { padding: 3px 8px; font-size: 12.5px; background: #fff; }
.tdq li .tde { font-weight: 400; }
.tdq li small { color: var(--muted); font-size: 11px; margin-left: 2px; }
.tdq.full li { padding: 6px 10px; font-size: 14px; }
.tdnote { display: block; margin-top: 5px; font-size: 12px; color: #6b4a12; line-height: 1.45; }
.todaylive { margin-top: 8px; }
.todaylive > small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.tdreport { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #e9c46a; }
#achPop.dq { background: linear-gradient(135deg, #1d4f7a, #2f6fa8); }
.cal { margin: 6px 0 4px; }
.calhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 14.5px; }
.calhead .btn { min-width: 36px; min-height: 36px; font-size: 18px; line-height: 1; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.calgrid > b { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.calgrid > span { position: relative; aspect-ratio: 1 / 1; max-height: 54px; border-radius: 8px; background: #f3efe6; display: grid; place-items: center; font-size: 17px; line-height: 1; }
.calgrid > span small { position: absolute; top: 3px; left: 5px; font-size: 10px; color: var(--muted); }
.calgrid > span.on { background: #fff4dc; }
.calgrid > span.clr { background: #ffe8a3; box-shadow: inset 0 0 0 1.5px #e9c46a; }
.calgrid > span.pto { background: #e4f1fb; }
.calgrid > span.today { box-shadow: inset 0 0 0 2px var(--accent); }
.calgrid > span.fut { opacity: .45; }
.callegend { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  /* 手機：設定卡只留 emoji 和進度，一行看完；點開才看完整任務和月曆 */
  .todaybox { margin: 4px 0 0; padding: 5px 8px; }
  .todaybox .tdq { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
  .todaybox .tdq li { flex: 1 1 0; min-width: 0; padding: 2px 6px; font-size: 12px; }
  .todaybox .tdq li .tdt { display: none; }
  .todaybox .tdnote { margin-top: 3px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .todaylive { margin-top: 3px; }
  .todaylive > small { font-size: 10.5px; }
  .calgrid > span { font-size: 15px; }
}

/* ---------- 🎯 今日挑戰 ---------- */
.roomrow .chalbtn { font-weight: 700; }
.chalbtn.new { background: linear-gradient(135deg, #fff4dc, #ffe2b3); border-color: var(--accent); color: #8a4a0f; animation: chalGlow 2.4s ease-in-out infinite; }
.chalbtn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
@keyframes chalGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(217,130,43,0); } 50% { box-shadow: 0 0 0 4px rgba(217,130,43,.22); } }
body.chal #setupCard { border-color: var(--brand); background: linear-gradient(180deg, #f2f6fb, var(--panel) 60%); }
.chalcfg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0; text-align: center; }
.chalcfg div { background: #f6f3ec; border-radius: 10px; padding: 8px 4px; display: flex; flex-direction: column; min-width: 0; }
.chalcfg span { font-size: 22px; line-height: 1.2; }
.chalcfg b { font-size: 14px; overflow-wrap: anywhere; }
.chalcfg small { font-size: 11px; color: var(--muted); }
.chalmine { background: #fff4dc; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.chalbox { border: 1.5px solid #9db4cf; background: linear-gradient(180deg, #f2f6fb, #e8f0f9); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.chalgrid { margin: 8px 0 4px; font-size: 20px; line-height: 1.35; letter-spacing: 1px; word-break: break-all; }
.chalmine .chalgrid { font-size: 16px; }
.chalkey { display: block; color: var(--muted); font-size: 11.5px; }
.chalrank { margin: 6px 0; font-size: 14px; }
.chalrank .ranklist { margin-top: 4px; }
.chalrank .ranklist li { background: #fff; }
.chalbox .row { display: flex; gap: 6px; margin-top: 6px; }
.chalbox .row .btn { flex: 1; min-height: 40px; }
@media (max-width: 900px) {
  .chalcfg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chalgrid { font-size: 18px; }
}
/* 在連線比賽房間裡不能挑戰，按鈕收起來，留位置給「全員開工」 */
body.inroom #chalBtn { display: none; }
/* 挑戰中座位和目標固定，重選座位／加人的按鈕收起來 */
body.chal #setupCard > .row { display: none; }
/* 全服排行：3／5／10／15 分＋🎯 挑戰，一排五格 */
.seg2.dtabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.seg2.dtabs button { white-space: nowrap; padding-left: 2px; padding-right: 2px; }

/* ---------- 桌機頂欄：按鈕一樣高、圖示和文字之間固定留白 ---------- */
/* 之前 ghost 按鈕被 emoji 撐成 42px、速度／縮放只有 34px，高低不齊；
   登入按鈕的名字是 inline-block，前面的空白被吃掉，變成「☁️August Wang」黏在一起 */
@media (min-width: 901px) {
  .controls .seg { height: 34px; align-items: stretch; }
  .controls .seg button { line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .controls .btn.ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    height: 34px; padding: 0 11px; line-height: 1; white-space: nowrap; flex: none;
  }
  .controls .btn.ghost .lbl { display: block; }
  #accountBtn .lbl { vertical-align: baseline; }
}
/* 901～1279：一排放不下全部文字，只留圖示（滑鼠移上去有 title 說明），頂欄維持兩行不會變三行 */
@media (min-width: 901px) and (max-width: 1279px) {
  .controls { gap: 6px; }
  .controls .btn.ghost { min-width: 38px; padding: 0 9px; }
  .controls .btn.ghost .lbl, .controls #accountBtn .lbl { display: none; }
}
/* 開工前的「重選座位／加一位附近的」：面板窄時不要折成兩行 */
.card .row .btn { white-space: nowrap; padding-left: 6px; padding-right: 6px; min-width: 0; }
