:root {
  color-scheme: light;
  --game-aspect: 1024 / 1792;
  --native-bottom-banner-h: 0px;
  --vk-bottom-banner-h: 0px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  min-width: 300px;
  min-height: 320px;
  margin: 0;
  overflow: hidden;
  background: #b98562;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-width: 300px;
  min-height: 320px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 236, 196, 0.28), transparent 38%),
    linear-gradient(180deg, #9f7662 0%, #d49b62 100%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 300px;
  min-height: 320px;
  aspect-ratio: auto;
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game button,
#game input {
  font-family: inherit;
  font-size: 18px;
}

.dom-game-viewport {
  position: absolute;
  inset: 0;
  min-width: 300px;
  min-height: 320px;
  overflow: hidden;
  background-image: var(--bg-image);
  background-position: center;
  background-size: cover;
  touch-action: none;
}

.dom-game-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(255, 236, 196, 0.08);
  pointer-events: none;
}

.dom-world {
  position: absolute;
  width: 1024px;
  height: 1792px;
  transform: scale(var(--world-scale, 1));
  transform-origin: top left;
  z-index: 2;
  color: #253a5d;
  font-size: calc(28px * var(--text-scale, 1));
  letter-spacing: 0;
  touch-action: none;
}

.dom-overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.dom-room {
  position: absolute;
  inset: -80px;
  pointer-events: none;
}

.dom-header {
  position: absolute;
  z-index: 8;
  left: 28px;
  top: 28px;
  right: 28px;
  height: 148px;
  display: grid;
  grid-template-columns: 104px 1fr 104px;
  align-items: start;
  pointer-events: none;
}

.dom-menu-button,
.dom-image-button {
  width: 94px;
  height: 94px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 150ms ease, filter 150ms ease;
}

.dom-menu-button img,
.dom-image-button img,
.dom-modal-close img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.dom-menu-button:active,
.dom-image-button:active,
.dom-modal-close:active,
.dom-modal-button:active,
.dom-toggle:active,
.dom-choice:active {
  transform: scale(0.96);
}

