/* Puzzle Box: the Towers board, from towers/towers.css on the cabinet's tokens. Monochrome while it is
   played; the towers take a color by height at the solve. Luke Steuber. */
.bx-towers{position:relative;line-height:0;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;
  /* The three faces of a tower: top, left, right. */
  --face-top:var(--bg);--face-left:var(--line);--face-right:var(--guide)}
.bx-towers .board{line-height:0}
.bx-towers .board svg{display:block;overflow:visible;touch-action:none}
.bx-towers .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;margin:0}

/* Ground, numbers at the edge, towers, then the labels above everything. */
.bx-towers .ground path{fill:var(--bg);stroke:var(--guide);stroke-width:1}
.bx-towers .cell{cursor:pointer;outline:none}
.bx-towers .cell path{stroke:var(--ink);stroke-width:1.25;stroke-linejoin:round}
.bx-towers .cell .tile{fill:transparent;stroke:none}
.bx-towers .cell .top{fill:var(--face-top)}
.bx-towers .cell .left{fill:var(--face-left)}
.bx-towers .cell .right{fill:var(--face-right)}
.bx-towers .cell.given .top{fill:var(--ink)}
.bx-towers .board.flat .cell .top{stroke:none;fill:transparent}
.bx-towers .board.flat .cell.given .top{fill:var(--ink)}
.bx-towers .labels,.bx-towers .clues,.bx-towers .ground,.bx-towers .focus-ring{pointer-events:none}
.bx-towers .labels text,.bx-towers .clues text{font-family:var(--mono);font-weight:500;text-anchor:middle;dominant-baseline:central}
.bx-towers .labels text{fill:var(--ink);stroke:var(--face-top);stroke-width:3px;paint-order:stroke;stroke-linejoin:round}
.bx-towers .labels .given text{fill:var(--bg);stroke:var(--ink)}
.bx-towers .board.flat .labels text{stroke:none}
.bx-towers .mark{fill:none;stroke:var(--ink)}
.bx-towers .given .mark{stroke:var(--bg)}
.bx-towers .mark.repeat{stroke-width:2;stroke-dasharray:5 4}
.bx-towers .mark.evidence{stroke-width:1.25;stroke:var(--guide)}
.bx-towers .mark.target{stroke-width:3;animation:bx-tw-pulse 650ms 2}
.bx-towers .clue text{fill:var(--ink)}
.bx-towers .clue.met text{fill:var(--sub)}
.bx-towers .clue circle{fill:none;stroke:var(--ink);stroke-width:1.5;display:none}
.bx-towers .clue.broken circle{display:inline;stroke-dasharray:4 3}
.bx-towers .clue.evidence circle{display:inline;stroke-dasharray:none;stroke-width:2;animation:bx-tw-pulse 650ms 2}
.bx-towers .focus-ring{display:none;fill:none;stroke:var(--ink);stroke-width:3.5;stroke-linejoin:round}
.bx-towers .focus-ring.on-given{stroke:var(--bg);stroke-width:3}
.bx-towers .board:has(.cell:focus-visible) .focus-ring,.bx-towers .board.picking .focus-ring{display:inline}
.bx-towers .board.solved .focus-ring{display:none!important}

/* The strip of heights for the square in hand: the empty square, then 1 … N. */
.bx-towers .picker{position:absolute;top:0;left:50%;transform:translateX(-50%);z-index:3;display:flex;gap:2px;padding:2px;border:1px solid var(--line);background:var(--bg);line-height:1;touch-action:manipulation}
.bx-towers .picker[hidden]{display:none}
.bx-towers .picker button{display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;background:none;color:var(--ink);font:500 18px/1 var(--mono);font-variant-numeric:tabular-nums}
.bx-towers .picker button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linejoin:round}
.bx-towers .picker button[aria-pressed=true]{background:var(--ink);color:var(--bg)}
.bx-towers .picker button:focus-visible{outline:2px solid var(--ink);outline-offset:-4px}
.bx-towers .picker button[aria-pressed=true]:focus-visible{outline-color:var(--bg)}

/* At the solve the ground lines let go and the numbers stay, quieter; a tapped number is a view.
   The towers it reaches keep their color, the ones behind a taller tower fall into shadow, the rest stand back. */
