/* ═════════ Shared pieces (start + result) ═════════ */

.brand-logo {
  flex: none;
  height: calc(var(--u) * 148);   /* sized by height so the English and Arabic logos match */
  width: auto;
  max-width: 100%;
}
/* Arabic logo: sized so its figure matches the English logo's figure exactly (figure = 94% of its height). */
[lang='ar'] .brand-logo {
  height: calc(var(--u) * 157);
  margin-block: calc(var(--u) * -4.5);   /* takes exactly the English logo's 148u of layout space */
}

.btn-pill {
  flex: none;
  display: grid;
  place-items: center;
  width: min(calc(var(--u) * 708), 100%);
  height: max(calc(var(--u) * 168), 52px);
  border-radius: 999px;
  background: var(--c-blue);
  color: var(--c-white);
  font-weight: 800;
  font-size: max(calc(var(--u) * 63), 18px);
  line-height: 1;
  letter-spacing: .005em;
  box-shadow: 0 calc(var(--u) * 6) calc(var(--u) * 26) rgba(0, 0, 0, .13);
  transition: transform .14s var(--ease-out), box-shadow .14s ease, opacity .2s ease;
}
.btn-pill:active:not(:disabled) {
  transform: scale(.965);
  box-shadow: 0 calc(var(--u) * 3) calc(var(--u) * 12) rgba(0, 0, 0, .14);
}
.btn-start:disabled { opacity: .55; cursor: default; }

/* Language switch: segmented control above START NOW; the blue thumb slides to the choice. */
.lang-switch {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: repeat(var(--count, 2), 1fr);
  width: min(calc(var(--u) * 560), 100%);
  height: max(calc(var(--u) * 112), 44px);
  margin-bottom: calc(var(--u) * 44);
  padding: max(calc(var(--u) * 8), 3px);
  border-radius: 999px;
  background: var(--c-white);
  box-shadow: 0 0 0 max(calc(var(--u) * 3), 1.5px) var(--c-pill) inset, 0 calc(var(--u) * 6) calc(var(--u) * 22) rgba(24, 122, 163, .12);
  --active: 0;
}
.lang-switch__thumb {
  position: absolute;
  top: max(calc(var(--u) * 8), 3px);
  bottom: max(calc(var(--u) * 8), 3px);
  left: max(calc(var(--u) * 8), 3px);
  width: calc((100% - 2 * max(calc(var(--u) * 8), 3px)) / var(--count, 2));
  border-radius: 999px;
  background: var(--c-blue);
  box-shadow: 0 calc(var(--u) * 4) calc(var(--u) * 14) rgba(41, 171, 226, .35);
  transform: translateX(calc(var(--active) * 100%));
  transition: transform .32s cubic-bezier(.3, 1.3, .5, 1);
}
.lang-switch__btn {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--c-teal);
  font-weight: 700;
  font-size: max(calc(var(--u) * 38), 14px);
  line-height: 1;
  transition: color .25s ease;
}
.lang-switch__btn[lang='ar'] { font-size: max(calc(var(--u) * 42), 15px); }
.lang-switch__btn[aria-checked='true'] { color: var(--c-white); }
.lang-switch__btn:active { transform: scale(.97); }
.btn-replay:disabled { cursor: default; }

/* ═════════ START ═════════ */

.screen--start { justify-content: space-evenly; }

.title-xl {
  flex: none;
  margin-top: calc(var(--u) * 40);
  font-weight: 800;
  font-size: calc(var(--u) * 94);
  line-height: 1.03;
  text-align: center;
  white-space: pre-line;
  letter-spacing: -.003em;
}

.start-emblem__img {
  flex: 1 1 0;
  min-height: calc(var(--u) * 260);
  max-height: calc(var(--u) * 640);
  width: 100%;
  margin: calc(var(--u) * 70) 0 calc(var(--u) * 60);
  object-fit: contain;
  animation: emblem-idle 3.6s ease-in-out infinite;
}
.start-emblem { display: contents; }

