@import url('https://fonts.googleapis.com/css2?family=Inter:wght@600&family=Nunito:wght@700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  background: #a8dde6;
}

.ex-page {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: 'Nunito', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* Canvas = viewport plin, coordonate Figma 1440×1024 → % */
.ex-board {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #a8dde6;
}

.ex-exit {
  position: fixed;
  z-index: 200;
  top: 4.24%;
  left: 2.58%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(14px, 1.5vw, 22px);
  color: #2a2706;
  text-decoration: none;
  white-space: nowrap;
}

.ex-exit:hover { background: rgba(255, 255, 255, 0.92); }
.ex-exit svg { width: 20px; height: 20px; flex-shrink: 0; }

.ex-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.ex-scene img {
  position: absolute;
  display: block;
  pointer-events: none;
}

/* Cer — imagini globale stânga/dreapta */
.ex-sky {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
  z-index: 1;
}

.ex-sky--desktop-left {
  left: 0;
  top: calc(5% + 30px);
  width: 25%;
}

.ex-sky--desktop-right {
  right: 0;
  left: auto;
  top: calc(26% + 30px);
  width: 24%;
}

.ex-scene img.ex-sky--mobile-left,
.ex-scene img.ex-sky--mobile-right {
  display: none;
}

.ex-grass {
  left: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  height: 24.02%;
  object-fit: fill;
  object-position: center bottom;
  z-index: 2;
}

.ex-sun {
  left: 84%;
  top: 0;
  width: 14%;
  z-index: 4;
}

.ex-prompt {
  position: absolute;
  left: 4.79%;
  top: 21.5%;
  width: min(25.62vw, calc(64.55vh * 369 / 661));
  aspect-ratio: 369 / 661;
  height: auto;
  z-index: 15;
  animation: ex-float 4.5s ease-in-out infinite;
  pointer-events: none;
}

.ex-prompt-balloon {
  position: absolute;
  display: block;
  object-fit: contain;
  z-index: 1;
}

.ex-prompt-balloon--mobile { display: none; }

.ex-prompt-balloon--desktop {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ex-prompt-card {
  position: absolute;
  left: 7.05%;
  top: 59.23%;
  width: 85.88%;
  height: 40.85%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: 0 10%;
  pointer-events: none;
}

.ex-prompt-text {
  margin: 0;
  font-weight: 800;
  font-size: clamp(13px, 1.95vw, 28px);
  line-height: 1.25;
  text-align: center;
  color: #364153;
}

.ex-page--grupuri .ex-prompt-text {
  font-size: clamp(12px, 1.74vw, 25px);
}

.ex-prompt-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35.3%;
  aspect-ratio: 1;
  max-width: 112px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.ex-prompt-play svg { width: 100%; height: 100%; display: block; }

.ex-prompt--playing .ex-prompt-play {
  animation: ex-pulse 0.6s ease-in-out infinite alternate;
}

.ex-prompt-hit {
  position: absolute;
  inset: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 3;
  pointer-events: auto;
}

.ex-choices {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.ex-choices--hidden {
  opacity: 0;
  pointer-events: none;
}

.ex-choice {
  position: absolute;
  width: 10%;
  height: auto;
  aspect-ratio: 144 / 381;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  animation: ex-float 3.8s ease-in-out infinite;
  transform-origin: center bottom;
  z-index: 10;
  pointer-events: auto;
}

.ex-choice--0 { left: 37.01%; top: 24.9%; animation-delay: 0s; }
.ex-choice--1 { left: 60.49%; top: 22.27%; animation-delay: 0.5s; }
.ex-choice--2 { left: 48.94%; top: 51.27%; animation-delay: 0.9s; }
.ex-choice--3 { left: 72.57%; top: 51.46%; animation-delay: 0.3s; }
.ex-choice--4 { left: 84.03%; top: 27.83%; animation-delay: 1.1s; }

.ex-choice:hover { filter: brightness(1.04); }
.ex-choice__svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.1));
}

.ex-choice--shake { animation: ex-shake 0.55s ease-in-out !important; }
.ex-choice--fade { opacity: 0; transform: scale(0.55) translateY(30px) !important; pointer-events: none; }
.ex-choice--correct { animation: ex-float 3.8s ease-in-out infinite, ex-glow 0.8s ease-in-out 2; }

.ex-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.ex-confetti span {
  position: absolute;
  top: -12px;
  border-radius: 2px;
  opacity: 0;
  animation: ex-confetti linear forwards;
}

