* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; background: #1c1f24; color: #e8e8e8; }
header { padding: 10px 16px; background: #262a31; border-bottom: 1px solid #3a3f47; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
h1 { font-size: 18px; margin: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .map-name { color: #b9c0ca; font-size: 13px; margin-right: 6px; }
button { background: #343a43; color: #e8e8e8; border: 1px solid #4a515c; padding: 6px 12px; cursor: pointer; font-size: 13px; }
button:hover { background: #404753; }
main { display: grid; grid-template-columns: 250px 1fr 250px; gap: 12px; padding: 12px; align-items: start; }
.team h2 { font-size: 15px; margin: 0 0 8px; padding: 6px 8px; }
.team h2.astra { background: #274b73; }
.team h2.umbra { background: #732727; }
.card { background: #262a31; border: 1px solid #3a3f47; padding: 8px; margin-bottom: 8px; cursor: pointer; }
.card.selected { border-color: #f0c040; }
.card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.card-head .slot { color: #9aa3ae; font-size: 12px; }
.card-head img { width: 28px; height: 28px; }
.card-head select { flex: 1; min-width: 0; background: #1c1f24; color: #e8e8e8; border: 1px solid #4a515c; padding: 4px; }
.guard-btn.on { background: #7a6420; border-color: #f0c040; }
.card-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.card-row > span { width: 24px; font-size: 12px; color: #b9c0ca; }
.steps { display: flex; gap: 3px; flex: 1; }
.step { flex: 1; padding: 3px 0; font-size: 11px; }
.step.on { background: #2f6db3; border-color: #7ab3e8; }

.board-wrap { min-width: 0; }
#board { position: relative; width: min(100%, 560px); margin: 0 auto; aspect-ratio: 600 / 840; background: #14161a; border: 1px solid #3a3f47; }
#mapSvg { position: absolute; inset: 0; width: 100%; height: 100%; }
#tokens { position: absolute; inset: 0; }
.hint { font-size: 12px; color: #9aa3ae; width: min(100%, 560px); margin: 8px auto 0; }
.hint.warn { color: #d8b45a; }

/* マップ模式図 */
.ground { fill: #101216; }
.field { fill: #232830; stroke: #3f4652; stroke-width: 2; }
.crystal-line { fill: none; stroke: #8fd8d0; stroke-width: 3; stroke-dasharray: 10 8; opacity: 0.7; }
.wall { fill: #565f6e; stroke: #79828f; stroke-width: 2; }
.spawn { opacity: 0.85; }
.spawn-astra { fill: #2f6db3; }
.spawn-umbra { fill: #b33a3a; }
.spawn-label { fill: #fff; font-size: 13px; text-anchor: middle; }
.checkpoint { fill: #d8b45a; stroke: #f0d080; stroke-width: 2; }
.crystal { fill: #8fd8d0; stroke: #d8fffa; stroke-width: 2; }
.potion { fill: #3f9e4d; stroke: #7ad887; stroke-width: 2; }
.potion-label { fill: #fff; font-size: 14px; text-anchor: middle; }
.los-mask { fill: rgba(0, 0, 0, 0.55); }
.los-area { fill: rgba(255, 240, 180, 0.10); stroke: rgba(255, 240, 180, 0.45); stroke-width: 1; }

/* コマ */
.token { position: absolute; width: 40px; height: 48px; transform: translate(-50%, -50%); cursor: grab; touch-action: none; }
.token:active { cursor: grabbing; }
.token .bars { width: 40px; margin-bottom: 2px; }
.bar { height: 5px; background: #111; border: 1px solid #000; margin-bottom: 1px; }
.bar i { display: block; height: 100%; }
.bar.hp i { background: #e5484d; }
.bar.mp i { background: #3e8ef7; }
.token-face { width: 36px; height: 36px; margin: 0 auto; border: 3px solid #888; background: #222; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.team-astra .token-face, .token.team-astra .token-face { border-color: #3e8ef7; }
.token.team-umbra .token-face { border-color: #e5484d; }
.token-face img { width: 100%; height: 100%; }
.token-fallback { font-size: 10px; font-weight: bold; align-items: center; justify-content: center; }
.token.selected .token-face { outline: 2px solid #f0c040; }
.token.blocked { opacity: 0.35; filter: grayscale(0.8); }
.token.in-sight .token-face { outline: 2px solid #ffe9a0; }
.token.selected .token-face { outline: 2px solid #f0c040; }
.guard-badge { position: absolute; top: 8px; right: -6px; background: #7a6420; border: 1px solid #f0c040; color: #ffe9a0; font-size: 10px; padding: 1px 3px; }

footer { padding: 14px 16px; border-top: 1px solid #3a3f47; color: #9aa3ae; font-size: 12px; }
footer p { margin: 3px 0; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr 1fr; }
  .board-wrap { grid-column: 1 / -1; order: -1; }
}
