body.player { min-height: 100%; overflow-x: hidden; }
.pscreen { display: none; min-height: 100vh; min-height: 100dvh; }
.pscreen.active { display: flex; flex-direction: column; }
.join { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 28px 18px calc(28px + env(safe-area-inset-bottom)); text-align: center; }
.j-logo { width: 116px; background: #fff; padding: 8px 12px; border-radius: 14px; }
.j-title { font-size: 56px; margin: 0; }
.j-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.j-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.j-form input { font-size: 20px; padding: 14px; }
#inPin { letter-spacing: .3em; font-weight: 800; text-align: center; font-size: 26px; }
.j-err { color: #ffb4b4; min-height: 1.2em; margin: 0; font-size: 14px; text-align: center; }
.j-note, .p-sub { color: var(--muted); font-size: 14px; max-width: 360px; line-height: 1.5; margin: 0 auto; }

.p-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: color-mix(in srgb, var(--tc, #5B449B) 75%, #120a2e); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.p-me { display: flex; flex-direction: column; min-width: 0; }
.p-me b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-me span { font-size: 12.5px; opacity: .9; }
.p-pin { font-size: 12px; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.p-pin b { letter-spacing: .1em; }

.p-wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 18px 8px; gap: 10px; text-align: center; }
.p-stage { display: flex; justify-content: center; min-height: 250px; align-items: flex-end; }
.p-stage .mascot { --mw: 180px; cursor: pointer; }
.p-status { font-size: 30px; }
.p-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; max-width: 360px; }
.p-actions .big { width: 100%; }
.p-row { display: flex; gap: 10px; width: 100%; }
.p-row .btn { flex: 1; }
.lead-badge { display: inline-block; margin-top: 4px; padding: 8px 14px; border-radius: 14px; background: rgba(255, 210, 63, .18); border: 1.5px solid var(--gold); color: var(--gold-2); font-weight: 700; font-size: 14px; line-height: 1.45; }

.p-game { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 8px; }
.p-scores { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 6px; }
.ps { border-radius: 12px; padding: 6px 8px; background: color-mix(in srgb, var(--tc) 30%, rgba(255, 255, 255, .03)); border: 2px solid transparent; min-width: 0; }
.ps.cur { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 210, 63, .35); }
.ps.me { outline: 2px dashed rgba(255, 255, 255, .6); outline-offset: 2px; }
.ps .n { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps .s { font-family: var(--display); font-size: 22px; color: var(--gold); line-height: 1; }
.p-turn { text-align: center; font-weight: 700; font-size: 16px; line-height: 1.4; min-height: 1.4em; }
.p-turn b { color: var(--gold); }
.p-hint { text-align: center; font-size: 13.5px; color: #e6e0ff; }
.p-board { min-height: 110px; height: 30vh; max-height: 260px; padding: 8px; border-radius: 16px; }
.p-ctrl { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding-bottom: 6px; }
.p-ctrl-msg { text-align: center; font-size: 16px; font-weight: 600; color: #e6e0ff; line-height: 1.45; }
.p-ctrl-msg b { color: var(--gold); }
.spin-btn { width: 170px; height: 170px; border-radius: 50%; border: 6px solid #fff3b8; background: radial-gradient(circle at 35% 30%, #ffe680, #f2b400 60%, #b07a00); color: #2a1a00; font-family: var(--display); font-size: 36px; cursor: pointer; box-shadow: 0 10px 0 #8a5e00, 0 20px 40px rgba(255, 210, 63, .4); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; animation: breathe 1.2s ease-in-out infinite; touch-action: manipulation; }
.spin-btn span { font-size: 44px; }
.spin-btn:active { transform: translateY(6px); box-shadow: 0 4px 0 #8a5e00; }
@keyframes breathe { 50% { transform: scale(1.05); } }
.p-kb { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; width: 100%; max-width: 440px; }
.p-kb button { height: 46px; border-radius: 10px; border: 1.5px solid #c9b8ff; background: linear-gradient(180deg, #8E6BE0, #4a2f99); color: #fff; font: 800 20px var(--display); box-shadow: 0 3px 0 #2C1C58; touch-action: manipulation; }
.p-kb button:active { transform: translateY(2px); box-shadow: 0 1px 0 #2C1C58; }
.p-kb button.used { opacity: .3; pointer-events: none; }
.p-kb button.hit { background: #4E8F2A; } .p-kb button.miss { background: #6b1f2a; text-decoration: line-through; }
.solve-btn { width: 100%; max-width: 440px; }
.p-timer { position: relative; width: 100%; max-width: 440px; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.p-timer i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #9BC85E, #FFD23F); border-radius: 7px; transition: width .25s linear; }
.p-timer.warn i { background: #ff6b6b; }
.p-timer span { position: absolute; right: 8px; top: -2px; font-size: 12px; font-weight: 800; }
.spinning-dot { display: inline-block; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.p-end { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; }
.p-end-medal { font-size: 96px; animation: crown 1.2s ease-in-out infinite; }
.p-end-title { font-size: 34px; }
.p-end-score { font-size: 18px; color: var(--gold-2); }
.p-end-list { width: 100%; max-width: 360px; display: grid; gap: 6px; margin-top: 10px; }
.p-end-list div { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-weight: 700; }

.p-cheer { position: sticky; bottom: 0; display: flex; justify-content: space-around; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(15, 8, 40, .85); border-top: 1px solid var(--bd); backdrop-filter: blur(8px); }
.p-cheer button { flex: 1; max-width: 56px; height: 48px; font-size: 26px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .08); touch-action: manipulation; transition: transform .1s; }
.p-cheer button:active, .p-cheer button.fired { transform: scale(1.25); background: rgba(255, 210, 63, .25); }
@media (min-height: 760px) { .p-board { height: 34vh; } }
