/* Beasties: Bedtime Nudge (app key push, PushGame.swift). .psh is the container: every size is a multiple of
 * --u = 1/374 of its width (the app's board panel: LabFrame 8 + 4 pt, the cells 350 pt wide in all), cells are --C.
 * Floor = LabHollows (white 6 %, inset .12, radius .16), stones = RockView, beds = PushBed, sleepers = PushSleeper
 * (pictures from the app, full cell canvas). A sleeper moves with a short ease-out like the app (.14 s); the hand comes
 * out behind it on a push. Dark like the app in both themes. */
.psh { --u: calc(100cqw / 374); position: relative; container-type: inline-size; box-sizing: border-box; width: 100%; }
.psh-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; }
.psh-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; }
.psh-grid { --C: calc(350 * var(--u) / var(--w)); position: absolute; left: calc(12 * var(--u)); top: calc(12 * var(--u)); width: calc(350 * var(--u)); height: calc(var(--C) * var(--h)); }
.psh-fx { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.psh-c, .psh-bed, .psh-s, .psh-arrows, .psh-hl { position: absolute; left: calc(var(--x) * var(--C)); top: calc(var(--y) * var(--C)); width: var(--C); height: var(--C); }
.psh-c::before { content: ""; position: absolute; inset: 12%; border-radius: 16%; background: rgba(255, 255, 255, .06); }
.psh-c.is-rock::before { display: none; }
.psh-c svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.psh-bed img, .psh-si { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.psh-bed { z-index: 1; }
.psh-s { z-index: 3; transition: left .14s ease-out, top .14s ease-out; }
.psh-on { position: absolute; z-index: 2; left: -3%; top: 53%; width: 50%; height: 50%; border-radius: 10%; background: #1a1533; }
.psh-on img { width: 100%; height: 100%; display: block; }
/* the hand behind a pushed sleeper (fingers point the way it moves) */
.psh-s.is-push::after { content: ""; position: absolute; z-index: -1; left: 18%; top: 18%; width: 64%; height: 64%; background: no-repeat center / contain url("../img/beasties/push-hand.webp"); animation: psh-hand .6s ease-out both; }
.psh-s.is-push[data-hand="0"]::after { --hx: 0; --hy: 1; --hr: 180deg; }
.psh-s.is-push[data-hand="1"]::after { --hx: -1; --hy: 0; --hr: -90deg; }
.psh-s.is-push[data-hand="2"]::after { --hx: 0; --hy: -1; --hr: 0deg; }
.psh-s.is-push[data-hand="3"]::after { --hx: 1; --hy: 0; --hr: 90deg; }
@keyframes psh-hand { 0% { opacity: 0; transform: translate(calc(var(--hx) * 70%), calc(var(--hy) * 70%)) rotate(var(--hr)) scale(.7); } 20%, 75% { opacity: 1; transform: translate(calc(var(--hx) * 88%), calc(var(--hy) * 88%)) rotate(var(--hr)); } 100% { opacity: 0; transform: translate(calc(var(--hx) * 88%), calc(var(--hy) * 88%)) rotate(var(--hr)); } }
.psh-s.is-push .psh-si { animation: psh-squash .37s ease-out; }
@keyframes psh-squash { 20% { transform: scale(1.16, .86); } 60% { transform: scale(.96, 1.04); } 100% { transform: none; } }
.psh-s.is-plop .psh-si { animation: psh-plop .58s ease-out; }
@keyframes psh-plop { 25% { transform: translateY(-30%); } 50% { transform: translateY(5%); } 100% { transform: none; } }
.psh-s.is-nudge .psh-si { animation: psh-nudge .42s ease-out; }
@keyframes psh-nudge { 17% { transform: translate(calc(var(--nx) * 10%), calc(var(--ny) * 10%)); } 40% { transform: translate(calc(var(--nx) * -4%), calc(var(--ny) * -4%)); } 100% { transform: none; } }
.psh-s.is-shake .psh-si { animation: psh-shake .48s linear; }
@keyframes psh-shake { 10% { transform: translateX(-9%); } 30% { transform: translateX(9%); } 50% { transform: translateX(-7%); } 70% { transform: translateX(5%); } 100% { transform: none; } }
.psh-s.is-touch .psh-si { animation: psh-squash .3s ease-out; }
/* yellow arrows where the selected sleeper can go (PushArrows) */
.psh-arrows { z-index: 4; pointer-events: none; }
.psh-arrows::before { content: ""; position: absolute; inset: 2%; border-radius: 20%; box-shadow: inset 0 0 0 3px #ffd400; }
.psh-arrows b { position: absolute; left: 38%; top: 38%; width: 24%; height: 24%; background: #ffd400; clip-path: polygon(50% 8%, 96% 92%, 4% 92%); filter: drop-shadow(0 1.5px 0 #0e0b1a); }
.psh-arrows b.is-d0 { transform: translateY(-275%); }
.psh-arrows b.is-d1 { transform: translateX(275%) rotate(90deg); }
.psh-arrows b.is-d2 { transform: translateY(275%) rotate(180deg); }
.psh-arrows b.is-d3 { transform: translateX(-275%) rotate(270deg); }
/* site only: yellow rings the guide points at */
.psh-hl { z-index: 6; pointer-events: none; }
.psh-hl::after { content: ""; position: absolute; inset: 4%; border-radius: 22%; box-shadow: 0 0 0 max(2px, calc(var(--C) * .07)) #ffd400, 0 0 calc(var(--C) * .35) rgba(255, 212, 0, .7); animation: psh-hl .8s ease-in-out infinite alternate; }
@keyframes psh-hl { from { opacity: .55; } to { opacity: 1; } }
/* solved: a warm flash */
.psh.is-glow .psh-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: psh-glow .8s ease-out; pointer-events: none; }
@keyframes psh-glow { 22% { opacity: .5; } 100% { opacity: 0; } }

/* FX: red flash on the cell that blocks, dust behind a push, a ring where a sleeper lands in bed, the banner */
.psh-flash { position: absolute; width: calc(var(--c) * .88); height: calc(var(--c) * .88); border-radius: 20%; transform: translate(-50%, -50%); box-shadow: inset 0 0 0 max(2.5px, calc(var(--c) * .09)) #ff4d6d; background: rgba(255, 77, 109, .25); animation: psh-flash .85s linear forwards; }
@keyframes psh-flash { 0%, 30% { opacity: 1; } 45% { opacity: .2; } 60%, 75% { opacity: 1; } 100% { opacity: 0; } }
.psh-dust { position: absolute; width: calc(var(--c) * .4); height: calc(var(--c) * .4); border-radius: 50%; transform: translate(-50%, -20%); background: radial-gradient(closest-side, rgba(255, 255, 255, .7), rgba(140, 134, 168, .3) 60%, transparent); animation: psh-dust .6s ease-out forwards; }
@keyframes psh-dust { from { opacity: 1; transform: translate(-50%, -20%) scale(.5); } to { opacity: 0; transform: translate(-50%, -40%) scale(1.6); } }
.psh-burst { position: absolute; width: calc(var(--c) * 1.8); height: calc(var(--c) * 1.8); border-radius: 50%; border: 3px solid var(--col, #ffd400); box-sizing: border-box; transform: translate(-50%, -50%); animation: psh-burst .7s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes psh-burst { from { transform: translate(-50%, -50%) scale(.3); opacity: .95; } to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.psh-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: psh-banner 1.8s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes psh-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 (Undo, Restart) ---------- */
.psh-tools { grid-template-columns: repeat(2, 1fr); }
.psh-tool.is-off { opacity: .4; }
button.psh-tool { border: 0; background: none; font: inherit; color: #ede7ff; cursor: pointer; padding: 0; }
button.psh-tool:disabled { cursor: default; }
button.psh-tool:focus-visible { outline: 2px solid #ffd400; outline-offset: 2px; border-radius: 10px; }

/* ---------- the game screen (LabScreen) ---------- */
.gx.is-push { --pw: 19%; }
.gx-head.is-push { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; margin-top: 2px; }
.gx-head.is-push .gx-icons, .gx-head.is-push .gx-pill { margin-top: 14px; }
.gx-head.is-push .gx-pill { white-space: nowrap; }
.gx-head.is-push .gx-title { gap: 1px; }
.gx.is-push .gx-stars, .psh-head .gx-stars { justify-content: center; gap: 3px; margin-top: 2px; }
.gx.is-push .st, .psh-head .st { width: 17px; height: 17px; }
.psh-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; }
.psh-line .st-mini { width: .9em; height: .9em; vertical-align: -.1em; margin-right: 1px; }
.psh-left.is-hot { color: #ff4d6d; }
/* the reason above the board ("No room behind to push") */
.psh-reason { min-height: 1.3em; margin: 2px 0 4px; font-size: .7rem; font-weight: 700; color: #ff4d6d; text-align: center; opacity: 0; transition: opacity .2s; }
.psh-reason.is-on { opacity: 1; }
.gx-stage.is-push { position: relative; }
.gx-stage.is-push .psh { z-index: 1; }
.bst-phone .gx.is-push .gx-stage { margin-top: auto; }
.bst-phone .gx.is-push .gx-bottom { margin-bottom: auto; }
.bst-phone .gx.is-push .psh-tools { margin-top: 14px; }
.gx.is-push .gx-home { margin-top: 0; }

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

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

/* ---------- one level ---------- */
.bst-level.is-push { max-width: 1040px; }
.psh-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; }
.psh-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); }
.psh-facts strong { font-family: var(--display); font-size: 1.7rem; line-height: 1; color: var(--text); }
.psh-facts span { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.psh-ui.is-page, .psh-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); }
.psh-head { display: flex; flex-direction: column; align-items: center; margin-bottom: 2px; }
.psh-head .gx-stars { display: flex; }
.psh-head .st { color: #ffd400; transition: color .3s; }
.psh-head .st.is-lost { color: #2c2456; }
.psh-ui.is-page .psh-line { font-size: .8rem; }
.psh-ui.is-page .psh-reason { font-size: .82rem; }
.psh-ui.is-page .psh-tools { margin-top: 10px; }
.psh-ui.is-page .psh-grid { cursor: pointer; touch-action: none; }
/* buttons: choose a sleeper, then a direction (keyboard, screen readers, anyone who prefers buttons) */
.psh-pad { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; margin-top: 12px; }
.psh-whos { display: flex; gap: 6px; }
.psh-who { display: grid; justify-items: center; gap: 1px; padding: 3px 6px 4px; border-radius: 12px; border: 2px solid #3a3166; background: #241e45; color: #ede7ff; font: inherit; font-size: .7rem; font-weight: 700; cursor: pointer; }
.psh-who img { width: 30px; height: 30px; display: block; }
.psh-who[aria-pressed="true"] { border-color: #ffd400; }
.psh-dirs { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(2, 30px); gap: 3px; }
.psh-dir { display: grid; place-items: center; border: 0; border-radius: 10px; background: #241e45; color: #ede7ff; cursor: pointer; padding: 0; }
.psh-dir svg { width: 20px; height: 20px; }
.psh-dir.is-d0 { grid-column: 2; grid-row: 1; }
.psh-dir.is-d3 { grid-column: 1; grid-row: 2; }
.psh-dir.is-d3 svg { transform: rotate(-90deg); }
.psh-dir.is-d2 { grid-column: 2; grid-row: 2; }
.psh-dir.is-d2 svg { transform: rotate(180deg); }
.psh-dir.is-d1 { grid-column: 3; grid-row: 2; }
.psh-dir.is-d1 svg { transform: rotate(90deg); }
.psh-who:focus-visible, .psh-dir:focus-visible { outline: 2px solid #ffd400; outline-offset: 2px; }
.psh-say { min-height: 3em; }
.psh-say.is-won { color: var(--text); font-weight: 700; }
.psh-sol-in .psh-ui.is-sol { --pw: 0%; }
.psh-sol-in .gx-peek { display: none; }
.psh-why { min-height: 4.2em; margin: 12px 4px 0; font-size: .92rem; line-height: 1.45; color: #ede7ff; }
.psh-sol-in .bst-player-bar { margin-top: 10px; }
.psh-sol-in .bst-play-btn:not(.is-main) { background: #241e45; color: #ede7ff; border-color: #3a3166; }
.psh-sol-in .bst-player-count, .psh-sol-in .bst-player-count strong { color: #ede7ff; }
.psh-sol-in .bst-player-count small { color: #b7aee0; }
.bst-spoiler.is-push { border-radius: 22px; }
.bst-spoiler.is-push:not(.is-open) .psh-sol-in { filter: blur(9px) saturate(.6); user-select: none; pointer-events: none; }
.bst-spoiler.is-push .psh-sol-in { transition: filter .35s ease; }
.bst-move-list.is-push li { margin-bottom: .35em; }
.psh-sol .bst-peek-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
@media (max-width: 560px) {
	.psh-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
	.psh-facts strong { font-size: 1.4rem; }
	.psh-ui.is-page, .psh-sol-in { padding: 10px 10px 14px; }
}
