.topbar {flex-wrap:wrap}
.toolbar-actions {flex-wrap:wrap;justify-content:flex-end}
.room-panel {width:min(100%,850px);margin:12px auto 18px;padding:clamp(14px,2.2vw,24px);background:#fffdf5;border:2px solid #42695d;border-radius:18px;box-shadow:0 4px 0 #28554a33;color:#244a43}
.room-panel :is(h2,h3,p) {margin:0}
.room-panel h2 {font:850 clamp(19px,3vw,28px)/1.15 var(--round)}
.room-head,.room-actions,.room-fields {display:flex;flex-wrap:wrap;align-items:center;gap:9px 14px}
.room-head {justify-content:space-between;align-items:flex-start}
.room-head p,.room-panel #student-help {font-size:.9rem;line-height:1.5;margin-top:5px}
#room-code-show {font:850 clamp(20px,4vw,32px)/1.1 var(--round);letter-spacing:.1em;border-radius:10px;color:#164e4a;background:#e0f4ed;padding:7px 12px;user-select:all}
.room-panel .room-actions,.room-fields,.room-roster,#room-roster-summary,#room-exit,#room-join,.room-picker {margin-top:12px}
.room-panel button,.room-panel select,.room-panel input:not([type=checkbox]) {min-height:42px;border:1px solid #67877c;border-radius:9px;background:white;padding:7px 12px;color:#20493e;font:700 .9rem/1.25 var(--round)}
.room-panel .room-primary {background:#195d56;color:white;border-color:#195d56}
.room-panel button:disabled {opacity:.55}
.room-panel button:focus-visible,.room-panel input:focus-visible,.room-panel select:focus-visible {outline:3px solid #a13541;outline-offset:2px}
.room-fields label,#room-join label {display:grid;gap:4px;font-size:.8rem;font-weight:750}
.room-fields label:first-child {flex:1;min-width:min(220px,100%)}
.room-picker,.room-roster {border-top:1px solid #cadbd3;padding-top:8px}
.room-panel summary {cursor:pointer;font-weight:750;padding:5px 0}
#room-words,#word-bank {display:flex;flex-wrap:wrap;gap:7px;padding:10px 1px}
#room-words {max-height:240px;overflow:auto}
#room-words label {background:#edf4ed;border:1px solid #b5cbc0;padding:5px 9px;border-radius:8px;font-size:.85rem}
#room-code-input {text-transform:uppercase;letter-spacing:.12em;max-width:10em}
#room-notice:not(:empty),.room-win,.room-winners {margin-top:11px;border-radius:10px;padding:9px 12px;background:#fff0bc;color:#563e14;font-weight:700}
.room-win,.room-winners {background:#dcf3df;color:#175e44}
.room-panel ul {margin:6px 0;padding-inline-start:22px}
#room-roster {columns:2}
.board-layout {display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:16px;margin-top:12px}
.board-layout:has(.word-tray:not([hidden])) {grid-template-columns:minmax(0,3fr) minmax(135px,1.4fr)}
.bingo-sheet {display:grid;grid-template-columns:repeat(var(--size),minmax(0,1fr));gap:clamp(3px,1vw,8px);max-width:595px;width:100%;margin:0 auto}
.room-panel .square {min-width:0;min-height:0;aspect-ratio:1;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;overflow-wrap:anywhere;line-height:1.08;font-size:clamp(10px,1.7vw,16px);background:#fffcf1;padding:3px;border:2px solid #a6bdb0;text-align:center}
.square[data-empty] {border-style:dashed;color:#6a8174}
.square.marked::after {content:"";position:absolute;inset:5%;border:clamp(3px,.55vw,6px) solid #d53445;border-radius:50%;pointer-events:none;transform:rotate(-8deg)}
.square.marked {background:#fff4ec}
.word-tray {background:#edf5ef;border-radius:12px;padding:10px;min-width:0}
#word-bank {align-content:flex-start;max-height:min(55vh,510px);overflow:auto}
.word-tray h3,.room-winners h3 {font-size:1rem}
.room-panel .bank-word {min-height:36px;padding:5px 8px;font-size:.83rem}
.room-panel [aria-pressed=true].move-word,.room-panel .drop-target {outline:3px solid #196f69;outline-offset:-3px;background:#d8f2e5}
.move-word {touch-action:manipulation}
.square.move-word,.mobile-drag {touch-action:none;user-select:none}
.drag-ghost {position:fixed;pointer-events:none;z-index:9999;background:#fff6d2;color:#264c48;border:2px solid #247469;border-radius:10px;padding:7px 10px;font:750 14px var(--round);transform:translate(8px,8px)}
body.room-active .mast :is(.selection-controls,.category-panel,.set-words),body.room-student .game,body.room-wait .game {display:none}
body.room-student :is(#voice-toggle,#reset),body.room-active :is(#reset,#room-open) {display:none}
body.room-active .mast {margin:5px auto 12px;pointer-events:auto}
@media(max-width:640px){.board-layout:has(.word-tray:not([hidden])){grid-template-columns:1fr}.room-panel{padding:12px}.room-panel .room-actions{gap:7px}.room-panel .room-actions button{font-size:.8rem}#word-bank{max-height:200px}.room-panel .square{font-size:clamp(10px,2.9vw,15px)}}

.room-panel .room-win {display:flex;align-items:center;gap:12px;font-size:1.4rem}
.room-win::before {content:"";width:68px;height:68px;flex:none;background:transparent url("/class-bingo/bingo-bird.webp") center/contain no-repeat}
.room-panel .bank-word {display:inline-flex;align-items:center;gap:2px;touch-action:pan-y;padding-left:2px}
.word-grip {display:inline-flex;align-items:center;justify-content:center;min-width:23px;min-height:30px;touch-action:none;cursor:grab;color:#577c6f}
.room-panel #word-filter {width:100%;margin-top:7px;font-weight:500}

.bingo-toast {position:fixed;z-index:999;inset:auto max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) auto;max-width:min(450px,calc(100vw - 24px));padding:12px 18px;border:2px solid #39785f;border-radius:14px;background:#e1f5df;color:#164e3d;font:850 clamp(17px,3vw,24px)/1.2 var(--round);box-shadow:0 4px 18px #183c3a40;overflow-wrap:anywhere;pointer-events:none}

.word-picture {display:block;width:48px;height:48px;flex:none;overflow:hidden;pointer-events:none;user-select:none}
#word-bank {display:grid;grid-template-columns:repeat(auto-fill,minmax(min(86px,100%),1fr));align-items:stretch;gap:7px}
.room-panel .bank-word {display:flex;position:relative;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-width:0;padding:4px 3px 6px;text-align:center}
.bank-word .word-picture {width:clamp(51px,6vw,68px);height:clamp(51px,6vw,68px)}
.bank-word .bank-label {line-height:1.12;overflow-wrap:anywhere}
.bank-word .word-grip {position:absolute;right:0;top:0;min-width:22px;min-height:24px;font-size:13px;opacity:.76}
.square .word-picture {width:min(67%,105px);height:auto;aspect-ratio:1;min-height:0;flex:0 1 auto}
.square > span {max-width:100%}
.drag-ghost {display:flex;align-items:center;gap:6px}
.drag-ghost .word-picture {width:45px;height:45px}
#room-words label {display:inline-flex;align-items:center;gap:4px}
#room-words .word-picture {width:38px;height:38px}
@media(max-width:640px){#word-bank{max-height:290px}.square .word-picture{width:min(68%,82px)}}
