/* SHITMATE Chess — arcade look shared with the Tom Pearl Games hub (Bungee + Chakra Petch), each boss brings its stage colours. */
@font-face { font-family: 'TPA Display'; src: url('/TomGames/fonts/Bungee-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'TPA HUD'; src: url('/TomGames/fonts/ChakraPetch-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'TPA HUD'; src: url('/TomGames/fonts/ChakraPetch-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root { --ink: #15110d; --gold: #ffd25b; --pink: #ff4fb8; --text: #fbf3ff; --muted: #c3b1dd; --panel: #1a0f2e; --line: rgba(196,150,255,.22); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0a0614; color: var(--text); font: 600 15px/1.35 'TPA HUD', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { --stage-a: #7a4ac8; --stage-b: #1c0b33; --sq-l: #f1e7ff; --sq-d: #8a6ab8; position: fixed; inset: 0; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--stage-a) 55%, #0a0614), var(--stage-b) 70%, #05030a); }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom)); overflow-y: auto; }
.screen.is-on { display: flex; }
h2, h3, .logo, .btn, .banner { font-family: 'TPA Display', Impact, sans-serif; letter-spacing: .02em; font-weight: 400; }
h3 { margin: 18px 0 8px; font-size: 15px; color: var(--gold); align-self: flex-start; width: min(760px, 100%); margin-inline: auto; }
.sub { color: var(--muted); text-align: center; margin: 4px 0 12px; max-width: 520px; }

/* Buttons */
.btn { --c: var(--gold); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 2px solid var(--c); border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 26%, #2a1838), #170d24 85%); color: #fff6e0; font-size: 15px; text-decoration: none;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 42%, #0a0612), 0 0 18px color-mix(in srgb, var(--c) 25%, transparent), inset 0 1px 0 #ffffff30; transition: transform .1s, box-shadow .1s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 42%, #0a0612); }
.btn.big { --c: var(--pink); min-height: 60px; font-size: 24px; padding: 0 34px; }
.btn.sm { min-height: 36px; font-size: 12px; padding: 0 12px; }
.btn:focus-visible, .round:focus-visible, .rung:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.round { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: #1a0f2e; font-size: 17px; }
.round.off { opacity: .45; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }

/* Menu */
#menu { justify-content: center; gap: 14px; }
.back-hub { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; color: var(--muted); text-decoration: none; font: 13px 'TPA Display', Impact, sans-serif; }
.logo { text-align: center; line-height: .9; filter: drop-shadow(0 6px 0 #0008); }
.logo-shit { display: block; font-size: clamp(48px, 13vw, 108px); color: #8a4b1c; -webkit-text-stroke: 3px #2a1206; text-shadow: 0 0 30px #ff9a2a55; }
.logo-shit span { color: var(--gold); -webkit-text-stroke-color: #4a2a00; }
.logo small { display: block; font-size: clamp(22px, 6vw, 44px); letter-spacing: .5em; margin-right: -.5em; color: #fff; }
.tag { margin: 0; color: var(--muted); font-size: 16px; }
.menu-cast { display: flex; justify-content: center; flex-wrap: wrap; max-width: 640px; gap: 0; margin: 6px 0; }
.menu-cast .pc-face { width: 54px; margin: 0 -6px; animation: bob 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.22s); filter: drop-shadow(0 3px 2px #0009); }
.menu-cast .pc-face.beaten { filter: grayscale(1) brightness(.7) drop-shadow(0 3px 2px #0009); }
.menu-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.menu-btns .row .btn { min-width: 168px; }
@keyframes bob { 50% { transform: translateY(-5px); } }

/* Bars */
.bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: min(760px, 100%); gap: 8px; margin-bottom: 8px; }
.bar h2 { margin: 0; font-size: 22px; text-align: center; }
.bar > :last-child { justify-self: end; }
.stars-total { color: var(--gold); font-family: 'TPA Display', Impact, sans-serif; }

/* Ladder */
.ladder { list-style: none; margin: 0; padding: 0 0 20px; width: min(760px, 100%); display: flex; flex-direction: column; gap: 10px; }
.rung { --c: #7a4ac8; display: grid; grid-template-columns: 30px 66px 1fr auto auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; cursor: pointer;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 45%, #170d24), #170d24 75%); border: 2px solid color-mix(in srgb, var(--c) 70%, #000); box-shadow: 0 4px 0 #0007; }
.rung.final { border-color: var(--gold); box-shadow: 0 0 24px #ffd25b44, 0 4px 0 #0007; }
.rung .no { font: 22px 'TPA Display', Impact, sans-serif; color: #fff8; text-align: center; }
.rung .pic { width: 66px; height: 66px; border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--c) 40%, #000); display: grid; place-items: end center; }
.rung .pic .pc-face { width: 66px; }
.rung .txt { display: flex; flex-direction: column; min-width: 0; }
.rung .txt b { font: 17px 'TPA Display', Impact, sans-serif; }
.rung .txt small { color: var(--gold); }
.rung .txt em { color: var(--muted); font-style: normal; font-size: 12px; }
.rung.locked { cursor: default; filter: grayscale(.85) brightness(.6); }
.rung.locked .pc-face { filter: brightness(0); }
.rung .lock { font-size: 22px; }
.rung.won .pic { box-shadow: 0 0 0 3px var(--gold); }
.st { display: flex; gap: 2px; }
.star { width: 18px; height: 18px; display: inline-block; background: #ffffff22; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.star.on { background: var(--gold); }
@media (max-width: 520px) {
  .rung { grid-template-columns: 52px 1fr auto; grid-template-areas: 'pic txt btn' 'pic st btn'; row-gap: 2px; }
  .rung .no { display: none; }
  .rung .pic { grid-area: pic; width: 52px; height: 52px; } .rung .pic .pc-face { width: 52px; }
  .rung .txt { grid-area: txt; } .rung .st { grid-area: st; } .rung > .btn, .rung .lock { grid-area: btn; }
}

/* Game layout */
#game { --bs: min(94vw, calc(100dvh - 210px), 720px); justify-content: center; gap: 6px; overflow: hidden; }
.side { width: var(--bs); display: flex; align-items: center; gap: 8px; min-height: 58px; position: relative; }
.side.bottom { flex-wrap: nowrap; }
.who { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }
.who b { display: block; font: 14px 'TPA Display', Impact, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }
.avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--stage-a) 60%, #000); border: 2px solid #fff3; display: grid; place-items: end center; }
.avatar .pc-face { width: 54px; }
#foe.thinking .avatar { animation: think 1s ease-in-out infinite; }
#foe.napping .avatar::after { content: 'Zzz'; position: absolute; left: 40px; top: -6px; font: 16px 'TPA Display', Impact, sans-serif; color: #cfe6ff; animation: zz 1.2s ease-out infinite; }
@keyframes think { 50% { box-shadow: 0 0 0 4px var(--gold); } }
@keyframes zz { from { transform: translateY(6px); opacity: 0; } 40% { opacity: 1; } to { transform: translateY(-10px); opacity: 0; } }
.bubble { position: absolute; left: 58px; bottom: calc(100% + 6px); z-index: 20; max-width: min(320px, 70vw); padding: 8px 12px; border-radius: 12px; background: #fff; color: var(--ink); font-weight: 700; font-size: 14px;
  box-shadow: 0 5px 0 #0006; opacity: 0; transform: translateY(-6px) scale(.9); transition: .18s; pointer-events: none; }
.bubble::before { content: ''; position: absolute; left: 14px; bottom: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: #fff; }
.bubble.on { opacity: 1; transform: none; }

/* Toilets (captured pieces) */
.pot { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; justify-content: flex-end; }
.pot .bowl { width: 34px; height: 30px; flex: none; order: 2; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 36'%3E%3Crect x='6' y='0' width='22' height='12' rx='3' fill='%23f4f4f0' stroke='%2315110d' stroke-width='2'/%3E%3Cpath d='M2 14h36q0 12-12 16v5H14v-5Q2 26 2 14z' fill='%23fff' stroke='%2315110d' stroke-width='2'/%3E%3Cellipse cx='20' cy='16' rx='13' ry='3.5' fill='%237a5a3a'/%3E%3C/svg%3E"); }
.pot.gulp .bowl { animation: gulp .5s; }
@keyframes gulp { 30% { transform: scale(1.3) rotate(-8deg); } 60% { transform: scale(.9) rotate(5deg); } }
.pot .pile { display: flex; flex-direction: row-reverse; order: 1; min-width: 0; overflow: hidden; }
.pot .pc.mini { width: 24px; height: 24px; margin-left: -9px; flex: none; }
.pot .adv { order: 0; color: var(--gold); font: 13px 'TPA Display', Impact, sans-serif; }
.tools { display: flex; gap: 6px; flex: none; }
.tools [hidden] { display: none; }

/* Board */
.board-wrap { position: relative; width: var(--bs); height: var(--bs); flex: none; }
.board { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); border-radius: 8px; overflow: hidden; touch-action: none; user-select: none;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--stage-a) 50%, #1a0f2e), 0 0 0 8px #0008, 0 18px 40px #000a; }
.sq { position: relative; background: var(--sq-d); }
.sq.l { background: var(--sq-l); }
.sq .rk, .sq .fl { position: absolute; font: 700 clamp(8px, 1.6vw, 12px)/1 'TPA HUD', sans-serif; color: #0007; pointer-events: none; z-index: 1; }
.sq .rk { left: 3px; top: 3px; } .sq .fl { right: 3px; bottom: 2px; }
.sq.last { box-shadow: inset 0 0 0 999px #ffd25b55; }
.sq.sel { box-shadow: inset 0 0 0 999px #ffd25b99; }
.sq.check { background: radial-gradient(circle, #ff2a2a 0, #ff2a2acc 35%, transparent 75%), var(--sq-d); }
.sq.l.check { background: radial-gradient(circle, #ff2a2a 0, #ff2a2acc 35%, transparent 75%), var(--sq-l); }
.sq.danger::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 4px #ff3b3bcc; border-radius: 3px; animation: pulse 1.2s ease-in-out infinite; z-index: 3; pointer-events: none; }
.sq.dot::after { content: ''; position: absolute; left: 35%; top: 35%; width: 30%; height: 30%; border-radius: 50%; background: #1a0f2e66; z-index: 4; pointer-events: none; }
.sq.cap::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; box-shadow: inset 0 0 0 5px #1a0f2e77; z-index: 4; pointer-events: none; }
.sq.risky.dot::after { background: #ff3b3bb0; }
.sq.risky.cap::after { box-shadow: inset 0 0 0 5px #ff3b3bcc; }
.sq.special.dot::after { background: #2ec4ffcc; box-shadow: 0 0 10px #2ec4ff; }
.sq.annexed { box-shadow: inset 0 0 0 999px #c4122f66; }
@keyframes pulse { 50% { opacity: .35; } }

/* Pieces */
.pc { position: absolute; inset: 3%; z-index: 2; pointer-events: none; filter: drop-shadow(0 3px 1.5px #0008); }
.pc svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pc .pc-hat { z-index: 3; }
.pc-shine { position: absolute; inset: 0; pointer-events: none; }
.pc-face { position: relative; display: block; aspect-ratio: 224 / 280; background-repeat: no-repeat; pointer-events: none; }
.pc > .pc-face { position: absolute; left: 26%; top: 8%; width: 48%; z-index: 2; }
.pc > .pc-face.small { left: 30%; top: 25%; width: 40%; }
.pc.t2 > .pc-face { left: 34%; top: 14%; width: 44%; }
.pc.t3 > .pc-face { top: 12%; }
.pc.emb .pc-emblem { z-index: 2; transform: scale(.92); transform-origin: 50% 90%; }
.pc.dragging { z-index: 30; transition: none; filter: drop-shadow(0 10px 6px #0009); }
.pc .xbadge { position: absolute; right: 2%; top: 4%; z-index: 4; font: 900 clamp(10px, 2vw, 16px)/1 Arial, sans-serif; color: #fff; background: #000; border-radius: 4px; padding: 1px 3px; }
.pc.flushing { animation: flush 1.1s cubic-bezier(.5,0,.8,.4) forwards; z-index: 40; }
@keyframes flush { 0% { transform: none; } 30% { transform: rotate(140deg) scale(1.15); } 100% { transform: rotate(1080deg) scale(0); opacity: 0; } }
.pc.mud { animation: mud 1.8s ease-in forwards; }
@keyframes mud { to { transform: translateY(30%) scaleY(.6); filter: sepia(1) brightness(.5); } }
.pc-face.flushed { filter: drop-shadow(0 4px 2px #0009) saturate(.7); transform: rotate(-12deg); }

/* Arrows */
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.arrows line { stroke-width: 15; stroke-linecap: round; opacity: .82; }
.arrows line.threat { stroke: #ff3b3b; } .arrows marker.threat path { fill: #ff3b3b; }
.arrows line.hint { stroke: #3ddc84; } .arrows marker.hint path { fill: #3ddc84; }
.arrows line.mate { stroke: #ff2a7a; } .arrows marker.mate path { fill: #ff2a7a; }
.arrows line.cover { stroke: #ffd25b; stroke-width: 10; stroke-dasharray: 18 12; } .arrows marker.cover path { fill: #ffd25b; }

/* Banner + boss FX */
.banner { position: absolute; left: 50%; top: 50%; z-index: 30; transform: translate(-50%, -50%) scale(.4); opacity: 0; pointer-events: none; white-space: nowrap;
  font-size: clamp(34px, 9vw, 76px); color: #fff; -webkit-text-stroke: 3px var(--ink); text-shadow: 0 6px 0 #0009; }
.banner.on { animation: bannerIn 1.1s ease-out forwards; }
.banner.check { color: #ff4f4f; } .banner.mate { color: var(--gold); } .banner.bad { color: #ff4f4f; }
@keyframes bannerIn { 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
.puff, .censor { position: absolute; inset: 0; display: grid; place-items: center; z-index: 8; pointer-events: none; font: clamp(8px, 1.8vw, 13px) 'TPA Display', Impact, sans-serif; text-align: center; line-height: 1; }
.puff { color: #fff; -webkit-text-stroke: 1px var(--ink); animation: puff 1.3s ease-out forwards; }
@keyframes puff { from { transform: scale(.5); opacity: 0; } 20% { transform: scale(1.15); opacity: 1; } to { transform: translateY(-60%); opacity: 0; } }
.censor { background: #000; color: #fff; animation: censor 1.3s steps(1) forwards; }
@keyframes censor { 85% { opacity: 1; } to { opacity: 0; } }
.dome { position: absolute; inset: -30%; z-index: 9; pointer-events: none; border-radius: 50% 50% 8% 8%; border: 4px solid #8fd3ff; background: radial-gradient(circle at 50% 70%, #8fd3ff33, #8fd3ff11 70%); animation: domeIn .4s ease-out; }
.dome.lid { border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%; border-color: #fff; background: #fffffff2; box-shadow: inset 0 -6px 0 #d6d6d0, 0 4px 0 #0006; transform: rotateX(55deg) translateY(-20%); transition: .5s; }
@keyframes domeIn { from { transform: scale(.2); opacity: 0; } }
.fx { position: absolute; inset: 0; z-index: 35; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: none; text-align: center; overflow: hidden; border-radius: 8px; }
.fx b { font: clamp(24px, 6.5vw, 52px)/1 'TPA Display', Impact, sans-serif; color: #fff; -webkit-text-stroke: 2px var(--ink); text-shadow: 0 5px 0 #0009; padding: 0 10px; animation: fxIn .4s ease-out; }
.fx span { font-weight: 700; font-size: clamp(13px, 2.6vw, 18px); background: #000c; padding: 4px 10px; border-radius: 6px; }
@keyframes fxIn { from { transform: scale(.3); opacity: 0; } }
.fx.rigged b { color: #ff4f4f; animation: shake .25s 6; }
@keyframes shake { 25% { transform: translateX(-6px) rotate(-2deg); } 75% { transform: translateX(6px) rotate(2deg); } }
.fx.raid { background: #00000088; } .fx.raid b { color: #4fa3ff; } .fx.raid .count { font: 44px 'TPA Display', Impact, sans-serif; background: none; color: var(--gold); }
.fx .bottle { position: absolute; top: -60px; width: 26px; height: 46px; border-radius: 6px 6px 8px 8px; background: linear-gradient(#f2f2f2 0 18%, #f7d77a 18% 40%, #fff 40% 70%, #f7d77a 70%); border: 2px solid var(--ink); animation: fall 1.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(calc(var(--bs) + 120px)) rotate(400deg); } }
.fx.boom { background: radial-gradient(circle, #fff 0, #ffb02a 25%, #ff4a1a 45%, transparent 70%); animation: boom 2s ease-out forwards; }
@keyframes boom { from { background-size: 10% 10%; } 15% { background-size: 140% 140%; } to { background-size: 140% 140%; opacity: .15; } }
.fx.censored { background: #000; animation: censorFx 2.2s steps(1); } .fx.censored b { font-size: clamp(16px, 4vw, 30px); -webkit-text-stroke: 0; }
@keyframes censorFx { 0% { opacity: 1; } }
.fx.camera { background: #000; animation: cam 2.8s steps(1); }
.fx.camera span { background: none; color: #f33; font-family: monospace; position: absolute; top: 10px; left: 12px; animation: blink .5s steps(1) infinite; }
@keyframes cam { 0% { opacity: 1; } 8% { opacity: .1; } 14% { opacity: 1; } 22% { opacity: .2; } 30% { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
.fx.caption { background: #0006; }

/* Coach line */
.coach { width: var(--bs); min-height: 40px; margin: 0; display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; font-size: 14px; color: var(--text); }
.coach.warn { color: #ff8a8a; } .coach.good { color: #7dffb0; } .coach.special { color: #8fdcff; }
.coach.demo { justify-content: flex-start; text-align: left; background: #0008; border-radius: 10px; padding: 6px 10px; }
.mini-board { flex: none; display: grid; grid-template: repeat(7, 11px) / repeat(7, 11px); border-radius: 3px; overflow: hidden; }
.mini-board i { position: relative; background: var(--sq-d); }
.mini-board i.l { background: var(--sq-l); }
.mini-board i.hd, .mini-board i.hx { animation: lit 1.6s ease-in-out infinite both; }
.mini-board i.hd { box-shadow: inset 0 0 0 99px #3ddc84cc; } .mini-board i.hx { box-shadow: inset 0 0 0 99px #ff4fb8cc; }
.mini-board .pc { inset: -40%; filter: none; }
@keyframes lit { 0%, 15% { opacity: .15; } 40%, 100% { opacity: 1; } }

/* Modals */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: #05030acc; }
.modal[hidden] { display: none; }
.card { width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 18px 18px 16px; border-radius: 16px; background: linear-gradient(180deg, #2a1846, #150c26); border: 2px solid var(--line); box-shadow: 0 20px 60px #000c; text-align: center; }
.card h2 { margin: 0 0 12px; font-size: 24px; }
.card p { text-align: left; color: var(--muted); } .card p b { color: var(--text); }
.seg { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.seg legend { color: var(--gold); margin-bottom: 6px; font-family: 'TPA Display', Impact, sans-serif; }
.seg label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--gold); background: #ffd25b14; }
.seg small { display: block; color: var(--muted); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; margin: 8px 0; text-align: left; cursor: pointer; }
input[type=radio], input[type=checkbox] { accent-color: var(--gold); width: 18px; height: 18px; margin-top: 2px; }
.promo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.promo-pick { position: relative; aspect-ratio: .8; border-radius: 12px; border: 2px solid var(--line); background: #ffffff10; padding: 0; }
.promo-pick .pc { inset: 6% 8% 26%; }
.promo-pick span { position: absolute; bottom: 6px; left: 0; right: 0; font-size: 12px; text-transform: uppercase; }
.promo-pick:hover, .promo-pick:focus-visible { border-color: var(--gold); }
.card.end { width: min(520px, 100%); }
.end-art { width: 110px; height: 110px; margin: 0 auto -6px; display: grid; place-items: end center; }
.end-art .pc-face { width: 100px; position: relative; }
.end-art .pc-face.gloat { animation: bob 1.4s ease-in-out infinite; }
.end-why { text-align: center !important; color: var(--text) !important; }
.end-line { text-align: center !important; font-style: italic; color: var(--gold) !important; }
.end-stars { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.end-stars .star { width: 38px; height: 38px; animation: starIn .4s ease-out both; }
.end-stars small { flex-basis: 100%; color: var(--muted); }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } }
.end-review { color: var(--pink); margin-bottom: 10px; font-weight: 700; }
.end-review:empty { display: none; }
.card .row + .row { margin-top: 10px; }
.btn[hidden] { display: none; }

/* Wall of shame */
.shame-grid { width: min(860px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding-bottom: 20px; }
.shame-card { --c: #7a4ac8; margin: 0; position: relative; aspect-ratio: .72; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, #000), #0a0614); border: 3px solid #fff2; box-shadow: 0 5px 0 #0008; }
.shame-card > .pc-face { position: absolute; top: 6%; width: 72%; left: 14%; }
.shame-card figcaption { position: relative; width: 100%; padding: 8px; background: #000b; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.shame-card figcaption b { font: 13px 'TPA Display', Impact, sans-serif; } .shame-card figcaption span { font-size: 12px; } .shame-card figcaption small { color: var(--muted); font-size: 10px; }
.shame-card.rare { border-color: var(--gold); box-shadow: 0 0 20px #ffd25b66, 0 5px 0 #0008; }
.shame-card.rare::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, #ffffff40 45%, transparent 60%); background-size: 250% 100%; animation: holo 3s linear infinite; pointer-events: none; }
@keyframes holo { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.shame-card.empty { filter: grayscale(1); opacity: .55; }
.shame-card .q { position: absolute; top: 25%; font: 60px 'TPA Display', Impact, sans-serif; color: #fff3; }

/* Locker */
.locker-grid { width: min(760px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 76px 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: #ffffff0c; }
.item .pc { inset: 6px auto auto 50%; width: 64px; height: 64px; transform: translateX(-80%); }
.item .pc.t1 { transform: translateX(-5%) scale(.8); transform-origin: bottom; }
.item.on { border-color: var(--gold); background: #ffd25b18; }
.item.locked { opacity: .55; cursor: default; }
.item.locked .pc { filter: brightness(.2); }
.item small { color: var(--muted); font-size: 11px; }
.swatch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 60px; height: 60px; border-radius: 6px; background: conic-gradient(var(--d) 0 25%, var(--l) 0 50%, var(--d) 0 75%, var(--l) 0) 0 0 / 30px 30px; box-shadow: 0 0 0 3px #0006; }

/* Toasts */
.toasts { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { padding: 8px 14px; border-radius: 10px; background: #2a1846; border: 2px solid var(--gold); transition: .4s; }
.toast.out { opacity: 0; transform: translateY(-10px); }

/* Wider screens: boss bar and Tom bar beside the board. */
@media (min-aspect-ratio: 4/3) and (min-width: 900px) {
  #game { --bs: min(calc(100dvh - 90px), 760px); display: none; flex-direction: row; flex-wrap: wrap; align-content: center; justify-content: center; column-gap: 18px; }
  #game.is-on { display: grid; grid-template-columns: 260px var(--bs) 260px; grid-template-rows: auto var(--bs) auto; grid-template-areas: 'foe board .' 'foe board me' '. coach .'; align-items: start; }
  #foe { grid-area: foe; } #me { grid-area: me; align-self: end; } .board-wrap { grid-area: board; } .coach { grid-area: coach; width: auto; }
  .side { width: 260px; flex-direction: column; align-items: flex-start; gap: 12px; }
  .bubble { position: relative; left: 0; top: 0; bottom: auto; max-width: 100%; }
  .bubble::before { left: 18px; top: -8px; bottom: auto; border: 8px solid transparent; border-top: 0; border-bottom-color: #fff; }
  .pot { margin-left: 0; justify-content: flex-start; width: 100%; flex-wrap: wrap; }
  .pot .pile { flex-wrap: wrap; flex-direction: row; overflow: visible; }
  .pot .pc.mini { width: 30px; height: 30px; margin-left: -6px; }
  .tools { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* real clip words under a boss line */
#foe-bubble .heard{display:block;margin-top:4px;font:600 .78em 'TPA HUD',sans-serif;opacity:.8;font-style:italic}
.credits{font:500 11px/1.4 'TPA HUD',sans-serif;opacity:.6;margin:10px 0 0;text-align:left}
/* dark (CPU) army: light rim so the dark body reads on dark squares too */
.pc.dk { filter: drop-shadow(0 0 1.2px #fff8) drop-shadow(0 3px 1.5px #0009); }
.pc .pc-band { z-index: 1; }

/* ── Tom's commentary ── */
.coach.tom { font-weight: 800; }
.coach.tom-great, .coach.tom-mate { color: #ffd25b; } .coach.tom-good { color: #7dffb0; }
.coach.tom-meh { color: #e6c79a; } .coach.tom-bad { color: #ff9a6a; } .coach.tom-awful, .coach.tom-missed { color: #ff5a5a; font-size: 16px; animation: shake .25s 3; }
#me.react .avatar { animation: tomPop .5s ease-out; }
#me.react-awful .avatar, #me.react-missed .avatar { animation: shake .2s 5; box-shadow: 0 0 0 3px #ff4a4a; }
#me.react-great .avatar, #me.react-mate .avatar { box-shadow: 0 0 0 3px #ffd25b, 0 0 18px #ffd25b; }
@keyframes tomPop { 40% { transform: scale(1.25) rotate(-6deg); } }

/* ── Boss meltdown (data-melt 0-4 on #foe and the board) ── */
#foe-face { position: relative; }
#foe-face .melt { position: absolute; pointer-events: none; opacity: 0; transition: opacity .5s; }
#foe-face .blush { inset: 0; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #ff2a2a00 20%, #ff2a2a88 80%); mix-blend-mode: multiply; }
#foe-face .sweat { width: 7px; height: 10px; background: #8fdcff; border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; box-shadow: inset -1px -2px 0 #4aa8e8; }
#foe-face .s1 { left: 6px; top: 8px; } #foe-face .s2 { right: 7px; top: 14px; animation-delay: .5s; } #foe-face .s3 { left: 22px; top: 2px; animation-delay: 1s; }
#foe-face .tear { width: 5px; top: 26px; height: 0; background: linear-gradient(#9fe2ff, #9fe2ff00); border-radius: 3px; }
#foe-face .t1 { left: 15px; } #foe-face .t2 { right: 15px; }
#foe[data-melt="1"] .sweat.s1, #foe[data-melt="2"] .sweat, #foe[data-melt="3"] .sweat, #foe[data-melt="4"] .sweat { opacity: 1; animation: drip 1.4s ease-in infinite; }
#foe[data-melt="2"] .blush { opacity: .6; } #foe[data-melt="3"] .blush, #foe[data-melt="4"] .blush { opacity: 1; }
#foe[data-melt="3"] .tear, #foe[data-melt="4"] .tear { opacity: 1; animation: tears 1.1s ease-in infinite; }
#foe.wobble .bubble { animation: shake .25s 3; }
@keyframes drip { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }
@keyframes tears { 0% { height: 0; } 100% { height: 26px; opacity: .3; } }
/* No constant shaking (owner 11-19: "too much, unnatural"): the face only sweats / reddens / cries, and his pieces
   shiver once when he gets worse (.shiver, added by meltUI). */
#foe[data-melt="4"] .avatar { filter: saturate(1.25) hue-rotate(-6deg); }
#foe.wobble .avatar { animation: nerv .45s 2; }
.board .pc.b.shiver { animation: nerv .4s 2; }
@keyframes nerv { 25% { translate: -1px 1px; } 50% { translate: 1px 0; rotate: 2deg; } 75% { translate: 0 -1px; rotate: -2deg; } }

/* ── The boss gets flushed on SHITMATE ── */
.fx.bossflush { background: #000b; }
.fx.bossflush .bowl-big { position: relative; width: min(60%, 280px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #6fc7ff 0 38%, #2a86c8 52%, #f4f4f0 53% 68%, #c9c9c2 70%); box-shadow: 0 10px 0 #0008; display: grid; place-items: center; overflow: hidden; }
.fx.bossflush .water { position: absolute; inset: 15%; border-radius: 50%; background: conic-gradient(#ffffff55, transparent 30%, #ffffff44 50%, transparent 80%); animation: spin .6s linear infinite; }
.fx.bossflush .pc-face { width: 45%; aspect-ratio: 1; border-radius: 50%; animation: swirlDown 2.2s cubic-bezier(.5, 0, .8, .4) forwards; }
.fx.bossflush b { animation: fxIn .4s 1.4s ease-out both; }
@keyframes swirlDown { 0% { transform: scale(1.4) rotate(0); } 100% { transform: scale(0) rotate(1080deg); opacity: .2; } }
@keyframes spin { to { transform: rotate(1turn); } }

/* ── Dirty mode ── */
.btn.report { background: #c4122f; color: #fff; }
.btn.report:not([disabled]) { animation: pulse 1.6s infinite; }
.ladder .acts { display: flex; gap: 6px; flex: none; }
.btn.dirty { background: #6a3a1c; color: #ffd9a8; }
.btn.dirty[disabled] { opacity: .4; }
.sq .rule { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.rule.r-annex span { position: absolute; right: 3px; top: 1px; font-size: clamp(10px, 2.2vw, 16px); }
.rule.r-lotion i { position: absolute; inset: 14%; border-radius: 46% 54% 40% 60% / 55% 45% 55% 45%; background: radial-gradient(circle at 35% 35%, #fff 0 12%, #fff6e8 13% 60%, #f0e2c8); opacity: .85; box-shadow: 0 0 0 2px #fff8; }
.rule.r-dome { inset: -6%; border-radius: 50% 50% 10% 10%; border: 3px solid #8fd3ff; background: #8fd3ff33; z-index: 6; animation: pulse 1.4s infinite; }
.rule.r-censor { background: #000c; z-index: 7; display: grid; place-items: center; }
.rule.r-censor span { color: #fff; font: clamp(7px, 1.5vw, 11px) 'TPA Display', Impact, sans-serif; }
#app.lights-off .board-wrap::after { content: 'CAM 2 — NO SIGNAL'; position: absolute; inset: 0; z-index: 30; background: #000; color: #f33; font: 14px monospace; padding: 10px; animation: blink .5s steps(1) infinite; }
@keyframes pulse { 50% { filter: brightness(1.3); } }
.rule.r-lotion::after { content: '🧴'; position: absolute; right: 2px; bottom: 1px; font-size: clamp(9px, 2vw, 14px); }

/* ── Bobblehead figurines (pieces.js figure()) ── */
.pc-face { background-image: var(--img); background-size: var(--size); background-position: var(--pos); }
.pc.fig { filter: drop-shadow(0 3px 2px #000a); }
.pc.fig.dk > .pc-back, .pc.fig.dk > .pc-hat { filter: drop-shadow(0 0 1px #fffc) drop-shadow(0 0 .6px #fff8); }
.board .sq > .pc.fig { inset: 1% 3% 3%; }
.pc.fig > .pc-face { position: absolute; z-index: 2; transform-origin: 50% 92%; filter: drop-shadow(0 1.5px 1px #0008) saturate(1.1); }
/* glaze on the face itself: light from the top left, shadow bottom right, cut to the face shape */
.pc.fig > .pc-face::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 32% 24%, #ffffff3a 0, #ffffff10 20%, transparent 38%), linear-gradient(135deg, transparent 55%, #00000040 100%);
  -webkit-mask: var(--img) var(--pos) / var(--size) no-repeat; mask: var(--img) var(--pos) / var(--size) no-repeat; }
.pc.fig.dk > .pc-face::after { background: radial-gradient(ellipse at 32% 24%, #ffffff30 0, transparent 34%), linear-gradient(135deg, transparent 55%, #00000045 100%); }
.pc.fig .pc-hat { z-index: 3; transform-origin: 50% var(--chin, 60%); }
.pc.fig.bobbing > .pc-face, .pc.fig.bobbing > .pc-hat { animation: bobble .9s ease-out; }
.sq.sel .pc.fig > .pc-face, .sq.sel .pc.fig > .pc-hat { animation: bobble 1.1s ease-in-out infinite; }
@keyframes bobble { 0% { rotate: 0deg; } 15% { rotate: -9deg; } 35% { rotate: 7deg; } 55% { rotate: -4deg; } 75% { rotate: 2deg; } 100% { rotate: 0deg; } }

/* ── Knight: the face is the horse's head (pieces.js horseHead()) ── */
.pc.fig .horse { position: absolute; inset: 0; z-index: 2; clip-path: url(#sm-horse); transform-origin: 50% 82%; }
.horse .h-skin { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--skin, #b08060) 85%, #fff), var(--skin, #b08060) 60%, color-mix(in srgb, var(--skin, #b08060) 70%, #000)); }
.horse .h-slice { position: absolute; left: 0; width: 100%; overflow: hidden; }
.horse .h-face { position: absolute; aspect-ratio: auto; filter: saturate(1.1); }
.horse .h-shade { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 30% 50% at 38% 32%, #ffffff38, transparent 70%), linear-gradient(90deg, #0006 0, transparent 24%, transparent 70%, #0007 100%), linear-gradient(180deg, transparent 70%, #0003 78%, #0006 100%); }
.pc.fig.dk .horse .h-shade { background: radial-gradient(ellipse 30% 50% at 38% 32%, #ffffff28, transparent 70%), linear-gradient(90deg, #0008 0, transparent 24%, transparent 68%, #0009 100%), linear-gradient(180deg, transparent 72%, #0005 100%); }
.pc.fig.bobbing > .horse { animation: bobble .9s ease-out; }
.sq.sel .pc.fig > .horse { animation: bobble 1.1s ease-in-out infinite; }