.bx-towers .clues,.bx-towers .ground path{transition:opacity .6s,stroke-opacity .6s}
.bx-towers .clue circle.hit{display:none}
/* The game's own rule lets a miscount show its 44px hit ring as a second dashed ring; here the hit ring stays unseen. */
.bx-towers .board.solved .clues{pointer-events:auto}
.bx-towers .board.solved .clue{cursor:pointer}
.bx-towers .board.solved .clue circle.hit{display:inline;stroke:none;fill:transparent;pointer-events:all}
.bx-towers .board.solved .clue text{fill:var(--sub)}
.bx-towers .board.solved .clue.viewing text{fill:var(--ink)}
.bx-towers .board.solved .clue.viewing circle:not(.hit){display:inline;stroke-dasharray:none;stroke-width:1.5}
.bx-towers .cell{transition:opacity .35s}
.bx-towers .board.solved .cell.aside{opacity:.22}
.bx-towers .board.solved .cell.shaded .top,.bx-towers .board.solved .cell.shaded.given .top,.bx-towers .board.solved.flat .cell.shaded .tile{fill:color-mix(in srgb,var(--c,transparent) 34%,#000)}
.bx-towers .board.solved .cell.shaded .left{fill:color-mix(in srgb,var(--c,var(--face-left)) 26%,#000)}
.bx-towers .board.solved .cell.shaded .right{fill:color-mix(in srgb,var(--c,var(--face-right)) 18%,#000)}
.bx-towers .board.solved .labels g.shaded text,.bx-towers .board.solved .labels g.shaded.given text{fill:#fff;fill-opacity:.75}
.bx-towers .board.solved .ground path{stroke-opacity:0}
.bx-towers .board.solved .cell{cursor:default}
/* And the towers take color, one per height, cool and low to warm and tall, each shaded on its two sides.
   The heights are still read from the shapes and the numbers. */
.bx-towers .cell path{transition:fill .7s,stroke .7s}
.bx-towers .labels text{transition:fill .7s,stroke .7s}
.bx-towers .board.solved .cell[data-v="1"]{--c:#8ecae6}
.bx-towers .board.solved .cell[data-v="2"]{--c:#9ad0c2}
.bx-towers .board.solved .cell[data-v="3"]{--c:#f4d58d}
.bx-towers .board.solved .cell[data-v="4"]{--c:#f2a65a}
.bx-towers .board.solved .cell[data-v="5"]{--c:#ee7b5f}
.bx-towers .board.solved .cell[data-v="6"]{--c:#d98fb3}
.bx-towers .board.solved .cell .top,.bx-towers .board.solved .cell.given .top,.bx-towers .board.solved.flat .cell .tile,.bx-towers .board.solved.flat .cell.given .top{fill:var(--c,transparent)}
.bx-towers .board.solved .cell .left{fill:color-mix(in srgb,var(--c,var(--face-left)) 80%,#000)}
.bx-towers .board.solved .cell .right{fill:color-mix(in srgb,var(--c,var(--face-right)) 60%,#000)}
.bx-towers .board.solved .labels text,.bx-towers .board.solved .labels .given text{fill:#111;stroke:transparent}

/* The unlock. The posts lock at height: each lifts to its catch and seats, back to front. */
.bx-towers .board.locking .cells .cell{animation:bx-tw-lock 240ms cubic-bezier(.3,.7,.4,1) calc(var(--d,0) * 30ms) both}
/* Then the sightlines flash from each side's numbers: crisp, no fades. */
.bx-towers .board.flash .cell,.bx-towers .board.flash .cell path,.bx-towers .board.flash .labels text{transition:none}

@keyframes bx-tw-pulse{50%{opacity:.3}}
@keyframes bx-tw-lock{0%{transform:translateY(0)}40%{transform:translateY(calc(var(--lift,3px) * -1))}72%{transform:translateY(calc(var(--lift,3px) * .3))}100%{transform:translateY(0)}}
:root[data-motion=reduce] .bx-towers *{animation:none!important;transition:none!important}
@media(prefers-reduced-motion:reduce){.bx-towers *{animation:none!important;transition:none!important}}

@media(forced-colors:active){
  .bx-towers .cell path,.bx-towers .mark,.bx-towers .focus-ring,.bx-towers .clue circle{stroke:CanvasText}
  .bx-towers .cell .top{fill:Canvas}.bx-towers .cell .left,.bx-towers .cell .right{fill:GrayText}.bx-towers .cell.given .top{fill:CanvasText}
  .bx-towers .labels text,.bx-towers .clue text{fill:CanvasText;stroke:Canvas}.bx-towers .labels .given text{fill:Canvas;stroke:CanvasText}.bx-towers .given .mark{stroke:Canvas}
  .bx-towers .ground path{fill:Canvas;stroke:GrayText}
  .bx-towers .board.solved .cell .top,.bx-towers .board.solved .cell.given .top,.bx-towers .board.solved.flat .cell .tile{fill:Canvas}.bx-towers .board.solved .cell .left,.bx-towers .board.solved .cell .right{fill:GrayText}.bx-towers .board.solved .labels text,.bx-towers .board.solved .labels .given text{fill:CanvasText;stroke:Canvas}
  .bx-towers .picker{border-color:CanvasText}.bx-towers .picker button[aria-pressed=true]{background:Highlight;color:HighlightText;forced-color-adjust:none}
}

/* The sight rail: a number's line seen from the number, while the board is still being worked. */
.bx-towers .clues{pointer-events:auto}
.bx-towers .clue{cursor:pointer}
.bx-towers .clue circle.hit{display:inline;stroke:none;fill:transparent;pointer-events:all}
.bx-towers .board:not(.solved) .clue.viewing circle:not(.hit){display:inline;stroke-dasharray:none;stroke-width:1.5}
.bx-towers .rail{position:absolute;bottom:calc(100% + 22px);left:50%;transform:translateX(-50%);z-index:2;width:120px;line-height:0;border:1px solid var(--line);background:var(--bg);pointer-events:none}
.bx-towers .rail[hidden]{display:none}
.bx-towers .rail svg{display:block;width:100%;height:auto}
.bx-towers .rail .post{fill:var(--bg);stroke:var(--ink);stroke-width:1.6}
.bx-towers .rail .floor{stroke:var(--ink);stroke-width:1.6;fill:none}
.bx-towers .rail .pip{fill:var(--ink)}
.bx-towers .rail .ord{fill:none;stroke:var(--ink);stroke-width:1.2;stroke-dasharray:2 2}
.bx-towers .rail .ord.full{fill:var(--ink);stroke-dasharray:none}
.bx-towers .rail text{fill:var(--ink);font:500 18px/1 var(--mono);text-anchor:middle}
@media(forced-colors:active){.bx-towers .rail{border-color:CanvasText}.bx-towers .rail .post{fill:Canvas;stroke:CanvasText}.bx-towers .rail .pip,.bx-towers .rail .ord.full{fill:CanvasText}}
