:root {
  --ink: #15323d;
  --muted: #627782;
  --paper: #fff8ec;
  --panel: #ffffff;
  --teal: #0c7f94;
  --teal-dark: #07596b;
  --coral: #ff6f61;
  --sun: #ffd15c;
  --leaf: #56bf7b;
  --sky: #8be7ff;
  --berry: #ff6f9f;
  --line: rgba(21, 50, 61, 0.14);
  --shadow: 0 18px 44px rgba(16, 42, 56, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.22) 0 14px, transparent 14px 32px),
    linear-gradient(135deg, #bdf3ff 0%, #fff1c8 46%, #dff7ef 100%);
  font-family: "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  width: min(100%, 1280px);
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 236, 0.86)),
    repeating-linear-gradient(90deg, rgba(255, 209, 92, 0.18) 0 18px, rgba(86, 191, 123, 0.12) 18px 36px);
  box-shadow: 0 18px 44px rgba(16, 42, 56, 0.22);
  overflow: hidden;
}

.topbar,
.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.9);
  box-shadow: 0 8px 18px rgba(20, 54, 68, 0.12);
  backdrop-filter: blur(10px);
}

.topbar {
  min-height: 74px;
  padding: 10px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 33%, #ffffff 0 8%, transparent 9%),
    radial-gradient(circle at 66% 33%, #ffffff 0 8%, transparent 9%),
    radial-gradient(circle at 36% 35%, #15323d 0 3%, transparent 4%),
    radial-gradient(circle at 68% 35%, #15323d 0 3%, transparent 4%),
    linear-gradient(135deg, var(--leaf), var(--sky) 62%, var(--sun));
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.08), 0 4px 12px rgba(12, 127, 148, 0.24);
}

.brand h1 {
  max-width: min(34vw, 430px);
  margin: 0;
  font-size: clamp(15px, 1.65vw, 25px);
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand p {
  max-width: 260px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 1.2vw, 15px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.stat {
  display: grid;
  gap: 2px;
  min-width: 94px;
  padding: 8px 12px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 209, 92, 0.42), rgba(139, 231, 255, 0.38)),
    var(--paper);
  border: 1px solid rgba(21, 50, 61, 0.1);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  font-size: clamp(16px, 1.7vw, 22px);
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(180deg, #10a9bc, var(--teal-dark));
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18), 0 8px 16px rgba(7, 89, 107, 0.2);
}

.icon-button span {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.icon-button:active,
.primary-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16), 0 5px 12px rgba(7, 89, 107, 0.18);
}

.playfield {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.playfield.layout-stacked {
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
}

.playfield.layout-side-by-side {
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.scene-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(20, 54, 68, 0.13);
  overflow: hidden;
}

.scene-panel canvas {
  display: block;
  width: auto;
  height: auto;
  max-height: 100%;
  max-width: 100%;
  aspect-ratio: auto;
  border-radius: 6px;
  background: #d7eef5;
  box-shadow: inset 0 0 0 1px rgba(21, 50, 61, 0.08);
  object-fit: contain;
  touch-action: manipulation;
}

.scene-label {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1;
  padding: 6px 10px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(180deg, #ff8b5d, #e75055);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
  font-weight: 800;
  font-size: 13px;
  pointer-events: none;
}

.bottombar {
  display: none;
  min-height: 52px;
  padding: 10px 12px;
}

.progress-track {
  width: min(420px, 42vw);
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(21, 50, 61, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.82);
}

#levelProgress {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--leaf), var(--sun), var(--coral));
  transition: width 180ms ease;
}

#statusText {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 39, 50, 0.42);
  backdrop-filter: blur(8px);
}

.overlay.hidden {
  display: none;
}

.dialog {
  width: min(760px, 92vw);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 22px 70px rgba(7, 44, 58, 0.34);
}

.start-dialog {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(260px, 1fr);
  overflow: hidden;
}

.dialog-art {
  min-height: 280px;
  background: #dff7ef;
}

.dialog-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dialog-copy,
.result-dialog {
  display: grid;
  gap: 12px;
  align-content: center;
  padding: clamp(22px, 3.2vw, 38px);
}

.eyebrow {
  margin: 0;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.dialog h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
}

.dialog p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.42;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  min-width: 172px;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(180deg, #ff9b54, #e75055);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.16), 0 14px 24px rgba(231, 80, 85, 0.24);
  font-weight: 900;
}

.primary-button span {
  line-height: 1;
}

.result-dialog {
  max-width: 520px;
  text-align: center;
}

.result-dialog .primary-button {
  justify-self: center;
}

.pulse {
  animation: pulse 650ms ease-in-out 2;
}

.miss {
  animation: miss 260ms ease;
}

.rotate-notice {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 22px;
  color: #ffffff;
  background: #0b5b70;
  text-align: center;
}

.rotate-notice div {
  display: grid;
  gap: 8px;
  max-width: 320px;
}

.rotate-notice strong {
  font-size: 26px;
}

.rotate-notice span {
  font-size: 16px;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.018);
  }
}