@media (max-aspect-ratio: 3/4) {
  /*
   * Mobile Figma 375×720 — bounds complete (left/top/width/height), img umplută
   */

  .ex-board {
    overflow: visible;
  }

  .ex-choices {
    overflow: visible;
  }

  .ex-scene img {
    object-fit: fill;
  }

  .ex-grass {
    left: 50%;
    top: 80.14%;
    bottom: auto;
    right: auto;
    width: 691.63%;
    height: auto;
    transform: translateX(-50%);
    object-fit: fill;
    object-position: center bottom;
  }

  .ex-sun {
    left: 74.93%;
    right: -15.67%;
    top: -9.03%;
    bottom: 87.27%;
    width: auto;
    object-fit: fill;
  }

  .ex-scene img.ex-sky--desktop-left,
  .ex-scene img.ex-sky--desktop-right {
    display: none;
  }

  /* Mobile Figma Group 30 / 31 — imagini globale, bounds complete */
  .ex-scene img.ex-sky--mobile-left {
    display: block;
    left: -20.27%;
    top: 5.83%;
    width: 56.44%;
    height: 17.3%;
    object-fit: fill;
  }

  .ex-scene img.ex-sky--mobile-right {
    display: block;
    left: 62.93%;
    top: 37.78%;
    width: 56.44%;
    height: 17.3%;
    object-fit: fill;
  }

  .ex-exit {
    top: 1.81%;
    left: auto;
    right: 3.72%;
    padding: 9px 17px;
    gap: 9px;
    border-radius: 18px;
    font-size: 15.5px;
  }

  .ex-exit svg {
    width: 20px;
    height: 20px;
  }

  .ex-prompt {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    left: 2.93%;
    top: 5.83%;
    right: 2.93%;
    width: auto;
    height: auto;
    animation: none;
  }

  .ex-prompt-balloon--desktop { display: none; }

  .ex-prompt-balloon--mobile {
    display: block;
    position: relative;
    flex: 0 0 37.35%;
    width: 37.35%;
    height: auto;
    aspect-ratio: 140 / 210;
    left: auto;
    top: auto;
    inset: auto;
    object-fit: contain;
    z-index: 2;
  }

  .ex-prompt-card {
    position: relative;
    flex: 0 0 70.34%;
    width: 70.34%;
    max-width: none;
    left: auto;
    top: auto;
    margin-top: 10.7%;
    margin-left: -18.36%;
    height: auto;
    min-height: max(18vh, 96px);
    aspect-ratio: unset;
    padding: 10px 12px 10px 14%;
    gap: 6px;
    background: #fff;
    border: 1.22px solid #0b273f;
    border-radius: 18px 18px 18px 0;
    box-shadow: 0 7px 11px -7px rgba(0, 0, 0, 0.1);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
  }

  .ex-prompt-text {
    width: 92%;
    max-width: 100%;
    font-size: 15px;
    line-height: 1.22;
    text-align: center;
  }

  .ex-page--grupuri .ex-prompt-text {
    font-size: 14px;
    line-height: 1.2;
  }

  .ex-prompt-play {
    align-self: center;
    width: 22.8%;
    max-width: 56px;
    pointer-events: auto;
  }

  .ex-choice {
    width: 20.27%;
    height: auto;
    aspect-ratio: 106 / 221;
    animation: ex-float 3.8s ease-in-out infinite;
    overflow: visible;
  }

  .ex-choice__svg {
    width: 100%;
    height: auto;
    display: block;
  }

  /* Baloane alegere — poziții Figma, proporții păstrate */
  .ex-choice--0 { left: 4.8%;  top: 39.61%; animation-delay: 0s; }
  .ex-choice--1 { left: 41.33%; top: 31.81%; animation-delay: 0.5s; }
  .ex-choice--2 { left: 20.27%; top: 56.75%; animation-delay: 0.9s; }
  .ex-choice--3 { left: 73%;   top: 42.83%; animation-delay: 0.3s; }
  .ex-choice--4 { left: 52%;   top: 62.19%; animation-delay: 1.1s; }
}

/* Telefon portrait — text 79% width, padding pentru balon */
@media (max-aspect-ratio: 3/4) and (max-width: 599px) {
  .ex-prompt-card {
    margin-top: 8%;
    margin-left: -14%;
    padding-left: 8%;
    min-height: max(17vh, 88px);
  }

  .ex-prompt-text {
    width: 79%;
    font-size: 15px;
  }

  .ex-page--grupuri .ex-prompt-text {
    font-size: 14px;
  }

  .ex-choice--0 { top: 44.61%; }
  .ex-choice--1 { top: 37.81%; }
  .ex-choice--2 { top: 61.75%; }
  .ex-choice--3 { top: 47.83%; }
  .ex-choice--4 { top: 67.19%; }
}

/* Tablet portrait (iPad Mini) — 20px, padding stânga pentru balon */
@media (max-aspect-ratio: 3/4) and (min-width: 600px) {
  .ex-prompt-card {
    padding: 12px 14px 12px 16%;
    min-height: max(16vh, 110px);
  }

  .ex-prompt-text {
    width: 100%;
    font-size: 20px;
    line-height: 1.2;
  }

  .ex-page--grupuri .ex-prompt-text {
    font-size: 18px;
    line-height: 1.18;
  }

  .ex-choice--0 { top: 45.61%; }
  .ex-choice--1 { top: 38.81%; }
  .ex-choice--2 { top: 62.75%; }
  .ex-choice--3 { top: 48.83%; }
  .ex-choice--4 { top: 68.19%; }
}

/* Landscape îngust — balon scalat (desktop fix nu încape) */
@media (orientation: landscape) and (max-height: 500px) {
  .ex-prompt {
    top: 6%;
    width: min(30vw, calc(56vh * 369 / 661));
    height: auto;
    aspect-ratio: 369 / 661;
  }

  .ex-prompt-card {
    left: 4%;
    top: 54%;
    width: 92%;
    height: 48%;
    padding: 5% 8%;
    gap: 0.25em;
    overflow: hidden;
  }

  .ex-prompt-text {
    width: 100%;
    font-size: clamp(9px, 1.3vw, 13px);
    line-height: 1.15;
  }

  .ex-page--grupuri .ex-prompt-text {
    font-size: clamp(8px, 1.15vw, 12px);
  }

  .ex-prompt-play {
    width: 28%;
    max-width: 42px;
  }
}

@keyframes ex-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes ex-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

@keyframes ex-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-12px) rotate(-5deg); }
  30% { transform: translateX(12px) rotate(5deg); }
  45% { transform: translateX(-10px); }
  60% { transform: translateX(10px); }
}

@keyframes ex-glow {
  0%, 100% { filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.1)); }
  50% { filter: drop-shadow(0 0 24px rgba(47, 137, 200, 0.55)); }
}

@keyframes ex-confetti {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}