.dom-level-title {
  justify-self: center;
  width: 430px;
  height: 104px;
  display: grid;
  place-items: center;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: #fff;
  font-size: 41px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 3px 0 rgba(16, 35, 73, 0.55), 0 0 7px rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.dom-progress {
  justify-self: end;
  min-width: 92px;
  height: 50px;
  margin-top: 28px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 228, 156, 0.56);
  border-radius: 25px;
  background:
    linear-gradient(180deg, rgba(41, 33, 24, 0.48), rgba(16, 22, 35, 0.62)),
    radial-gradient(circle at 50% 0%, rgba(255, 231, 162, 0.32), transparent 72%);
  color: #fff7d7;
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(54, 36, 17, 0.68), 0 0 8px rgba(255, 219, 132, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.dom-tutorial-banner {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 259px;
  width: 720px;
  min-height: 76px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 18px;
  padding: 12px 28px;
  border: 4px solid rgba(255, 255, 255, 0.95);
  border-radius: 38px;
  background: linear-gradient(180deg, rgba(255, 254, 249, 0.96), rgba(239, 248, 255, 0.92));
  color: #244166;
  box-shadow: 0 14px 30px rgba(57, 67, 87, 0.18), inset 0 0 0 3px rgba(255, 255, 255, 0.66);
  pointer-events: none;
  animation: tutorial-hint-in 420ms cubic-bezier(.16,.84,.24,1) both;
}

.dom-tutorial-banner.is-stable-during-collect {
  animation: none;
}

.dom-tutorial-kicker {
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 21px;
  background: linear-gradient(180deg, #78c9ff, #356dc6);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(20, 49, 102, 0.42);
}

.dom-tutorial-banner strong {
  font-size: 27px;
  line-height: 1.08;
  font-weight: 900;
  text-align: left;
}

.dom-tutorial-target-panel {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 124px;
  width: 760px;
  height: 142px;
  transform: translateX(-50%);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 46px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: none;
  pointer-events: none;
  animation: tutorial-target-in 440ms cubic-bezier(.16,.84,.24,1) both;
}

.dom-tutorial-target-panel.is-stable-during-collect {
  animation: none;
}

.dom-tutorial-target-icons {
  position: absolute;
  inset: 18px 46px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 320ms cubic-bezier(.2,.72,.22,1), transform 320ms cubic-bezier(.2,.72,.22,1);
  will-change: transform, opacity;
}

.dom-tutorial-target-icons.is-entering {
  opacity: 0;
  transform: translate3d(0, 10px, 0) scale(0.975);
}

.dom-tutorial-target-icons.is-leaving {
  opacity: 0;
  transform: translate3d(0, -10px, 0) scale(1.018);
}

.dom-tutorial-target-icon {
  width: 94px;
  height: 94px;
  object-fit: contain;
  filter: none;
}

.dom-tutorial-plus {
  color: #b36a00;
  font-size: 42px;
  font-weight: 900;
  text-shadow: 0 2px 0 #fff;
}

.dom-tutorial-hand {
  position: absolute;
  z-index: 38;
  left: 0;
  top: 0;
  width: 300px;
  height: 300px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 10px 14px rgba(42, 34, 24, 0.28));
  transform-origin: 32% 22%;
  animation: none;
  transition: none;
  will-change: transform, opacity;
}

.dom-tutorial-motion-layer {
  position: absolute;
  left: var(--world-left, 0);
  top: var(--world-top, 0);
  width: 1024px;
  height: 1792px;
  z-index: 34;
  transform: scale(var(--world-scale, 1));
  transform-origin: top left;
  pointer-events: none;
}

.dom-tutorial-trajectory {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.dom-tutorial-path {
  fill: none;
  stroke: rgba(64, 185, 255, 0.86);
  stroke-width: 9px;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  filter: drop-shadow(0 4px 5px rgba(27, 96, 153, 0.36));
}

.dom-tutorial-path.is-target {
  stroke: rgba(255, 163, 61, 0.9);
  stroke-width: 8px;
  filter: drop-shadow(0 4px 5px rgba(153, 88, 20, 0.34));
}

.dom-tutorial-grab-wave {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 34;
  border: 7px solid rgba(85, 205, 255, 0.9);
  border-radius: 999px;
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.42),
    0 0 28px rgba(76, 190, 255, 0.48);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.dom-tutorial-card-ghost {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 35;
  pointer-events: none;
  cursor: default;
  transition: none;
  will-change: transform, opacity;
}

.dom-tile.dom-tutorial-card-ghost {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0;
  border: 0;
  cursor: default;
  transition: none;
}

.dom-tutorial-card-ghost.is-source {
  z-index: 37;
}

.dom-tutorial-card-ghost.is-target {
  z-index: 33;
}

.dom-board {
  position: absolute;
  z-index: 5;
  left: 18px;
  top: 246px;
  width: 988px;
  height: 1390px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.dom-board.has-tutorial {
  top: 382px;
  height: 1230px;
}

.dom-board.is-locked {
  pointer-events: none;
}

.dom-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  align-items: center;
  justify-items: center;
  padding: 0 2px;
  border-radius: 34px;
}

.dom-row.is-solved {
  flex: 0 0 206px;
  width: 760px;
  align-self: center;
  grid-template-columns: repeat(4, 176px);
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(192, 197, 46, 0.78), rgba(255, 244, 216, 0.55)),
    linear-gradient(90deg, var(--group-color), rgba(255, 255, 255, 0.72));
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.dom-row.is-open {
  box-sizing: border-box;
  flex: 0 0 250px;
  width: 972px;
  height: 250px;
  grid-template-columns: repeat(4, 230px);
  justify-content: center;
  gap: 6px;
  margin-top: 0;
  padding: 4px 10px;
  background: rgba(241, 232, 220, 0.36);
  border: 4px dashed #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.dom-row.is-solved.is-collecting-target {
  visibility: hidden;
  animation: none;
  will-change: transform;
  pointer-events: none;
}

.dom-row.is-solved.is-collect-settled {
  animation: none;
  pointer-events: none;
}

.dom-row.is-collecting-source {
  visibility: hidden;
  pointer-events: none;
}

.dom-row.is-portal-sucked {
  opacity: 0;
}

.dom-row-label {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: -36px;
  min-width: 210px;
  max-width: 520px;
  transform: translateX(-50%);
  padding: 8px 22px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: rgba(139, 229, 98, 0.95);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  text-align: center;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.2em #10630e;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 4px rgba(76, 47, 15, 0.4);
}

.dom-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  cursor: grab;
  touch-action: none;
  transition: transform 170ms ease, filter 170ms ease, opacity 120ms ease;
}

.dom-row.is-solved .dom-tile {
  width: 176px;
  align-self: center;
  justify-self: center;
}

.dom-row.is-solved .dom-card-check {
  width: 50px;
  height: 50px;
  top: 7px;
  right: 6px;
}

.dom-tile:hover {
  transform: translateY(-3px) scale(1.012);
  filter: brightness(1.025);
}

.dom-tile:active {
  cursor: grabbing;
}

.dom-tile:disabled {
  cursor: default;
}

.dom-tile.is-dragging {
  opacity: 0.24;
}

.dom-tile.is-drag-target {
  transform: translateY(-4px) scale(1.035);
  filter: brightness(1.08) saturate(1.08);
}

.dom-tile.is-drag-target::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 5px solid rgba(128, 226, 38, 0.96);
  border-radius: 23px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

.dom-tile.is-swap-settling {
  visibility: hidden;
  pointer-events: none;
  transition: none !important;
}

.dom-card-shadow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  height: 116%;
  transform: translate(-50%, -50%);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.26;
  pointer-events: none;
}

.dom-card-art {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 92%;
  height: 92%;
  object-fit: contain;
  transform: translate(-50%, -50%) scale(var(--art-scale, 1));
  pointer-events: none;
  image-rendering: auto;
}

.dom-card-check {
  position: absolute;
  top: 11px;
  right: 10px;
  width: 54px;
  height: 54px;
  object-fit: contain;
  pointer-events: none;
  filter: none;
}

.dom-tile.is-idle-hint {
  z-index: 4;
  animation: idle-hint-tug 900ms ease-in-out 2;
}

.dom-row.is-help-level-1 {
  z-index: 3;
  animation: help-row-glow 900ms ease-in-out 2;
}

.dom-tile.is-help-level-2,
.dom-tile.is-help-level-3 {
  z-index: 5;
}

.dom-tile.is-help-level-2::after,
.dom-tile.is-help-level-3::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 25px;
  pointer-events: none;
  border: 7px solid rgba(255, 233, 92, 0.92);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.56), 0 0 28px rgba(255, 206, 73, 0.68);
  animation: help-tile-pulse 900ms ease-in-out 2;
}