@keyframes emblem-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(calc(var(--u) * -10)); }
}

.level-readout {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.level-readout__value {
  color: var(--c-blue);
  font-weight: 800;
  font-size: calc(var(--u) * 92);
  line-height: 1;
}
.level-readout__label {
  margin-top: calc(var(--u) * 10);
  font-weight: 800;
  font-size: calc(var(--u) * 61);
  line-height: 1.1;
}

.instruction {
  flex: none;
  margin: calc(var(--u) * 34) 0 calc(var(--u) * 44);
  font-weight: 700;
  font-size: max(calc(var(--u) * 37), 13px);
  line-height: 1.22;
  text-align: center;
  white-space: pre-line;
}

/* ═════════ RESULT ═════════ */

.screen--result { justify-content: space-evenly; }

.result-heading {
  flex: none;
  margin-top: calc(var(--u) * 46);
  font-weight: 800;
  font-size: calc(var(--u) * 68);
  line-height: 1.1;
  text-align: center;
}

.result-percent {
  flex: none;
  color: var(--c-blue);
  font-weight: 800;
  font-size: calc(var(--u) * 220);
  line-height: .92;
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}

.result-tier {
  flex: none;
  min-height: 1.25em;
  margin-top: calc(var(--u) * 6);
  color: var(--c-teal);
  font-weight: 600;
  font-size: max(calc(var(--u) * 40), 14px);
  line-height: 1.25;
  text-align: center;
  text-transform: capitalize;
}

.result-emblem {
  position: relative;
  flex: 1 1 0;
  min-height: calc(var(--u) * 240);
  max-height: calc(var(--u) * 560);
  width: 100%;
  margin: calc(var(--u) * 70) 0 calc(var(--u) * 60);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 14);
  container-type: size;
  --emblem-h: min(calc(var(--u) * 520), 100cqh);
}
@supports not (container-type: size) {
  .result-emblem { --emblem-h: calc(var(--u) * 400); }
}

.emblem-big {
  position: relative;
  flex: none;
  height: var(--emblem-h);
  aspect-ratio: 354 / 495;
  transition: opacity .2s ease;
  --fill: 0;
}
.emblem-big.is-pre { opacity: 0; }
.emblem-big__outline { position: relative; width: 100%; height: 100%; }
.emblem-big__fill {
  position: absolute;
  /* RESULT_FILL_BOX in js/data/assets.js */
  left: 35.762%;
  top: 39.652%;
  width: 28.477%;
  height: 52.291%;
  clip-path: inset(calc((100 - var(--fill)) * 1%) 0 0 0);
  -webkit-clip-path: inset(calc((100 - var(--fill)) * 1%) 0 0 0);
}

.confetti {
  flex: none;
  height: calc(var(--emblem-h) * .92);
  width: auto;
  opacity: 0;
}
.is-revealed .confetti { animation: confetti-drift 4.5s ease-in-out infinite alternate; }
.is-revealed .confetti--right { animation-delay: -2.2s; }
@keyframes confetti-drift {
  from { transform: translateY(calc(var(--u) * -8)) rotate(-1.5deg); }
  to { transform: translateY(calc(var(--u) * 8)) rotate(1.5deg); }
}

.result-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--emblem-h) * 1.25);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(41, 171, 226, .26), rgba(41, 171, 226, 0));
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}

.result-tagline {
  flex: none;
  margin-bottom: calc(var(--u) * 44);
  font-weight: 800;
  font-size: max(calc(var(--u) * 49), 15px);
  line-height: 1.18;
  text-align: center;
  white-space: pre-line;
  text-transform: capitalize;
}

[data-stage].is-pre { opacity: 0; }
.no-level-title .result-tier { display: none; }

.result-fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.emblem-flight {
  position: fixed;
  z-index: 50;
  transform-origin: 0 0;
  pointer-events: none;
  will-change: transform, opacity;
}
