:root {
  --bg: radial-gradient(circle at 10% 20%, #1a1b3a 0%, #0b0d1d 60%, #04050b 100%);
  --card-bg: rgba(20, 24, 40, 0.78);
  --card-border: rgba(255, 255, 255, 0.08);
  --accent: #8b75c6;
  --accent-strong: #a58df0;
  --text: #f3f4ff;
  --muted: rgba(232, 235, 255, 0.7);
  --cta: linear-gradient(135deg, #8b75c6, #42a5f5);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

/* Ensure elements with the hidden attribute are never shown by layout rules */
[hidden] { display: none !important; }

body {
  display: flex;
  justify-content: center;
}

.subscribe-wrapper {
  width: min(1120px, 96vw);
  padding: 48px 0 80px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* Make the language picker inline in the header */
.page-header .hero-lang-label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.page-header #subscribeLangSelect {
  min-width: 140px;
  padding: 8px 14px;
}

.page-header h1 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 28px;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 700;
}

/* Stack title and description vertically next to logo */
.page-header .site-title-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.page-header .site-description {
  font-size: 1rem;
  opacity: 0.8;
}

.page-header .app-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  background: rgba(15, 17, 34, 0.85);
  padding: 4px;
}

.user-chip {
  display: inline-flex;
  align-items: center; /* keep name/tier vertically centered to avatar */
  gap: 10px;
  background: rgba(16, 20, 42, 0.6);
  border: 1px solid rgba(120, 140, 220, 0.35);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  color: #f4f6ff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.user-chip .user-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(138, 117, 198, 0.9), rgba(66, 165, 245, 0.9));
  display: inline-grid;            /* ensure perfect centering of fallback */
  place-items: center;             /* center both horizontally and vertically */
  font-weight: 700;
  letter-spacing: 0.01em;
}

.user-chip .user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none; /* shown when loaded via JS */
}

.user-chip .user-fallback {
  font-size: 0.95rem;
  line-height: 1;                 /* avoid vertical offset */
  text-align: center;
}

.user-chip .user-label {
  display: flex;
  flex-direction: column;
  justify-content: center;      /* vertically center name/tier next to avatar */
  line-height: 1.1;
  min-height: 34px;             /* match avatar height so centering is exact */
}

.user-chip .user-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.15;
}