.dom-tile.is-help-level-3.is-help-source::after {
  border-color: rgba(94, 226, 120, 0.96);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.58), 0 0 32px rgba(71, 220, 96, 0.76);
}

.dom-tile.is-help-level-3.is-help-target::after {
  border-color: rgba(255, 132, 84, 0.96);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.58), 0 0 32px rgba(255, 114, 64, 0.78);
}

.dom-drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10000;
  pointer-events: none;
  opacity: 0.96;
  filter: drop-shadow(0 22px 22px rgba(34, 29, 23, 0.24));
  transform-origin: top left;
  transition: none;
  will-change: transform;
}

.dom-swap-ghost {
  opacity: 1;
  will-change: transform, opacity;
}

.dom-swap-ghost-source {
  z-index: 10020;
}

.dom-swap-ghost-target {
  z-index: 10010;
}

.dom-drag-source-placeholder-fade {
  position: fixed;
  z-index: 10005;
  pointer-events: none;
  transform-origin: top left;
  filter: drop-shadow(0 10px 12px rgba(34, 29, 23, 0.12));
  will-change: opacity;
}

.dom-swap-impact {
  position: fixed;
  z-index: 10015;
  pointer-events: none;
  border-radius: 24px;
  transform-origin: center;
  animation: swap-impact-ring 680ms ease-out forwards;
  will-change: transform, opacity;
}

.dom-swap-impact::before {
  content: "";
  position: absolute;
  inset: -8px;
  border: 4px solid rgba(49, 214, 98, 0.92);
  border-radius: 30px;
  box-shadow:
    0 0 0 2px rgba(202, 255, 204, 0.78),
    0 0 28px rgba(39, 229, 103, 0.58),
    inset 0 0 22px rgba(39, 229, 103, 0.38);
  transform-origin: center;
  animation: swap-impact-outline 680ms ease-out forwards;
  will-change: transform, opacity;
}

.dom-swap-impact-line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--impact-length);
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(194, 255, 185, 0), rgba(58, 236, 104, 0.95), rgba(232, 255, 221, 0));
  box-shadow: 0 0 14px rgba(31, 226, 92, 0.75);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--impact-angle)) scaleX(0.12);
  transform-origin: center;
  animation: swap-impact-line 520ms ease-out forwards;
  animation-delay: var(--impact-delay);
  will-change: transform, opacity;
}

