/* ================= SORT GAMES ================= */
.sort-root { position: absolute; inset: 0; overflow: hidden; }
.sort-root.classic { background: radial-gradient(120% 70% at 50% 0%, #3E2F7A 0%, #1E1640 55%, #120E26 100%); }
.sort-root.bentley { background: #26170F; }
.sort-root.beau { background: #0E1424; }
.sort-root.waterth { background: radial-gradient(120% 70% at 50% 0%, #1D3D73 0%, #0D1E3D 60%, #081329 100%); }
.sort-photo { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(16px) brightness(.42) saturate(1.15); transform: scale(1.05); }
.sort-root.beau .sort-photo { filter: blur(16px) brightness(.38) saturate(.9); }
.sort-board { position: absolute; left: 0; right: 0; top: 4px; bottom: calc(74px + var(--sb)); z-index: 1; }
.bolt { position: absolute; }
.bolt.shake { animation: shake .32s; }
.rod { position: absolute; border-radius: 6px 6px 3px 3px;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .2) 0 2px, rgba(255, 255, 255, .0) 2px 6px), linear-gradient(90deg, #7D8494, #E9EDF3 38%, #B9BFCB 62%, #6F7685); }
.head { position: absolute; background: linear-gradient(180deg, #E3E7EE, #A3AAB8 60%, #868D9B); clip-path: polygon(7% 0, 93% 0, 100% 50%, 93% 100%, 7% 100%, 0 50%); }
.shelf { position: absolute; border-radius: 99px; background: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03)); }
.nut { position: absolute; left: 0; top: 0; z-index: 2; will-change: transform; transition: transform .2s cubic-bezier(.3, .75, .4, 1); pointer-events: none;
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%); }
.nut.lifted { filter: brightness(1.1) saturate(1.05); }
.nut.spin { animation: nutspin .55s linear; }
@keyframes nutspin { from { background-position: 0 0, 0 0; } to { background-position: 0 0, 150% 0; } }
.nut.hid { background: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, .3)), linear-gradient(90deg, #2E3340, #5D6576 30%, #474E5D 60%, #252A35); color: rgba(255, 255, 255, .75); font-weight: 900; display: grid; place-items: center; line-height: 1; }
.nut.reveal { animation: reveal .5s ease-out; }
@keyframes reveal { 0% { filter: brightness(2.4) saturate(0); } 100% { filter: none; } }
.cap { position: absolute; z-index: 3; border-radius: 50%; display: grid; place-items: center; overflow: hidden; opacity: 0; transform: scale(.2) translateY(20px);
  transition: opacity .3s, transform .45s cubic-bezier(.2, 1.6, .4, 1); background: radial-gradient(circle at 35% 30%, #FFF6C8, #FFC52E 55%, #D89400); color: #7A4E00; font-weight: 900; border: 2px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.cap img { width: 100%; height: 100%; object-fit: cover; }
.bolt.locked .cap { opacity: 1; transform: none; }
.bolt.locked .rod { filter: brightness(1.15); }
.bolt.hint .rod, .bolt.hint .glass { box-shadow: 0 0 16px 5px rgba(255, 226, 122, .85); }
.bolt.hint::after { content: attr(data-step); position: absolute; left: 50%; top: -4px; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: #FFE27A; color: #4A3200; font-weight: 900; font-size: 14px; display: grid; place-items: center; z-index: 4; animation: popin .3s; }
.spark { position: absolute; width: 7px; height: 7px; border-radius: 50%; z-index: 6; pointer-events: none; animation: spark .8s ease-out forwards; box-shadow: 0 0 8px currentColor; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
/* water */
.glass { position: absolute; border: 3px solid rgba(255, 255, 255, .6); border-top-width: 0; border-radius: 4px 4px 999px 999px; background: rgba(255, 255, 255, .06); overflow: hidden;
  box-shadow: inset 6px 0 10px rgba(255, 255, 255, .10), 0 6px 16px rgba(0, 0, 0, .25); transition: transform .2s cubic-bezier(.3, .75, .4, 1), border-color .3s; transform-origin: 50% 0; }
.glass::before { content: ""; position: absolute; left: -3px; right: -3px; top: 0; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .7); z-index: 2; }
.glass::after { content: ""; position: absolute; left: 18%; top: 10%; width: 12%; height: 70%; border-radius: 99px; background: rgba(255, 255, 255, .18); z-index: 2; }
.liquid { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column-reverse; }
.unit { flex-shrink: 0; transition: height .32s ease; }
.bolt.sel .glass { transform: translateY(-18px); }
.bolt.locked .glass { border-color: #FFE27A; }
.stream { position: absolute; width: 6px; border-radius: 3px; z-index: 5; opacity: .95; transform-origin: top; animation: streamIn .14s ease-out; transition: opacity .2s; }
.stream.end { opacity: 0; }
@keyframes streamIn { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ================= POOL ================= */
.screen.game[data-game="pool"] { background: radial-gradient(120% 80% at 50% 30%, #2B2F3A 0%, #15171D 70%); }
.pool-root { position: absolute; inset: 0; }
.pool-hud { display: flex; align-items: center; gap: 6px; padding: 4px 10px 6px; height: 62px; }
.pcard { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 16px; background: rgba(255, 255, 255, .06); transition: all .25s; border: 2px solid transparent; }
.pcard.right { flex-direction: row-reverse; text-align: right; }
.pcard.on { background: rgba(61, 220, 132, .14); border-color: rgba(61, 220, 132, .75); box-shadow: 0 0 18px rgba(61, 220, 132, .25); }
.pcard img, .pav { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; flex-shrink: 0; }
.pav { display: grid; place-items: center; background: #FF6B3D; font-weight: 900; }
.pinfo { min-width: 0; }
.pinfo b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdots { display: flex; gap: 2px; margin-top: 3px; font-size: 10.5px; opacity: .8; font-weight: 700; flex-wrap: wrap; }
.pcard.right .pdots { justify-content: flex-end; }
.pdots i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -2px 2px rgba(0, 0, 0, .3); }
.pdots i.gone { opacity: .18; }
.pvs { font-weight: 900; font-size: 12px; opacity: .5; }
.pool-cv { position: absolute; left: 0; touch-action: none; }
.pool-banner { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%) scale(.9); background: rgba(10, 12, 18, .82); color: #fff; padding: 10px 18px; border-radius: 16px; font-weight: 800; font-size: 15px; opacity: 0; transition: all .25s; pointer-events: none; text-align: center; max-width: 80%; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pool-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.spin-ball { width: 180px; height: 180px; border-radius: 50%; margin: 10px auto 0; position: relative; touch-action: none; background: radial-gradient(circle at 35% 30%, #fff, #E9E5DA 60%, #BEB8A8); box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
.spin-ball::before, .spin-ball::after { content: ""; position: absolute; background: rgba(0, 0, 0, .1); }
.spin-ball::before { left: 50%; top: 10%; bottom: 10%; width: 1px; }
.spin-ball::after { top: 50%; left: 10%; right: 10%; height: 1px; }
.spin-dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FF8A80, #E53935); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); z-index: 1; }
.seg { display: flex; background: #F1E8DF; border-radius: 14px; padding: 4px; gap: 4px; }
.segb { flex: 1; padding: 10px 6px; border-radius: 11px; font-weight: 800; font-size: 14px; color: var(--muted); transition: all .2s; }
.segb.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(60, 30, 10, .12); }

/* ================= BLAST ================= */
.screen.game[data-game="blast"] { background: radial-gradient(120% 70% at 50% 0%, #3C3A8F 0%, #22225A 55%, #16163C 100%); }
.blast-root { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; }
.blast-hud { width: 100%; display: flex; flex-direction: column; align-items: center; padding: 0 16px 8px; position: relative; height: 92px; }
.bh-best { position: absolute; left: 18px; top: 4px; display: flex; align-items: center; gap: 6px; font-weight: 800; color: #FFD66B; font-size: 16px; }
.bh-score b { font-size: 46px; font-weight: 900; letter-spacing: -1px; font-variant-numeric: tabular-nums; text-shadow: 0 4px 16px rgba(0, 0, 0, .35); }
.blast-combo { font-weight: 800; color: #FFB86B; font-size: 14px; min-height: 18px; }
.blast-grid { display: grid; padding: 6px; border-radius: 18px; background: rgba(10, 10, 40, .55); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .08); }
.bc { aspect-ratio: 1; margin: 1px; border-radius: 22%; background: rgba(255, 255, 255, .05); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); transition: background .12s; }
.bc.full, .bc.ghost, .blk { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22), inset 0 2px 0 rgba(255, 255, 255, .45); }
.bc.ghost { opacity: .45; }
.bc.willclear { filter: brightness(1.35) saturate(1.2); box-shadow: 0 0 10px rgba(255, 255, 255, .6), inset 0 -3px 0 rgba(0, 0, 0, .22); }
.bc.pop { animation: bpop .22s ease-out; }
@keyframes bpop { 0% { transform: scale(.75); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
.bc.clearing { animation: bclear .33s ease-in forwards; }
@keyframes bclear { 0% { filter: brightness(2.2); transform: scale(1.05); } 100% { filter: brightness(2.5); transform: scale(0); opacity: 0; } }
.bc.dim { filter: grayscale(.85) brightness(.6); transition: filter .4s; }
.blast-tray { width: 100%; display: flex; align-items: center; justify-content: space-around; padding: 10px 12px; margin-top: auto; margin-bottom: calc(var(--sb) + 8px); }
.bslot { flex: 1; height: 100%; display: grid; place-items: center; touch-action: none; }
.bpiece { position: relative; }
.bpiece.nofit { opacity: .3; filter: grayscale(.6); }
.blk { position: absolute; border-radius: 22%; }
.blast-fx { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.bpiece.dragging { position: absolute; left: 0; top: 0; filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .45)); }

/* ================= LIGHT GAMES SHARED ================= */
.m-root { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 4px 14px calc(var(--sb) + 12px); gap: 12px; }
.m-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pbtn.dark { background: #fff; color: var(--ink); box-shadow: 0 2px 10px rgba(60, 30, 10, .1), inset 0 0 0 1px var(--line); }
.pbtn.dark.on { background: #FFE3D6; box-shadow: inset 0 0 0 2px var(--accent); }
.m-help { color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; max-width: 340px; }
/* 2048 */
.m-board { position: relative; border-radius: 18px; background: #E7D3BD; box-shadow: 0 10px 30px rgba(120, 70, 20, .18); touch-action: none; }
.m-cell { position: absolute; left: 0; top: 0; border-radius: 12px; background: rgba(255, 255, 255, .38); }
.m-tile { position: absolute; left: 0; top: 0; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; transition: transform .11s ease-in-out; box-shadow: 0 3px 0 rgba(0, 0, 0, .12); overflow: hidden; }
.m-tile.new { animation: popin .18s ease-out; }
.m-tile.pop { animation: mpop .2s ease-out; }
@keyframes mpop { 0% { scale: 1; } 50% { scale: 1.14; } 100% { scale: 1; } }
.m-ic { line-height: 1; opacity: .9; }
.m-num { line-height: 1.05; letter-spacing: -.5px; }
.m-tile.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-tile.face .m-num.badge { position: absolute; right: 5px; bottom: 5px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 8px; padding: 2px 6px; }
/* slide */
.s-board { position: relative; border-radius: 16px; background: #2A1E14; box-shadow: 0 10px 30px rgba(60, 30, 10, .25); overflow: hidden; }
.s-tile { position: absolute; left: 0; top: 0; border-radius: 8px; background-repeat: no-repeat; transition: transform .14s ease; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); cursor: pointer; }
.s-tile span { position: absolute; left: 5px; top: 3px; color: #fff; font-weight: 900; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); opacity: .85; }
.s-board.solved .s-tile span { opacity: 0; }
.s-peek { position: absolute; inset: 3px; background-size: cover; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 2; }
.s-peek.show { opacity: 1; }
.s-pics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.s-pic { aspect-ratio: 1; border-radius: 12px; background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px var(--line); transition: transform .12s; }
.s-pic.on { box-shadow: 0 0 0 3px var(--accent); transform: scale(.96); }
/* memory */
.mem-board { display: grid; gap: 10px; justify-content: center; margin-top: 4px; }
.mem-card { perspective: 700px; animation: popin .3s backwards; }
.mem-inner { position: relative; width: 100%; height: 100%; transition: transform .35s cubic-bezier(.3, .7, .4, 1.2); transform-style: preserve-3d; }
.mem-card.up .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front { position: absolute; inset: 0; border-radius: 14px; -webkit-backface-visibility: hidden; backface-visibility: hidden; display: grid; place-items: center; overflow: hidden; box-shadow: 0 4px 12px rgba(60, 30, 10, .15); }
.mem-back { background: linear-gradient(135deg, #FF7A45, #FF4F8B); background-image: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .25) 0 8%, transparent 9%), radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .18) 0 10%, transparent 11%), linear-gradient(135deg, #FF7A45, #FF4F8B); }
.mem-back span { font-size: 28px; opacity: .85; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .2)); }
.mem-front { background: #fff; transform: rotateY(180deg); border: 3px solid #fff; }
.mem-front img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.mem-card.matched .mem-front { box-shadow: 0 0 0 3px #34C38F, 0 6px 16px rgba(52, 195, 143, .4); animation: mpop .3s; }
/* tic tac toe */
.ttt-hud .box { display: flex; flex-direction: column; align-items: center; min-width: 92px; border: 2px solid transparent; transition: all .2s; }
.ttt-hud .box img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; margin-bottom: 2px; }
.ttt-hud .box.on { border-color: var(--accent); }
.ttt-status { font-weight: 800; font-size: 17px; min-height: 26px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.st-face { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.ttt-board { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px; border-radius: 24px; background: #F1E1CF; box-shadow: 0 10px 30px rgba(120, 70, 20, .15); }
.ttt-cell { background: #fff; border-radius: 18px; display: grid; place-items: center; box-shadow: 0 3px 0 rgba(120, 70, 20, .12); transition: transform .12s, background .2s; }
.ttt-cell:active { transform: scale(.95); }
.ttt-cell img { width: 72%; height: 72%; border-radius: 50%; object-fit: cover; animation: popin .25s cubic-bezier(.2, 1.5, .4, 1); box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--tc, #FF7A45); }
.ttt-cell.x img { --tc: #FF7A45; }
.ttt-cell.o img { --tc: #4D7CFF; }
.ttt-cell.win { background: #FFF4C2; animation: mpop .4s; }
.ttt-line { display: none; }
/* connect 4 */
.c4-board { position: relative; touch-action: none; filter: drop-shadow(0 12px 20px rgba(30, 60, 160, .3)); }
.c4-holes { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.c4-discs { position: absolute; inset: 0; z-index: 1; }
.c4-disc { position: absolute; border-radius: 50%; overflow: hidden; }
.c4-disc img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.c4-disc.p1 { box-shadow: inset 0 0 0 5px #FF5A4E; background: #FF5A4E; }
.c4-disc.p2 { box-shadow: inset 0 0 0 5px #FFC531; background: #FFC531; }
.c4-disc img { border: 4px solid; box-sizing: border-box; }
.c4-disc.p1 img { border-color: #FF5A4E; }
.c4-disc.p2 img { border-color: #FFC531; }
.c4-disc.win { animation: c4win .6s ease-in-out infinite alternate; z-index: 3; }
@keyframes c4win { to { filter: brightness(1.3); box-shadow: 0 0 18px 6px rgba(255, 255, 255, .9); } }
.c4-disc.dim { opacity: .45; }
.c4-col-hl { position: absolute; top: 8px; bottom: 8px; left: 0; border-radius: 12px; background: rgba(255, 255, 255, .25); opacity: 0; transition: opacity .2s; z-index: 3; pointer-events: none; }
.c4-col-hl.show { opacity: 1; }
/* checkers */
.ck-board { position: relative; display: grid; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 8px #6B3E1E, 0 0 0 10px #4A2810, 0 16px 30px rgba(60, 30, 10, .35); touch-action: none; margin-top: 8px; }
.ck-sq.light { background: #F3DDBB; }
.ck-sq.dark { background: #A9713F; }
.ck-sq.movable { box-shadow: inset 0 0 0 3px rgba(255, 230, 120, .8); }
.ck-sq.target { background: #7FB069; box-shadow: inset 0 0 0 3px #CFF5B8; }
.ck-pieces { position: absolute; inset: 0; pointer-events: none; }
.ck-pc { position: absolute; left: 0; top: 0; border-radius: 50%; display: grid; place-items: center; transition: transform .18s; }
.ck-pc.p1 { background: radial-gradient(circle at 35% 30%, #FFFFFF, #ECE6DA 55%, #C9C0AE); box-shadow: 0 4px 0 #A79C88, 0 6px 10px rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(0, 0, 0, .06); }
.ck-pc.p2 { background: radial-gradient(circle at 35% 30%, #5A5E66, #2B2E35 60%, #15171B); box-shadow: 0 4px 0 #000, 0 6px 10px rgba(0, 0, 0, .4), inset 0 0 0 4px rgba(255, 255, 255, .06); }
.ck-pc .paw { opacity: .35; filter: grayscale(1); }
.ck-pc.p2 .paw { filter: grayscale(1) invert(1); opacity: .3; }
.ck-pc.sel { outline: 3px solid #FFD43B; outline-offset: 2px; }
.ck-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.ck-dot.p1 { background: #ECE6DA; box-shadow: inset 0 0 0 2px #A79C88; }
.ck-dot.p2 { background: #2B2E35; }
/* minesweeper */
.ms-board { display: grid; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 26px rgba(60, 90, 20, .25); touch-action: manipulation; }
.ms-c { display: grid; place-items: center; font-weight: 900; line-height: 1; }
.ms-c.a { background: #A9D751; }
.ms-c.b { background: #A2D149; }
.ms-c.open { animation: msopen .2s backwards; }
.ms-c.open.a { background: #E5C29F; }
.ms-c.open.b { background: #D7B899; }
@keyframes msopen { from { filter: brightness(1.3); transform: scale(.85); } }
.ms-c.boom { background: #E8414A !important; }
.ms-c.mine { animation: popin .2s; }
.ms-board.shake { animation: shake .4s; }
.shake.m-board { animation: shake .3s; }