@keyframes miss {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
}

@media (max-width: 960px) {
  .topbar {
    min-height: 62px;
    padding: 8px;
  }

  .brand {
    min-width: 160px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .stat {
    min-width: 74px;
    padding: 6px 8px;
  }

  .actions {
    gap: 6px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .bottombar {
    min-height: 44px;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .app {
    padding: 0;
  }

  .game-shell {
    width: 100%;
    gap: 2px;
    padding: 2px;
  }

  .topbar {
    min-height: 46px;
    padding: 5px 8px;
    gap: 8px;
  }

  .brand {
    min-width: 130px;
    gap: 7px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand h1 {
    font-size: 19px;
  }

  .brand p,
  .stat span {
    display: none;
  }

  .stats {
    gap: 6px;
    flex: 0 1 auto;
  }

  .stat {
    min-width: 64px;
    padding: 5px 8px;
  }

  .stat strong {
    font-size: 16px;
  }

  .actions {
    gap: 6px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .icon-button span {
    font-size: 21px;
  }

  .playfield {
    gap: 2px;
  }

  .scene-panel {
    padding: 2px;
    border-width: 1px;
  }

  .scene-label {
    top: 18px;
    left: 18px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .bottombar {
    min-height: 32px;
    padding: 6px 8px;
  }

  .progress-track {
    width: min(350px, 43vw);
    height: 12px;
  }

  #statusText {
    font-size: 13px;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .brand p,
  .stat span {
    display: none;
  }

  .topbar,
  .bottombar {
    border-radius: 6px;
  }

  .app {
    gap: 6px;
    padding: 6px;
  }

  .scene-panel {
    padding: 5px;
  }

  .scene-label {
    top: 10px;
    left: 10px;
    padding: 4px 7px;
    font-size: 11px;
  }

  #statusText {
    font-size: 13px;
  }
}

@media (orientation: portrait) {
  .rotate-notice {
    display: grid;
  }
}

@media (max-width: 680px) {
  .start-dialog {
    grid-template-columns: 1fr;
  }

  .dialog-art {
    min-height: 180px;
  }
}

/* 2026-07: child-friendly UI, settings, hints, transitions and feedback */
:root {
  --ink: #17304d;
  --muted: #62708d;
  --paper: #fff7de;
  --panel: #fffef8;
  --teal: #10b7cf;
  --teal-dark: #087e9a;
  --coral: #ff6c7a;
  --sun: #ffd44d;
  --leaf: #50d680;
  --sky: #8deaff;
  --berry: #ff71b8;
  --purple: #8b72ff;
  --line: rgba(23, 48, 77, 0.14);
  --shadow: 0 20px 50px rgba(40, 60, 110, 0.2);
}

html,
body,
canvas,
button,
.app,
.game-shell,
.playfield,
.scene-panel {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 113, 184, 0.26) 0 82px, transparent 83px),
    radial-gradient(circle at 92% 18%, rgba(255, 212, 77, 0.33) 0 96px, transparent 98px),
    radial-gradient(circle at 12% 88%, rgba(80, 214, 128, 0.28) 0 96px, transparent 98px),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.28) 0 14px, transparent 14px 34px),
    linear-gradient(135deg, #a6f0ff 0%, #fff0b8 45%, #ffd7e8 100%);
}

button:focus-visible,
canvas:focus-visible {
  outline: 4px solid rgba(255, 212, 77, 0.92);
  outline-offset: 3px;
}

.game-shell {
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  border-width: 4px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 222, 0.9)),
    repeating-linear-gradient(90deg, rgba(255, 212, 77, 0.22) 0 22px, rgba(80, 214, 128, 0.18) 22px 44px, rgba(141, 234, 255, 0.2) 44px 66px);
  box-shadow: 0 20px 55px rgba(23, 48, 77, 0.24), inset 0 0 0 3px rgba(255, 255, 255, 0.72);
}