.dom-swap-impact-dot {
  position: absolute;
  left: var(--dot-left);
  top: var(--dot-top);
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(218, 255, 206, 0.96);
  box-shadow: 0 0 12px rgba(42, 232, 90, 0.86);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
  animation: swap-impact-dot 520ms ease-out forwards;
  animation-delay: var(--dot-delay);
  will-change: transform, opacity;
}

.dom-collect-ghost {
  position: fixed;
  box-sizing: border-box;
  z-index: 10001;
  pointer-events: none;
  transform-origin: top left;
  overflow: visible;
  transition: none !important;
  will-change: transform;
}

.dom-collect-ghost .dom-tile {
  cursor: default;
  transform: none;
  filter: none !important;
  transition: none !important;
  will-change: transform;
}

.dom-collect-ghost .dom-collect-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  animation: none;
  transition: none !important;
  will-change: transform;
}

.dom-collect-callout {
  position: absolute;
  left: 50%;
  bottom: -42px;
  min-width: 218px;
  transform: translateX(-50%);
  padding: 8px 20px;
  border: 3px solid rgba(255, 230, 176, 0.96);
  border-radius: 22px;
  background: linear-gradient(180deg, #fffdf5, #ffdf84);
  color: #714409;
  font-size: 25px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 10px 24px rgba(92, 61, 22, 0.24);
  opacity: 0;
  transition: none !important;
  will-change: transform, opacity;
}

.dom-collect-confetti {
  position: fixed;
  inset: 0;
  z-index: 10008;
  pointer-events: none;
  overflow: visible;
}

.dom-collect-confetti span {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--size, 9px);
  height: calc(var(--size, 9px) * 0.72);
  border-radius: 3px;
  background: var(--color, #ffe27a);
  box-shadow: 0 6px 10px rgba(75, 48, 20, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  opacity: 0;
  transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(0.52);
  animation: none;
  will-change: transform, opacity;
}

.dom-collect-confetti span.is-spark {
  width: calc(var(--size, 9px) * 0.9);
  height: calc(var(--size, 9px) * 0.9);
  border-radius: 50%;
  box-shadow: 0 0 16px var(--color, #ffe27a), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dom-portal-suck-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  pointer-events: none;
  overflow: visible;
}

.dom-portal-suck-ghost {
  position: fixed;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: center;
  justify-items: center;
  padding: 6px;
  border: 4px solid rgba(255, 237, 196, 0.96);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 244, 216, 0.62)),
    linear-gradient(90deg, var(--group-color, #8de7ff), rgba(255, 255, 255, 0.76));
  box-shadow: 0 24px 58px rgba(17, 22, 44, 0.32), inset 0 0 0 3px rgba(255, 255, 255, 0.48);
  transform-origin: center center;
  transition: none !important;
  will-change: transform, opacity, filter;
}

.dom-portal-suck-ghost .dom-tile {
  cursor: default;
  transition: none !important;
}

.dom-modal-overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  background: rgba(13, 18, 27, 0.62);
  pointer-events: auto;
}

.dom-modal-stage {
  position: absolute;
  left: var(--world-left, 0);
  top: var(--world-top, 0);
  width: 1024px;
  height: 1792px;
  display: grid;
  place-items: center;
  transform: scale(var(--world-scale, 1));
  transform-origin: top left;
  pointer-events: none;
}

.dom-modal-panel {
  position: relative;
  width: 760px;
  min-height: 560px;
  max-height: 1260px;
  padding: 115px 76px 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: #2f4568;
  pointer-events: auto;
}

.dom-modal-options .dom-modal-panel {
  min-height: 760px;
  gap: 18px;
}

.dom-modal-win .dom-modal-panel {
  min-height: 760px;
}

.dom-modal-title {
  position: absolute;
  top: 48px;
  left: 120px;
  right: 120px;
  margin: 0;
  color: #183361;
  font-size: 46px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #fff;
}

.dom-modal-close {
  position: absolute;
  top: -34px;
  right: -22px;
  width: 104px;
  height: 104px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.dom-modal-button {
  width: 420px;
  height: 120px;
  min-height: 120px;
  padding: 0 34px 6px;
  border: 44px solid transparent;
  border-image-source: var(--button-bg);
  border-image-slice: 48 68 fill;
  border-image-width: 44px 58px;
  border-image-repeat: stretch;
  background-color: transparent;
  background-image: var(--button-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: #fff;
  cursor: pointer;
  font-size: 52px;
  font-weight: 900;
  line-height: 0.96;
  text-align: center;
  text-shadow: 0 2px 0 rgba(32, 55, 96, 0.52);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 140ms ease, filter 140ms ease;
}

@supports (border-image-source: var(--button-bg)) {
  .dom-modal-button {
    background-image: none;
  }
}

.dom-modal-options .dom-modal-button,
.dom-modal-win .dom-modal-button {
  font-size: 37px;
}

.dom-modal-options .dom-modal-button.is-primary,
.dom-modal-win .dom-modal-button.is-primary {
  font-size: 37px;
  letter-spacing: 0;
}

/* #game button has a small base size; keep modal button text explicit. */
#game .dom-modal-button {
  font-size: 52px;
  font-weight: 900;
  line-height: 0.96;
}

#game .dom-modal-options .dom-modal-button,
#game .dom-modal-win .dom-modal-button {
  font-size: 37px;
}

#game .dom-modal-options .dom-modal-button.is-primary,
#game .dom-modal-win .dom-modal-button.is-primary {
  font-size: 37px;
  letter-spacing: 0;
}

.dom-modal-button:hover {
  filter: brightness(1.04);
}

.dom-help-level-badge {
  position: absolute;
  z-index: 28;
  left: 50%;
  top: 224px;
  min-width: 250px;
  height: 58px;
  display: grid;
  place-items: center;
  padding: 0 28px;
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: 29px;
  background: linear-gradient(180deg, rgba(35, 65, 104, 0.94), rgba(20, 42, 78, 0.94));
  color: #fff8cf;
  font-size: 29px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(12, 27, 55, 0.7);
  box-shadow: 0 12px 26px rgba(16, 25, 45, 0.2);
  pointer-events: none;
  transform: translateX(-50%);
  animation: help-badge-in 220ms ease-out both;
}

.dom-options-coins {
  width: 226px;
  height: 78px;
  align-self: flex-start;
  margin-left: 48px;
  display: grid;
  grid-template-columns: 76px 1fr;
  grid-template-rows: 30px 38px;
  align-items: center;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: #1f365a;
}

.dom-options-coins-label {
  grid-column: 2;
  align-self: end;
  padding-left: 8px;
  font-size: 18px;
  font-weight: 900;
}

.dom-options-coins strong {
  grid-column: 2;
  align-self: start;
  padding-left: 8px;
  font-size: 34px;
  line-height: 1;
}

.dom-option-row,
.dom-volume-row {
  width: 590px;
  min-height: 72px;
  display: grid;
  grid-template-columns: 72px 1fr 164px;
  gap: 18px;
  align-items: center;
  padding: 8px 14px;
  border: 2px solid rgba(238, 185, 95, 0.42);
  border-radius: 28px;
  background: rgba(255, 247, 226, 0.76);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.36);
}

