@font-face { font-family: 'Fredoka'; src: url(../assets/fredoka.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Lilita One'; src: url(../assets/lilita.woff2) format('woff2'); font-display: swap; }
:root {
  --accent: #ff5c9d; --accent2: #ffc2dc;
  --glass: rgba(70, 10, 60, .6); --glass-b: rgba(255, 255, 255, .18);
  --text: #fff; --muted: #e3d4ff;
  --B: #8a4dff; --I: #ff3d7f; --N: #c45a8c; --G: #ff5a4f; --O: #ff9a2f;
  --top: 56px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3a0838; color: var(--text); font-family: 'Fredoka', 'Arial Rounded MT Bold', system-ui, sans-serif; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
.hidden { display: none !important; }
#bg { position: fixed; inset: 0; background-size: cover; background-position: center bottom; transition: background-image .6s; z-index: 0; }
#bg-shade { position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(30,0,60,.05), rgba(20,0,40,.55)); z-index: 0; pointer-events: none; }
.glass { background: var(--glass); border: 2px solid var(--glass-b); border-radius: 18px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 8px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.15); }

/* ---------- top bar ---------- */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--top); z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
  background: linear-gradient(90deg, rgba(120,12,80,.95), rgba(80,10,110,.92), rgba(120,12,80,.95)); border-bottom: 3px solid var(--accent); box-shadow: 0 4px 18px rgba(0,0,0,.4); gap: 8px; }
.tb-left, .tb-right, .tb-mid { display: flex; align-items: center; gap: 8px; }
.mini-logo { font-family: 'Lilita One', sans-serif; font-size: 20px; letter-spacing: 1px; color: #ffd84a; text-shadow: 0 2px 0 #7a1aa8; white-space: nowrap; }
.mini-logo b { color: #fff; font-weight: normal; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; font-size: 19px; display: grid; place-items: center; transition: transform .1s, background .2s; }
.icon-btn:hover { background: rgba(255,255,255,.22); } .icon-btn:active { transform: scale(.9); }
.icon-btn.off { opacity: .45; filter: grayscale(1); }
.pill { display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.2); font-weight: 600; white-space: nowrap; }
.coins-pill { color: #ffe066; font-family: 'Lilita One', sans-serif; font-size: 18px; letter-spacing: .5px; }
.coin-ico svg { display: block; }
.coins-pill.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.25); } }

#app { position: fixed; top: var(--top); left: 0; right: 0; bottom: 0; z-index: 1; }
.screen { position: absolute; inset: 0; display: none; overflow: auto; padding: 14px; }
.screen.active { display: flex; animation: screenIn .35s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } }

/* ---------- buttons ---------- */
.btn { border: none; border-radius: 14px; padding: 12px 20px; font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25);
  box-shadow: 0 5px 0 rgba(0,0,0,.3), inset 0 2px 0 rgba(255,255,255,.35); transition: transform .08s, filter .2s; }
