/* Tetris presentation only. Board coordinates, scoring and room handlers stay source-owned. */
.teacher-game-page:has(.tetris-frame) .teacher-hero { padding: 10px 0 12px; }
.teacher-game-page:has(.tetris-frame) .teacher-hero .teacher-kicker { display: none; }
.teacher-game-page:has(.tetris-frame) .teacher-hero h1 { margin: 0; font-size: 28px; }
.teacher-game-page .tetris-frame { height: max(420px, calc(100svh - 242px)); min-height: 0; }
body:has(> .wrap #board) { display: block; min-height: 0; }
.wrap:has(#board) { width: calc(100% - 24px); margin: 12px auto; padding: 12px; border: 1px solid #555561; border-radius: 12px; background: #19191f; }
.wrap:has(#board) > h1 { display: none; }
.wrap:has(#board) .game-row { gap: 14px; }
.wrap:has(#board) #board { height: min(640px, calc(100svh - 50px)); width: auto; border: 3px solid #81818e; border-radius: 4px; }
.wrap:has(#board) .info { width: 210px; padding: 12px; border-color: #4c4c5b; background: #22222b; font-size: 14px; }
.wrap:has(#board) .info .row { margin: 4px 0; line-height: 1.45; }
.wrap:has(#board) .big { color: #f8f1e7; font-size: 17px; }
.wrap:has(#board) .side-previews { margin: 10px 0; gap: 10px; }
.wrap:has(#board) .preview { height: 64px; object-fit: contain; border-color: #4c4c5b; border-radius: 4px; }
.wrap:has(#board) .preview-label { font-size: 12px; }
.wrap:has(#board) .mission-list { margin: 10px 0; padding: 8px; border-color: #4c4c5b; }
.wrap:has(#board) .mission { font-size: 12px; margin: 4px 0; }
.wrap:has(#board) .help { font-size: 12px; line-height: 1.6; margin: 8px 0 0; color: #d4d4df; }
.wrap:has(#board) button { font-family: inherit; font-size: 14px; font-weight: 800; line-height: 1.35; border: 1px solid #727281; border-radius: 6px; padding: 10px 12px; color: #f8f1e7; background: #34343f; box-shadow: inset 0 1px 0 #ffffff12; }
.wrap:has(#board) #startBtn { min-height: 52px; margin-bottom: 10px; font-size: 17px; color: #102f24; border: 2px solid #9befc1; background: #9befc1; box-shadow: inset 0 -4px 0 #1b6e3e26; }
.wrap:has(#board) button:not(:disabled):hover { border-color: #bfc0d0; background: #434350; }
.wrap:has(#board) #startBtn:not(:disabled):hover { background: #b8f7d5; border-color: #b8f7d5; }
/* Press changes the face, never the target or its neighboring layout. */
.wrap:has(#board) button:not(:disabled):active { box-shadow: inset 0 3px 0 #0004; }
.wrap:has(#board) button:focus-visible { outline: 3px solid #fff7a6; outline-offset: 3px; }
.wrap:has(#board) button:disabled { opacity: 1; color: #9d9da9; background: #292932; border-color: #454552; box-shadow: none; }
.wrap:has(#board) #startBtn:disabled { color: #b5b5c0; background: #292932; border-color: #727281; box-shadow: none; }
.wrap:has(#board) .battle-lobby { margin: 14px 0 0; padding: 12px; background: #22222b; border-color: #4c4c5b; }
.wrap:has(#board) .battle-lobby::before { content: attr(aria-label); display: block; margin-bottom: 12px; font-size: 16px; font-weight: 800; }
.wrap:has(#board) .battle-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
.wrap:has(#board) .battle-create { grid-column: 1 / -1; }
.wrap:has(#board) .battle-join { display: grid; grid-template-columns: 1fr; }
.wrap:has(#board) .battle-join input { width: 100%; }
.wrap:has(#board) .gg-room-directory { padding: 10px; margin-top: 12px; border-radius: 6px; background: #19191f; color: #f8f1e7; box-shadow: none; }
.wrap:has(#board) .gg-room-directory__head { flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wrap:has(#board) .gg-room-directory .gg-room-directory__head h2 { font-size: 16px; white-space: nowrap; }
.wrap:has(#board) .gg-room-directory button.gg-room-directory__refresh { font-size: 14px; margin-left: auto; }
.wrap:has(#board) .gg-room-directory__empty { font-size: 13px; color: #d4d4df; }
.wrap:has(#board) .status { min-height: 0; font-size: 13px; }
/* Disabled Start means a solo round only while no real room connection is present. */
.wrap:has(#startBtn:disabled):not(:has(#battleLeave:enabled)):not(.battle-active) .battle-lobby { display: none; }
@media (min-width: 900px) and (min-height: 521px) {
  .wrap:has(#board) { display: grid; grid-template-columns: minmax(0,1fr) 230px; gap: 16px; align-items: start; }
  .wrap:has(#board) .game-row { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: auto 210px; justify-content: center; align-items: start; }
  .wrap:has(#board) .battle-lobby { grid-column: 2; grid-row: 1; margin: 0; }
  .wrap:has(#startBtn:disabled):not(:has(#battleLeave:enabled)):not(.battle-active), .wrap.battle-active { grid-template-columns: 1fr; }
}
.wrap.battle-active .battle-lobby::before { display: none; }
.wrap.battle-active .battle-lobby { grid-column: 1 / -1; grid-row: auto; }
.wrap.battle-active .battle-arena { grid-column: 1 / -1; }
@media (max-width: 899px) and (min-width: 761px) {
  .wrap:has(#board) { display: flex; flex-direction: column; }
  .wrap:has(#board) .game-row { order: 1; }
  .wrap:has(#board) .battle-lobby { order: 2; }
}
@media (max-width: 760px) {
  .teacher-game-page:has(.tetris-frame) .teacher-topbar { gap: 4px; padding-block: 4px; }
  .teacher-game-page:has(.tetris-frame) .teacher-scoreboard { padding-bottom: 0; }
  .teacher-game-page:has(.tetris-frame) .teacher-scoreboard span { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
  .teacher-game-page:has(.tetris-frame) .teacher-hero { padding: 6px 0; }
  .teacher-game-page:has(.tetris-frame) .teacher-hero h1 { font-size: 22px; }
  .teacher-game-page:has(.tetris-frame) .arcade-sound-bar { padding: 4px 8px; min-height: 44px; }
  .teacher-game-page .tetris-frame { height: max(430px,calc(100svh - 265px)); }
  .wrap:has(#board) { width: calc(100% - 12px); margin: 6px auto; padding: 6px; }
  .wrap:has(#board) .game-row { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(112px,1fr); gap: 8px; }
  .wrap:has(#board) #board { grid-row: 1; width: auto; max-width: 100%; height: min(calc(100svh - 94px), 102vw); max-height: none; justify-self: center; }
  .wrap:has(#board) .info { grid-column: 2; grid-row: 1; width: 100%; padding: 6px; }
  .wrap:has(#board) .info .row { font-size: 12px; margin: 2px 0; line-height: 1.3; }
  .wrap:has(#board) .big { font-size: 13px; }
  .wrap:has(#board) #startBtn { min-height: 44px; font-size: 14px; padding: 8px 4px; }
  .wrap:has(#board) .preview { height: 40px; }
  .wrap:has(#board) .side-previews { margin: 6px 0; }
  .wrap:has(#board) .mission-list { display: block; padding: 5px; margin: 6px 0; }
  .wrap:has(#board) .mission { display: block; font-size: 11px; }
  .wrap:has(#board) .mission b { margin-left: 4px; }
  .wrap:has(#board) .touch-controls { grid-column: 1 / -1; grid-row: 2; width: 100%; grid-template-columns: repeat(6,minmax(0,1fr)); }
  .wrap:has(#board) .touch-controls button { padding: 6px 2px; min-height: 44px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .teacher-game-page .tetris-frame { height: max(300px,calc(100svh - 70px)); }
  .wrap:has(#board) { margin: 4px auto; padding: 4px; }
  .wrap:has(#board) .game-row { grid-template-columns: auto 132px 220px; gap: 8px; }
  .wrap:has(#board) #board { height: calc(100svh - 20px); width: auto; }
  .wrap:has(#board) .info { width: 220px; max-height: calc(100svh - 20px); overflow: auto; }
  .wrap:has(#board) .mission-list { display: block; }
}
@media (min-width: 900px) and (max-height: 520px) and (pointer: fine) {
  .wrap:has(#board) .game-row { grid-template-columns: auto 210px; justify-content: center; }
  .wrap:has(#board) .touch-controls { display: none; }
  .wrap:has(#board) .info { grid-column: 2; width: 210px; padding: 8px; font-size: 12px; }
  .wrap:has(#board) .info .row { margin: 2px 0; }
  .wrap:has(#board) .side-previews { margin: 6px 0; }
  .wrap:has(#board) .preview { height: 40px; }
  .wrap:has(#board) .mission-list { margin: 6px 0; padding: 5px; }
  .wrap:has(#board) .help { display: block; font-size: 11px; line-height: 1.4; }
}