.dom-audio-row {
  grid-template-columns: 72px 132px 1fr 118px;
}

.dom-volume-row {
  grid-template-columns: 230px 1fr;
  min-height: 58px;
  padding-inline: 22px;
}

.dom-option-icon {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.dom-option-label,
.dom-volume-label {
  color: #314b73;
  font-size: 27px;
  font-weight: 900;
}

.dom-audio-row .dom-option-label {
  font-size: 26px;
}

.dom-toggle,
.dom-choice {
  min-width: 118px;
  height: 52px;
  border: 3px solid rgba(144, 92, 24, 0.48);
  border-radius: 26px;
  background: #eef5e8;
  color: #315071;
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

.dom-slider {
  position: relative;
  height: 58px;
  display: block;
  cursor: pointer;
  touch-action: none;
  --slider-progress: 0;
}

.dom-slider-rail,
.dom-slider-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 28px;
  transform: translateY(-50%);
  border-radius: 999px;
  pointer-events: none;
}

.dom-slider-rail {
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  filter: drop-shadow(0 3px 3px rgba(72, 50, 28, 0.16));
}

.dom-slider-fill {
  left: 5%;
  right: auto;
  top: 41%;
  width: 90%;
  height: 10px;
  transform: scaleX(var(--slider-progress));
  transform-origin: left center;
  background: linear-gradient(180deg, rgba(172, 232, 67, 0.96), rgba(87, 170, 10, 0.92));
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.58), inset 0 -2px 3px rgba(48, 100, 7, 0.32);
  clip-path: inset(0 0 0 0 round 999px);
}

