* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #f2f0ea; color: #222; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
#app { display: flex; flex-direction: column; height: 100%; }
header { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #2f3542; color: #fff; }
header h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: 2px; }
.tag { font-size: 12px; background: #48505e; padding: 2px 8px; border-radius: 10px; }
.conn { margin-left: auto; font-size: 12px; opacity: .85; }
.conn.ok { color: #7bed9f; }
.conn.bad { color: #ff7675; }
main { flex: 1; display: flex; min-height: 0; }
#boardWrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 6px; min-width: 0; }
#board { width: 100%; height: 100%; max-width: min(92vh, 100%); max-height: 100%; touch-action: manipulation; }
#panel { width: 240px; background: #fff; border-left: 1px solid #e2ded4; padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.joinbar { display: flex; gap: 6px; }
.joinbar input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
.joinbar button, #actions button { padding: 6px 12px; border: none; border-radius: 6px; background: #2c6fbb; color: #fff; font-size: 14px; cursor: pointer; }
#actions button { width: 100%; }
button:disabled { background: #aaa !important; cursor: not-allowed; }
.turnbox { padding: 8px; border-radius: 8px; background: #f4f6ff; text-align: center; font-size: 15px; font-weight: 600; }
.turnbox.my { background: #e6ffe6; color: #1b7a1b; }
.seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.seats li { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; font-size: 14px; background: #f7f7f7; }
.seats li .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.seats li .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seats li .g { font-size: 12px; opacity: .6; }
.seats li.me { outline: 2px solid #2c6fbb; }
.seats li.out { opacity: .45; text-decoration: line-through; }
.winner { text-align: center; padding: 10px; border-radius: 8px; background: #fff3cd; font-weight: 700; color: #8a6d3b; }
.logtitle { font-size: 12px; color: #888; margin-top: 4px; }
.log { flex: 1; min-height: 60px; max-height: 30vh; overflow-y: auto; font-size: 12px; color: #555; line-height: 1.5; border-top: 1px dashed #eee; padding-top: 4px; }
.hint { font-size: 11px; color: #999; text-align: center; }
.toast { position: fixed; left: 50%; top: 60px; transform: translateX(-50%); background: rgba(0,0,0,.82); color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; }

/* svg board */
.cell rect { cursor: pointer; }
.cell .bg { fill: #fff; stroke: #b9b3a4; stroke-width: 0.4; }
.cell.camp .bg { fill: #fdf3c7; stroke: #d8b84a; }
.cell.hq .bg { fill: #e8ecf8; stroke: #566; stroke-width: 0.6; }
.cell.sel .bg { stroke: #e63946; stroke-width: 1.2; }
.cell.hl .bg { stroke: #2c6fbb; stroke-width: 0.9; }
.edge { stroke: #c9c3b4; stroke-width: 0.5; }
.edge.rail { stroke: #8a8378; stroke-width: 1.1; }
.piece rect { stroke: rgba(0,0,0,.25); stroke-width: 0.3; }
.piece text { fill: #fff; font-size: 2.4px; text-anchor: middle; dominant-baseline: central; pointer-events: none; font-weight: 600; }
.piece.hidden text { fill: rgba(255,255,255,.85); }