.btn:hover { filter: brightness(1.1); } .btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.btn:disabled { filter: grayscale(.8) brightness(.8); cursor: not-allowed; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.big { font-family: 'Lilita One', sans-serif; font-size: 24px; letter-spacing: 1px; padding: 14px 30px; }
.btn-pink { background: linear-gradient(180deg, #ff7ad0, #e0158f); }
.btn-blue { background: linear-gradient(180deg, #4cc3ff, #1460e0); }
.btn-green { background: linear-gradient(180deg, #6df08a, #13a04a); }
.btn-ghost { background: rgba(255,255,255,.15); border: 2px solid rgba(255,255,255,.3); box-shadow: none; }

/* ---------- title ---------- */
#screen-title { align-items: center; justify-content: center; }
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(720px, 100%); margin: auto; }
.logo { width: min(620px, 94vw); }
.logo-svg { width: 100%; height: auto; overflow: visible; animation: logoIn .9s cubic-bezier(.2,1.6,.4,1); }
.logo-ball { animation: floaty 2.4s ease-in-out infinite; transform-box: fill-box; }
@keyframes floaty { 50% { translate: 0 -10px; } }
@keyframes logoIn { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
.profile-card { padding: 10px 14px; width: min(420px, 100%); }
.profile-card .row { display: flex; gap: 10px; align-items: center; }
.avatar-btn { font-size: 30px; width: 54px; height: 54px; border-radius: 50%; border: 3px solid #ffd84a; background: rgba(255,255,255,.15); }
#name-input, .setup input[type=text], .lobby-box input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 2px solid rgba(255,255,255,.3); background: rgba(0,0,0,.3); color: #fff; font-size: 18px; outline: none; width: 100%; }
#name-input:focus, .lobby-box input:focus { border-color: #ffd84a; }
.avatar-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 10px; }
.avatar-picker button { font-size: 26px; background: rgba(255,255,255,.1); border: 2px solid transparent; border-radius: 10px; padding: 4px; }
.avatar-picker button.sel { border-color: #ffd84a; background: rgba(255,216,74,.25); }
.title-buttons { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.big-btn { position: relative; width: 260px; padding: 18px 16px 16px 76px; text-align: left; border: 3px solid rgba(255,255,255,.6); border-radius: 22px; color: #fff;
  font-family: 'Lilita One', sans-serif; font-size: 30px; letter-spacing: 1px; text-shadow: 0 3px 0 rgba(0,0,0,.3); box-shadow: 0 8px 0 rgba(0,0,0,.3), 0 12px 30px rgba(0,0,0,.35); transition: transform .12s; }
.big-btn small { display: block; font-family: 'Fredoka', sans-serif; font-size: 14px; letter-spacing: 0; font-weight: 600; opacity: .9; }
.big-btn .bb-ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 42px; }
.big-btn:hover { transform: translateY(-3px) scale(1.03); } .big-btn:active { transform: translateY(4px); }
.big-btn.btn-pink { background: linear-gradient(160deg, #ff8ad8, #d0137f); }
.big-btn.btn-blue { background: linear-gradient(160deg, #57d0ff, #2650e8); }
.title-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.title-foot { opacity: .85; font-size: 14px; text-align: center; text-shadow: 0 1px 3px #000; }

/* ---------- mode tiles ---------- */
.mode-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-tile { --mc: #ff4fb3; --mc2: #ffb347; position: relative; border: 3px solid rgba(255,255,255,.35); border-radius: 16px; padding: 10px 10px 12px; color: #fff; text-align: left;
  background: linear-gradient(150deg, var(--mc), color-mix(in srgb, var(--mc) 55%, #1a0030)); box-shadow: 0 5px 0 rgba(0,0,0,.3); transition: transform .12s, box-shadow .2s; overflow: hidden; }
.mode-tile::after { content: ''; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: var(--mc2); opacity: .35; }
.mode-tile .m-ico { font-size: 28px; }
.mode-tile .m-name { font-family: 'Lilita One', sans-serif; font-size: 21px; letter-spacing: .5px; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.mode-tile .m-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #fff; background: rgba(0,0,0,.28); border: 1px solid var(--mc2); padding: 1px 7px; border-radius: 99px; margin-top: 2px; }
.mode-tile .m-desc { font-size: 12.5px; opacity: .95; margin-top: 4px; line-height: 1.25; }
.mode-tile:hover { transform: translateY(-2px); }
.mode-tile.sel { border-color: #fff; box-shadow: 0 0 0 4px var(--mc2), 0 5px 0 rgba(0,0,0,.3), 0 0 26px var(--mc); }
.mode-tile.sel::before { content: '✔'; position: absolute; right: 10px; top: 8px; z-index: 1; font-size: 18px; }
.title-modes .mode-tile .m-desc { display: none; }
.mode-badge { border-radius: 14px; padding: 6px 10px; text-align: center; font-family: 'Lilita One', sans-serif; font-size: 18px; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #1a0030)); border: 2px solid var(--accent2); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent); }
.mode-badge small { display: block; font-family: 'Fredoka'; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: #fff; opacity: .9; }

/* ---------- setup panels ---------- */
.panel { padding: 16px 18px; }
.setup { width: min(760px, 100%); margin: auto; display: flex; flex-direction: column; gap: 12px; }
.setup h2, .panel h2 { margin: 0; font-family: 'Lilita One', sans-serif; font-size: 34px; letter-spacing: 1px; color: #ffd84a; text-shadow: 0 3px 0 #7a1aa8; text-align: center; }
h3 { margin: 4px 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--muted); text-transform: uppercase; font-size: 13px; letter-spacing: 1px; }
.speed-val { color: #ffd84a; text-transform: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 99px; border: 2px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; font-weight: 600; font-size: 15px; transition: all .15s; }
.chip:hover { background: rgba(255,255,255,.2); }
.chip.sel { background: linear-gradient(180deg, #ffe066, #ff9a1f); color: #4a1500; border-color: #fff; box-shadow: 0 0 14px rgba(255,200,60,.6); }
.chips.small .chip { padding: 4px 9px; font-size: 12px; }
input[type=range] { width: 100%; margin-top: 8px; accent-color: #ffd84a; }
.card-count { display: flex; gap: 10px; }
.cc-btn { flex: 1; max-width: 120px; padding: 10px 6px; border-radius: 14px; border: 3px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; font-family: 'Lilita One'; font-size: 22px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cc-btn .mini-cards { display: grid; gap: 3px; }
.cc-btn .mini-cards i { width: 16px; height: 20px; border-radius: 3px; background: linear-gradient(#fff, #e6dcff); border-top: 4px solid var(--accent); display: block; }
.cc-btn.sel { border-color: #ffd84a; background: rgba(255,216,74,.22); box-shadow: 0 0 16px rgba(255,216,74,.5); }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 8px 0; }

/* ---------- lobby ---------- */
.conn-status { text-align: center; font-size: 14px; color: var(--muted); }
.conn-status.ok { color: #7dff9a; }
.conn-status.bad { color: #ff9a9a; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lobby-box { background: rgba(0,0,0,.2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.code-input { text-transform: uppercase; letter-spacing: 8px; font-family: 'Lilita One' !important; text-align: center; font-size: 26px !important; }
.room-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.room-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255,255,255,.08); padding: 10px 12px; border-radius: 12px; border: 2px solid rgba(255,255,255,.12); }
.room-item b { font-size: 17px; } .room-item small { color: var(--muted); display: block; }
.empty { opacity: .7; text-align: center; padding: 14px; }

/* ---------- room ---------- */
.room-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; width: min(1150px, 100%); margin: auto; height: 100%; max-height: 820px; }
.room-main { display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.room-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.room-label { font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.room-code { font-family: 'Lilita One'; font-size: 46px; letter-spacing: 8px; color: #ffd84a; text-shadow: 0 3px 0 #7a1aa8; }
body:not(.is-host) .host-only { display: none !important; }
body.is-host .guest-only { display: none !important; }
.room-info { background: rgba(0,0,0,.2); padding: 10px 12px; border-radius: 12px; }
.waiting { font-weight: 600; color: #ffd84a; }
.dots::after { content: '…'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.player-list { display: flex; flex-direction: column; gap: 6px; }
.player-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; background: rgba(255,255,255,.08); }
.player-row .av { font-size: 24px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); flex: none; }
.player-row .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row .tag { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: rgba(255,255,255,.15); }
.player-row .tag.host { background: #ffd84a; color: #4a1500; }
.player-row .tag.you { background: #39d98a; color: #003a1a; }
.player-row .sc { font-family: 'Lilita One'; color: #ffe066; }
.player-row.won { background: linear-gradient(90deg, rgba(255,216,74,.35), rgba(255,255,255,.05)); }
.player-list.compact .player-row { padding: 4px 8px; } .player-list.compact .av { width: 28px; height: 28px; font-size: 18px; }

/* ---------- chat ---------- */
.chat-panel { display: flex; flex-direction: column; min-height: 0; padding: 10px; position: relative; }
.box-title { font-family: 'Lilita One'; font-size: 17px; letter-spacing: 1px; color: #ffd84a; margin-bottom: 6px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; min-height: 80px; padding-right: 4px; }
.chat-msg { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; line-height: 1.3; animation: msgIn .25s; }
@keyframes msgIn { from { opacity: 0; transform: translateX(-10px); } }
.chat-msg .av { font-size: 18px; flex: none; }
.chat-msg .bubble { background: rgba(255,255,255,.12); padding: 5px 9px; border-radius: 4px 12px 12px 12px; word-break: break-word; }
.chat-msg .bubble b { color: #ffd84a; margin-right: 4px; }
.chat-msg.me .bubble { background: rgba(80,200,255,.25); }
.chat-msg.sys { justify-content: center; } .chat-msg.sys .bubble { background: none; color: #d8c6ff; font-size: 12.5px; font-style: italic; text-align: center; padding: 2px; }
.quick-row { display: flex; gap: 5px; overflow-x: auto; padding: 6px 0; scrollbar-width: none; }
.quick-row button { flex: none; border: none; border-radius: 99px; padding: 4px 9px; background: rgba(255,255,255,.14); color: #fff; font-size: 13px; }
.quick-row button:hover { background: rgba(255,255,255,.25); }
.chat-form { display: flex; gap: 6px; position: relative; }
.chat-input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 12px; border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.3); color: #fff; font-size: 15px; outline: none; }
.chat-input:focus { border-color: #ffd84a; }
.emoji-toggle, .chat-send { border: none; border-radius: 12px; width: 40px; font-size: 18px; background: rgba(255,255,255,.15); color: #fff; }
.chat-send { background: linear-gradient(180deg, #ff7ad0, #e0158f); }
.emoji-pop { position: absolute; bottom: 48px; left: 0; right: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; background: rgba(40,8,70,.97); border: 2px solid rgba(255,255,255,.25); border-radius: 14px; padding: 8px; z-index: 5; }
.emoji-pop button { border: none; background: none; font-size: 22px; padding: 3px; border-radius: 8px; }
.emoji-pop button:hover { background: rgba(255,255,255,.15); }

/* ---------- game ---------- */
#screen-game { padding: 10px; }
.game-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr) 290px; gap: 10px; width: 100%; height: 100%; }
.g-left, .g-right { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.g-right .chat-panel { flex: 1; }
.players-box { padding: 10px; max-height: 38%; overflow: auto; flex: none; }
.ball-stage { padding: 8px 10px 10px; position: relative; display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--accent) 45%, transparent), var(--glass) 70%); }
.ball-count { position: absolute; top: 8px; left: 12px; font-family: 'Lilita One'; color: #ffd84a; font-size: 16px; }
.current-ball { width: 132px; height: 132px; display: grid; place-items: center; }
.current-ball .ball-svg { width: 100%; height: 100%; filter: drop-shadow(0 8px 12px rgba(0,0,0,.45)); }
.current-ball .ball-svg.pop { animation: ballIn .6s cubic-bezier(.2,1.5,.4,1); }
@keyframes ballIn { 0% { transform: translateX(160px) rotate(300deg) scale(.4); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.current-ball .placeholder { width: 112px; height: 112px; border-radius: 50%; border: 4px dashed rgba(255,255,255,.35); display: grid; place-items: center; font-family: 'Lilita One'; font-size: 20px; color: rgba(255,255,255,.6); }
.recent-balls { display: flex; gap: 5px; height: 46px; margin-top: 2px; }
.recent-balls .ball-svg { width: 46px; height: 46px; animation: slideIn .4s; }
.recent-balls .ball-svg:nth-child(n+2) { opacity: .85; }
@keyframes slideIn { from { transform: translateX(-30px); opacity: 0; } }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { padding: 6px; text-align: center; }
.stat-v { font-family: 'Lilita One'; font-size: 26px; color: #ffe066; line-height: 1.1; }
.stat-v.flash { animation: bump .5s; }
.stat-l { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.pattern-box { padding: 6px 10px; display: flex; align-items: center; gap: 10px; }
.pattern-box .stat-l { display: none; }
.pattern-name { flex: 1; font-weight: 700; font-size: 15px; }
.pattern-mini { display: grid; grid-template-columns: repeat(5, 8px); gap: 2px; }
.pattern-mini i { width: 8px; height: 8px; border-radius: 2px; background: rgba(255,255,255,.2); }
.pattern-mini i.on { background: #ffd84a; animation: patPulse 1.6s infinite; }
@keyframes patPulse { 50% { background: var(--accent); } }
.board { padding: 8px; display: grid; grid-template-columns: 22px repeat(15, 1fr); gap: 2px; flex: 1; min-height: 0; align-content: start; overflow: auto; }
.board .bl { font-family: 'Lilita One'; font-size: 14px; display: grid; place-items: center; border-radius: 4px; color: #fff; }
.board .bn { font-size: 10px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.08); color: rgba(255,255,255,.45); font-weight: 600; }
.board .bn.on { color: #fff; background: var(--lc); box-shadow: 0 0 6px var(--lc); animation: bnOn .5s; }
.board .bn.last { outline: 2px solid #fff; }
@keyframes bnOn { 0% { transform: scale(1.8); } }
.g-center { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.cards-area { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: var(--gap, 12px); }
.g-controls { display: flex; align-items: center; gap: 12px; padding: 8px 12px; flex-wrap: wrap; justify-content: space-between; }
.power-btn { position: relative; overflow: hidden; border: 3px solid #fff; border-radius: 16px; padding: 10px 20px; font-family: 'Lilita One'; font-size: 20px; letter-spacing: 1px; color: #fff;
  background: #3a1460; min-width: 170px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.power-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: linear-gradient(90deg, #ffb347, #ff4fb3); transition: width .4s; }
.power-label { position: relative; }
.power-btn.ready { animation: powerGlow .8s infinite alternate; }
.power-btn.ready .power-fill { background: linear-gradient(90deg, #ffe066, #ff9a1f, #ff4fb3); }
@keyframes powerGlow { from { box-shadow: 0 0 8px #ffd84a; transform: scale(1); } to { box-shadow: 0 0 26px #ff4fb3; transform: scale(1.05); } }
.speed-ctl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { display: none; }
.switch .slider { width: 46px; height: 26px; border-radius: 99px; background: rgba(255,255,255,.25); position: relative; transition: background .2s; }
.switch .slider::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .slider { background: #39d98a; }
.switch input:checked + .slider::after { transform: translateX(20px); }

/* ---------- bingo card ---------- */
.card { --cw: 300px; width: var(--cw); position: relative; border-radius: calc(var(--cw) * .06); padding: calc(var(--cw) * .03);
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #1a0030)); border: 3px solid rgba(255,255,255,.75);
  box-shadow: 0 10px 0 rgba(0,0,0,.25), 0 14px 30px rgba(0,0,0,.4); animation: cardIn .5s cubic-bezier(.2,1.4,.4,1) backwards; }
@keyframes cardIn { from { transform: translateY(40px) scale(.8); opacity: 0; } }
.card-head { display: grid; grid-template-columns: repeat(5, 1fr); gap: calc(var(--cw) * .012); margin-bottom: calc(var(--cw) * .015); }
.card-head span { font-family: 'Lilita One'; text-align: center; font-size: calc(var(--cw) * .1); line-height: 1.15; color: #fff; border-radius: calc(var(--cw) * .025); text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.card-head .hB { background: var(--B); } .card-head .hI { background: var(--I); } .card-head .hN { background: var(--N); } .card-head .hG { background: var(--G); } .card-head .hO { background: var(--O); }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: calc(var(--cw) * .012); }
.cell { position: relative; aspect-ratio: 1; border: none; border-radius: calc(var(--cw) * .03); background: linear-gradient(180deg, #fff, #ece4ff); color: #2a1b4a;
  font-family: 'Lilita One'; font-size: calc(var(--cw) * .085); display: grid; place-items: center; padding: 0; box-shadow: inset 0 -3px 0 rgba(80,40,140,.18); transition: transform .08s; }
.cell:active { transform: scale(.92); }
.cell .num { position: relative; z-index: 2; }
.cell.daubed .num { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.cell .daub-svg { position: absolute; inset: -4%; width: 108%; height: 108%; z-index: 1; animation: daubIn .35s cubic-bezier(.2,1.7,.4,1); pointer-events: none; }
@keyframes daubIn { from { transform: scale(2.2) rotate(-40deg); opacity: 0; } }
.cell.free { background: radial-gradient(circle, #ffe066, #ff9a1f); color: #6a2b00; font-size: calc(var(--cw) * .05); }
.cell.free .num { line-height: 1; text-align: center; }
.cell .chest-svg { position: absolute; right: 4%; bottom: 4%; width: 38%; height: 38%; z-index: 3; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.cell.daubed .chest-svg { animation: chestPop .6s forwards; }
@keyframes chestPop { 50% { transform: scale(1.8) translateY(-30%); } to { transform: scale(0); opacity: 0; } }
.cell.near { animation: nearPulse 1s infinite; }
@keyframes nearPulse { 50% { box-shadow: 0 0 0 3px #ffd84a, 0 0 18px #ffd84a; } }
.cell.wrong { animation: shake .35s; background: #ffc2cf; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.cell.win { box-shadow: 0 0 0 3px #fff, 0 0 18px #ffd84a; z-index: 2; }
.card-foot { display: flex; gap: calc(var(--cw) * .02); margin-top: calc(var(--cw) * .025); align-items: stretch; }
.bingo-btn { flex: 1; border: 3px solid #fff; border-radius: calc(var(--cw) * .045); font-family: 'Lilita One'; font-size: calc(var(--cw) * .085); letter-spacing: 2px; color: #fff; padding: calc(var(--cw) * .018) 0;
  background: linear-gradient(180deg, #ffe066, #ff7a00); text-shadow: 0 2px 0 #a33c00; box-shadow: 0 4px 0 #8a3000; transition: transform .08s; }
.bingo-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a3000; }
.bingo-btn.ready { animation: bingoReady .6s infinite alternate; background: linear-gradient(180deg, #8dff7a, #12b34a); text-shadow: 0 2px 0 #06602a; box-shadow: 0 4px 0 #06602a; }
@keyframes bingoReady { to { transform: scale(1.04); box-shadow: 0 4px 0 #06602a, 0 0 22px #8dff7a; } }
.bingo-btn:disabled { filter: grayscale(1) brightness(.8); }
.card-lock, .card-won { position: absolute; inset: 0; border-radius: inherit; display: grid; place-items: center; z-index: 5; text-align: center; font-family: 'Lilita One'; pointer-events: none; }
.card-lock { background: rgba(60,0,20,.55); font-size: calc(var(--cw) * .09); color: #ffb3c3; }
.card-won { background: rgba(20,0,40,.25); }
.card-won .ribbon { background: linear-gradient(180deg, #ffe066, #ff9a1f); color: #6a2b00; padding: 8px 22px; border-radius: 12px; border: 3px solid #fff; transform: rotate(-8deg); font-size: calc(var(--cw) * .1);
  box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: ribbonIn .6s cubic-bezier(.2,1.7,.4,1); }
.card-won .ribbon small { display: block; font-size: .5em; }
@keyframes ribbonIn { from { transform: rotate(-8deg) scale(3); opacity: 0; } }
.card.spectate { opacity: .6; }
.spectator-note { font-size: 22px; text-align: center; padding: 30px; }
.float-coin { position: fixed; z-index: 60; pointer-events: none; font-family: 'Lilita One'; color: #ffe066; font-size: 20px; text-shadow: 0 2px 0 #7a1aa8; animation: floatUp 1.2s forwards; }
@keyframes floatUp { to { transform: translateY(-70px); opacity: 0; } }

/* ---------- overlays ---------- */
.countdown { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; pointer-events: none; font-family: 'Lilita One'; font-size: 180px; color: #ffe066; text-shadow: 0 8px 0 #7a1aa8, 0 0 40px rgba(255,79,179,.8); }
.countdown span { animation: cdPop .9s forwards; }
@keyframes cdPop { 0% { transform: scale(3); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(.6); opacity: 0; } }
.bingo-burst { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; pointer-events: none; }
.bingo-burst > * { grid-area: 1 / 1; }
.burst-rays { width: 900px; height: 900px; background: repeating-conic-gradient(rgba(255,224,102,.55) 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: spin 4s linear infinite, burstIn .5s;
  mask-image: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%); }
@keyframes spin { to { rotate: 360deg; } }
.burst-text { font-family: 'Lilita One'; font-size: clamp(80px, 16vw, 190px); color: #ffe066; -webkit-text-stroke: 6px #8a0f8c; paint-order: stroke fill; text-shadow: 0 10px 0 #4a0660, 0 0 50px #ff4fb3; animation: burstIn .7s cubic-bezier(.2,1.8,.4,1); }
.burst-sub { margin-top: 220px; font-family: 'Lilita One'; font-size: 34px; color: #fff; text-shadow: 0 3px 0 #7a1aa8; animation: burstIn .9s; }
@keyframes burstIn { from { transform: scale(0) rotate(-20deg); opacity: 0; } }
#confetti { position: fixed; inset: 0; z-index: 56; pointer-events: none; width: 100%; height: 100%; }
#toasts { position: fixed; top: calc(var(--top) + 10px); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: rgba(30,5,55,.92); border: 2px solid var(--accent); padding: 8px 16px; border-radius: 99px; font-weight: 600; animation: toastIn .3s, toastOut .4s 2.6s forwards; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.good { border-color: #39d98a; } .toast.bad { border-color: #ff4f6a; }
@keyframes toastIn { from { transform: translateY(-20px); opacity: 0; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
.modal { position: fixed; inset: 0; z-index: 65; background: rgba(10,0,25,.6); display: grid; place-items: center; padding: 16px; animation: screenIn .3s; }
.modal-box { width: min(560px, 100%); max-height: 90%; overflow: auto; padding: 20px; text-align: center; background: rgba(50,12,90,.95); }
.modal-box h2 { margin: 0 0 4px; }
.results { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; text-align: left; }
.res-row { display: grid; grid-template-columns: 40px 34px 1fr auto auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.08); animation: msgIn .4s backwards; }
.res-row.me { background: rgba(80,200,255,.22); border: 2px solid #4cc3ff; }
.res-row .pos { font-family: 'Lilita One'; font-size: 22px; text-align: center; }
.res-row .av { font-size: 24px; } .res-row .sc { font-family: 'Lilita One'; color: #ffe066; font-size: 18px; }
.res-row .bg { font-size: 13px; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.mobile-tabs { display: none; }
.badge { background: #ff4f6a; border-radius: 99px; padding: 0 6px; font-size: 11px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .game-layout { grid-template-columns: 230px minmax(0, 1fr) 250px; } .current-ball { width: 110px; height: 110px; } }
@media (max-width: 860px) {
  :root { --top: 50px; }
  .mini-logo { display: none; } #pill-player { display: none; }
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  .room-layout { grid-template-columns: 1fr; height: auto; max-height: none; }
  .room-layout .chat-panel { height: 340px; }
  .lobby-grid { grid-template-columns: 1fr; }
  .mode-pick, .title-modes { grid-template-columns: 1fr; }
  .title-modes { grid-template-columns: repeat(3, 1fr); } .title-modes .mode-tile .m-tag { font-size: 9px; } .title-modes .mode-tile .m-name { font-size: 15px; }
  .big-btn { width: 100%; }
  #screen-game { padding: 6px 6px 54px; }
  .game-layout { display: flex; flex-direction: column; gap: 6px; }
  .g-left { flex-direction: row; flex-wrap: wrap; flex: none; gap: 6px; }
  .ball-stage { flex-direction: row; gap: 8px; padding: 6px 10px; flex: 1 1 100%; }
  .ball-count { position: static; order: 3; font-size: 13px; }
  .current-ball { width: 64px; height: 64px; } .current-ball .placeholder { width: 56px; height: 56px; font-size: 12px; }
  .recent-balls { height: 34px; margin: 0; } .recent-balls .ball-svg { width: 34px; height: 34px; }
  .stat-row { flex: 1; } .stat-v { font-size: 18px; } .stat-l { font-size: 9px; }
  .pattern-box { flex: 1; } .mode-badge { display: none; }
  .board, .g-right { display: none; }
  .g-center { flex: 1; }
  .g-controls { padding: 6px 8px; gap: 8px; } .power-btn { min-width: 120px; font-size: 15px; padding: 7px 10px; } .speed-ctl > span { display: none; }
  body.tab-board .g-center, body.tab-chat .g-center { display: none; }
  body.tab-board .board { display: grid; flex: 1 1 100%; }
  body.tab-chat .g-right { display: flex; flex: 1; min-height: 0; }
  body.tab-chat .g-left .stat-row, body.tab-chat .g-left .pattern-box, body.tab-board .g-left .stat-row { display: none; }
  .mobile-tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 50px; z-index: 15; background: rgba(40,6,70,.96); border-top: 2px solid var(--accent); }
  .mobile-tabs button { flex: 1; border: none; background: none; color: #fff; font-weight: 700; font-size: 15px; }
  .mobile-tabs button.active { background: rgba(255,255,255,.12); color: #ffd84a; }
  .countdown { font-size: 120px; }
}
@media (max-height: 560px) and (min-width: 861px) { .current-ball { width: 84px; height: 84px; } .board .bn { font-size: 8px; } }

/* ---------- love theme ---------- */
#hearts { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#hearts .fh { position: absolute; bottom: -60px; animation: heartRise linear infinite; opacity: .0; filter: drop-shadow(0 2px 6px rgba(255,80,150,.5)); }
@keyframes heartRise { 0% { transform: translateY(0) translateX(0) rotate(-10deg); opacity: 0; } 10% { opacity: var(--o, .7); } 50% { transform: translateY(-55vh) translateX(var(--dx, 30px)) rotate(10deg); } 90% { opacity: var(--o, .7); } 100% { transform: translateY(-115vh) translateX(0) rotate(-10deg); opacity: 0; } }
body:not([data-screen="title"]) #hearts .fh { --o: .28; }
.logo-heart { animation: beat 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes beat { 0%, 100% { scale: 1; } 15% { scale: 1.18; } 30% { scale: .96; } 45% { scale: 1.1; } }
.beat { display: inline-block; animation: beat 1.4s ease-in-out infinite; }
.title-love { font-family: 'Lilita One', sans-serif; font-size: 26px; letter-spacing: .5px; color: #fff; text-shadow: 0 3px 0 #b0175f, 0 0 18px rgba(255,92,157,.8); text-align: center; }
.title-kids { font-size: 16px; color: #ffe1ee; text-shadow: 0 1px 3px #000; margin-top: -10px; }
.title-kids b { color: #ffd84a; }
.mini-logo::before { content: '💖 '; }
.card-head span:nth-child(3)::after { content: '♥'; font-size: .45em; vertical-align: super; margin-left: 1px; color: #ffe1ee; }
.card::before { content: ''; position: absolute; width: calc(var(--cw) * .14); height: calc(var(--cw) * .14); right: calc(var(--cw) * -.04); top: calc(var(--cw) * -.05); z-index: 4;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 96'%3E%3Cpath d='M50 88 C20 66 6 50 6 32 C6 18 17 8 30 8 C39 8 46 13 50 20 C54 13 61 8 70 8 C83 8 94 18 94 32 C94 50 80 66 50 88Z' fill='%23ff3d7f' stroke='white' stroke-width='7'/%3E%3C/svg%3E") center/contain no-repeat;
  transform: rotate(14deg); animation: beat 1.6s ease-in-out infinite; }
.cell.free { background: radial-gradient(circle at 50% 40%, #ffb3d1, #ff3d7f); color: #fff; text-shadow: 0 1px 2px rgba(120,0,40,.6); }
.cell { background: linear-gradient(180deg, #fff, #ffe9f3); box-shadow: inset 0 -3px 0 rgba(200,60,120,.18); }
.bingo-btn { background: linear-gradient(180deg, #ff9ac4, #e8246a); text-shadow: 0 2px 0 #8a0f40; box-shadow: 0 4px 0 #8a0f40; }
.bingo-btn:active { box-shadow: 0 1px 0 #8a0f40; }
.chip.sel { background: linear-gradient(180deg, #ffc2dc, #ff5c9d); color: #5a0030; box-shadow: 0 0 14px rgba(255,92,157,.6); }
.burst-rays { background: repeating-conic-gradient(rgba(255,140,190,.55) 0 10deg, transparent 10deg 20deg); }
.burst-text { -webkit-text-stroke: 6px #b0175f; text-shadow: 0 10px 0 #6a0638, 0 0 50px #ff5c9d; }
.burst-hearts { position: absolute; inset: 0; pointer-events: none; }
.burst-hearts .bh { position: absolute; left: 50%; top: 50%; animation: heartPop 1.4s ease-out forwards; }
@keyframes heartPop { from { transform: translate(-50%, -50%) scale(.2); opacity: 1; } to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.2) rotate(var(--r)); opacity: 0; } }
.toast { border-color: #ff8ab8; }
.res-row.me { background: rgba(255,92,157,.22); border-color: #ff8ab8; }
.chat-msg.me .bubble { background: rgba(255,92,157,.28); }

.server-box { background: rgba(0,0,0,.2); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.server-box summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.server-box .row { margin-top: 8px; flex-wrap: nowrap; }
.server-box input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 2px solid rgba(255,255,255,.3); background: rgba(0,0,0,.3); color: #fff; font-size: 14px; }
.server-box small { display: block; margin-top: 6px; color: var(--muted); }

/* ---------- splash / loading ---------- */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #b0175f, #5a0d4f 60%, #2a0530); transition: opacity .6s, visibility .6s; }
#splash.gone { opacity: 0; visibility: hidden; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(560px, 90vw); text-align: center; }
.splash-heart { width: 110px; height: 106px; animation: beat 1.1s ease-in-out infinite; filter: drop-shadow(0 0 24px rgba(255,92,157,.9)); }
.splash-heart svg { width: 100%; height: 100%; }
.splash-logo { width: 100%; }
.splash-bar { width: 80%; height: 16px; border-radius: 99px; background: rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.4); overflow: hidden; }
.splash-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ff9ac4, #ff3d7f, #ffd23f); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; transition: width .25s; }
@keyframes shimmer { to { background-position: -200% 0; } }
.splash-status { color: #ffe1ee; font-weight: 600; min-height: 1.3em; }
.splash-kids { color: #ffc2dc; font-size: 14px; opacity: .85; }
#splash-go { animation: goPulse 1s ease-in-out infinite alternate, screenIn .4s; }
@keyframes goPulse { to { transform: scale(1.06); box-shadow: 0 5px 0 rgba(0,0,0,.3), 0 0 30px #ff5c9d; } }

/* ---------- settings ---------- */
.settings-box { text-align: left; }
.settings-box h2 { text-align: center; margin-bottom: 10px; }
.set-row { display: grid; grid-template-columns: 1fr auto 1.2fr; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid rgba(255,255,255,.1); font-weight: 600; }
.set-row .chips { grid-column: 2 / 4; justify-content: flex-end; }
.set-row input[type=range] { margin: 0; }
.set-foot { text-align: center; margin-top: 12px; font-size: 12px; color: var(--muted); }
.daub-chip { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); padding: 0; }
.daub-chip.sel { border-color: #fff; box-shadow: 0 0 12px #fff; }

/* ---------- extra juice ---------- */
.screen.active .panel, .screen.active .title-wrap > * { animation: popIn .5s cubic-bezier(.2,1.4,.4,1) backwards; }
.screen.active .title-wrap > *:nth-child(2) { animation-delay: .08s; } .screen.active .title-wrap > *:nth-child(3) { animation-delay: .16s; }
.screen.active .title-wrap > *:nth-child(4) { animation-delay: .24s; } .screen.active .title-wrap > *:nth-child(5) { animation-delay: .32s; }
.screen.active .title-wrap > *:nth-child(n+6) { animation-delay: .4s; }
@keyframes popIn { from { opacity: 0; transform: translateY(24px) scale(.94); } }
.screen.leaving { display: flex; animation: screenOut .25s forwards; pointer-events: none; }
@keyframes screenOut { to { opacity: 0; transform: translateY(-14px) scale(.98); } }
.modal:not(.hidden) .modal-box { animation: modalIn .45s cubic-bezier(.2,1.5,.4,1); }
@keyframes modalIn { from { transform: scale(.6) translateY(40px); opacity: 0; } }
.current-ball .ball-svg.pop { animation: ballDrop .85s cubic-bezier(.3,.1,.3,1); }
@keyframes ballDrop { 0% { transform: translate(120px, -160px) rotate(260deg) scale(.5); opacity: 0; } 35% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1.05, .92); }
  50% { transform: translate(-6px, -26px) rotate(-12deg); } 65% { transform: translate(0, 0) scale(1.03, .96); } 78% { transform: translateY(-8px); } 100% { transform: none; } }
.sparkle { position: fixed; z-index: 58; pointer-events: none; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #ff9ac4, 0 0 2px #fff; animation: spark .6s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; } }
.big-btn.btn-blue { background: linear-gradient(160deg, #c28cff, #7a2bd6); }
.btn-blue { background: linear-gradient(180deg, #c28cff, #7a2bd6); }
/* splash must fit short landscape phones */
#splash { overflow: auto; }
.splash-inner { gap: min(14px, 2vh); padding: 10px 0; }
.splash-heart { width: min(110px, 15vh); height: min(106px, 14.5vh); }
.splash-logo { width: min(100%, 120vh); }

/* ---------- landscape phones (short screens) ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --top: 44px; }
  #topbar { padding: 0 8px; } .icon-btn { width: 34px; height: 34px; font-size: 15px; } .pill { padding: 3px 10px; }
  .mini-logo { font-size: 16px; }
  #screen-game { padding: 6px 64px 6px 6px; }
  .game-layout { grid-template-columns: 150px minmax(0, 1fr); gap: 6px; }
  .g-left { gap: 6px; }
  .ball-stage { padding: 4px 6px 6px; } .ball-count { font-size: 12px; top: 4px; left: 8px; }
  .current-ball { width: 70px; height: 70px; } .current-ball .placeholder { width: 60px; height: 60px; font-size: 13px; }
  .recent-balls { height: 28px; gap: 3px; } .recent-balls .ball-svg { width: 28px; height: 28px; }
  .stat-v { font-size: 18px; } .stat-l { font-size: 9px; } .stat { padding: 3px; }
  .mode-badge { font-size: 13px; padding: 4px 6px; } .mode-badge small { font-size: 8px; }
  .pattern-box { padding: 4px 8px; } .pattern-name { font-size: 12px; }
  .board, .g-right { display: none; }
  .g-center { flex-direction: row; }
  .g-controls { flex-direction: column; justify-content: center; width: 118px; flex: none; padding: 6px; gap: 8px; }
  .power-btn { min-width: 0; width: 100%; font-size: 13px; padding: 8px 4px; }
  .switch .sw-label { font-size: 12px; } .switch .slider { width: 38px; height: 22px; } .switch .slider::after { width: 16px; height: 16px; }
  .switch input:checked + .slider::after { transform: translateX(16px); }
  .speed-ctl { flex-direction: column; } .speed-ctl > span { display: none; } .speed-ctl .chips { justify-content: center; gap: 4px; }
  .g-controls .btn.small { padding: 5px 8px; font-size: 12px; }
  .mobile-tabs { display: flex; flex-direction: column; position: fixed; right: 0; top: var(--top); bottom: 0; width: 58px; height: auto; z-index: 15; background: rgba(40,6,70,.96); border-left: 2px solid var(--accent); }
  .mobile-tabs button { flex: 1; border: none; background: none; color: #fff; font-weight: 700; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
  .mobile-tabs button.active { background: rgba(255,255,255,.12); color: #ffd84a; }
  body:not([data-screen="game"]) .mobile-tabs { display: none; }
  body.tab-board .g-center, body.tab-chat .g-center { display: none; }
  body.tab-board .board { display: grid; } body.tab-board .g-left { grid-column: 1 / 3; flex-direction: row; } body.tab-board .g-left > :not(.board) { display: none; }
  body.tab-board .board { flex: 1; grid-template-columns: 22px repeat(15, 1fr); }
  body.tab-chat .g-right { display: flex; grid-column: 2; flex-direction: row; }
  body.tab-chat .g-right .players-box { max-height: none; width: 180px; }
  .countdown { font-size: 110px; }
  .room-layout { grid-template-columns: minmax(0, 1fr) 300px; height: auto; max-height: none; }
  .room-layout .chat-panel { height: calc(100vh - var(--top) - 30px); position: sticky; top: 0; }
  .title-wrap { gap: 10px; } .logo { width: min(520px, 90vw, 100vh); }
  .modal-box { max-height: 96%; padding: 12px; } .res-row { padding: 4px 8px; }
  .burst-text { font-size: 90px; } .burst-sub { margin-top: 140px; font-size: 22px; }
}
/* overflow fixes for narrow phones */
.room-layout, .room-main, .setup, .field { min-width: 0; }
.cc-btn { min-width: 0; font-size: clamp(14px, 4.2vw, 22px); }
.bingo-burst { overflow: hidden; }
.bingo-burst .burst-rays { position: absolute; left: 50%; top: 50%; width: min(900px, 150vmax); height: min(900px, 150vmax); translate: -50% -50%; }
.burst-text, .burst-sub { max-width: 100vw; text-align: center; }
@media (max-width: 860px) {
  .room-layout { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 12px; }
  .room-main { overflow-x: hidden; }
  .room-code { font-size: 38px; letter-spacing: 6px; }
}
