/* Akari in the puzzle box: the game's board and its two looks, scoped under .bx-akari. The paper look (light theme)
   follows akari-classic/akari.css; the lit look (.ak-dark, dark theme) follows akari/akari.css. Luke Steuber. */
.bx-akari{display:flex;flex-direction:column;align-items:center;flex:none;touch-action:none}
.bx-akari,.bx-akari *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}

/* The board: paper look. */
.bx-akari .board{display:flex;flex-direction:column;flex:none;position:relative;isolation:isolate;touch-action:none;border:1px solid var(--ink)}
.bx-akari .grid-row{display:flex;flex:none}
.bx-akari .cell{width:var(--cell);height:var(--cell);flex:none;position:relative;display:grid;place-items:center;border-right:1px solid var(--guide);border-bottom:1px solid var(--guide);font:500 calc(var(--cell)*.42)/1 var(--mono);background:var(--line);color:var(--ink);touch-action:none;outline:none;cursor:pointer}
.bx-akari .grid-row:last-child .cell{border-bottom:0}
.bx-akari .cell:last-child{border-right:0}
.bx-akari .cell.wall{background:var(--ink);color:var(--bg);border-color:var(--bg);cursor:default}
.bx-akari .cell.lit{background:var(--bg)}
.bx-akari .cell .bulb{width:70%;height:70%;stroke:currentColor;stroke-width:1.7;fill:none;stroke-linecap:round;stroke-linejoin:round}
.bx-akari .cell .lamp{display:none}
.bx-akari .cell.excluded::before{content:'×';font:400 calc(var(--cell)*.54)/1 var(--sans);transition:opacity .6s}
.bx-akari .cell.conflict{background:repeating-linear-gradient(135deg,var(--bg) 0 4px,var(--guide) 4px 6px)}
.bx-akari .cell.conflict::after{content:'';position:absolute;inset:2px;border:2px solid currentColor;border-radius:50%}
.bx-akari .cell.rule-error{outline:2px dashed currentColor;outline-offset:-4px}
.bx-akari .cell.evidence{outline:2px dashed currentColor;outline-offset:-3px}
.bx-akari .cell.hint-target{z-index:1}
.bx-akari .cell.hint-target::after{content:'';position:absolute;inset:3px;border:3px solid currentColor;border-radius:50%;animation:ak-pulse 650ms 2}
.bx-akari .cell.inner-group{outline:4px double currentColor;outline-offset:-6px}
.bx-akari.keys .cell.at{z-index:2;outline:2px solid var(--ink);outline-offset:-3px}
.bx-akari.keys .cell.wall.at{outline-color:var(--bg);box-shadow:inset 0 0 0 2px var(--bg)}
.bx-akari .board.solved{animation:ak-settle .65s cubic-bezier(.3,.7,.2,1)}
.bx-akari .board.solved .cell:not(.wall){border-color:var(--line)}
.bx-akari .board.solved .cell.excluded::before{opacity:0}
.bx-akari .light-field{display:none}
@keyframes ak-pulse{50%{opacity:.3}}
@keyframes ak-settle{0%{transform:scale(1)}45%{transform:scale(.985)}100%{transform:scale(1)}}