.topbar,
.bottombar,
.scene-panel,
.dialog {
  border-radius: 22px;
}

.topbar,
.bottombar {
  border-width: 3px;
}

.brand-mark {
  border-radius: 34% 58% 45% 55%;
  animation: mascotWiggle 4.6s ease-in-out infinite;
}

.brand h1,
.dialog h2,
.stat strong {
  letter-spacing: -0.025em;
}

.stat {
  border-radius: 18px;
  border-width: 2px;
  box-shadow: inset 0 -4px 0 rgba(23, 48, 77, 0.07);
}

.icon-button,
.primary-button,
.toggle-card {
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.icon-button {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: linear-gradient(180deg, #25d3e9, #0a81a1);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16), 0 9px 18px rgba(8, 126, 154, 0.22);
}

.icon-button:hover,
.primary-button:hover,
.toggle-card:hover {
  filter: saturate(1.1) brightness(1.03);
  transform: translateY(-1px) scale(1.02);
}

.hint-button {
  background: linear-gradient(180deg, #ffe873, #ff9b54);
  color: #17304d;
}

.hint-badge {
  position: absolute;
  right: -6px;
  top: -7px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: #ff6c7a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(255, 108, 122, 0.26);
}

.hint-button.ad-mode .hint-badge {
  min-width: 34px;
  background: #8b72ff;
}

.scene-panel {
  border-width: 4px;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 212, 77, 0.18), transparent 27%),
    rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(23, 48, 77, 0.16), inset 0 0 0 2px rgba(255, 255, 255, 0.78);
}

.scene-panel canvas {
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(23, 48, 77, 0.08), 0 10px 24px rgba(23, 48, 77, 0.1);
  touch-action: manipulation;
}

.scene-panel.pulse {
  animation: panelHappy 620ms ease-in-out 2;
}

.scene-panel.level-enter {
  animation: levelEnter 720ms cubic-bezier(.17,.84,.44,1) both;
}

.scene-label {
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8dbd, #ff6172);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), 0 8px 18px rgba(255, 97, 114, 0.24);
  font-size: 14px;
}

.bottombar {
  display: flex;
  background: rgba(255, 253, 250, 0.94);
}

.progress-track {
  height: 20px;
  border-width: 3px;
}

#levelProgress {
  background: linear-gradient(90deg, #50d680, #ffd44d, #ff71b8, #8b72ff);
  transition: width 260ms cubic-bezier(.17,.84,.44,1);
}

#statusText {
  font-size: clamp(13px, 1.4vw, 17px);
}

.overlay {
  animation: overlayFade 170ms ease both;
}

.dialog {
  border: 4px solid rgba(255, 255, 255, 0.82);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 212, 77, 0.22), transparent 28%),
    radial-gradient(circle at 92% 88%, rgba(141, 234, 255, 0.28), transparent 25%),
    #fffef8;
  box-shadow: 0 28px 80px rgba(16, 42, 83, 0.32), inset 0 0 0 2px rgba(255, 255, 255, 0.74);
  animation: dialogPop 260ms cubic-bezier(.17,.84,.44,1.18) both;
}

.start-dialog {
  border-radius: 30px;
}

