/* App chooser modal (iOS / Android / Web). Visual language = .app-cta band +
   .app-cta__btn: dark gradient surface, --accent orange, Play green, ghost
   buttons, --font-display headings, 10px button radius. Tokens come from
   site-chrome.css :root; the fallbacks keep it correct where that file is absent.
   Fixed overlay + scrollbar compensation => zero layout shift on open/close. */

.app-chooser {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  font-family: var(--font-body, "TWK Lausanne 400", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}
.app-chooser.app-chooser--open { display: flex; }

.app-chooser__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0.64);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.app-chooser__dialog {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 36px 28px 28px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, #1a1a2e 0%, #12121f 55%, #1a1220 100%);
  color: var(--fg-inverse, #f0f7ff);
  text-align: center;
  box-shadow: 0 24px 64px rgba(10, 10, 20, 0.45);
  animation: app-chooser-in 0.18s ease-out;
}
.app-chooser__dialog::before {
  content: "";
  position: absolute;
  inset: -30% auto auto 50%;
  transform: translateX(-50%);
  width: 420px;
  height: 220px;
  background: radial-gradient(ellipse at center, rgba(255, 101, 41, 0.18), transparent 70%);
  pointer-events: none;
}
.app-chooser__dialog:focus { outline: none; }

.app-chooser__title,
.app-chooser__sub,
.app-chooser__options { position: relative; z-index: 1; }

.app-chooser__title {
  margin: 0 0 10px;
  font-family: var(--font-display, "TWK Lausanne 600", "Inter", -apple-system, sans-serif);
  font-size: clamp(24px, 3.5vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #fff;
}
.app-chooser__sub {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(240, 247, 255, 0.78);
}

.app-chooser__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
.app-chooser__close:hover { background: rgba(255, 255, 255, 0.16); }

.app-chooser__options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.app-chooser__options li { margin: 0; padding: 0; }

.app-chooser__option {
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  width: 100%;
  min-height: 64px;
  padding: 14px 20px;
  border-radius: var(--radius-btn, 10px);
  border: 1px solid transparent;
  font-family: var(--font-display, "TWK Lausanne 600", "Inter", -apple-system, sans-serif);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: none !important;
  color: #fff !important;
  transition: opacity 0.15s, transform 0.12s, background 0.15s;
}
.app-chooser__option:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}
.app-chooser__option--ios { background: var(--accent, #ff6942); }
.app-chooser__option--ios:hover { background: var(--accent-hover, #e55a35); }
.app-chooser__option--android { background: #01875f; border-color: #01875f; }
.app-chooser__option--android:hover { background: #016b4c; border-color: #016b4c; }
.app-chooser__option--web {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}
.app-chooser__option--web:hover { background: rgba(255, 255, 255, 0.14); }
.app-chooser__option.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}
.app-chooser__option.is-disabled:hover { opacity: 0.55; transform: none; }

.app-chooser__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}
.app-chooser__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-chooser__label { font-size: 16px; line-height: 1.2; }
.app-chooser__hint {
  font-family: var(--font-body, "TWK Lausanne 400", "Inter", -apple-system, sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  opacity: 0.82;
}

.app-chooser__option:focus-visible,
.app-chooser__close:focus-visible {
  outline: 2px solid var(--accent, #ff6942);
  outline-offset: 2px;
}
.app-chooser__option--ios:focus-visible { outline-color: #fff; }

/* Lock page scroll without layout shift (the scrollbar width is padded back). */
html.app-chooser-lock {
  overflow: hidden;
  padding-right: var(--app-chooser-sbw, 0px);
}
html.app-chooser-lock .site-header { padding-right: var(--app-chooser-sbw, 0px); }

/* Mobile: bottom sheet. */
@media (max-width: 600px) {
  .app-chooser { align-items: flex-end; padding: 0; }
  .app-chooser__dialog {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 32px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    animation-name: app-chooser-sheet;
  }
}

@keyframes app-chooser-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes app-chooser-sheet {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .app-chooser__dialog { animation: none; }
  .app-chooser__option,
  .app-chooser__close { transition: none; }
  .app-chooser__option:hover { transform: none; }
}