.dom-slider-knob {
  position: absolute;
  top: 50%;
  left: calc(2% + var(--slider-progress) * 96%);
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 5px 5px rgba(74, 50, 20, 0.24));
  pointer-events: none;
}

.dom-slider input {
  position: absolute;
  inset: 0 -8px;
  width: calc(100% + 16px);
  height: 58px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.dom-toggle.is-on {
  background: linear-gradient(180deg, #a9e342, #60ad11);
  color: #fff;
  text-shadow: 0 2px 0 rgba(41, 96, 7, 0.5);
}

.dom-toggle.is-off {
  background: linear-gradient(180deg, #e7e6e2, #c4c1ba);
  color: #5c6270;
}

.dom-volume-row input {
  width: 100%;
  accent-color: #75bd16;
}

.dom-win-stars {
  width: 232px;
  height: 92px;
  margin-top: 16px;
  background-position: center;
  background-repeat: repeat-x;
  background-size: 76px 76px;
}

.dom-win-subtitle {
  color: #23436f;
  font-size: 40px;
  font-weight: 900;
  text-shadow: 0 2px 0 #fff;
}

.dom-win-coins {
  width: 360px;
  height: 126px;
  display: grid;
  place-items: center;
  border-radius: 42px;
  background: linear-gradient(180deg, #fff5cd, #ffd668);
  border: 4px solid #d88a16;
  color: #1f375c;
  font-size: 62px;
  font-weight: 900;
  box-shadow: 0 16px 28px rgba(106, 73, 27, 0.2), inset 0 0 0 4px rgba(255, 255, 255, 0.42);
}

.dom-win-progress {
  color: #4a5d77;
  font-size: 27px;
  font-weight: 900;
}

.dom-portal-overlay {
  position: absolute;
  z-index: 24;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
}

.dom-portal-veil {
  position: absolute;
  inset: 0;
  background: rgba(14, 18, 35, 0.58);
  animation: portal-veil 1550ms ease both;
}

.dom-portal {
  position: relative;
  width: 310px;
  height: 310px;
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(115, 204, 255, 0.82), 0 0 130px rgba(95, 90, 255, 0.48);
  animation: portal-spin 1550ms cubic-bezier(.18,.82,.22,1) both;
}

.dom-portal-sprite {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: 1600% 100%;
  background-position: 0 0;
  filter: drop-shadow(0 0 24px rgba(129, 238, 255, 0.94));
  animation: portal-sprite-frames 720ms steps(16) infinite;
}

.dom-portal::before,
.dom-portal::after {
  content: "";
  position: absolute;
  inset: -36px;
  border-radius: 50%;
  border: 12px solid rgba(155, 229, 255, 0.55);
  border-left-color: transparent;
  border-bottom-color: transparent;
  animation: portal-ring 760ms linear infinite;
}

.dom-portal::after {
  inset: -72px;
  border-width: 8px;
  animation-duration: 1120ms;
  animation-direction: reverse;
}

.dom-portal-label {
  position: absolute;
  left: 50%;
  top: calc(50% + 235px);
  transform: translateX(-50%);
  color: #fff;
  font-size: 42px;
  font-weight: 900;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
  animation: portal-label 1550ms ease both;
}

@keyframes collected-row-reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes tutorial-hint-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes tutorial-target-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes collect-label-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes idle-hint-tug {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  36% {
    transform: translate3d(var(--hint-x, 0), var(--hint-y, 0), 0) scale(1.035);
  }
  62% {
    transform: translate3d(calc(var(--hint-x, 0) * -0.18), calc(var(--hint-y, 0) * -0.18), 0) scale(1.015);
  }
}

@keyframes help-row-glow {
  0%,
  100% {
    filter: none;
    transform: translateZ(0) scale(1);
  }
  45% {
    filter: drop-shadow(0 0 24px rgba(255, 230, 93, 0.74));
    transform: translateZ(0) scale(1.018);
  }
}

@keyframes help-tile-pulse {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes help-badge-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes swap-impact-ring {
  0% {
    opacity: 0.94;
    transform: scale(0.92);
  }

  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

@keyframes swap-impact-outline {
  0% {
    opacity: 0.95;
    transform: scale(0.88);
  }

  48% {
    opacity: 0.88;
    transform: scale(1.03);
  }

  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

@keyframes swap-impact-line {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--impact-angle)) scaleX(0.12);
  }

  34% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--impact-angle)) scaleX(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--impact-angle)) scaleX(1.32);
  }
}

