/* Beasties: Lantern Night (app key lights, LightsView.swift). .lgt is the container: every size is a multiple of
 * --u = 1/374 of its width (the app's 374 pt board panel: LabFrame 8 + 4 pt, the cells 350 pt wide in all). Cells are
 * --C wide. Floor = LightsFloor.tile (rounded, inset .07, radius .18): dark = white 4 % on the well, lit = gold that
 * fades a little with the distance d to the lantern (LightsFloor.color: #FFCB45 → #D99A2B by min(1, d · .1) in OKLab,
 * opacity .92 − .12 t; table .d0–.d10). The light runs out from a new lantern (--ld). Dark like the app in both themes. */
.lgt { --u: calc(100cqw / 374); position: relative; container-type: inline-size; box-sizing: border-box; width: 100%; }
.lgt-panel { position: absolute; left: 0; top: 0; right: 0; bottom: calc(6 * var(--u)); border-radius: calc(20 * var(--u)); background: #241e45; box-shadow: inset 0 0 0 calc(3 * var(--u)) #0e0b1a, 0 calc(6 * var(--u)) 0 #0e0b1a; }
.lgt-well { position: absolute; inset: calc(8 * var(--u)); border-radius: calc(14 * var(--u)); background: #1a1533; box-shadow: inset 0 0 0 calc(3 * var(--u)) #0e0b1a; }
.lgt-grid { position: absolute; left: calc(12 * var(--u)); top: calc(12 * var(--u)); width: calc(350 * var(--u)); height: calc(350 * var(--u) / var(--w) * var(--h)); }
.lgt-fx { position: absolute; inset: 0; z-index: 8; pointer-events: none; }

.lgt-c { --C: calc(350 * var(--u) / var(--w)); --lc: rgba(255, 255, 255, .04); position: absolute; left: calc(var(--x) * var(--C)); top: calc(var(--y) * var(--C)); width: var(--C); height: var(--C); }
.lgt-c.d0 { --lc: rgba(255, 203, 69, .92); } .lgt-c.d1 { --lc: rgba(251, 198, 66, .908); } .lgt-c.d2 { --lc: rgba(247, 193, 64, .896); }
.lgt-c.d3 { --lc: rgba(244, 188, 61, .884); } .lgt-c.d4 { --lc: rgba(240, 183, 59, .872); } .lgt-c.d5 { --lc: rgba(236, 178, 56, .86); }
.lgt-c.d6 { --lc: rgba(232, 173, 53, .848); } .lgt-c.d7 { --lc: rgba(228, 169, 51, .836); } .lgt-c.d8 { --lc: rgba(225, 164, 48, .824); }
.lgt-c.d9 { --lc: rgba(221, 159, 46, .812); } .lgt-c.d10 { --lc: rgba(217, 154, 43, .8); }
.lgt-f { position: absolute; inset: calc(var(--C) * .07); border-radius: calc(var(--C) * .18); background: var(--lc); transition: background-color .2s ease-out var(--ld, 0s); }
.lgt-c.is-floor .lgt-f { background-color: var(--lc); background-image: none; }
/* the last (at most five) dark cells carry a small crescent moon (LightsMoon) */
.lgt-c.is-moon::after { content: ""; position: absolute; inset: 0; opacity: .8; background: no-repeat center / 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23B9B0E8' d='M37 50a13 13 0 0 0 23.6 7.5A13 13 0 0 1 45.8 37.6 13 13 0 0 0 37 50z'/%3E%3C/svg%3E"); pointer-events: none; }
/* stones: RockView with the number (white, yellow when met) */
.lgt-c.is-stone svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lgt-n { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 4%; font-family: var(--display); font-style: normal; font-weight: 700; font-size: calc(var(--C) * .5); line-height: 1; color: #ede7ff; text-shadow: 0 calc(var(--C) * .02) 0 rgba(14, 11, 26, .55); transition: color .2s ease-out; }
.lgt-c.is-ok .lgt-n { color: #ffd400; }
/* crosses: the app's muted heavy x */
.lgt-c.is-x::after { content: ""; position: absolute; inset: 35%; background: no-repeat center / 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4l16 16M20 4L4 20' stroke='%238f86b8' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E"); animation: lgt-in .15s ease-out; pointer-events: none; }
@keyframes lgt-in { from { transform: scale(.5); opacity: 0; } }
/* the lantern: LightsLamp (app picture, cell-sized canvas) over a round warm glow (plus-lighter like the app) */
.lgt-l { position: absolute; inset: 0; z-index: 3; pointer-events: none; animation: lgt-lamp .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes lgt-lamp { from { transform: scale(.3); opacity: 0; } }
.lgt-glow { position: absolute; left: -12%; top: -12%; width: 124%; height: 124%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 241, 184, .75), rgba(255, 201, 60, .25) 60%, rgba(255, 201, 60, 0)); mix-blend-mode: plus-lighter; }
.lgt-li { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lgt-c.is-pop .lgt-l { animation: lgt-pop .4s ease-out; }
@keyframes lgt-pop { 0% { transform: none; } 30% { transform: scale(1.18); } 100% { transform: none; } }
.lgt-c.is-x.is-pop::after { animation: lgt-in .2s ease-out; }
/* monster cells: LabMonsterTile, scared in the dark, happy in the light (12 pt padding around a 100 pt tile at .72 cell) */
.lgt-m { position: absolute; z-index: 2; left: 5.7%; top: 5.7%; width: 88.6%; height: 88.6%; display: block; opacity: .75; transition: opacity .25s; }
.lgt-c.is-mon:not(.is-dark) .lgt-m { opacity: 1; }
.lgt-c.is-hop .lgt-m { animation: lgt-hop .42s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes lgt-hop { 0%, 100% { transform: none; } 30% { transform: translateY(-16%); } }
/* a wrong lantern: red tile, red lantern, shakes, fades (LightsWrong); the cause gets a red ring (LightsCulprit) */
.lgt-wl { position: absolute; z-index: 5; inset: 7%; border-radius: 16%; background: rgba(255, 77, 109, .35); box-shadow: inset 0 0 0 max(2px, calc(var(--C) * .06)) #ff4d6d; animation: lgt-wrong .8s ease-out forwards; pointer-events: none; }
.lgt-wl img { position: absolute; left: -7.5%; top: -7.5%; width: 115%; height: 115%; filter: sepia(1) saturate(5) hue-rotate(-40deg) brightness(1.05); }
@keyframes lgt-wrong { 0% { opacity: 1; translate: 0; } 6% { translate: 8% 0; } 14% { translate: -8% 0; } 22% { translate: 6% 0; } 30% { translate: -3% 0; } 38% { translate: 0; opacity: 1; } 60% { opacity: 1; } 100% { opacity: 0; } }
.lgt-c.is-culprit::before { content: ""; position: absolute; z-index: 6; inset: 2%; border-radius: 20%; box-shadow: inset 0 0 0 max(2.5px, calc(var(--C) * .09)) #ff4d6d; animation: lgt-culprit 1.25s linear forwards; pointer-events: none; }
@keyframes lgt-culprit { 0%, 24% { opacity: 1; } 36% { opacity: .2; } 48%, 72% { opacity: 1; } 100% { opacity: 0; } }
.lgt-c.is-bad::before { content: ""; position: absolute; z-index: 6; inset: 2%; border-radius: 20%; box-shadow: inset 0 0 0 max(2.5px, calc(var(--C) * .09)) #ff4d6d; pointer-events: none; }
/* what-if (guide): the tried lantern and what it forces are drawn faint, with a dashed ring */
.lgt-c.is-try .lgt-l, .lgt-c.is-try .lgt-f { opacity: .6; }
.lgt-c.is-try::before, .lgt-c.is-tryx::before { content: ""; position: absolute; z-index: 6; inset: 6%; border-radius: 20%; border: max(1.5px, calc(var(--C) * .05)) dashed #ede7ff; pointer-events: none; }
.lgt-c.is-tryx::after { content: ""; position: absolute; inset: 35%; opacity: .7; background: no-repeat center / 100% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4l16 16M20 4L4 20' stroke='%23ede7ff' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E"); }
/* site only: yellow rings the guide points at */
.lgt-c.is-hl::after { content: ""; position: absolute; z-index: 7; inset: 4%; border-radius: 22%; background: none; box-shadow: 0 0 0 max(2px, calc(var(--C) * .07)) #ffd400, 0 0 calc(var(--C) * .35) rgba(255, 212, 0, .7); animation: lgt-hl .8s ease-in-out infinite alternate; pointer-events: none; opacity: 1; }
@keyframes lgt-hl { from { opacity: .55; } to { opacity: 1; } }
/* solved: everything glows gold for a moment */
.lgt.is-glow .lgt-grid::after { content: ""; position: absolute; inset: 0; z-index: 7; border-radius: calc(10 * var(--u)); background: #ffe27a; mix-blend-mode: plus-lighter; opacity: 0; animation: lgt-glow .8s ease-out; pointer-events: none; }
@keyframes lgt-glow { 22% { opacity: .55; } 100% { opacity: 0; } }

/* FX: a ring where a lantern lands, the "All lit!" banner */
.lgt-burst { position: absolute; z-index: 8; width: calc(var(--c) * 1.8); height: calc(var(--c) * 1.8); border-radius: 50%; border: 3px solid #ffd400; box-sizing: border-box; transform: translate(-50%, -50%); animation: lgt-burst .7s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes lgt-burst { from { transform: translate(-50%, -50%) scale(.3); opacity: .95; } to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.lgt-banner { position: absolute; z-index: 9; transform: translate(-50%, -50%) rotate(-4deg); padding: .3em .7em; border-radius: 14px; background: #ffd400; color: #0e0b1a; font-family: var(--display); font-weight: 800; font-size: max(1.2rem, 9cqw); line-height: 1; white-space: nowrap; text-transform: uppercase; box-shadow: inset 0 0 0 3px #0e0b1a, 0 5px 0 #0e0b1a; animation: lgt-banner 1.8s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes lgt-banner { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-4deg) scale(.3); } 15%, 78% { opacity: 1; transform: translate(-50%, -50%) rotate(-4deg) scale(1); } 100% { opacity: 0; transform: translate(-50%, -62%) rotate(-4deg) scale(1); } }

/* ---------- tools (GameToolbar: Lantern, Cross, Undo, Restart) ---------- */
.lgt-tools { grid-template-columns: repeat(4, 1fr); }
.lgt-tool.is-off { opacity: .4; }
button.lgt-tool { border: 0; background: none; font: inherit; color: #ede7ff; cursor: pointer; padding: 0; }
button.lgt-tool:disabled { cursor: default; }
button.lgt-tool:focus-visible { outline: 2px solid #ffd400; outline-offset: 2px; border-radius: 10px; }

/* ---------- the game screen (LabScreen) ---------- */
.gx.is-lights { --pw: 19%; }
.gx-head.is-lights { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; margin-top: 2px; }
.gx-head.is-lights .gx-icons, .gx-head.is-lights .gx-pill { margin-top: 14px; }
.gx-head.is-lights .gx-pill { white-space: nowrap; }
.gx-head.is-lights .gx-title { gap: 1px; }
.gx.is-lights .gx-stars, .lgt-head .gx-stars { justify-content: center; gap: 3px; margin-top: 2px; }
.gx.is-lights .st, .lgt-head .st { width: 17px; height: 17px; }
.lgt-line { display: block; margin-top: 2px; font-size: .66rem; font-weight: 600; color: #8f86b8; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; transition: color .2s; }
.lgt-line.is-why { color: #ff4d6d; }
.gx-stage.is-lights { position: relative; }
.gx-stage.is-lights .lgt { z-index: 1; }
.bst-phone .gx.is-lights .gx-stage { margin-top: auto; }
.bst-phone .gx.is-lights .gx-bottom { margin-bottom: auto; }
.bst-phone .gx.is-lights .lgt-tools { margin-top: 14px; }
.gx.is-lights .gx-home { margin-top: 0; }

/* ---------- on a card: Gnatz peeks over the board ---------- */
.bst-board-card.is-lights { padding: 12px 14px 16px; background: linear-gradient(180deg, #2a1c63, #17112f); border-color: #0e0b1a; color: #ede7ff; max-width: 420px; }
.lgt-ui { --pw: 19%; position: relative; }
.lgt-ui .gx-peek, .gx.is-lights .gx-peek { --px: .5; }

/* ---------- on the site ---------- */
.bst-mini.is-lights { background: #1a1533; }
.bst-tier.is-lights .bst-tier-board { margin-bottom: 10px; }
.bst-fan-card.is-lights { display: flex; background: #241e45; border-color: #0e0b1a; }
.bst-fan-card.is-lights .bst-fan-well { flex: 1; display: flex; align-items: center; min-width: 0; padding: 2px; }
.bst-how-pic .bst-scene-visual:has(> .bst-how-lgt) { height: 100%; display: grid; place-items: center; }
.bst-how-pic .bst-scene:has(.bst-how-lgt) { grid-template-columns: minmax(0, 1fr); width: 100%; height: 100%; }
.bst-how-lgt { height: 96%; aspect-ratio: .82; display: grid; align-items: center; }
.bst-how-lgt .bst-board-card { width: 100%; box-sizing: border-box; padding: 6px 8px 8px; border-radius: 16px; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .lgt *, .lgt-ui *, .gx.is-lights * { transition: none !important; animation: none !important; } }

/* ---------- one level ---------- */
.bst-level.is-lights { max-width: 1040px; }
.lgt-facts { list-style: none; margin: 0 auto 28px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 680px; }
.lgt-facts li { display: grid; gap: 2px; justify-items: center; align-content: start; text-align: center; padding: 12px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.lgt-facts strong { font-family: var(--display); font-size: 1.7rem; line-height: 1; color: var(--text); }
.lgt-facts span { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.lgt-ui.is-page, .lgt-sol-in { padding: 12px 14px 16px; border-radius: 22px; background: linear-gradient(180deg, #2a1c63, #17112f); color: #ede7ff; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7); }
.lgt-head { display: flex; flex-direction: column; align-items: center; margin-bottom: 4px; }
.lgt-head .gx-stars { display: flex; }
.lgt-head .st { color: #ffd400; transition: color .3s; }
.lgt-head .st.is-lost { color: #2c2456; }
.lgt-ui.is-page .lgt-line { font-size: .8rem; }
.lgt-ui.is-page .lgt-tools { margin-top: 14px; }
.lgt-ui.is-page .lgt-grid { cursor: pointer; touch-action: none; }   /* only the playable board takes swipes (cross tool) */
.lgt-say { min-height: 3em; }
.lgt-say.is-won { color: var(--text); font-weight: 700; }
.lgt-sol-in .lgt-ui.is-sol { --pw: 0%; }
.lgt-sol-in .gx-peek { display: none; }
.lgt-why { min-height: 4.2em; margin: 12px 4px 0; font-size: .92rem; line-height: 1.45; color: #ede7ff; }
.lgt-sol-in .bst-player-bar { margin-top: 10px; }
.lgt-sol-in .bst-play-btn:not(.is-main) { background: #241e45; color: #ede7ff; border-color: #3a3166; }
.lgt-sol-in .bst-player-count, .lgt-sol-in .bst-player-count strong { color: #ede7ff; }
.lgt-sol-in .bst-player-count small { color: #b7aee0; }
.bst-spoiler.is-lights { border-radius: 22px; }
.bst-spoiler.is-lights:not(.is-open) .lgt-sol-in { filter: blur(9px) saturate(.6); user-select: none; pointer-events: none; }
.bst-spoiler.is-lights .lgt-sol-in { transition: filter .35s ease; }
.bst-move-list.is-lights li { margin-bottom: .35em; }
@media (max-width: 560px) {
	.lgt-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
	.lgt-facts strong { font-size: 1.4rem; }
	.lgt-ui.is-page, .lgt-sol-in { padding: 10px 10px 14px; }
}
.lgt-sol .bst-peek-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
