@font-face {
  font-family: "Storm Arabic";
  src: url("assets/fonts/NotoSansArabic.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Storm Devanagari";
  src: url("assets/fonts/NotoSansDevanagari.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

html:lang(ar) body, html:lang(ar) .studio-menu-root,
html:lang(ar) .loading-screen, html:lang(ar) .fatal-error {
  font-family: "Storm Arabic", "Segoe UI", sans-serif;
}
html:lang(hi) body, html:lang(hi) .studio-menu-root,
html:lang(hi) .loading-screen, html:lang(hi) .fatal-error {
  font-family: "Storm Devanagari", "Nirmala UI", sans-serif;
}
html:lang(ar) button, html:lang(ar) select, html:lang(ar) input,
html:lang(hi) button, html:lang(hi) select, html:lang(hi) input { font-family: inherit; }

.v2-page {
  min-height: 100dvh;
  padding: 0;
}

.v2-shell {
  width: 100vw;
  height: 100dvh;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 16%, rgb(67 99 145 / 34%), transparent 42%),
    radial-gradient(circle at 10% 50%, rgb(76 215 239 / 13%), transparent 34%),
    radial-gradient(circle at 90% 54%, rgb(255 96 153 / 13%), transparent 34%),
    linear-gradient(135deg, #080c1b, #111a31 48%, #090c1a);
  box-shadow: none;
}

.game-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(
    calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right)),
    calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9)
  );
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgb(103 218 239 / 66%);
  border-radius: clamp(0px, 1.2vw, 16px);
  background: #11162a;
  box-shadow:
    0 24px 80px rgb(0 0 0 / 62%),
    0 0 64px rgb(82 204 235 / 18%),
    0 0 0 1px rgb(255 255 255 / 10%) inset;
  transform: translate(-50%, -50%);
}

.game-stage canvas {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.loading-screen {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff7e8;
  background:
    radial-gradient(circle at 50% 42%, rgb(255 158 42 / 18%), transparent 34%),
    radial-gradient(circle at 28% 58%, rgb(71 214 239 / 14%), transparent 34%),
    linear-gradient(150deg, #0b1124, #121a31 54%, #090d1c);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  opacity: 1;
  transition: opacity 320ms ease, visibility 320ms ease;
  container: loading-screen / size;
}

.loading-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-screen__glow {
  position: absolute;
  width: 64%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 165 45 / 16%), transparent 66%);
  filter: blur(20px);
}

.loading-screen__card {
  position: relative;
  display: grid;
  width: min(78%, 700px);
  width: min(78cqw, 700px);
  grid-template-columns: minmax(0, 30%) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 2.2cqw, 28px);
  padding: clamp(12px, 2.4cqw, 30px);
  overflow: hidden;
  border: 1px solid rgb(102 218 239 / 48%);
  border-radius: clamp(14px, 2cqw, 26px);
  background:
    linear-gradient(145deg, rgb(29 39 65 / 96%), rgb(10 16 33 / 97%));
  box-shadow:
    0 24px 70px rgb(0 0 0 / 58%),
    0 0 42px rgb(88 211 237 / 12%),
    inset 0 0 0 1px rgb(255 255 255 / 7%);
}

.loading-screen__logo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 2px solid rgb(255 201 91 / 76%);
  justify-self: center;
  border-radius: clamp(12px, 1.7cqw, 22px);
  object-fit: cover;
  box-shadow: 0 14px 34px rgb(0 0 0 / 52%), 0 0 28px rgb(255 143 34 / 20%);
}

.loading-screen__copy {
  min-width: 0;
  overflow: hidden;
}

.loading-screen__studio {
  margin: 0 0 clamp(5px, 0.8cqw, 10px);
  color: #ffb254;
  font-size: clamp(8px, 0.95cqw, 12px);
  font-weight: 900;
  letter-spacing: 0.22em;
}