.user-chip .user-tier {
  font-size: 0.78rem;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

/* Hide the tier row when there is no text so the name centers cleanly */
.user-chip .user-tier:empty {
  display: none;
}

.user-chip .user-tier::before {
  content: '';
  margin-right: 4px;
}

/* Stripe diagnostics list inside notice */
.stripe-diag {
  margin: 8px 0 0 0;
  padding-left: 18px;
  color: #e2e8f0;
  font-size: 14px;
}
.stripe-diag li.ok { color: #a7f3d0; }
.stripe-diag li.warn { color: #fde68a; }
.stripe-diag li.err { color: #fecaca; }

.hero {
  display: flex;
  gap: 40px;
  align-items: center;
  justify-content: space-between;
  padding: 32px 40px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(27, 29, 49, 0.9), rgba(13, 15, 30, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
}

.hero-content h2 {
  font-size: clamp(2.2rem, 4vw, 3rem);
  margin: 0 0 12px;
}

.hero-tagline {
  margin: 0 0 24px;
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.6;
}

.hero-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.hero-lang-label {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: rgba(240, 242, 255, 0.75);
}

#subscribeLangSelect {
  appearance: none;
  background: rgba(14, 18, 36, 0.9);
  color: var(--text);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 10px 18px;
  min-width: 180px;
  font-size: 0.95rem;
}

#subscribeLangSelect:focus {
  outline: none;
  border-color: rgba(138, 117, 198, 0.65);
  box-shadow: 0 0 0 2px rgba(138,117,198,0.3);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #0f1024;
  background: var(--cta);
  box-shadow: 0 16px 30px rgba(66, 165, 245, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 34px rgba(66, 165, 245, 0.45);
}

.hero-note {
  margin-top: 16px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.6);
}

.hero-visual img {
  width: 220px;
  max-width: 100%;
  opacity: 0.85;
}

.notice {
  margin: 28px 0;
  padding: 18px 24px;
  border-radius: 18px;
  background: rgba(255, 204, 0, 0.08);
  border: 1px solid rgba(255, 204, 0, 0.18);
  color: #ffe082;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.notice p {
  margin: 0;
}

.secondary-btn {
  padding: 8px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 204, 0, 0.4);
  color: #ffe082;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.secondary-btn:hover {
  border-color: rgba(255, 204, 0, 0.7);
}

.plans {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin: 48px 0;
}

.plan-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 18px 32px rgba(8, 10, 24, 0.5);
}

.plan-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.plan-card.disabled .alt-link {
  pointer-events: none;
  color: rgba(200, 210, 255, 0.3);
}

.plan-card.highlighted {
  border-color: rgba(138, 120, 205, 0.65);
  background: linear-gradient(155deg, rgba(26, 22, 55, 0.9), rgba(18, 31, 58, 0.92));
  transform: translateY(-6px);
}

.plan-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.plan-head h2 {
  margin: 0;
  font-size: 1.4rem;
}

.price {
  font-weight: 600;
  color: var(--accent-strong);
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(138, 120, 205, 0.18);
  border: 1px solid rgba(138, 120, 205, 0.4);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.plan-features {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  color: rgba(240, 242, 255, 0.85);
}

.plan-features li::marker {
  color: var(--accent);
}

.plan-fun {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.plan-action {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

stripe-buy-button.stripe-button {
  width: 100%;
  min-height: 48px;
}

.alt-link {
  color: rgba(200, 210, 255, 0.6);
  font-size: 0.9rem;
  text-decoration: none;
}

.alt-link:hover {
  text-decoration: underline;
}

/* Philosophy panel */
.philosophy {
  margin: 36px 0 28px;
  position: relative;
}
.philo-inner {
  position: relative;
  border-radius: 20px;
  padding: 24px 22px 22px 68px;
  background: linear-gradient(155deg, rgba(26,22,55,0.78), rgba(18,31,58,0.82));
  border: 1px solid rgba(138,120,205,0.45);
  box-shadow: 0 18px 36px rgba(8,10,24,0.45);
}
.philo-quote-icon {
  position: absolute;
  left: 18px;
  top: 18px;
  color: rgba(165, 180, 252, 0.85);
}
.philo-content h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  letter-spacing: 0.2px;
}
.philo-content p {
  margin: 0 0 10px;
  color: rgba(232, 235, 255, 0.9);
}
.philo-bullets {
  margin: 0;
  padding-left: 18px;
  color: rgba(220, 225, 255, 0.88);
  display: grid;
  gap: 6px 20px;                 /* row gap, column gap */
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}
.philo-bullets li::marker {
  color: var(--accent);
}

.faq {
  margin-top: 72px;
  background: rgba(14, 16, 30, 0.8);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 32px 36px;
}

.faq h3 {
  margin: 0 0 18px;
}

.faq dl {
  display: grid;
  gap: 18px;
  margin: 0;
}

.faq dt {
  font-weight: 600;
}

.faq dd {
  margin: 6px 0 0;
  color: var(--muted);
}

.footer {
  margin-top: 60px;
  text-align: center;
  color: rgba(220, 225, 255, 0.6);
  font-size: 0.9rem;
}

.footer a {
  color: rgba(220, 225, 255, 0.85);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (max-width: 880px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding: 40px 28px;
  }
  .hero-visual {
    order: -1;
  }
  .hero-controls {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .subscribe-wrapper {
    width: calc(100vw - 24px);
    padding: 24px 0 60px;
  }
  .philo-inner { padding: 22px 18px 18px 56px; }
  .philo-quote-icon { left: 12px; top: 14px; }
  .page-header {
    justify-content: center;
  }
  .page-header h1 {
    margin-bottom: 20px;
    font-size: 1.9rem;
  }
  .page-header .app-logo {
    width: 44px;
    height: 44px;
    padding: 3px;
  }
  .plan-card {
    padding: 24px;
  }
  .plans {
    gap: 20px;
  }
  .faq {
    padding: 28px 22px;
  }
  .philo-bullets { grid-template-columns: 1fr; }
  #subscribeLangSelect {
    min-width: 150px;
  }
}

body[dir="rtl"] {
  direction: rtl;
}

body[dir="rtl"] .plans {
  text-align: right;
}

body[dir="rtl"] .plan-features {
  padding-left: 0;
  padding-right: 20px;
}
body[dir="rtl"] .philo-bullets {
  padding-left: 0;
  padding-right: 18px;
}