.dialog-art {
  background: linear-gradient(135deg, #d8fbff, #fff1b8);
}

.dialog-art img {
  transform: scale(1.02);
}

.eyebrow {
  color: #0a81a1;
  letter-spacing: 0.06em;
}

.primary-button {
  min-height: 58px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffb14f, #ff6172);
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.16), 0 16px 28px rgba(255, 97, 114, 0.24);
}

.reward-stars {
  margin-bottom: 4px;
  font-size: 34px;
  letter-spacing: 8px;
  animation: rewardSparkle 1.2s ease-in-out infinite;
}

.settings-dialog {
  display: grid;
  gap: 16px;
  width: min(560px, 92vw);
  padding: clamp(22px, 3.2vw, 38px);
  text-align: center;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.toggle-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 14px;
  border: 3px solid rgba(23, 48, 77, 0.1);
  border-radius: 24px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 222, 0.96));
  box-shadow: inset 0 -5px 0 rgba(23, 48, 77, 0.06), 0 10px 22px rgba(23, 48, 77, 0.1);
  text-align: left;
}

.toggle-card[aria-pressed="false"] {
  filter: grayscale(0.45) opacity(0.8);
}

.toggle-emoji {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 20px;
  background: linear-gradient(180deg, #8deaff, #fff4a3);
  font-size: 30px;
}

.toggle-card strong,
.toggle-card small {
  display: block;
}

.toggle-card strong {
  font-size: 18px;
}

.toggle-card small {
  color: var(--muted);
  font-weight: 800;
}

.toast-stack {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 25;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 210px;
  max-width: min(360px, 80vw);
  padding: 12px 16px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  color: #17304d;
  background: linear-gradient(180deg, #ffffff, #fff4c7);
  box-shadow: 0 12px 28px rgba(23, 48, 77, 0.18);
  font-weight: 900;
  animation: toastIn 260ms cubic-bezier(.17,.84,.44,1.18) both;
}

.toast.good {
  background: linear-gradient(180deg, #ffffff, #dfffe9);
}

.toast.hint {
  background: linear-gradient(180deg, #ffffff, #fff0bc);
}

.toast.miss-toast {
  background: linear-gradient(180deg, #ffffff, #ffe0e6);
}

.toast.fade-out {
  animation: toastOut 220ms ease both;
}

.floating-mark {
  position: fixed;
  z-index: 26;
  left: 0;
  top: 0;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 5px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(180deg, #50d680, #0cb36c);
  box-shadow: 0 14px 28px rgba(12, 179, 108, 0.32), inset 0 -5px 0 rgba(0, 0, 0, 0.14);
  font-size: 46px;
  font-weight: 1000;
  pointer-events: none;
  animation: floatingMark 780ms cubic-bezier(.17,.84,.44,1) forwards;
}

.level-transition {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4), rgba(16, 183, 207, 0.42));
  backdrop-filter: blur(5px);
  pointer-events: none;
  animation: overlayFade 180ms ease both;
}

.level-transition.hidden {
  display: none;
}

.level-card {
  display: grid;
  gap: 8px;
  min-width: min(420px, 82vw);
  padding: 24px 30px;
  border: 5px solid #ffffff;
  border-radius: 32px;
  color: #17304d;
  background: linear-gradient(135deg, #fffef8, #fff0bc 52%, #d8fbff);
  box-shadow: 0 24px 70px rgba(23, 48, 77, 0.28), inset 0 -7px 0 rgba(23, 48, 77, 0.08);
  text-align: center;
  animation: levelCardPop 470ms cubic-bezier(.17,.84,.44,1.18) both;
}

.level-card span {
  color: #0a81a1;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.level-card strong {
  font-size: clamp(54px, 9vw, 92px);
  line-height: 0.95;
}

.level-card small {
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.confetti-piece {
  position: fixed;
  z-index: 24;
  left: 50%;
  top: 45%;
  width: 12px;
  height: 18px;
  border-radius: 4px;
  background: var(--confetti-color, #ffd44d);
  pointer-events: none;
  animation: confettiFly 900ms cubic-bezier(.13,.8,.34,1) forwards;
}

.sparkle-dot {
  position: fixed;
  z-index: 24;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffd44d;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.76);
  pointer-events: none;
  animation: sparkleDot 620ms ease-out forwards;
}

@keyframes mascotWiggle {
  0%, 100% { transform: rotate(-2deg) scale(1); }
  50% { transform: rotate(3deg) scale(1.05); }
}

@keyframes panelHappy {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.025) rotate(-0.35deg); }
  70% { transform: scale(1.012) rotate(0.35deg); }
}

@keyframes levelEnter {
  0% { transform: translateY(18px) scale(0.985); opacity: 0.2; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes overlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogPop {
  0% { transform: translateY(16px) scale(0.94); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes rewardSparkle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.06); }
}

@keyframes toastIn {
  from { transform: translateX(16px) scale(0.94); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
  to { transform: translateX(18px) scale(0.92); opacity: 0; }
}

@keyframes floatingMark {
  0% { transform: translate(-50%, -50%) scale(0.42) rotate(-16deg); opacity: 0; }
  25% { transform: translate(-50%, -62%) scale(1.1) rotate(8deg); opacity: 1; }
  100% { transform: translate(-50%, -100%) scale(0.78) rotate(0); opacity: 0; }
}

@keyframes levelCardPop {
  0% { transform: scale(0.78) rotate(-2deg); opacity: 0; }
  65% { transform: scale(1.04) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes confettiFly {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(0.6); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, 260px))) rotate(var(--r, 220deg)) scale(1); opacity: 0; }
}

@keyframes sparkleDot {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, -42px))) scale(1.3); opacity: 0; }
}

