:root {
  color-scheme: light;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  background: #d7eef7;
  --game-top-offset: 60px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.page-shell {
  display: grid;
  width: 100%;
  min-height: 100vh;
  align-items: start;
  justify-items: center;
  padding: var(--game-top-offset) 12px 12px;
}

.game-wrap {
  width: min(100vw - 24px, 1024px);
  aspect-ratio: 1024 / 715;
  max-height: calc(100vh - 24px);
}

.game-stage {
  position: relative;
  width: 1024px;
  height: 715px;
  overflow: hidden;
  transform-origin: top left;
  background: #fff;
  box-shadow: 0 14px 34px rgb(0 62 89 / 22%);
}

.game-element {
  position: absolute;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.game-element.is-tool {
  cursor: grab;
}

.game-element.is-tool:active {
  cursor: grabbing;
}

.game-element.is-button {
  cursor: pointer;
}

.game-element.is-button:active {
  transform: translateY(1px);
}

.picture-select-icon {
  outline: 0 solid transparent;
}

.picture-select-icon:hover {
  filter: brightness(1.04);
}

.picture-select-icon.is-selected {
  outline: 3px solid rgba(255, 205, 38, 0.95);
  outline-offset: 2px;
}

.picture-select-icon.is-disabled {
  cursor: default;
  opacity: 0.58;
  filter: grayscale(0.25);
}

.is-hidden {
  display: none !important;
}

.game-element[data-name="pictureA"],
.game-element[data-name="pictureB"],
.game-element[data-name="pictureC"],
.game-element[data-name="pictureD"] {
  opacity: 0;
  pointer-events: none;
}

.game-element[data-name="pictureAOutline"],
.game-element[data-name="pictureBOutline"],
.game-element[data-name="pictureCOutline"],
.game-element[data-name="pictureDOutline"] {
  pointer-events: none;
}

.reveal-layer {
  position: absolute;
  z-index: 45;
  overflow: visible;
  pointer-events: auto;
}

.revealed-image {
  pointer-events: none;
}

.hotspots {
  pointer-events: auto;
}

.target-hotspot {
  fill: transparent;
  cursor: default;
  pointer-events: all;
}

.target-hotspot.is-drag-match {
  fill: rgba(255, 216, 64, 0.22);
  stroke: rgba(255, 177, 0, 0.85);
  stroke-width: 2;
}

.drag-ghost {
  position: absolute;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 10px 12px rgba(0, 37, 54, 0.3));
  opacity: 0.92;
  transform: scale(1.04);
  transform-origin: center;
}

.drag-ghost.is-error {
  animation: drag-error 0.34s ease-in-out;
}

.shape-name-display {
  position: absolute;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 0 18px;
  color: #174eff;
  direction: ltr;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.game-stage[data-lang-dir="rtl"] .shape-name-display,
.game-stage[data-lang-dir="rtl"] .completion-message,
.game-stage[data-lang-dir="rtl"] .info-content {
  direction: rtl;
}

.game-stage[data-lang-dir="ltr"] .shape-name-display,
.game-stage[data-lang-dir="ltr"] .completion-message,
.game-stage[data-lang-dir="ltr"] .info-content {
  direction: ltr;
}

.shape-name-display.is-feedback {
  animation: feedback-pop 0.95s ease-out forwards;
}

.solved-flash {
  position: absolute;
  z-index: 75;
  pointer-events: none;
  overflow: visible;
}

.solved-flash path {
  fill: rgba(255, 232, 92, 0.28);
  stroke: rgba(255, 190, 0, 0.95);
  stroke-width: 4;
  animation: solved-flash 0.6s ease-out forwards;
}

.completion-overlay {
  position: absolute;
  top: 10px;
  left: 330px;
  width: 360px;
  height: 66px;
  z-index: 110;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.completion-overlay.is-visible {
  opacity: 1;
}

.completion-message {
  display: grid;
  gap: 2px;
  min-width: 0;
  width: 100%;
  padding: 8px 18px;
  border: 2px solid rgba(255, 201, 38, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #174eff;
  direction: ltr;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 42, 66, 0.26);
}

.completion-message strong {
  font-size: 24px;
  line-height: 1;
}

.completion-message span {
  color: #123746;
  font-size: 15px;
  font-weight: 700;
}

.info-overlay {
  position: absolute;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  background: rgba(9, 68, 96, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.info-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.info-panel {
  position: relative;
  width: 560px;
  height: 360px;
  max-width: calc(100% - 64px);
  max-height: calc(100% - 64px);
  border: 4px solid rgba(47, 184, 221, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 46px rgba(0, 42, 66, 0.28);
}

.info-close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 38px;
  height: 38px;
  border: 2px solid rgba(13, 95, 130, 0.28);
  border-radius: 50%;
  background: #e8f8fc;
  color: #174eff;
  cursor: pointer;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.info-close:hover {
  background: #d7f1f8;
}

.info-content {
  display: grid;
  width: 100%;
  height: 100%;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 58px 54px 42px;
  color: #123746;
  direction: ltr;
  text-align: center;
}

.info-content h2 {
  margin: 0 0 8px;
  color: #174eff;
  font-size: 30px;
  line-height: 1;
}

.info-content p {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
}

.progress-display {
  position: absolute;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: 0 18px;
  color: #174eff;
  direction: ltr;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.element-label {
  position: absolute;
  z-index: 90;
  display: grid;
  place-items: center;
  color: #174eff;
  direction: ltr;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.element-label-easy,
.element-label-hard {
  cursor: pointer;
  font-size: 18px;
  pointer-events: auto;
}

.element-label-start {
  color: #fff;
  font-size: 34px;
  letter-spacing: 0;
  cursor: pointer;
  pointer-events: auto;
  text-shadow: 0 2px 4px rgba(0, 44, 72, 0.35);
}

.element-label-dimensionFrame3D,
.element-label-dimensionFrame2D {
  font-size: 30px;
  font-weight: 700;
}

.element-label-easy.is-selected,
.element-label-hard.is-selected {
  color: #123746;
  text-shadow: 0 0 8px rgba(255, 214, 64, 0.9);
}

@keyframes drag-error {
  0%,
  100% {
    transform: translateX(0) scale(1.04);
  }

  25% {
    transform: translateX(-10px) scale(1.04);
  }

  50% {
    transform: translateX(10px) scale(1.04);
  }

  75% {
    transform: translateX(-6px) scale(1.04);
  }
}

@keyframes feedback-pop {
  0% {
    opacity: 0;
    transform: translateY(4px) scale(0.95);
  }

  18%,
  72% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-8px) scale(1);
  }
}

@keyframes solved-flash {
  0% {
    opacity: 0;
    transform: scale(0.98);
    transform-origin: center;
  }

  35% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.03);
    transform-origin: center;
  }
}

.load-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  direction: rtl;
  color: #123746;
  font-size: 24px;
  text-align: center;
  background: #eaf8fc;
}