.loading-screen h1 {
  max-width: 100%;
  margin: 0;
  color: #fff5df;
  font-size: clamp(18px, 3.1cqw, 40px);
  font-weight: 950;
  letter-spacing: 0.018em;
  line-height: 1;
  overflow-wrap: normal;
  word-break: normal;
  text-wrap: balance;
  text-shadow: 0 4px 18px rgb(0 0 0 / 48%);
}

.loading-screen__copy > p:last-child {
  margin: clamp(9px, 1.4cqw, 18px) 0 0;
  color: #8fe6f3;
  font-size: clamp(8px, 1cqw, 13px);
  font-weight: 850;
  letter-spacing: 0.13em;
}

.loading-screen__progress {
  grid-column: 1 / -1;
  height: clamp(4px, 0.55cqw, 7px);
  overflow: hidden;
  border-radius: 999px;
  background: rgb(78 96 130 / 42%);
  box-shadow: inset 0 1px 4px rgb(0 0 0 / 44%);
}

.loading-screen__progress span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #65d8ed, #ffd05f, #ff884f);
  box-shadow: 0 0 18px rgb(102 220 239 / 65%);
  animation: loading-screen-progress 1.45s ease-in-out infinite;
}

@keyframes loading-screen-progress {
  0% { transform: translateX(-110%); }
  50% { transform: translateX(82%); }
  100% { transform: translateX(290%); }
}

@container loading-screen (max-width: 520px) {
  .loading-screen__card {
    width: 88cqw;
    grid-template-columns: minmax(0, 25%) minmax(0, 1fr);
    gap: clamp(8px, 2.5cqw, 13px);
    padding: clamp(8px, 2.8cqw, 14px);
  }

  .loading-screen h1 {
    font-size: clamp(14px, 5cqw, 24px);
  }

  .loading-screen__studio {
    font-size: clamp(7px, 2.3cqw, 10px);
  }

  .loading-screen__copy > p:last-child {
    margin-top: clamp(6px, 2cqw, 10px);
    font-size: clamp(7px, 2.4cqw, 10px);
    letter-spacing: 0.08em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-screen,
  .loading-screen__progress span {
    animation: none;
    transition: none;
  }

  .loading-screen__progress span {
    width: 62%;
  }
}

@media (max-aspect-ratio: 16 / 9) {
  .game-stage {
    width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));
  }
}

.fatal-error {
  margin: auto;
  color: #fff7e8;
  font: 700 18px/1.5 "Segoe UI", system-ui, sans-serif;
  text-align: center;
}

.studio-menu-root {
  position: absolute;
  z-index: 40;
  inset: 0;
  pointer-events: none;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

.studio-menu-root.is-open {
  pointer-events: auto;
  background: linear-gradient(90deg, rgb(5 10 20 / 24%), transparent 48%);
}

.studio-menu-trigger {
  position: absolute;
  top: 1.1%;
  left: 0.7%;
  display: grid;
  width: 4.6%;
  height: 7.4%;
  place-items: center;
  padding: clamp(2px, 0.28vw, 5px);
  border: 1px solid rgb(105 207 226 / 52%);
  border-radius: clamp(8px, 1.2vw, 12px);
  color: #f8e7bd;
  background:
    linear-gradient(145deg, rgb(25 37 60 / 94%), rgb(10 17 34 / 96%));
  box-shadow: 0 8px 24px rgb(0 0 0 / 50%),
    inset 0 0 0 1px rgb(255 255 255 / 7%);
  cursor: pointer;
  pointer-events: auto;
}

.studio-menu-trigger:hover,
.studio-menu-trigger:focus-visible,
.studio-menu-root.is-open .studio-menu-trigger {
  border-color: #ffd06f;
  outline: none;
  filter: brightness(1.08);
}

.studio-menu-trigger img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.studio-menu-popover {
  position: absolute;
  top: clamp(76px, 16%, 150px);
  left: clamp(6px, 1.2%, 10px);
  display: grid;
  width: min(390px, calc(100% - 12px));
  max-height: calc(100% - clamp(88px, 18%, 164px));
  gap: clamp(7px, 1.5vh, 12px);
  padding: clamp(9px, 1.6vw, 14px);
  overflow: auto;
  border: 1px solid rgb(105 207 226 / 50%);
  border-radius: 12px;
  color: #eaf8fb;
  background:
    radial-gradient(circle at 0 0, rgb(255 125 86 / 18%), transparent 42%),
    linear-gradient(150deg, rgb(22 31 54 / 98%), rgb(7 13 29 / 99%));
  box-shadow: 0 24px 60px rgb(0 0 0 / 76%),
    inset 0 0 0 1px rgb(255 255 255 / 7%);
  pointer-events: auto;
  scrollbar-color: #60718c #11182a;
}

.studio-menu-popover[hidden] {
  display: none;
}

.studio-menu-popover > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(7px, 1.3vh, 10px);
  border-bottom: 1px solid rgb(126 160 185 / 26%);
}