@media (max-height: 640px) and (orientation: landscape) {
  .game-shell {
    border-radius: 14px;
    gap: 3px;
    padding: 3px;
  }

  .topbar,
  .bottombar,
  .scene-panel {
    border-radius: 10px;
    border-width: 2px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .hint-badge {
    min-width: 20px;
    height: 20px;
    font-size: 10px;
    border-width: 2px;
  }

  .bottombar {
    min-height: 34px;
  }
}

@media (max-width: 680px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    width: 100%;
  }
}

/* 2026-07 moderation fixes: no browser selection, context menus, or page pull/scroll gestures */
html,
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-overflow-scrolling: auto;
  -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

img,
canvas {
  -webkit-user-drag: none;
  user-drag: none;
}

button,
.icon-button,
.primary-button,
.toggle-card {
  touch-action: manipulation;
}

button:disabled,
.primary-button:disabled {
  cursor: default;
  filter: grayscale(0.2) opacity(0.68);
  transform: none;
}


/* 2026-07 UI refinement: larger images, clearer stats, volume sliders */
.game-shell {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.bottombar {
  display: none !important;
}

.topbar {
  min-height: 64px;
  padding: 8px 10px;
}

.playfield {
  gap: 6px;
}

.scene-panel {
  padding: 4px;
}

.stats {
  gap: 10px;
  align-items: stretch;
}

.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 98px;
  padding: 7px 10px;
  text-align: center;
}

.stat span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.05;
  color: #647794;
}

.stat strong {
  display: block;
}

.settings-dialog {
  width: min(620px, 92vw);
}

.volume-controls {
  display: grid;
  gap: 12px;
  text-align: left;
}

.volume-control {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 3px solid rgba(23, 48, 77, 0.1);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 251, 255, 0.94));
  box-shadow: inset 0 -5px 0 rgba(23, 48, 77, 0.06), 0 10px 22px rgba(23, 48, 77, 0.08);
}

.volume-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.volume-head strong {
  font-size: 18px;
}

.volume-value {
  min-width: 54px;
  text-align: right;
  color: #0a81a1;
  font-weight: 900;
}

.volume-control input[type="range"] {
  width: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8deaff, #ffd44d, #ff8dbd);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #0ea8bf;
  box-shadow: 0 6px 14px rgba(23, 48, 77, 0.22);
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #0ea8bf;
  box-shadow: 0 6px 14px rgba(23, 48, 77, 0.22);
}

