/* FunVerse - solo games (memcards g2048 snake minesweeper simon whack slide15 mathsprint reaction quizsolo) */
.sg { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 390px; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.sg-hud { display: flex; gap: 8px; }
.sg-stat { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.sg-k { font-size: 11.5px; color: var(--sub); line-height: 1.4; }
.sg-v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.4; }
.sg-body { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.sg-hint { font-size: 12.5px; min-height: 20px; }
.sg button { touch-action: manipulation; }
/* boards are index-ordered left-to-right: keep them LTR inside the RTL page so swipes match */
.g48-board, .s15-board, .ms-board, .sn-pad, .g-mathsprint .ms-pad, .mc-grid, .sm-grid, .wh-grid { direction: ltr; }

/* ---------- memcards ---------- */
.mc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.mc-card { aspect-ratio: 1; padding: 0; border: 0; background: none; perspective: 600px; min-height: 40px; }
.mc-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .38s cubic-bezier(.3, .7, .3, 1); }
.mc-card.open .mc-in { transform: rotateY(180deg); }
.mc-f { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 14px; border: 1px solid var(--line); backface-visibility: hidden; -webkit-backface-visibility: hidden; font-weight: 800; }
.mc-back { background: var(--panel-2); color: var(--accent); font-size: 26px; box-shadow: inset 0 0 0 3px var(--panel); }
.mc-front { background: var(--panel); transform: rotateY(180deg); font-size: 34px; text-shadow: 0 0 1px rgba(0, 0, 0, .55); }
.mc-card.done .mc-front { border-color: var(--good); box-shadow: 0 0 0 2px var(--good); }
.mc-card.done .mc-in { animation: mc-pop .35s ease; }
@keyframes mc-pop { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }

/* ---------- 2048 ---------- */
.g48-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; aspect-ratio: 1; width: 100%; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); touch-action: none; }
.g48-board .t { display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; color: #1b1b1b; min-width: 0; overflow: hidden; }
.g48-board .t.d3 { font-size: 24px; }
.g48-board .t.d4 { font-size: 20px; }
.g48-board .t.v2 { background: #eee4da; }
.g48-board .t.v4 { background: #ede0c8; }
.g48-board .t.v8 { background: #f2b179; }
.g48-board .t.v16 { background: #f59563; }
.g48-board .t.v32 { background: #f67c5f; color: #fff; }
.g48-board .t.v64 { background: #ee5a3c; color: #fff; }
.g48-board .t.v128 { background: #edcf72; }
.g48-board .t.v256 { background: #edcc61; }
.g48-board .t.v512 { background: #e8c03f; }
.g48-board .t.v1024 { background: #5eb8e8; }
.g48-board .t.v2048 { background: #3b82f6; color: #fff; box-shadow: 0 0 14px #3b82f6aa; }
.g48-board .t.v4096 { background: #7c3aed; color: #fff; }
.g48-board .t.pop0 { animation: g48-pop0 .18s ease-out; }
.g48-board .t.pop1 { animation: g48-pop1 .18s ease-out; }
@keyframes g48-pop0 { from { scale: .4; opacity: .3; } to { scale: 1; opacity: 1; } }
@keyframes g48-pop1 { from { scale: .4; opacity: .3; } to { scale: 1; opacity: 1; } }

/* ---------- snake ---------- */
.sn-cv { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius); border: 2px solid var(--line); background: var(--panel-2); touch-action: none; image-rendering: pixelated; }
.sn-pad { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-areas: '. u .' 'l d r'; gap: 8px; max-width: 240px; width: 100%; margin: 0 auto; }
.sn-btn { min-height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 20px; font-weight: 800; touch-action: none; }
.sn-btn:active { background: var(--accent); color: var(--accent-ink); }
.sn-btn.u { grid-area: u; } .sn-btn.l { grid-area: l; } .sn-btn.d { grid-area: d; } .sn-btn.r { grid-area: r; }

/* ---------- minesweeper ---------- */
.ms-board { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; padding: 4px; width: 100%; aspect-ratio: 1; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); touch-action: manipulation; }
.ms-c { display: flex; align-items: center; justify-content: center; min-width: 0; border-radius: 7px; font-weight: 800; font-size: 18px; line-height: 1; background: var(--panel); border: 1px solid var(--line); box-shadow: inset 0 -3px 0 var(--line); cursor: pointer; }
.ms-c.open { background: var(--panel-2); box-shadow: none; border-color: transparent; cursor: default; }
.ms-c.flag { color: var(--warn); }
.ms-c.mine { color: var(--bad); background: color-mix(in srgb, var(--bad) 22%, var(--panel-2)); }
.ms-c.boom { background: var(--bad); color: var(--bg2); }
.ms-c.wrong { color: var(--bad); text-decoration: line-through; }
.ms-c.n1 { color: #3b82f6; } .ms-c.n2 { color: #16a34a; } .ms-c.n3 { color: #ef4444; } .ms-c.n4 { color: #8b5cf6; }
.ms-c.n5 { color: #f97316; } .ms-c.n6 { color: #06b6d4; } .ms-c.n7 { color: #ec4899; } .ms-c.n8 { color: var(--sub); }
html[data-theme='light'] .ms-c.n3 { color: #b91c1c; }
.ms-flag.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ---------- simon ---------- */
.sm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 358px; aspect-ratio: 1; margin: 0 auto; padding: 10px; border-radius: 50%; background: var(--panel-2); border: 2px solid var(--line); transition: box-shadow .2s; }
.sm-pad { border: 0; min-height: 40px; opacity: .5; filter: saturate(.8); transition: opacity .08s, filter .08s, transform .08s; touch-action: manipulation; }
.sm-pad.p0 { background: #16a34a; border-radius: 100% 14px 14px 14px; }
.sm-pad.p1 { background: #e5484d; border-radius: 14px 100% 14px 14px; }
.sm-pad.p2 { background: #eab308; border-radius: 14px 14px 14px 100%; }
.sm-pad.p3 { background: #3b82f6; border-radius: 14px 14px 100% 14px; }
.sm-pad.lit, .sm-pad:active { opacity: 1; filter: brightness(1.35) saturate(1.2); box-shadow: 0 0 26px currentColor, 0 0 0 3px #fff8 inset; transform: scale(.97); }
.sm-pad.p0 { color: #16a34a; } .sm-pad.p1 { color: #e5484d; } .sm-pad.p2 { color: #eab308; } .sm-pad.p3 { color: #3b82f6; }
.sm-grid.wrong { box-shadow: 0 0 0 3px var(--bad), 0 0 24px var(--bad); animation: sm-shake .4s; }
@keyframes sm-shake { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }

/* ---------- whack ---------- */
.wh-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.wh-hole { position: relative; aspect-ratio: 1; min-height: 40px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: radial-gradient(ellipse at 50% 70%, #000a 0 40%, var(--panel-2) 72%); overflow: hidden; touch-action: manipulation; transition: background .12s, border-color .12s; }
.wh-t { position: absolute; left: 14%; right: 14%; bottom: -60%; height: 70%; display: flex; align-items: center; justify-content: center; border-radius: 50% 50% 0 0; font-weight: 800; font-size: 15px; transition: bottom .1s ease-out; }
.wh-hole.up .wh-t { bottom: 6%; }
.wh-hole.mole .wh-t { background: #a16207; color: #fff; }
.wh-hole.bomb .wh-t { background: #1f2937; color: #fca5a5; border: 2px solid var(--bad); }
.wh-hole.hit { border-color: var(--good); background: color-mix(in srgb, var(--good) 35%, var(--panel-2)); }
.wh-hole.boom { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 45%, var(--panel-2)); }

/* ---------- slide15 ---------- */
.s15-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px; width: 100%; aspect-ratio: 1; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); touch-action: none; }
.s15-c { display: flex; align-items: center; justify-content: center; min-width: 0; border-radius: 12px; font-size: 26px; font-weight: 800; background: var(--panel); border: 1px solid var(--line); box-shadow: inset 0 -3px 0 var(--line); cursor: pointer; transition: background .15s, color .15s; }
.s15-c.ok { background: color-mix(in srgb, var(--good) 25%, var(--panel)); border-color: var(--good); color: var(--good); }
.s15-c.blank { background: transparent; border-color: transparent; box-shadow: none; cursor: default; }

/* ---------- mathsprint ---------- */
.g-mathsprint .ms-q { text-align: center; font-size: 34px; font-weight: 800; direction: ltr; unicode-bidi: isolate; padding: 18px 12px; font-variant-numeric: tabular-nums; }
.g-mathsprint .ms-a { text-align: center; min-height: 64px; display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 800; border-radius: 16px; background: var(--panel-2); border: 2px solid var(--line); color: var(--accent); transition: background .15s, border-color .15s; }
.g-mathsprint .ms-a.good { border-color: var(--good); color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--panel-2)); }
.g-mathsprint .ms-a.bad { border-color: var(--bad); color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--panel-2)); animation: sm-shake .22s; }
.g-mathsprint .ms-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.g-mathsprint .ms-k { min-height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 24px; font-weight: 800; touch-action: manipulation; }
.g-mathsprint .ms-k.alt { background: var(--panel-2); color: var(--accent); }
.g-mathsprint .ms-k:active { background: var(--accent); color: var(--accent-ink); }

/* ---------- reaction ---------- */
.rx-screen { min-height: 260px; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 20px; border: 2px solid var(--line); background: var(--panel); touch-action: manipulation; transition: background .1s; outline: none; }
.rx-big { font-size: 30px; font-weight: 800; }
.rx-sub { font-size: 14px; color: var(--sub); min-height: 22px; }
.rx-screen.ready { border-color: var(--accent); box-shadow: var(--glow); }
.rx-screen.wait { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.rx-screen.go { background: #16a34a; border-color: #16a34a; color: #fff; }
.rx-screen.early { background: #b45309; border-color: #b45309; color: #fff; }
.rx-screen.wait .rx-sub, .rx-screen.go .rx-sub, .rx-screen.early .rx-sub { color: #ffffffd9; }
.rx-screen.result { background: var(--panel-2); border-color: var(--accent); }
.rx-chips { flex-wrap: wrap; min-height: 34px; }
.rx-chips .chip { min-height: 34px; display: inline-flex; align-items: center; padding: 0 12px; }

/* ---------- quizsolo ---------- */
.qz-bar { height: 8px; border-radius: 4px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); }
.qz-bar i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 4px; transition: width .1s linear; }
.qz-q { min-height: 96px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 18px; font-weight: 700; line-height: 1.9; }
.qz-opts { display: flex; flex-direction: column; gap: 8px; }
.qz-o { min-height: 52px; width: 100%; padding: 8px 14px; text-align: center; line-height: 1.6; }
.qz-o.good { background: var(--good); color: var(--bg2); border-color: transparent; }
.qz-o.bad { background: var(--bad); color: var(--bg2); border-color: transparent; animation: sm-shake .3s; }
