html { --game-height: var(--telegram-height, 100dvh); --safe-top: max(env(safe-area-inset-top, 0px), var(--platform-safe-top, 0px)); --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--platform-safe-bottom, 0px)); }
html { overscroll-behavior: none; }
html.zoom-open { overflow: hidden; }
#app, .select, .screen { min-height: var(--game-height); }
.home { max-width: 480px; margin-inline: auto; }
#board { min-width: 0; }
#board, #board .scene, #board .target, #zoomViewport, #zoomViewport .scene, #zoomViewport .target { touch-action: none; }
#board, #zoomViewport { user-select: none; -webkit-user-select: none; }
.zoomLayer { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: var(--game-height); bottom: auto; overflow: hidden; padding-inline: max(10px, env(safe-area-inset-left, 0px), var(--platform-safe-left, 0px)) max(10px, env(safe-area-inset-right, 0px), var(--platform-safe-right, 0px)); }
.zoomLayer #zoomViewport { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.zoomLayer .frame { width: var(--zoom-width, min(100%, 820px)); max-width: none; margin: 0 auto 6px; }
.volume-control { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; margin: .6rem 0; font-size: .85rem; }
.volume-control input { width: min(9rem, 45vw); min-height: 32px; accent-color: #f7d27c; }
#cloudStatus { padding-inline: 12px; }
#cloudStatus:empty { display: none; }
@media (min-width: 700px) {
  #app { max-width: 1100px; }
  .select, #notice { max-width: 900px; margin-inline: auto; }
  #board:not(:has(.pair)) { width: min(100%, 660px); margin-inline: auto; }
  .pair .compareWindow { aspect-ratio: var(--scene-aspect, 599/1312); max-height: max(360px, calc(var(--game-height) - 145px)); }
  #board .pair .compareWindow .scene { width: 100%; }
  #board .pair .frame { margin: 0; }
}
@media (orientation: landscape) and (max-height: 650px) {
  #app { max-width: 1100px; }
  #game { display: grid; grid-template-columns: minmax(0, 1fr) clamp(128px, 30vw, 220px); column-gap: 12px; align-content: start; align-items: start; }
  #game > .bar, #game > #heading, #game > #sceneTitle { grid-column: 1 / -1; }
  #game > #board { grid-column: 1; grid-row: 4 / span 6; width: 100%; }
  #game > :is(#zoomButtons,#paws,#message,.actions,.game-toolbar,.tip,.volume-control) { grid-column: 2; margin-block: 4px; flex-wrap: wrap; }
  #game .heading { margin: 5px 0 2px; font-size: 19px; }
  #game #sceneTitle { margin: 2px 0 8px; }
  .zoomTitle { margin: 3px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mark, .hintpulse { animation: none; }
}

#bootSplash { display: none; }
@media (display-mode: standalone) {
  html:not(.app-ready) #bootSplash { display: flex; position: fixed; inset: 0; z-index: 3000; align-items: center; justify-content: center; gap: 16px; flex-direction: column; background: #1b3d31; color: #ffecb7; font-size: 1.4rem; }
  #bootSplash img { width: 96px; height: 96px; border-radius: 22px; }
}

#game>.bar { display:grid; grid-template-columns:1fr auto 1fr; }
#game>.bar>button { justify-self:start; }
#game>.bar>#levelName { grid-column:2; }
.pair.independent-pair { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; align-items:start; }
.pair.independent-pair .frame { width:100%; margin:0; }
.diff-card { min-width:0; }
.diff-tools { display:flex; gap:5px; justify-content:flex-end; align-items:center; margin-bottom:7px; color:#ffecb7; font-size:.8rem; }
.diff-tools span { margin-right:auto; }
.diff-tools .btn { padding:2px 9px; min-width:32px; min-height:32px; border-width:2px; border-radius:12px; }
.diff-tools .btn:disabled { opacity:.45; }
#board .independent-pair .compareWindow { width:100%; aspect-ratio:var(--photo-ratio); touch-action:none; max-height:min(65dvh,520px); }
#board .independent-pair .compareWindow .scene { width:calc(100% * var(--photo-scale,1)); }
.diff-pan-note { color:#ffecb7; font-size:11px; text-align:center; margin-top:5px; }
@media (orientation:portrait) {
  .pair.independent-pair.can-stack { grid-template-columns:minmax(0,1fr); }
}
#adDialog { border:3px solid #f7d27c; border-radius:18px; background:#244c40; color:white; padding:16px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
#adDialog::backdrop { background:#122f27cf; }
#adDialog h2 { margin:0 0 8px; }
#adFrame:not([hidden]) { display:block; border:0; width:min(80vw,400px); height:min(62dvh,600px); }

.home .count { top:52.6%; transform:translate(-50%,-50%); width:10%; height:2.6%; display:grid; place-items:center; background:linear-gradient(#ffe69e,#ffda79); border-radius:3px; font-size:clamp(11px,3.8vw,16px); line-height:1; font-weight:800; text-shadow:none; }
.home .count.c { left:29.7%; }
.home .count.d { left:75.5%; }
.home #sound.hotspot { left:3.1%; bottom:3.2%; width:10%; height:5.7%; font-size:0; background:transparent; padding:0; }
.home #sound[aria-pressed="false"]::after { content:""; position:absolute; left:22%; right:22%; height:2px; top:49%; background:#fff0cd; transform:rotate(-45deg); box-shadow:0 1px 2px #4e291d; }