@keyframes swap-impact-dot {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }

  36% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.9);
  }
}

@keyframes portal-spin {
  0% {
    transform: scale(0.2) rotate(0deg);
    opacity: 0;
  }
  22% {
    opacity: 1;
  }
  72% {
    transform: scale(1.25) rotate(520deg);
    opacity: 1;
  }
  100% {
    transform: scale(0.05) rotate(800deg);
    opacity: 0;
  }
}

@keyframes portal-ring {
  to {
    transform: rotate(360deg);
  }
}

@keyframes portal-sprite-frames {
  to {
    background-position: -1600% 0;
  }
}

@keyframes portal-veil {
  0% {
    opacity: 0;
  }
  25%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0.82;
  }
}

@keyframes portal-label {
  0%,
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  35%,
  75% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

#boot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: #2d405f;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0;
  pointer-events: none;
}

#boot::after {
  content: "";
  display: none;
}

#boot[data-status="failed"]::after,
body.boot-failed #boot::after {
  display: block;
  content: attr(data-message);
  min-height: 24px;
}

#boot[data-status="failed"],
body.boot-failed #boot {
  width: min(420px, calc(100vw - 48px));
  height: auto;
  min-height: 148px;
  grid-template-rows: auto auto;
  gap: 12px;
  padding: 22px 28px;
  border: 3px solid rgba(183, 63, 44, 0.62);
  border-radius: 26px;
  background: rgba(255, 244, 229, 0.96);
  box-shadow: 0 12px 28px rgba(95, 100, 98, 0.18);
  color: #7a261d;
  pointer-events: auto;
}

#boot[data-status="failed"] .boot-spinner,
body.boot-failed #boot .boot-spinner {
  display: none;
}

.boot-spinner {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 7px solid rgba(255, 255, 255, 0.52);
  border-top-color: #8f9692;
  animation: boot-spin 0.8s linear infinite;
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

body.ready #boot {
  display: none;
}

body.boot-failed #boot {
  display: grid;
}

.boot-retry-button {
  min-width: 142px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #2d405f;
  color: #fff;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

.boot-retry-button:active {
  transform: translateY(1px);
}

.perf-debug-overlay {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 20000;
  width: min(420px, calc(100vw - 16px));
  max-height: 45vh;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border-radius: 8px;
  background: rgba(8, 15, 24, 0.84);
  color: #d9f0ff;
  font: 11px/1.35 Consolas, monospace;
  pointer-events: none;
  white-space: pre-wrap;
}

body.low-performance .dom-tile,
body.low-performance .dom-menu-button,
body.low-performance .dom-image-button,
body.low-performance .dom-modal-button,
body.low-performance .dom-toggle,
body.low-performance .dom-choice {
  transition-duration: 80ms;
}

body.low-performance .dom-tutorial-target-icons,
body.low-performance .dom-tutorial-hand,
body.low-performance .dom-tutorial-path,
body.low-performance .dom-tutorial-card-ghost,
body.low-performance .dom-row.is-solved.is-collecting-target,
body.low-performance .dom-drag-ghost,
body.low-performance .dom-swap-ghost,
body.low-performance .dom-drag-source-placeholder-fade,
body.low-performance .dom-swap-impact,
body.low-performance .dom-swap-impact::before,
body.low-performance .dom-collect-ghost,
body.low-performance .dom-collect-ghost .dom-tile,
body.low-performance .dom-collect-ghost .dom-collect-label,
body.low-performance .dom-collect-callout,
body.low-performance .dom-collect-confetti span,
body.low-performance .dom-portal-suck-ghost {
  will-change: auto;
}

body.low-performance .dom-game-viewport::after,
body.low-performance .dom-card-shadow {
  display: none;
}

body.low-performance .dom-tutorial-hand,
body.low-performance .dom-tutorial-path,
body.low-performance .dom-tutorial-path.is-target,
body.low-performance .dom-slider-rail,
body.low-performance .dom-slider-knob,
body.low-performance .dom-tile:hover,
body.low-performance .dom-tile.is-drag-target,
body.low-performance .dom-modal-button:hover {
  filter: none;
}

body.low-performance .dom-row.is-open,
body.low-performance .dom-row.is-solved,
body.low-performance .dom-tutorial-banner,
body.low-performance .dom-help-level-badge,
body.low-performance .dom-win-coins,
body.low-performance .dom-portal,
body.low-performance .dom-portal-suck-ghost,
body.low-performance .dom-drag-ghost,
body.low-performance .dom-drag-source-placeholder-fade,
body.low-performance .dom-collect-callout,
body.low-performance .dom-collect-confetti span,
body.low-performance .dom-collect-confetti span.is-spark {
  box-shadow: none;
  filter: none;
}

body.low-performance .dom-swap-impact-line,
body.low-performance .dom-swap-impact-dot,
body.low-performance .dom-tutorial-grab-wave,
body.low-performance .dom-portal::before,
body.low-performance .dom-portal::after {
  display: none;
}

body.low-performance .dom-tile.is-idle-hint,
body.low-performance .dom-row.is-help-level-1,
body.low-performance .dom-tile.is-help-level-2,
body.low-performance .dom-tile.is-help-level-3,
body.low-performance .dom-help-level-badge,
body.low-performance .dom-portal-veil,
body.low-performance .dom-portal,
body.low-performance .dom-portal-sprite,
body.low-performance .dom-portal-label {
  animation: none;
}

body.low-performance .dom-tile.is-help-level-2::after,
body.low-performance .dom-tile.is-help-level-3::after {
  content: none;
}

body.low-performance .dom-tile.is-drag-target::after,
body.low-performance .dom-tile.is-help-level-2::after,
body.low-performance .dom-tile.is-help-level-3::after {
  box-shadow: none;
}

body.low-performance .dom-portal {
  box-shadow: none;
}

body.low-performance .dom-portal-sprite {
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .dom-tutorial-motion-layer,
  .dom-collect-confetti,
  .dom-swap-impact,
  .dom-portal::before,
  .dom-portal::after {
    display: none !important;
  }

  .dom-tile,
  .dom-menu-button,
  .dom-image-button,
  .dom-modal-button,
  .dom-toggle,
  .dom-choice,
  .dom-tutorial-target-icons {
    transition: none !important;
  }
}

@supports (height: 100dvh) {
  #game-shell {
    height: 100dvh;
  }

  #game {
    height: 100dvh;
  }
}