.volume-control input[type="range"]::-moz-range-track {
  height: 12px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #8deaff, #ffd44d, #ff8dbd);
}

@media (max-height: 640px) and (orientation: landscape) {
  .topbar {
    min-height: 54px;
    padding: 5px 8px;
    gap: 6px;
  }

  .brand {
    min-width: 120px;
    gap: 6px;
  }

  .brand h1 {
    max-width: min(29vw, 250px);
    font-size: 15px;
  }

  .brand p {
    display: none;
  }

  .stats {
    gap: 5px;
  }

  .stat {
    min-width: 60px;
    padding: 4px 6px;
    border-radius: 14px;
  }

  .stat span {
    display: block !important;
    font-size: 9px;
  }

  .stat strong {
    font-size: 14px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .icon-button span {
    font-size: 19px;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .topbar {
    gap: 6px;
  }

  .brand {
    min-width: 0;
    flex: 1 1 auto;
  }

  .brand h1 {
    max-width: 30vw;
    font-size: 14px;
  }

  .brand p {
    display: none;
  }

  .stats {
    flex: 0 1 auto;
    gap: 5px;
  }

  .stat {
    min-width: 60px;
    padding: 4px 6px;
    border-radius: 14px;
  }

  .stat span {
    display: block !important;
    font-size: 9px;
  }

  .stat strong {
    font-size: 14px;
  }

  .scene-label {
    top: 8px;
    left: 8px;
  }
}

@media (max-width: 680px) {
  .volume-head strong {
    font-size: 16px;
  }

  .volume-control {
    padding: 12px 14px;
  }
}


/* 2026-07 mobile moderation fit: hide top title, fit dialogs to small landscape screens */
.brand {
  min-width: auto;
  flex: 0 0 auto;
}

.brand-copy {
  display: none !important;
}

.topbar {
  justify-content: space-between;
}

.overlay {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  justify-items: center;
}

.dialog {
  max-width: min(96vw, 760px);
  max-height: min(92dvh, 760px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.start-dialog {
  width: min(900px, 96vw);
}

.settings-dialog {
  width: min(640px, 96vw);
}

.dialog-copy,
.result-dialog,
.settings-dialog {
  min-width: 0;
}

@media (max-width: 920px) and (orientation: landscape) {
  .overlay {
    padding: 10px;
  }

  .start-dialog {
    grid-template-columns: minmax(180px, 0.85fr) minmax(220px, 1fr);
    width: min(96vw, 760px);
  }

  .dialog-art {
    min-height: 180px;
  }

  .dialog-copy,
  .result-dialog {
    gap: 8px;
    padding: 18px;
  }

  .dialog h2 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 0.98;
  }

  .dialog-copy p,
  .result-dialog p,
  .settings-dialog p {
    font-size: 14px;
    line-height: 1.35;
  }

  .primary-button {
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 16px;
  }

  .settings-dialog {
    gap: 12px;
    width: min(96vw, 620px);
    padding: 18px;
  }

  .settings-grid {
    gap: 10px;
  }

  .toggle-card {
    min-height: 76px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .toggle-emoji {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    font-size: 26px;
  }

  .toggle-card strong {
    font-size: 16px;
  }

  .toggle-card small {
    font-size: 13px;
  }

  .volume-controls {
    gap: 10px;
  }

  .volume-control {
    gap: 6px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .volume-head strong {
    font-size: 16px;
  }

  .volume-value {
    min-width: 46px;
    font-size: 14px;
  }

  .volume-control input[type="range"] {
    height: 10px;
  }

  .volume-control input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .volume-control input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .overlay {
    padding: 8px;
  }

  .dialog {
    max-height: 96dvh;
    border-radius: 20px;
  }

  .start-dialog {
    grid-template-columns: 1fr 1fr;
    width: min(96vw, 740px);
  }

  .dialog-art {
    min-height: 150px;
  }

  .dialog-copy,
  .result-dialog {
    gap: 6px;
    padding: 14px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .dialog h2 {
    font-size: clamp(22px, 3.2vw, 34px);
  }

  .dialog-copy p,
  .result-dialog p,
  .settings-dialog p {
    font-size: 13px;
    line-height: 1.28;
  }

  .primary-button {
    min-height: 42px;
    padding: 10px 16px;
    font-size: 16px;
  }

  .settings-dialog {
    gap: 10px;
    width: min(96vw, 580px);
    padding: 14px;
  }

  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .toggle-card {
    min-height: 64px;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 16px;
  }

  .toggle-emoji {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 22px;
  }

  .toggle-card strong {
    font-size: 15px;
  }

  .toggle-card small {
    font-size: 12px;
  }

  .volume-control {
    padding: 8px 10px;
    border-radius: 16px;
  }

  .volume-head strong {
    font-size: 15px;
  }

  .volume-value {
    font-size: 13px;
  }

  .volume-control input[type="range"] {
    height: 8px;
  }

  .volume-control input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border-width: 2px;
  }

  .volume-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-width: 2px;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .brand {
    display: none;
  }

  .topbar {
    padding: 4px 6px;
    gap: 4px;
  }

  .stats {
    flex: 1 1 auto;
    justify-content: flex-start;
    gap: 4px;
  }

  .stat {
    min-width: 54px;
    padding: 3px 5px;
  }

  .stat span {
    font-size: 8px;
  }

  .stat strong {
    font-size: 13px;
  }

  .actions {
    gap: 4px;
  }

  .icon-button {
    width: 32px;
    height: 32px;
  }

  .icon-button span {
    font-size: 17px;
  }

  .hint-badge {
    min-width: 18px;
    height: 18px;
    font-size: 9px;
  }

  .start-dialog {
    grid-template-columns: 1fr;
    width: min(96vw, 520px);
  }

  .dialog-art {
    min-height: 120px;
  }

  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .start-dialog {
    width: min(96vw, 460px);
  }
}


/* 2026-07 no-scroll dialog fitting: modals scale down as one piece on small Yandex mobile viewports */
.overlay {
  overflow: hidden !important;
  padding: 8px !important;
  place-items: center !important;
  align-items: center !important;
  justify-items: center !important;
  -webkit-overflow-scrolling: auto !important;
}

.dialog {
  --dialog-scale: 1;
  max-width: none !important;
  max-height: none !important;
  overflow: visible !important;
  animation: none !important;
  transform: scale(var(--dialog-scale)) !important;
  transform-origin: center center !important;
  will-change: transform;
}

.start-dialog {
  grid-template-columns: minmax(220px, 0.95fr) minmax(260px, 1fr) !important;
  width: min(900px, calc(100vw - 16px)) !important;
}

.settings-dialog {
  width: min(640px, calc(100vw - 16px)) !important;
}

.result-dialog {
  width: min(560px, calc(100vw - 16px)) !important;
}

.dialog-art {
  min-height: 240px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

@media (max-height: 520px) and (orientation: landscape) {
  .dialog-copy,
  .result-dialog,
  .settings-dialog {
    padding: 18px !important;
  }

  .dialog h2 {
    font-size: clamp(32px, 4.5vw, 46px);
  }

  .dialog-art {
    min-height: 220px;
  }

  .toggle-card {
    min-height: 82px;
  }
}

@media (max-height: 430px) and (orientation: landscape) {
  .dialog-copy,
  .result-dialog,
  .settings-dialog {
    padding: 16px !important;
  }

  .dialog h2 {
    font-size: clamp(30px, 4.2vw, 42px);
  }

  .dialog-copy p,
  .result-dialog p {
    font-size: 16px;
    line-height: 1.4;
  }

  .dialog-art {
    min-height: 210px;
  }
}


/* 2026-07 viewport-safe dialogs: keep start/settings panels fully inside the visible area without scrolling */
.overlay > .dialog {
  position: absolute !important;
  left: var(--dialog-center-x, 50%) !important;
  top: var(--dialog-center-y, 50%) !important;
  margin: 0 !important;
  transform: translate(-50%, -50%) scale(var(--dialog-scale, 1)) !important;
  transform-origin: center center !important;
}
