/* The playing area: the board on the left, the side panel (orders, players, ledger) on the right.
   On a narrow screen the panel goes under the board and the whole area scrolls. */
#view{flex:1;min-height:0;position:relative;display:flex;overflow:hidden}
#stage{flex:1;min-width:0;min-height:0;display:grid;place-items:center;overflow:hidden;padding:36px 8px 8px}
#side{flex:0 0 300px;min-height:0;display:flex;flex-direction:column;border-left:1px solid var(--line);background:var(--panel)}
.pn{border-bottom:1px solid var(--line);padding:6px 8px}
@media (max-width:760px){
  #view{flex-direction:column;overflow:auto;-webkit-overflow-scrolling:touch}
  #stage{flex:none;overflow:visible;padding:36px 4px 6px}
  #side{flex:none;border-left:0;border-top:1px solid var(--line)}
}

/* ---- board ---- */
.board{display:grid;grid-template-columns:auto auto;grid-template-rows:auto auto;user-select:none;-webkit-user-select:none;--cs:40px}
.colheads{display:grid;grid-template-columns:repeat(var(--cols),var(--cs))}
.rowheads{display:grid;grid-template-rows:repeat(var(--rows),var(--cs))}
.colheads div,.rowheads div{display:flex;align-items:center;justify-content:center;color:var(--mute);font:500 10px var(--display)}
.colheads div{height:16px}
.rowheads div{width:20px}
.cells{position:relative;display:grid;grid-template-columns:repeat(var(--cols),var(--cs));grid-template-rows:repeat(var(--rows),var(--cs));border-top:1px solid var(--line);border-left:1px solid var(--line);background:var(--slot);touch-action:manipulation}
.cell{position:relative;padding:8%;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
.cell.last{background:color-mix(in srgb,var(--accent) 20%,var(--slot))}
.cell.own,.cell.target{cursor:pointer}
.board.placing .cell:not(.occ){cursor:copy}
@media (hover:hover){.cell.own:hover,.cell.target:hover,.board.placing .cell:not(.occ):hover{background:var(--tile)}}
.cell.sel{outline:2px solid var(--ink);outline-offset:-2px;z-index:1;background:var(--tile)}
.cell.target::after{content:"";position:absolute;left:50%;top:50%;width:22%;height:22%;transform:translate(-50%,-50%);background:var(--mute);opacity:.55}
.cell svg{display:block;width:100%;height:100%;pointer-events:none}
.p0{color:var(--p0)}
.p1{color:var(--p1)}
svg.overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:2}
svg.overlay text{font-family:var(--display)}
.draw{stroke-dasharray:1;stroke-dashoffset:1;animation:draw .45s ease-out forwards}
@keyframes draw{to{stroke-dashoffset:0}}
.mark.late{opacity:0;animation:fade .25s .4s forwards}
@keyframes fade{to{opacity:1}}
@media (prefers-reduced-motion:reduce){.draw,.mark.late{animation:none;stroke-dashoffset:0;opacity:1}}

/* ---- orders: what the player to move can do with the selection ---- */
#action{min-height:74px;display:flex;flex-direction:column;justify-content:center;gap:4px}
.atext{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-height:30px;font:600 12px var(--display);letter-spacing:.06em}
.ahint{font:400 12px/1.35 var(--body);color:var(--mute)}
.arrows{display:inline-flex;gap:3px}
.arrows button{width:34px;height:30px;padding:0;font-size:16px}
.cancel{margin-left:auto;height:24px;padding:0 6px;font-size:10px;color:var(--mute)}
@media (pointer:coarse){.arrows button{width:42px;height:38px}.cancel{height:32px}}

/* ---- players: reserve (click a piece to place it) and lasers left ---- */
#players{display:flex;flex-direction:column;gap:4px;padding:6px}
.player{display:flex;flex-direction:column;gap:4px;padding:5px 6px;border-left:3px solid transparent}
.player.active{background:var(--bg);border-left-color:currentColor}
.prow{display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--ink)}
.pname{font:600 12px var(--display);letter-spacing:.08em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pname small{font:400 11px var(--body);letter-spacing:0;color:var(--mute);margin-left:6px}
.reserve{display:flex;gap:4px;flex:none}
.res{display:inline-flex;align-items:center;gap:5px;padding:0 7px;height:28px}
.res svg{width:16px;height:16px}
.res.on{background:var(--ink);border-color:var(--ink);color:var(--panel)}
.lives{display:flex;align-items:center;gap:3px;font:500 9px var(--display);letter-spacing:.12em;color:var(--mute);text-transform:uppercase}
.lives i{width:9px;height:9px;background:currentColor;flex:none}
.lives i.dead{background:none;border:1px solid var(--mute);opacity:.6}
.lives span{margin-right:5px}

/* ---- ledger ---- */
.ledger{flex:1;min-height:90px;overflow:auto;border-bottom:0;font:500 12px var(--display);-webkit-overflow-scrolling:touch}
#matchinfo{font:400 11px/1.4 var(--body);color:var(--mute);margin-bottom:4px}
#ledger{list-style:none;margin:0;padding:0}
#ledger li{display:grid;grid-template-columns:2.4em 1fr 1fr;gap:6px;padding:1px 0}
#ledger .num{color:var(--mute);text-align:right}
#ledger .result{grid-template-columns:2.4em 1fr;font-weight:600}
#ledger .empty{display:block;color:var(--mute);font:400 12px var(--body)}
@media (max-width:760px){.ledger{max-height:220px}}