body.platform-poki,
body.platform-poki #game-shell,
body.platform-poki #game,
body.platform-poki .dom-game-viewport {
  min-width: 300px;
  min-height: 320px;
}

body.platform-poki #game-shell,
body.platform-poki #game {
  height: max(100vh, 320px);
}

@supports (height: 100dvh) {
  body.platform-poki #game-shell,
  body.platform-poki #game {
    height: max(100dvh, 320px);
  }
}

body.platform-android #game-shell,
body.platform-vk-games #game-shell {
  display: block;
  place-items: stretch;
  background: #b98562;
}

body.platform-vk-games.has-vk-bottom-banner #game-shell {
  bottom: var(--vk-bottom-banner-h);
  height: calc(100vh - var(--vk-bottom-banner-h));
  height: calc(100dvh - var(--vk-bottom-banner-h));
}

body.platform-vk-games.has-vk-bottom-banner #game {
  width: min(100vw, calc((100vh - var(--vk-bottom-banner-h)) * 1024 / 1792));
  width: min(100vw, calc((100dvh - var(--vk-bottom-banner-h)) * 1024 / 1792));
  height: min(calc(100vh - var(--vk-bottom-banner-h)), calc(100vw * 1792 / 1024));
  height: min(calc(100dvh - var(--vk-bottom-banner-h)), calc(100vw * 1792 / 1024));
}

body.platform-android.has-native-bottom-banner #game-shell {
  height: calc(100vh - var(--native-bottom-banner-h));
  height: calc(100dvh - var(--native-bottom-banner-h));
}

body.platform-android #game,
body.platform-vk-games #game {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  box-shadow: none;
}

@supports (height: 100dvh) {
  body.platform-android #game,
  body.platform-vk-games #game {
    height: 100dvh !important;
  }
}

body.platform-android.has-native-bottom-banner #game {
  height: calc(100vh - var(--native-bottom-banner-h)) !important;
  height: calc(100dvh - var(--native-bottom-banner-h)) !important;
}

body.platform-vk-games.has-vk-bottom-banner #game {
  width: 100vw !important;
  height: calc(100vh - var(--vk-bottom-banner-h)) !important;
  height: calc(100dvh - var(--vk-bottom-banner-h)) !important;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  box-shadow: none;
}
