* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; background: #f4f1ea; color: #222; font-size: 18px; }
header.top { background: #234; color: #fff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; }
header.top h1 { font-size: 20px; margin: 0; }
header.top a { color: #9cf; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; min-width: 48px; padding: 0 10px; }
main { max-width: 520px; margin: 0 auto; padding: 10px; }
.card { background: #fff; border-radius: 12px; padding: 12px; margin: 10px 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
button, select, input { font: inherit; }
button { min-height: 52px; min-width: 52px; padding: 8px 14px; border-radius: 10px; border: 2px solid #345; background: #fff; color: #234; }
button.primary { background: #2a6; border-color: #185; color: #fff; font-weight: bold; }
button.danger { background: #c43; border-color: #922; color: #fff; }
button.on { background: #345; color: #fff; }
button:disabled, button.primary:disabled, button.danger:disabled { opacity: 1; background: #d5d5d5; color: #444; border-color: #888; }
input[type=text], input[type=number], select { min-height: 48px; padding: 6px 10px; border: 2px solid #789; border-radius: 10px; width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.row > * { flex: 1 1 auto; }
.row.nogrow > * { flex: 0 0 auto; }
.chips button { min-width: 62px; flex: 0 0 auto; }
.abc { display: flex; gap: 8px; } .abc label { flex: 1; font-size: 15px; }
.grid { width: 100%; height: auto; max-height: 82vh; display: block; touch-action: manipulation; background: #fff; border-radius: 8px; }
.gl { stroke: #d6d6d6; stroke-width: .04; } .axis { stroke: #555; stroke-width: .09; }
.tick { font-size: .9px; fill: #333; pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: .22px; stroke-linejoin: round; }
.tick.origin { stroke-width: .34px; }
.rayend { fill: #d00; stroke: #fff; stroke-width: .05; }
.pt { cursor: pointer; }
.mk { stroke: #222; stroke-width: .06; fill: #4a90e2; } .mk.hit { fill: #e44; } .mk.dead { fill: #bbb; } .mk.safe { fill: #4a90e2; } .mk.me { fill: #2a6; }
.mk.radar { fill: #f90; } .mk.ghost { fill: rgba(40,160,100,.25); stroke-dasharray: .15; }
.mklabel { font-size: .55px; fill: #fff; font-weight: bold; pointer-events: none; }
.turret { fill: #d33; stroke: #600; stroke-width: .07; }
.sel { fill: none; stroke: #f90; stroke-width: .14; }
.reach { fill: rgba(40,160,100,.13); }
.shade { fill: rgba(255,153,0,.28); }
.rcircle { fill: rgba(255,153,0,.18); stroke: #f90; stroke-width: .1; }
.raypath { stroke: rgba(200,0,0,.28); stroke-width: .1; stroke-dasharray: .3 .2; }
.rayline { stroke: #d00; stroke-width: .16; stroke-linecap: round; }
.rayline.anim { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.mk.hit.anim { animation: pop 1.6s; } @keyframes pop { 0%,60% { fill: #4a90e2; r: .42; } 80% { r: .8; } 100% { fill: #e44; r: .42; } }
.eq { font-size: 22px; font-weight: bold; margin: 4px 0; font-family: "SF Mono", Menlo, monospace; }
.eqlabel { font-size: 13px; background: #234; color: #fff; padding: 2px 6px; border-radius: 6px; font-family: sans-serif; vertical-align: middle; }
.note { font-size: 14px; color: #555; }
.err { color: #c22; font-weight: bold; min-height: 1.4em; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; background: #234; color: #fff; font-size: 14px; }
.steps { display: flex; gap: 4px; font-size: 13px; } .steps span { flex: 1; text-align: center; padding: 4px 2px; background: #ddd; border-radius: 6px; } .steps span.cur { background: #2a6; color: #fff; font-weight: bold; }
.dpad { display: grid; grid-template-columns: repeat(3, 60px); gap: 6px; justify-content: center; margin: 6px 0; }
.big { font-size: 22px; } .hidden { display: none; }
.hitlist li { font-size: 20px; }
/* whiteboard */
body.board { font-size: 26px; background: #102030; color: #eee; }
body.board .card { background: #1c3045; color: #eee; }
body.board header.top h1 { font-size: 36px; }
.bwrap { display: grid; grid-template-columns: 900px 1fr; gap: 20px; padding: 14px; height: calc(100vh - 70px); }
.bwrap svg { max-height: 800px; width: 100%; height: auto; }
.rooms { display: flex; gap: 10px; flex-wrap: wrap; }
.roomchip { padding: 10px 16px; border: 3px solid #567; border-radius: 12px; cursor: pointer; min-width: 190px; font-size: 22px; }
.roomchip.spot { border-color: #fc3; background: #345; }
body.board .eq { font-size: 40px; } body.board .eqlabel { font-size: 20px; }
body.board button { font-size: 24px; min-height: 60px; }
body.board select, body.board input { font-size: 24px; width: auto; }

.slopes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 6px 0; }
.slopes button { min-width: 0; width: 100%; padding: 8px 2px; }
.rolebar { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 20px; font-weight: bold; color: #fff; text-align: center; }
.rolebar.attacker { background: #b3261e; } .rolebar.dodger { background: #1d5fb8; }
.card.waitcard { font-size: 20px; text-align: center; border: 4px dashed; padding: 18px 12px; }
.card.waitcard.attacker { border-color: #b3261e; background: #fdeceb; color: #7a1712; }
.card.waitcard.dodger { border-color: #1d5fb8; background: #e8f0fc; color: #123e7a; }
body[data-role=attacker] header.top { background: #7a1712; } body[data-role=dodger] header.top { background: #123e7a; }
/* whiteboard: readable from the back of the room */
body.board .card h2 { font-size: 34px; }
body.board p, body.board .note, body.board .roomchip, body.board .err { font-size: 30px; color: #f2f6fa; }
body.board .badge { font-size: 30px; padding: 4px 16px; color: #fff; background: #3b5470; margin: 2px; }
body.board .badge.role.attacker { background: #c62828; } body.board .badge.role.dodger { background: #1565c0; }
body.board .eqlabel { font-size: 30px; background: #ffd23f; color: #0b1a2a; padding: 2px 12px; }
body.board .hitlist li { font-size: 32px; }
body.board .eq { font-size: 44px; }
body.board .roomchip { font-size: 28px; }
body.board .err { color: #ff8a80; }
body.board .bwrap { grid-template-columns: 860px 1fr; }

.bwrap > div:last-child { min-height: 0; overflow-y: auto; }
#b-end p { overflow-wrap: anywhere; }

#s-up, #s-dn { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* narrow screens: board stacks in one column; in the lobby the control card (stage, rounds, 開始) goes above the grid */
@media (max-width: 1000px) {
  body.board .bwrap, .bwrap { grid-template-columns: 1fr; height: auto; }
  .bwrap.lobbyphase > div:last-child { order: -1; }
  .bwrap > div:last-child { overflow-y: visible; }
}

.waitlist { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: #ffe08a; color: #6a3d00; font-size: 20px; border: 2px solid #f0a500; }
body.board .waitlist { font-size: 34px; }
.lastresult { border: 3px solid #e4572e; background: #fff1ec; }
.lastresult .hitname { background: #e4572e; color: #fff; padding: 0 6px; border-radius: 6px; font-weight: 700; }
.histscroll { max-height: 260px; overflow-y: auto; }
.histrow { padding: 4px 0; border-top: 1px solid #ddd; }
body.board .histrow { font-size: 24px; }
#b-history summary { cursor: pointer; }
