:root {
  --bg: #000000;
  --card: #1c1c1e;
  --card-elevated: #2c2c2e;
  --accent: #a294f9;
  --accent-dim: #7b6fd4;
  --text: #ffffff;
  --text-secondary: #a1a1a6;
  --text-dim: #636366;
  --border-subtle: #3a3a3c;
  --warning-border: #8b6914;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-pill: 9999px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.config-error {
  max-width: 420px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid #8b6914;
  background: rgba(139, 105, 20, 0.15);
  color: #f5e6c8;
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: center;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

/* Logo */
.brand-wrap {
  text-align: center;
  margin-bottom: 8px;
  margin-top: max(8vh, 32px);
}

.brand-title {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin: 0;
  background: linear-gradient(135deg, #fff 0%, #e8e0ff 45%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-transform: uppercase;
}

.brand-sub {
  margin: 12px 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* Platform chip row */
.platform-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  max-width: 420px;
}

.platform-bar span {
  font-size: 0.75rem;
  color: var(--text-dim);
  width: 100%;
  text-align: center;
  margin-bottom: 4px;
}

.platform-pill {
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.platform-pill:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}

.platform-pill.active {
  background: rgba(162, 148, 249, 0.15);
  border-color: var(--accent);
  color: var(--text);
}

/* Персональная ссылка / нет подписки */
.portal-card {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}

.portal-title {
  font-family: "Unbounded", sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.portal-text {
  margin: 0 0 20px;
  line-height: 1.55;
  text-align: left;
}

a.portal-cta {
  text-decoration: none;
  justify-content: center;
  margin-top: 4px;
}

/* Card */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 28px 22px 22px;
  margin-top: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.card-muted {
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
  margin: 0 0 20px;
  line-height: 1.45;
}

/* Spinner screen */
.screen {
  width: 100%;
  max-width: 420px;
  margin-top: 28px;
}

.screen.hidden {
  display: none;
}

.loader-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 36px 24px 28px;
  text-align: center;
}

.loader-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0 0 28px;
}

.spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 24px;
  border: 3px solid #333;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
}

/* BAPE ape: без яркого свечения — лёгкая глубина, не «вырвиглаз» */
.ape-showcase {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 2px auto 20px;
  padding: 24px 12px 28px;
  max-width: min(280px, 100%);
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

/* Едва заметный ореол за силуэтом (без анимации, низкая насыщенность) */
.ape-showcase::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  width: min(200px, 58vw);
  height: min(190px, 52vw);
  background: radial-gradient(
    ellipse 62% 58% at 50% 48%,
    rgba(162, 148, 249, 0.07) 0%,
    rgba(162, 148, 249, 0.02) 55%,
    transparent 72%
  );
  pointer-events: none;
  z-index: 0;
}

.ape-showcase__svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-width: 168px;
  height: auto;
  margin: 0 auto;
  overflow: visible;
  /* один мягкий слой + чуть контраста снизу */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35))
    drop-shadow(0 6px 20px rgba(162, 148, 249, 0.1));
}

/* Step buttons */
.step-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, filter 0.15s;
  margin-bottom: 12px;
}

.step-btn:active {
  transform: scale(0.98);
}

.step-btn--primary {
  background: var(--accent);
  color: #0d0d0d;
}

.step-btn--primary:hover {
  filter: brightness(1.08);
}

.step-btn--secondary {
  background: #0d0d0d;
  color: var(--text);
  border: 1px solid var(--border-subtle);
}

.step-btn--secondary:hover {
  border-color: var(--accent-dim);
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.step-btn--primary .step-num {
  background: rgba(0, 0, 0, 0.2);
  color: #0d0d0d;
}

.step-btn--secondary .step-num {
  background: var(--card-elevated);
  color: var(--text-secondary);
}

.step-label {
  flex: 1;
  text-align: left;
}

.step-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.step-btn--primary .step-arrow {
  background: rgba(0, 0, 0, 0.15);
}

.step-btn--secondary .step-arrow {
  background: rgba(162, 148, 249, 0.25);
  color: var(--accent);
}

/* Toggle other apps */
.toggle-apps {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

.toggle-apps:hover {
  color: var(--text-secondary);
}

.alt-apps {
  display: none;
  margin-top: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.alt-apps.open {
  display: block;
}

.alt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  background: #0d0d0d;
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s;
}

.alt-row:hover {
  border-color: var(--accent-dim);
}

.alt-row small {
  display: block;
  color: var(--text-dim);
  font-size: 0.72rem;
  margin-top: 2px;
}

.alt-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--card-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--card-elevated);
  border-radius: var(--radius-lg);
  padding: 28px 22px 22px;
  max-width: 400px;
  width: 100%;
  border: 1px solid var(--border-subtle);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  text-align: center;
}

.modal p {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: center;
}

.warning-box {
  border: 1px solid var(--warning-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.warning-box a {
  color: var(--accent);
  text-decoration: none;
}

.warning-box a:hover {
  text-decoration: underline;
}

.modal-close {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--text);
  color: #000;
  font-weight: 700;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.modal-close.secondary {
  margin-top: 10px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.footer-note {
  margin-top: 32px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  max-width: 360px;
  line-height: 1.5;
}