.studio-menu-popover > header small,
.studio-menu-popover > header strong {
  display: block;
}

.studio-menu-popover > header small {
  color: #ffab5c;
  font-size: clamp(7px, 0.85vw, 9px);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.studio-menu-popover > header strong {
  margin-top: 3px;
  color: #fff7e8;
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.05;
}

.studio-menu-close {
  display: grid;
  width: clamp(32px, 4vw, 38px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(137 173 197 / 42%);
  border-radius: 9px;
  color: #a9bfca;
  background: rgb(22 36 53 / 88%);
  font: 800 clamp(20px, 2.4vw, 25px)/1 Arial, sans-serif;
  cursor: pointer;
}

.studio-menu-close:hover,
.studio-menu-close:focus-visible {
  border-color: #ffd06f;
  color: #fff7e8;
  outline: none;
}

.studio-menu-games {
  display: grid;
  gap: 8px;
}

.studio-menu-game {
  display: grid;
  grid-template-columns: clamp(43px, 5.6vw, 54px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: clamp(58px, 8vh, 72px);
  padding: 8px;
  border: 1px solid rgb(103 152 179 / 38%);
  border-radius: 10px;
  color: inherit;
  background: rgb(17 30 50 / 90%);
  text-decoration: none;
}

.studio-menu-game img {
  display: block;
  width: clamp(43px, 5.6vw, 54px);
  aspect-ratio: 1;
  border-radius: 9px;
  object-fit: cover;
}

.studio-menu-game span,
.studio-menu-game strong,
.studio-menu-game small {
  display: block;
  min-width: 0;
}

.studio-menu-game strong {
  color: #f5fbff;
  font-size: clamp(11px, 1.35vw, 14px);
}

.studio-menu-game small {
  margin-top: 4px;
  color: #8ca6b4;
  font-size: clamp(8px, 0.95vw, 10px);
}

.studio-menu-game.is-link:hover,
.studio-menu-game.is-link:focus-visible {
  border-color: #ffd06f;
  outline: none;
  translate: 0 -1px;
}

.studio-menu-placeholder {
  margin: 0;
  padding: clamp(9px, 1.4vw, 13px);
  border: 1px dashed rgb(103 152 179 / 45%);
  border-radius: 8px;
  color: #8199a7;
  font-size: clamp(8px, 0.95vw, 10px);
  line-height: 1.4;
  text-align: center;
}

.studio-menu-developer-link {
  justify-self: center;
  padding: 7px 11px;
  border: 1px solid rgb(113 191 170 / 50%);
  border-radius: 8px;
  color: #a9f0d7;
  font-size: clamp(8px, 1vw, 10px);
  font-weight: 800;
  text-decoration: none;
}

.studio-menu-developer-link:hover,
.studio-menu-developer-link:focus-visible {
  border-color: #ffd06f;
  outline: none;
}

.studio-menu-review {
  display: grid;
  grid-template-columns: clamp(30px, 4vw, 38px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: clamp(7px, 1.2vw, 10px);
  border: 1px solid rgb(221 174 65 / 50%);
  border-radius: 10px;
  background:
    radial-gradient(circle at 0 50%, rgb(255 200 74 / 15%), transparent 42%),
    linear-gradient(135deg, rgb(30 37 50 / 95%), rgb(15 23 37 / 95%));
}

.studio-menu-review[hidden] {
  display: none;
}

.studio-menu-review.is-complete {
  border-color: rgb(85 211 153 / 58%);
}

.studio-menu-review-icon {
  display: grid;
  width: clamp(30px, 4vw, 38px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #e7b840;
  border-radius: 9px;
  color: #ffe07b;
  background: #392c12;
  overflow: hidden;
}

.studio-menu-review-icon svg {
  display: block;
  width: 58%;
  height: 58%;
  fill: currentColor;
  filter: drop-shadow(0 0 5px rgb(255 224 123 / 35%));
}

.studio-menu-review-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.studio-menu-review-copy strong {
  color: #fff0b1;
  font-size: clamp(9px, 1.15vw, 12px);
  letter-spacing: 0.05em;
}

.studio-menu-review-copy small {
  color: #a9bdc7;
  font-size: clamp(7px, 0.9vw, 9px);
  line-height: 1.3;
}

.studio-menu-review button {
  min-height: clamp(30px, 4vh, 36px);
  padding: 0 clamp(8px, 1.2vw, 12px);
  border: 1px solid #e3b43e;
  border-radius: 8px;
  color: #201707;
  background: linear-gradient(#ffe178, #dca72c);
  box-shadow: 0 5px 14px rgb(0 0 0 / 45%);
  font: 900 clamp(7px, 0.86vw, 9px)/1 Arial, sans-serif;
  cursor: pointer;
}

.studio-menu-review button:focus-visible {
  outline: 2px solid #7de4f2;
  outline-offset: 2px;
}

.studio-menu-review button:disabled {
  border-color: #526268;
  color: #819399;
  background: #1b282d;
  box-shadow: none;
  cursor: default;
}

@media (max-width: 520px), (max-height: 480px) {
  .studio-menu-review {
    grid-template-columns: clamp(30px, 4vw, 38px) minmax(0, 1fr);
  }

  .studio-menu-review-icon {
    grid-row: 1 / span 2;
    align-self: start;
  }

  .studio-menu-review button {
    grid-column: 2;
    justify-self: start;
    max-width: 100%;
  }
}

.studio-menu-language {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: clamp(7px, 1.3vh, 11px);
  border-top: 1px solid rgb(126 160 185 / 26%);
}

.studio-menu-language > span {
  color: #92a8b5;
  font-size: clamp(8px, 0.95vw, 10px);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.studio-menu-language select {
  width: min(160px, 54%);
  min-height: clamp(30px, 4vh, 36px);
  padding: 0 10px;
  border: 1px solid rgb(112 181 203 / 58%);
  border-radius: 8px;
  color: #eefaff;
  background: #111d31;
  font: 700 clamp(9px, 1.1vw, 11px)/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}

.studio-menu-language select:focus-visible {
  border-color: #ffd06f;
  outline: none;
}

@media (orientation: portrait) {
  .v2-shell #orientation-hint {
    display: grid;
    z-index: 1;
  }

  .studio-menu-root {
    display: none;
  }
}

@media (pointer: coarse), (max-height: 540px) {
  .studio-menu-trigger {
    width: 4.2%;
    grid-template-columns: minmax(0, 1fr);
    padding: clamp(2px, 0.2vw, 3px);
  }

}

@media (max-height: 420px) {
  .studio-menu-popover {
    top: 6px;
    left: clamp(70px, 10%, 86px);
    width: min(390px, calc(100% - clamp(78px, 11%, 94px)));
    max-height: calc(100% - 12px);
  }
}
