/* Puzzle Box: Spiral Galaxies on ivory paper. Luke Steuber.
   Shapes, diamond targets, pair previews and conflict marks adapted from galaxies/galaxies.css.
   The host supplies light cabinet tokens. Solved regions and the hatch use ink, never accent. */
.bx-galaxies{color:var(--ink);touch-action:none;user-select:none;-webkit-user-select:none}
.bx-galaxies .board{position:relative;width:max-content;margin:12px 24px;background:var(--bg);outline:1px solid var(--ink);touch-action:none}
.bx-galaxies .matrix{position:relative;display:flex;flex-direction:column}
.bx-galaxies .grid-row{display:flex}
.bx-galaxies .cell{position:relative;flex:none;width:var(--cell);height:var(--cell);box-sizing:border-box;background:transparent;border-right:1px solid var(--guide);border-bottom:1px solid var(--guide);touch-action:none;outline:none}
.bx-galaxies .cell:last-child{border-right:0}
.bx-galaxies .grid-row:last-child .cell{border-bottom:0}
.bx-galaxies .cell.owned{background:var(--band)}
.bx-galaxies .cell.balanced{background:transparent}
.bx-galaxies .cell.join-r{border-right-color:transparent}
.bx-galaxies .cell.join-b{border-bottom-color:transparent}
.bx-galaxies .cell.selected{background:var(--band)}
.bx-galaxies .cell.illegal:not(.owned){background:var(--bg)}
.bx-galaxies .cell.pair-preview::before{content:'';position:absolute;inset:7px;border:1px dotted var(--ink);background:var(--band);pointer-events:none}
.bx-galaxies .cell.conflict::after{content:'';position:absolute;inset:3px;border:2px dashed var(--ink);pointer-events:none}
.bx-galaxies .cell.conflict.loose::after{display:none}
.bx-galaxies .cell.evidence{outline:1px dashed var(--ink);outline-offset:-5px}
.bx-galaxies .cell.hint-target::after{content:'';display:block;position:absolute;inset:3px;border:3px solid var(--accent);pointer-events:none}
.bx-galaxies .cell:focus-visible{outline:2px solid var(--ink);outline-offset:-3px;z-index:2}
.bx-galaxies .regions,.bx-galaxies .outlines,.bx-galaxies .mechanism{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
.bx-galaxies .regions{fill:var(--lit)}
.bx-galaxies .shape{transform-box:view-box}
.bx-galaxies .outlines{fill:none;stroke:var(--ink);stroke-linecap:square}
.bx-galaxies .outlines path,.bx-galaxies .mechanism path{vector-effect:non-scaling-stroke}
.bx-galaxies .rim{stroke-width:1.5px}
.bx-galaxies .rim.chosen{stroke-width:2.5px}
.bx-galaxies .centres{position:absolute;inset:0;pointer-events:none}
.bx-galaxies .centre{position:absolute;transform:translate(-50%,-50%);width:48px;height:48px;min-width:48px;min-height:48px;padding:0;border:0;display:grid;place-items:center;background:none;z-index:4;touch-action:none;pointer-events:auto;clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%);cursor:pointer}
.bx-galaxies .centre::before{content:'';position:absolute;box-sizing:content-box;width:24px;height:24px;border:2px solid var(--ink);background:var(--bg);box-shadow:0 0 0 3px var(--bg);transform:rotate(45deg)}
.bx-galaxies .centre::after{content:'';position:absolute;width:8px;height:8px;background:var(--ink);clip-path:polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%);pointer-events:none}
.bx-galaxies .centre[aria-pressed=true]::before{background:var(--ink)}
.bx-galaxies .centre[aria-pressed=true]::after{background:var(--bg)}
.bx-galaxies .centre.evidence::before{outline:2px dashed var(--accent);outline-offset:3px}
.bx-galaxies .centre:focus-visible{outline:none}
.bx-galaxies .centre:focus-visible::before{outline:2px solid var(--ink);outline-offset:4px}
.bx-galaxies .centre:disabled{opacity:1;cursor:default}
.bx-galaxies .centre.given{pointer-events:none}
.bx-galaxies .nudge .centre:not(:disabled)::before{animation:bx-galaxies-nudge 450ms ease}
.bx-galaxies .mechanism{fill:none;stroke:var(--ink);stroke-width:1.5px}
.bx-galaxies .seam{stroke-dasharray:1;stroke-dashoffset:1;stroke-width:2px}
.bx-galaxies .catch-seat{stroke:var(--guide)}
.bx-galaxies .catch{fill:var(--bg);transform:translateX(0)}
.bx-galaxies .board.solved{outline-width:2px}
.bx-galaxies .board.solved .cell{border-color:transparent;cursor:default}
.bx-galaxies .board.solved .centre{pointer-events:none}
.bx-galaxies .board.solved .seam{stroke-dashoffset:0}
.bx-galaxies .board.solved .catch{transform:translateX(.24px)}
/* Finish: symmetric paper regions seat first (0–320 ms), seam runs (340–640), catch withdraws
   (660–840). The controller clears the animation class at 880 ms, below finishMs=1100. */
.bx-galaxies .board.unlocking .shape{animation:bx-galaxies-settle 320ms cubic-bezier(.3,.7,.2,1) both}
.bx-galaxies .board.unlocking .seam{animation:bx-galaxies-seam 300ms linear 340ms both}
.bx-galaxies .board.unlocking .catch{animation:bx-galaxies-catch 180ms ease-in 660ms both}
@keyframes bx-galaxies-settle{0%{transform:scale(1)}45%{transform:scale(.965)}100%{transform:scale(1)}}
@keyframes bx-galaxies-seam{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}
@keyframes bx-galaxies-catch{from{transform:translateX(0)}to{transform:translateX(.24px)}}
@keyframes bx-galaxies-nudge{50%{transform:rotate(45deg) scale(1.4)}}
.bx-galaxies.reduced *,.bx-galaxies.reduced *::before,.bx-galaxies.reduced *::after{animation:none!important;transition:none!important}
@media(prefers-reduced-motion:reduce){.bx-galaxies *,.bx-galaxies *::before,.bx-galaxies *::after{animation:none!important;transition:none!important}}
@media(forced-colors:active){
  .bx-galaxies .board{background:Canvas;outline-color:CanvasText}
  .bx-galaxies .regions{fill:Canvas}
  .bx-galaxies .cell{background:transparent;border-color:GrayText}
  .bx-galaxies .cell.join-r{border-right-color:transparent}.bx-galaxies .cell.join-b{border-bottom-color:transparent}
  .bx-galaxies .cell.conflict::after,.bx-galaxies .cell.hint-target::after,.bx-galaxies .cell.evidence,.bx-galaxies .cell:focus-visible{border-color:CanvasText;outline-color:CanvasText}
  .bx-galaxies .outlines,.bx-galaxies .mechanism{stroke:CanvasText}
  .bx-galaxies .catch{fill:Canvas}
  .bx-galaxies .centre::before{border-color:CanvasText;background:Canvas;box-shadow:0 0 0 3px Canvas}
  .bx-galaxies .centre::after{background:CanvasText}
  .bx-galaxies .centre[aria-pressed=true]::before{background:CanvasText}
  .bx-galaxies .centre[aria-pressed=true]::after{background:Canvas}
}