/* The board: lit look. Luminous sources over a charcoal floor; the light field is a canvas under the cells. */
.bx-akari.ak-dark .board{border:1px solid #ffffff10;background:#000;filter:drop-shadow(0 16px 24px #0003);transition:border-color .6s}
.bx-akari.ak-dark .board.solved{animation:none}
.bx-akari.ak-dark .light-field{display:block;position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:-1}
.bx-akari.ak-dark .cell,.bx-akari.ak-dark .cell.lit,.bx-akari.ak-dark .cell.conflict{background:transparent;color:#fff;border-color:#ffffff06;font:400 calc(var(--cell)*.23)/1 var(--sans);transition:border-color .6s}
.bx-akari.ak-dark .cell .bulb{display:none!important} /* beats the host's #panel-board svg rule */
.bx-akari.ak-dark .cell .lamp{display:block;width:4%;min-width:3px;aspect-ratio:1;border-radius:50%;background:#fff;box-shadow:0 0 2px 1px #fff,0 0 8px 2px #ffffff66,0 0 16px 4px #ffffff14;z-index:1}
.bx-akari.ak-dark .cell:not(.wall)::after{content:'';position:absolute;inset:1px;pointer-events:none;background:#484848cc;opacity:1;border:0;border-radius:0;transition:opacity .24s}
.bx-akari.ak-dark .cell.lit::after{opacity:0}
.bx-akari.ak-dark .cell.excluded::before{font-size:calc(var(--cell)*.25);color:#fff;z-index:1}
.bx-akari.ak-dark .cell.source{overflow:hidden}
.bx-akari.ak-dark .cell.wall{background:#000;color:#fff;border-color:#ffffff06;box-shadow:inset 0 -1px #000;isolation:isolate}
.bx-akari.ak-dark .cell.wall::before{content:'';position:absolute;inset:0 0 6px;background:linear-gradient(145deg,#ffffff05,transparent 65%),#000;border-top:1px solid var(--rim-top,#ffffff33);border-left:1px solid var(--rim-left,#ffffff1a);border-right:1px solid var(--rim-right,transparent);border-bottom:1px solid var(--rim-bottom,transparent);box-shadow:0 1px 0 #000,0 5px 7px #0007;z-index:-1}
.bx-akari.ak-dark .cell.wall.join-below::before{bottom:0;box-shadow:none;border-bottom-color:#ffffff0b}
.bx-akari.ak-dark .cell.wall.join-above::before{border-top-color:transparent}
.bx-akari.ak-dark .cell.wall.join-right::before{border-right-color:#ffffff0b}
.bx-akari.ak-dark .cell.wall.join-left::before{border-left-color:transparent}
.bx-akari.ak-dark .wall-label{transform:translateY(-3px);transition:opacity .6s}
/* A number still short of its bulbs is gray; blue is exact and yellow is too many. */
.bx-akari.ak-dark .wall.short .wall-label{color:#787878}
.bx-akari.ak-dark .wall.satisfied .wall-label{color:#a6def5}
.bx-akari.ak-dark .wall.overfull .wall-label{color:#ffff00}
/* Bulbs that face each other are plainly wrong: red. */
.bx-akari.ak-dark .cell.conflict .lamp{background:#ff3b30;box-shadow:0 0 5px 2px #ff3b30,0 0 16px 6px #ff3b3066}
.bx-akari.ak-dark .cell.conflict::after{opacity:1;border:2px solid #ff3b30;background:none;inset:20%;border-radius:50%}
.bx-akari.ak-dark .cell.hint-target::after{opacity:1;background:none;border:3px solid #a6def5;inset:15%;border-radius:50%}
.bx-akari.ak-dark .cell.rule-error,.bx-akari.ak-dark .cell.evidence{outline-color:#a6def5}
/* Routine clue status uses the number, reserving outlines for requested hints. */
.bx-akari.ak-dark .cell.wall.rule-error:not(.evidence):not(.hint-target){outline:none}
/* Keyboard focus: a white ring between two black bands, the same on every ground. */
.bx-akari.ak-dark.keys .cell.at{outline:2px solid #fff;outline-offset:-4px;box-shadow:inset 0 0 0 5px #000;z-index:2}
.bx-akari.ak-dark.keys .cell.at:not(.wall):not(.conflict):not(.hint-target)::after{inset:5px}
.bx-akari.ak-dark.keys .cell.evidence.at{outline-color:#a6def5}
/* The solved light field becomes one image. */
.bx-akari.ak-dark .board.solved,.bx-akari.ak-dark .board.solved .cell{border-color:transparent}
.bx-akari.ak-dark .board.solved .wall-label{opacity:0}

/* The unlock: four receivers above the top edge, fed by the board's inner guides. Hairline until the board lets go,
   then the light runs up each guide and the receivers fill. */
.bx-akari .ak-recv{display:block;flex:none;overflow:visible;pointer-events:none}
.bx-akari .ak-recv .rail{stroke:var(--line);stroke-width:1}
.bx-akari .ak-recv .run{stroke:var(--ink);stroke-width:2;stroke-linecap:butt;stroke-dasharray:1 1;stroke-dashoffset:1;transition:stroke-dashoffset .38s cubic-bezier(.4,0,.2,1) calc(.22s + var(--k)*40ms)}
.bx-akari .ak-recv .recv{fill:var(--bg);stroke:var(--line);stroke-width:1.2;transition:stroke .2s calc(.58s + var(--k,0)*40ms)}
.bx-akari .ak-recv .core{fill:var(--ink);transform-box:fill-box;transform-origin:center;transform:scale(0);transition:transform .2s cubic-bezier(.3,.7,.2,1.3) calc(.6s + var(--k)*40ms)}
.bx-akari .ak-recv .spill{display:none}
.bx-akari.done .ak-recv .run{stroke-dashoffset:0}
.bx-akari.done .ak-recv .recv{stroke:var(--ink)}
.bx-akari.done .ak-recv .core{transform:scale(1)}
.bx-akari.ak-dark .ak-recv .recv{fill:#000;stroke:#ffffff26}
.bx-akari.ak-dark .ak-recv .run,.bx-akari.ak-dark .ak-recv .core{stroke:#fff;fill:#fff;filter:drop-shadow(0 0 3px #ffffffaa)}
.bx-akari.ak-dark .ak-recv .run{fill:none}
.bx-akari.ak-dark .ak-recv .spill{display:block;opacity:0;transition:opacity .35s .12s}
.bx-akari.ak-dark.done .ak-recv .recv{stroke:#ffffff80}
.bx-akari.ak-dark.done .ak-recv .spill{opacity:1}

/* The game's Mark mode button in the host toolbar (the button carries the scope class): outlined when pressed in the
   paper look, inverted in the lit look. */
.ib.bx-akari.ak-mark{display:inline-grid;align-items:center;justify-content:center;width:48px;height:48px;touch-action:manipulation}
.ib.bx-akari.ak-mark[aria-pressed=true]{outline:1px solid var(--ink);outline-offset:-7px}
.ib.bx-akari.ak-mark.ak-dark[aria-pressed=true]{background:var(--ink);color:var(--bg);outline:none}

/* Reduced motion, and a board mounted already solved: the end state, no motion. */
.bx-akari.still,.bx-akari.still *,.bx-akari.still *::before,.bx-akari.still *::after{transition:none!important;animation:none!important}

@media(forced-colors:active){
  .bx-akari .light-field,.bx-akari .ak-recv .spill{display:none!important}
  .bx-akari .cell,.bx-akari.ak-dark .cell{forced-color-adjust:none;background:Canvas;color:CanvasText;border-color:CanvasText}
  .bx-akari .cell.wall,.bx-akari.ak-dark .cell.wall{background:CanvasText;color:Canvas}
  .bx-akari.ak-dark .cell.wall::before,.bx-akari.ak-dark .cell::after{display:none}
  .bx-akari .cell:not(.wall):not(.lit){background:repeating-linear-gradient(135deg,Canvas 0 5px,GrayText 5px 6px)}
  .bx-akari .cell.conflict{outline:3px dashed CanvasText;outline-offset:-4px}
  .bx-akari.ak-dark .wall .wall-label{color:Canvas}
  .bx-akari.ak-dark .cell .lamp{width:16%;background:CanvasText;box-shadow:none}
  .bx-akari.keys .cell.at{outline:2px solid Highlight;outline-offset:-3px;box-shadow:none}
  .ib.bx-akari.ak-mark[aria-pressed=true]{background:Highlight;color:HighlightText}
}
