/* V66: distribution choice shown before authentication. */
body.distribution-choice-active #appPreloader {
  overflow: auto;
  padding: clamp(12px, 2.2vw, 28px);
  background:
    radial-gradient(circle at 12% 16%, rgba(65, 221, 255, .32), transparent 27%),
    radial-gradient(circle at 88% 82%, rgba(255, 190, 55, .24), transparent 28%),
    linear-gradient(145deg, #087dcc 0%, #0752ae 42%, #202179 100%);
}

body.distribution-choice-active .loader-card {
  width: min(1040px, 96vw);
  padding: clamp(18px, 3.2vh, 32px) clamp(18px, 3vw, 34px) clamp(20px, 3.4vh, 34px);
}

.download-choice-panel[hidden],
.loader-progress-panel[hidden] {
  display: none !important;
}

.download-choice-panel {
  position: relative;
  z-index: 1;
  text-align: center;
}

.choice-brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 3px;
  color: #7eeaff;
  font-size: clamp(10px, 1.4vw, 13px);
  font-weight: 950;
  letter-spacing: .16em;
}

.choice-brand-row img {
  width: clamp(82px, 11vw, 118px);
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .28));
}

.download-choice-panel h1 {
  margin: 2px 0 5px;
  color: #fff;
  font-size: clamp(23px, 3.1vw, 39px);
  font-weight: 1000;
  letter-spacing: -.035em;
  text-shadow: 0 3px 0 rgba(20, 8, 83, .48);
}

.choice-lead {
  margin: 0 auto clamp(15px, 2.6vh, 25px);
  max-width: 720px;
  color: #d9f5ff;
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 650;
  line-height: 1.45;
}

.download-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 20px);
}

.download-choice-card {
  position: relative;
  min-width: 0;
  min-height: clamp(176px, 25vh, 224px);
  padding: clamp(17px, 2.4vw, 25px) clamp(14px, 2vw, 20px) 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .72);
  border-radius: clamp(19px, 2.5vw, 28px);
  color: #fff;
  font: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(3, 21, 77, .58), 0 18px 34px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}

.download-choice-card::before {
  content: '';
  position: absolute;
  width: 150px;
  aspect-ratio: 1;
  top: -78px;
  right: -54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .13);
}

.download-choice-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.08);
  box-shadow: 0 11px 0 rgba(3, 21, 77, .58), 0 22px 40px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.download-choice-card:active {
  transform: translateY(3px);
  box-shadow: 0 4px 0 rgba(3, 21, 77, .58), 0 10px 22px rgba(0, 0, 0, .24);
}

.download-choice-card:focus-visible {
  outline: 4px solid #fff36b;
  outline-offset: 4px;
}

.download-choice-card:disabled {
  opacity: .64;
  cursor: wait;
  transform: none;
  filter: grayscale(.15);
}

.choice-pwa { background: linear-gradient(145deg, #12aaaf, #0879c8 58%, #274bb3); }
.choice-play { background: linear-gradient(145deg, #20a45d, #087849 58%, #075444); }
.choice-online { background: linear-gradient(145deg, #7c53e9, #5540be 58%, #313096); }

.choice-icon {
  position: relative;
  z-index: 1;
  width: 61px;
  height: 61px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .72);
  border-radius: 18px;
  font-size: 31px;
  line-height: 1;
  background: rgba(255, 255, 255, .17);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 12px rgba(0, 0, 0, .18);
}

.choice-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
}

.choice-copy strong {
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 950;
  line-height: 1.15;
}

.choice-copy small {
  color: rgba(255, 255, 255, .84);
  font-size: clamp(10px, 1.2vw, 12px);
  font-weight: 700;
}

.choice-action {
  position: relative;
  z-index: 1;
  min-width: 112px;
  margin-top: 2px;
  padding: 7px 13px;
  border-radius: 999px;
  color: #17305f;
  font-size: 12px;
  font-weight: 950;
  background: #fff7ae;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}

.install-choice-message {
  min-height: 21px;
  margin: 17px 0 0;
  color: #d8f5ff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.install-choice-message.is-notice {
  color: #fff29a;
}

/* Keep install/fullscreen controls available from the first app screens. */
body.app-preloading #fullscreenBtn,
body.app-preloading #installPwaBtn {
  display: none !important;
}

body:not(.app-preloading):not(.immersive-standalone).view-auth #fullscreenBtn,
body:not(.app-preloading):not(.immersive-standalone).view-main #fullscreenBtn,
body:not(.app-preloading):not(.immersive-standalone).view-lobby #fullscreenBtn {
  display: flex !important;
  visibility: visible !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto !important;
}

body.pwa-install-available:not(.app-preloading):not(.immersive-standalone).view-auth #installPwaBtn,
body.pwa-install-available:not(.app-preloading):not(.immersive-standalone).view-main #installPwaBtn,
body.pwa-install-available:not(.app-preloading):not(.immersive-standalone).view-lobby #installPwaBtn {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

@media (max-width: 720px) and (orientation: portrait) {
  body.distribution-choice-active #appPreloader { align-items: start; }
  body.distribution-choice-active .loader-card { margin: auto 0; }
  .download-choice-grid { grid-template-columns: 1fr; }
  .download-choice-card {
    min-height: 118px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 55px minmax(0, 1fr) auto;
    text-align: left;
  }
  .choice-icon { width: 51px; height: 51px; border-radius: 15px; font-size: 26px; }
  .choice-copy { text-align: left; }
  .choice-action { min-width: 88px; text-align: center; }
}

@media (orientation: landscape) and (max-height: 540px) {
  body.distribution-choice-active .loader-card { width: min(1000px, 96vw); padding: 11px 18px 13px; }
  .choice-brand-row { margin: -4px 0 -2px; }
  .choice-brand-row img { width: 74px; height: 37px; }
  .download-choice-panel h1 { font-size: clamp(20px, 4.8vh, 27px); }
  .choice-lead { margin-bottom: 9px; font-size: 10px; }
  .download-choice-grid { gap: 11px; }
  .download-choice-card { min-height: 130px; padding: 9px 11px 10px; gap: 5px; border-radius: 18px; }
  .choice-icon { width: 43px; height: 43px; border-radius: 13px; font-size: 22px; }
  .choice-copy strong { font-size: clamp(13px, 3.2vh, 17px); }
  .choice-copy small { font-size: 9px; }
  .choice-action { min-width: 96px; padding: 5px 10px; font-size: 10px; }
  .install-choice-message { min-height: 14px; margin-top: 8px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .download-choice-card { transition: none; }
}
