/* Shared rhythm-game ergonomics; each game's palette remains local. */
body[data-mtl-game] { --muted:#a7b7d0; padding:76px 20px 24px; overflow-y:auto; }
body[data-mtl-game] button,body[data-mtl-game] summary { touch-action:manipulation; }
body[data-mtl-game] button:focus-visible,body[data-mtl-game] summary:focus-visible { outline:3px solid #b5f3ed; outline-offset:4px; }
body[data-mtl-game] input[type="text"],body[data-mtl-game] select { min-height:44px; }
body[data-mtl-game] .mtl-setup { width:min(100%,1000px); max-width:1000px; margin:0 auto; padding:28px; display:grid; grid-template-columns:1fr 1fr; align-items:start; gap:32px; height:auto; max-height:none; overflow:visible; }
.mtl-setup-intro,.mtl-setup-form { min-width:0; }
body[data-mtl-game] .mtl-setup-intro img { width:100%; max-width:100%; height:auto; aspect-ratio:16/9; object-fit:contain; border-radius:14px; margin:0 0 18px; filter:none; animation:none; }
body[data-mtl-game] .mtl-setup-intro .hero { margin:0; padding:0; }
body[data-mtl-game] .mtl-setup-intro .subtitle,body[data-mtl-game] .mtl-setup-intro .game-subtitle { color:#d0dced; font-size:.95rem; line-height:1.6; margin:0; }
.mtl-quick-guide { color:#a7b7d0; font-size:.8rem; line-height:1.8; margin:16px 0 0; }
body[data-mtl-game] .mtl-setup-form>.setup-card,body[data-mtl-game] .mtl-setup-form>.section,body[data-mtl-game] .mtl-setup-form>.setup-section { margin:0; padding:0; border:0; background:none; box-shadow:none; }
body[data-mtl-game] .mtl-setup-form>button { width:100%; min-height:52px; margin:18px 0 0; }
.mtl-teacher-options { border-top:1px solid #9aabc333; margin-top:20px; padding-top:6px; }
.mtl-teacher-options summary { min-height:48px; padding:14px 0; font-size:.8rem; font-weight:600; color:#b7c8df; cursor:pointer; }
body[data-mtl-game] .mtl-teacher-options>.setup-card,body[data-mtl-game] .mtl-teacher-options>.section,body[data-mtl-game] .mtl-teacher-options>.setup-section { margin:16px 0 0; padding:16px; border:1px solid #9aabc333; border-radius:12px; background:#0a111b55; }
body[data-mtl-game] .mtl-teacher-options .figure-list,body[data-mtl-game] .mtl-teacher-options .figures-grid { grid-template-columns:repeat(auto-fit,minmax(100px,1fr)); }
body[data-mtl-game] .meter,body[data-mtl-game] .ghost,body[data-mtl-game] .btn-restart { min-height:44px; }
/* Board sizing follows the panel's available width, including padding. */
body[data-mtl-game].game-active { padding:76px 20px 20px; overflow:auto; }
body[data-mtl-game].game-active .app { height:auto; min-height:calc(100dvh - 96px); }
body[data-mtl-game] #game-screen { height:auto; min-height:0; max-height:none; padding:20px; overflow:visible; }
body[data-mtl-game] .game-header { gap:14px; }
body[data-mtl-game] .game-header h2 { margin:0; font-size:clamp(1.2rem,3vw,1.7rem); line-height:1.3; }
body[data-mtl-game] .game-message { color:#bdcbe0; line-height:1.5; }
body[data-mtl-game] .header-actions { gap:6px; }
body[data-mtl-game] .header-actions button { font-size:.75rem; padding:8px 12px; color:#bdcbe0; }
body[data-mtl-game] .board { box-sizing:border-box; width:100%; min-width:0; margin:20px auto 0; max-width:760px; }
body[data-mtl-game="tictactoe-ritmico"] .board { grid-template-columns:repeat(3,minmax(0,1fr)); max-width:780px; }
body[data-mtl-game="tictactoe-ritmico"] .board-cell { min-width:0; min-height:100px; }
body[data-mtl-game="tictactoe-ritmico"] .cell-rhythm { width:100%; min-width:0; }
body[data-mtl-game="conecta4-ritmico"] .board-wrap { display:block; width:100%; min-width:0; }
body[data-mtl-game="conecta4-ritmico"] .board { aspect-ratio:7/6; gap:6px; padding:10px; max-width:700px; }
body[data-mtl-game="conecta4-ritmico"] .cell { min-width:0; min-height:0; border-radius:50%; aspect-ratio:1; }
body[data-mtl-game="conecta4-ritmico"] .scoreboard { grid-template-columns:repeat(2,minmax(0,1fr)); margin-top:16px; }
body[data-mtl-game] .score-card { min-width:0; }
body[data-mtl-game] .challenge-card { max-height:calc(100dvh - 110px); overflow:auto; }
body[data-mtl-game] .challenge-actions { display:flex; gap:10px; }
body[data-mtl-game] #challenge-tap,body[data-mtl-game] #tap-btn { min-height:64px; }
body[data-mtl-game] #game-area { margin-top:0; padding-top:0; }
body[data-mtl-game="kaboom"] #rr-tap-btn { min-height:72px; min-width:180px; }
body[data-mtl-game="kaboom"] #card:focus-visible { outline:3px solid #f4d271; outline-offset:6px; }
body[data-mtl-game="stacking-blocks"] .modal-overlay { padding-top:76px; }
@media(max-width:767px) {
 body[data-mtl-game],body[data-mtl-game].game-active { padding:76px 16px 20px; }
 body[data-mtl-game] .mtl-setup { grid-template-columns:1fr; gap:24px; padding:20px; border-radius:20px; }
 body[data-mtl-game] .mtl-setup-intro img { margin-bottom:14px; }.mtl-quick-guide{font-size:.75rem;margin-top:10px;}
 body[data-mtl-game] .mtl-setup-intro .subtitle,body[data-mtl-game] .mtl-setup-intro .game-subtitle { font-size:.85rem; }
 body[data-mtl-game] #game-screen { padding:16px 12px; }
 body[data-mtl-game] .header-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; }
 body[data-mtl-game="tictactoe-ritmico"] .header-actions { grid-template-columns:repeat(3,minmax(0,1fr)); }
 body[data-mtl-game] .header-actions button { font-size:.67rem; padding:6px; }
 body[data-mtl-game] .eyebrow.small { font-size:.65rem; margin-bottom:6px; }
 body[data-mtl-game] .board { margin-top:16px; }
 body[data-mtl-game="tictactoe-ritmico"] .board { gap:6px; }
 body[data-mtl-game="tictactoe-ritmico"] .board-cell { padding:8px 4px; min-height:104px; }
 body[data-mtl-game="conecta4-ritmico"] .board { padding:7px; gap:4px; }
 body[data-mtl-game="conecta4-ritmico"] .score-card { padding:10px; gap:3px; }
 body[data-mtl-game="conecta4-ritmico"] .score-card .score-name { font-size:.8rem; overflow-wrap:anywhere; }
 body[data-mtl-game="conecta4-ritmico"] .piece-symbol { font-size:clamp(1.2rem,5vw,2rem); }
}
@media(prefers-reduced-motion:reduce) { body[data-mtl-game] .game-logo,body[data-mtl-game] .hero-logo { animation:none; } }

body[data-mtl-game] [hidden] { display:none!important; }
body[data-mtl-game="detective"] .app-shell { width:min(100%,1080px); margin:auto; }
body[data-mtl-game="detective"] .mtl-setup-intro .hero { text-align:left; }
body[data-mtl-game="detective"] .hero-logo-wrap { max-width:100%; margin:0; }
body[data-mtl-game="detective"] .hero-logo-wrap::after { display:none; }
body[data-mtl-game="detective"] .hero h1 { font-size:1.4rem; letter-spacing:.06em; margin:12px 0; }
body[data-mtl-game="detective"] .hero .eyebrow { color:#a7b7d0; font-size:.65rem; }
body[data-mtl-game="detective"] .intro { font-size:.9rem; line-height:1.6; }
body[data-mtl-game="detective"] .mtl-teacher-options .setup-grid { grid-template-columns:1fr; }
body[data-mtl-game="detective"] .mtl-setup-form>.setup-group { padding:0; }
body[data-mtl-game="detective"] #figuras-selector { border-top:0!important; margin-top:12px!important; padding-top:0!important; }
body[data-mtl-game="detective"] .opciones-figuras { grid-template-columns:repeat(2,minmax(0,1fr)); }
body[data-mtl-game="detective"] .oculto { display:none!important; }

body[data-mtl-game="stacking-blocks"].game-mode #game-area { width:100%; max-width:1200px; min-height:calc(100dvh - 96px); height:calc(100dvh - 96px); padding:12px; margin:0 auto; border-radius:20px; border:1px solid #91deff4d; }
body[data-mtl-game="stacking-blocks"].game-mode .tower-card { width:100%; max-width:680px; }
body[data-mtl-game="stacking-blocks"] .scoreboard { grid-template-columns:repeat(2,minmax(0,1fr)); }
body[data-mtl-game="kaboom"] { height:auto; min-height:100dvh; }

@media(max-width:767px) {
 body[data-mtl-game="detective"] #soloStatsBar { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; padding:10px; }
 body[data-mtl-game="detective"] #soloStatsBar .stat { padding:6px; }
 body[data-mtl-game="detective"] #soloStatsBar .stat span:first-child { font-size:.66rem; }
 body[data-mtl-game="detective"] #soloStatsBar .stat span:last-child { font-size:1rem; }
 body[data-mtl-game="detective"] .mugshot-lines { min-height:60px; }
 body[data-mtl-game="detective"] .suspect { padding:10px 8px; }
 body[data-mtl-game="detective"] .suspect button { min-height:44px; }
}

body[data-mtl-game="stacking-blocks"].game-mode .scoreboard { width:100%; max-width:680px; }
body[data-mtl-game="stacking-blocks"].game-mode .game-topbar,body[data-mtl-game="stacking-blocks"].game-mode .game-layout {min-width:0;max-width:100%;}

@media(max-width:400px) {
 body[data-mtl-game="conecta4-ritmico"].game-active { padding-left:8px; padding-right:8px; }
 body[data-mtl-game="conecta4-ritmico"] #game-screen { padding-left:4px; padding-right:4px; }
 body[data-mtl-game="conecta4-ritmico"] .board { padding:6px; gap:3px; }
}
