/* Holsha: спільна розкладка міні-ігор (корінь отримує .t19 від frame.js).
   Поле зберігає власні пропорції (--field-w / --field-h з frame.js). */
html,body{height:100%;margin:0;overflow:hidden;background:#fff}
.t19{height:100%;max-width:none;margin:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;padding:14px;gap:12px}
.t19 [hidden]{display:none!important}
.t19>*{min-width:0}
.t19 a{color:inherit}

.t19 .ba-game-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;padding:0 0 12px;margin:0;border-bottom:1px solid #ccc;align-items:center}
.t19 .ba-game-head>div:first-child{display:flex!important;flex-direction:column;align-items:flex-start;gap:5px;min-width:0}
.t19 .ba-game-head h3{font-size:23px;line-height:1;margin:0}
.t19 .ba-game-head .ba-kicker{font-size:10px;color:#666;letter-spacing:.06em;margin:0}
.t19 .ba-stats-top{margin:0;padding:0;gap:16px;font-size:11px;flex-wrap:nowrap;align-items:center}
.t19 .ba-stats-top span{display:flex;flex-direction:column;gap:5px;white-space:nowrap}
.t19 .ba-stats-top b{font-size:21px}

.t19 .ba-game-layout{display:grid;grid-template-columns:var(--field-w,300px) 170px;grid-template-rows:minmax(0,1fr);justify-content:center;align-items:center;gap:28px;border:0;background:#fff;min-height:0;min-width:0}
.t19 .ba-board-shell{border:0;padding:0;min-height:0;min-width:0;display:flex;justify-content:center;align-items:center}
.t19 .ba-canvas-wrap{width:var(--field-w,300px);height:var(--field-h,400px);max-width:none;margin:0;aspect-ratio:auto;flex-shrink:0}
/* Some games (pong, maze) make the field wrapper grow (flex:1, width:100%, aspect-ratio on phones): the fitted size always wins. */
.t19 .ba-board-shell>.ba-canvas-wrap{flex:0 0 auto!important;width:var(--field-w,300px)!important;height:var(--field-h,400px)!important;min-height:0!important;aspect-ratio:auto!important}
/* Pipes: the board takes all free space; the game itself fits its square grid inside (applyBoardSize). */
.ba-flow-connect.t19 .ba-game-layout{grid-template-columns:minmax(0,1fr) 170px;justify-content:stretch;align-items:stretch}
.ba-flow-connect.t19 .ba-board-shell{align-items:stretch}
.ba-flow-connect.t19 .ba-board-wrap{width:100%;height:100%;min-height:0}
@media(max-width:520px){.ba-flow-connect.t19 .ba-game-layout{grid-template-columns:minmax(0,1fr)}}
/* Tile games (match three, memory): the square tile board takes the fitted square. */
.t19 .ba-board-wrap{width:var(--field-w,300px);height:var(--field-h,300px);max-width:none;min-height:0;margin:0;aspect-ratio:auto;flex-shrink:0;box-sizing:border-box}
.t19 .ba-side{padding:0;background:#fff;min-height:0;display:flex;flex-direction:column;justify-content:center;border:0}
.t19 .ba-controls-zone{margin:0;padding:0}
.t19 .ba-controls-zone button{min-height:52px}
.t19 .ba-stats-top span.arcade-stat-value{display:inline;white-space:nowrap;color:#777}
.t19 .arcade-stat-value b{color:#111}
/* Games whose only side control moved to the footer: the field takes the whole width. */
.t19-noside.t19 .ba-game-layout{grid-template-columns:var(--field-w,300px);grid-template-rows:minmax(0,1fr)}
@media(max-width:520px){.t19-noside.t19 .ba-game-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}}
/* Pipes: compact START / level cards so they fit the smaller board on phones. */
@media(max-width:520px),(max-height:520px){.ba-flow-connect.t19 .ba-start-card,.ba-flow-connect.t19 .ba-level-card{padding:14px 16px;box-shadow:4px 4px 0 #111}.ba-flow-connect.t19 .ba-start-card strong,.ba-flow-connect.t19 .ba-level-card strong{font-size:22px;line-height:1.05}.ba-flow-connect.t19 .ba-start-card small{margin:6px 0 10px}.ba-flow-connect.t19 .ba-start-card button,.ba-flow-connect.t19 .ba-level-card button{min-height:44px}}
.t19 .arcade-arrow{display:inline-flex;vertical-align:-.18em;line-height:0;pointer-events:none}

.t19 .arcade-footer{border-top:1px solid #ccc;padding-top:10px}
.t19 .arcade-footer p{font:13px/1.5 system-ui,sans-serif;color:#555;margin:0 0 8px}
.t19 .arcade-footer>div{display:flex;justify-content:space-between;gap:10px}
.t19 .arcade-footer button{border:0;background:transparent;padding:5px 0;color:#111;text-decoration:underline;cursor:pointer;font-size:13px}

@media(max-width:520px){
.t19{padding:10px;gap:10px}
.t19 .ba-game-head{gap:7px;padding-bottom:8px}
.t19 .ba-game-head h3{font-size:15px}
.t19 .ba-game-head .ba-kicker{font-size:8px}
.t19 .ba-stats-top{gap:9px;font-size:8px}
.t19 .ba-stats-top b{font-size:16px}
.t19 .ba-game-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;justify-content:stretch;align-items:stretch;gap:10px}
.t19 .ba-side{display:block}
.t19 .ba-controls-zone button{min-height:48px}
.t19 .arcade-footer p{font-size:12px;margin-bottom:4px}
.t19 .arcade-footer button{font-size:12px}
}
/* Narrow phones: the record (BEST) gives way to the indicators needed during play. */
@media(max-width:420px){.t19 .ba-stats-top>span.arcade-stat-best{display:none}.t19 .ba-stats-top{gap:8px}}
.t19 .ba-stats-top>span.arcade-stat-moved b{letter-spacing:.02em}
/* Many indicators : on phones the title and the indicators take separate rows. */
@media(max-width:520px){
.t19-many-stats.t19 .ba-game-head{grid-template-columns:minmax(0,1fr);gap:6px}
.t19-many-stats.t19 .ba-game-head>div:first-child{flex-direction:row;align-items:baseline;gap:8px}
.t19-many-stats.t19 .ba-stats-top{justify-content:space-between;gap:6px}
.t19-many-stats.t19 .ba-stats-top>span{gap:3px}
}
/* Narrow phones: the title stays as a compact line above the indicators. */
@media(max-width:420px){
.t19-many-stats.t19 .ba-game-head>div:first-child{display:flex!important}
.t19-many-stats.t19 .ba-game-head .ba-kicker{display:none}
}
/* Maze game: on phones the four direction buttons go in one row (← ↑ ↓ →) so the maze keeps its size. */
@media(max-width:520px){
.ba-host-run.t19 .ba-dpad{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.ba-host-run.t19 .ba-dpad>span{display:none}
.ba-host-run.t19 .ba-dpad [data-ba-dir="left"]{order:1}
.ba-host-run.t19 .ba-dpad [data-ba-dir="up"]{order:2}
.ba-host-run.t19 .ba-dpad [data-ba-dir="down"]{order:3}
.ba-host-run.t19 .ba-dpad [data-ba-dir="right"]{order:4}
}
@media(max-height:500px){
.t19{padding:8px;gap:7px}
.t19 .ba-game-head{padding-bottom:6px}
.t19 .ba-game-head h3{font-size:16px}
.t19 .ba-game-head .ba-kicker{display:none}
.t19 .ba-stats-top b{font-size:16px}
.t19 .arcade-footer{padding-top:6px}
.t19 .arcade-footer p{font-size:11px;line-height:1.3;margin-bottom:3px}
}

/* Second template (push, slider and tank games): the game fits its own board inside the stage, so the stage takes all free space. */
.t19-fill.t19 .ba-game-layout{grid-template-columns:minmax(0,1fr) 190px;justify-content:stretch;align-items:stretch;border:0;background:#fff}
.t19-fill.t19 .ba-board-shell{display:flex!important;flex-direction:column;padding:0!important;border:0!important;min-height:0}
.t19-fill.t19 .ba-stage{flex:1 1 auto;width:100%;min-height:0!important;aspect-ratio:auto!important}
.t19-fill.t19 .ba-controls-zone{margin:0!important;padding:0!important}
.t19-fill.t19 .ba-dpad{width:100%}
.t19-fill.t19 .ba-controls-zone button{min-height:48px}
.t19-fill.t19 .ba-game-head>div:first-child{justify-self:stretch;align-items:flex-start!important;text-align:left}
/* Start / level cards of these games: compact on phones and in low windows so they fit the board. */
@media(max-width:520px),(max-height:520px){
.t19-fill.t19 .ba-panel{padding:14px 16px!important;box-shadow:4px 4px 0 #111}
.t19-fill.t19 .ba-panel strong{font-size:22px!important;line-height:1.05}
.t19-fill.t19 .ba-panel p{margin:6px 0 10px!important;font-size:13px}
.t19-fill.t19 .ba-panel button{min-height:44px}
}
@media(max-width:520px){
/* Slider: PREVIEW, UNDO and RESTART in one row on phones. */
.ba-brand-slider.t19 .ba-controls-zone{display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:6px}
.ba-brand-slider.t19 .ba-actions{display:contents}
.ba-brand-slider.t19 .ba-preview{margin:0!important;min-height:48px;font-size:13px!important}
.t19-fill.t19 .ba-game-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
.t19-fill.t19 .ba-dpad{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.t19-fill.t19 .ba-dpad>span{display:none}
.t19-fill.t19 .ba-dpad [data-dir="left"]{order:1}
.t19-fill.t19 .ba-dpad [data-dir="up"]{order:2}
.t19-fill.t19 .ba-dpad [data-dir="down"]{order:3}
.t19-fill.t19 .ba-dpad [data-dir="right"]{order:4}
.t19-fill.t19 .ba-actions{margin-top:6px}
.ba-bc3.t19 .ba-controls-zone{display:grid;grid-template-columns:minmax(0,4fr) minmax(0,1.3fr);gap:6px;align-items:stretch}
.ba-bc3.t19 .ba-fire{margin:0!important;min-height:48px}
}

/* Snake: on phones the five direction/boost buttons go in one row so the field keeps its size. */
@media(max-width:520px){.ba-digital-snake.t19 .ba-dpad{grid-template-columns:repeat(5,minmax(0,1fr));grid-template-areas:"left up boost down right";gap:6px}.ba-digital-snake.t19 .ba-dpad button{min-height:48px}}

/* End-of-game card (ba-over): fits the field on phones. */
.t19 .ba-over{padding:6px;align-items:center;justify-content:center}
.t19 .ba-over-card{box-sizing:border-box;min-width:0;width:min(100%,520px);max-height:100%;overflow:auto}
