.game-root,
.game-root * {
  box-sizing: border-box;
}

.game-root {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #edf3ee;
  color: #29475a;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pazzle-picture-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.92), transparent 27%),
    radial-gradient(circle at 88% 78%, rgba(205, 232, 218, 0.76), transparent 31%),
    linear-gradient(145deg, #f7f1e7, #e7f2ec);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
}

.pazzle-picture-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

.game-page .pazzle-picture-canvas canvas {
  display: block;
  cursor: url("/static/img/cursors/cursor_cat.54234ab9b215.png") 0 0, default !important;
}

.pazzle-picture-heading {
  position: absolute;
  top: max(13px, env(safe-area-inset-top));
  left: 50%;
  z-index: 5;
  width: min(620px, calc(100% - 320px));
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 8px 100px 8px 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 30px rgba(42, 67, 72, 0.13);
  transform: translateX(-50%);
  backdrop-filter: blur(9px);
  pointer-events: none;
}

.pazzle-picture-heading h1 {
  margin: 0;
  color: #28566a;
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
}

.pazzle-picture-progress {
  position: absolute;
  top: 50%;
  right: 10px;
  min-width: 78px;
  border-radius: 999px;
  padding: 8px 11px;
  background: #417e70;
  color: #fff;
  font-size: clamp(13px, 1.45vw, 17px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  transform: translateY(-50%);
}

.pazzle-picture-levels {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(13px, env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  max-width: calc(100% - 28px);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 11px 25px rgba(42, 67, 72, 0.15);
  backdrop-filter: blur(9px);
}

.pazzle-picture-level {
  min-width: 82px;
  min-height: 42px;
  border: 2px solid transparent;
  border-radius: 11px;
  padding: 0 13px;
  background: #e5eee9;
  color: #36566a;
  font: 850 14px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: none;
  cursor: url("/static/img/cursors/cursor_hand.7271d4ef0443.png") 12 4, pointer;
  transition: transform 170ms ease, background 170ms ease, color 170ms ease;
}

.pazzle-picture-level:hover {
  transform: translateY(-1px);
}

.pazzle-picture-level.is-active {
  border-color: rgba(255, 255, 255, 0.9);
  background: #4e8e7c;
  color: #fff;
  box-shadow: 0 7px 14px rgba(63, 123, 106, 0.25);
}

.pazzle-picture-level:focus-visible,
.pazzle-picture-primary:focus-visible,
.pazzle-picture-secondary:focus-visible {
  outline: 4px solid #f0c958;
  outline-offset: 3px;
}

.pazzle-picture-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(39, 56, 63, 0.24);
  backdrop-filter: blur(5px);
}

.pazzle-picture-overlay[hidden] {
  display: none;
}

.pazzle-picture-dialog {
  width: min(100%, 530px);
  border: 3px solid #fff;
  border-radius: 22px;
  padding: clamp(26px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.97);
  text-align: center;
  box-shadow: 0 24px 64px rgba(32, 49, 58, 0.23);
}

.pazzle-picture-dialog h2 {
  margin: 0;
  color: #28566a;
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 950;
  line-height: 1.04;
  text-wrap: balance;
}

.pazzle-picture-dialog p {
  margin: 14px auto 0;
  max-width: 430px;
  color: #576c77;
  font-size: clamp(15px, 2vw, 19px);
  font-weight: 700;
  line-height: 1.42;
}

.pazzle-picture-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 25px;
}

.pazzle-picture-primary,
.pazzle-picture-secondary {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 13px;
  padding: 0 22px;
  background: #417e70;
  color: #fff;
  text-decoration: none;
  font: 900 17px/1 system-ui, sans-serif;
  box-shadow: 0 12px 24px rgba(50, 103, 91, 0.24);
  cursor: url("/static/img/cursors/cursor_hand.7271d4ef0443.png") 12 4, pointer;
}

.pazzle-picture-secondary {
  background: #5d7692;
  box-shadow: 0 12px 24px rgba(66, 88, 112, 0.22);
}

.pazzle-picture-error {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #edf3ee;
  color: #93463f;
  font-size: clamp(17px, 2.6vw, 24px);
  font-weight: 850;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 760px) and (orientation: portrait) {
  .pazzle-picture-heading {
    top: max(63px, calc(env(safe-area-inset-top) + 57px));
    width: calc(100% - 24px);
    min-height: 42px;
    border-radius: 14px;
    padding: 7px 72px 7px 12px;
  }

  .pazzle-picture-heading h1 {
    font-size: clamp(15px, 4.2vw, 21px);
  }

  .pazzle-picture-progress {
    right: 7px;
    min-width: 62px;
    padding: 7px 8px;
    font-size: 13px;
  }

  .pazzle-picture-levels {
    right: max(10px, env(safe-area-inset-right));
    left: max(10px, env(safe-area-inset-left));
    justify-content: center;
    gap: 5px;
    padding: 6px;
  }

  .pazzle-picture-level {
    min-width: 0;
    min-height: 40px;
    flex: 1 1 74px;
    padding: 0 7px;
    font-size: 12px;
  }

  .pazzle-picture-dialog {
    padding: 26px 19px;
  }
}

@media (orientation: landscape) and (max-width: 1024px) and (max-height: 440px) {
  .pazzle-picture-heading {
    top: max(8px, env(safe-area-inset-top));
    width: min(430px, calc(100% - 310px));
    min-height: 38px;
    border-radius: 13px;
    padding: 5px 70px 5px 12px;
  }

  .pazzle-picture-heading h1 {
    font-size: clamp(14px, 2.2vw, 19px);
  }

  .pazzle-picture-progress {
    right: 6px;
    min-width: 58px;
    padding: 6px 7px;
    font-size: 12px;
  }

  .pazzle-picture-levels {
    left: max(8px, env(safe-area-inset-left));
    bottom: max(7px, env(safe-area-inset-bottom));
    gap: 4px;
    border-radius: 12px;
    padding: 4px;
  }

  .pazzle-picture-level {
    min-width: 68px;
    min-height: 34px;
    border-radius: 9px;
    padding: 0 8px;
    font-size: 11px;
  }

  .pazzle-picture-dialog {
    width: min(480px, calc(100% - 150px));
    padding: 18px 26px;
  }

  .pazzle-picture-dialog h2 {
    font-size: clamp(25px, 7vh, 36px);
  }

  .pazzle-picture-dialog p {
    margin-top: 9px;
    font-size: 14px;
  }

  .pazzle-picture-actions {
    margin-top: 15px;
  }

  .pazzle-picture-primary,
  .pazzle-picture-secondary {
    min-height: 42px;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pazzle-picture-shell * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
