/* Finance.TheGamerMarket — App-Style WebApp
   Inspired: CRED · Groww · INDmoney · PhonePe */

:root {
  --bg: #0B0D10;
  --bg-elevated: #0F1115;
  --card: #161A22;
  --card-hover: #1E232D;
  --primary: #00E676;
  --primary-dark: #00C853;
  --primary-glow: rgba(0, 230, 118, 0.22);
  --accent-blue: #38bdf8;
  --accent-gold: #fbbf24;
  --text: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
  --bottom-nav-h: 72px;
  --header-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ring-c: 213.6;
  --app-max: 480px;
  --content-max: 1200px;
  --section-px: 16px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: var(--safe-bottom);
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(0, 230, 118, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(56, 189, 248, 0.05), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(0, 200, 83, 0.04), transparent 60%);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* ---- App Shell ---- */
.app {
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
  padding-top: env(safe-area-inset-top, 0px);
}

.app-header {
  display: none !important;
}

.app-header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
}

.app-header__icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #000;
  font-weight: 800;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.app-header__actions {
  display: flex;
  gap: 8px;
}

.app-header__btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.app-header__btn:hover {
  color: var(--primary);
  background: var(--card-hover);
}

.app-content {
  padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px));
  animation: fadeIn 0.4s ease;
}

/* Content sections — horizontal inset on containers (cards keep internal padding only) */
.challenge-list,
.tool-list,
.quiz-list,
.home-block,
.page-intro,
.greeting,
.profile-hero,
.stats-grid,
.app-content>.section-title,
.profile-menu,
.breadcrumb-app,
.facts-feed__header {
  padding-left: var(--section-px);
  padding-right: var(--section-px);
}

.app-content--spacious {
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Bottom Navigation (hidden — use header / in-page links) ---- */
.bottom-nav {
  display: none !important;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  min-width: 56px;
}

.bottom-nav__item i {
  font-size: 1.25rem;
}

.bottom-nav__item.active {
  color: var(--primary);
}

.bottom-nav__item.active i {
  transform: scale(1.1);
}

/* ---- Ads (Native Style) ---- */
.ad-native {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 16px 0;
  min-height: 60px;
}

.ad-native--banner {
  min-height: 50px;
  border-radius: var(--radius-sm);
}

.ad-native--card {
  min-height: 100px;
}

.ad-native--result {
  min-height: 120px;
  margin: 20px 0;
}

.ad-native__tag {
  background: rgba(0, 200, 83, 0.12);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.65rem;
}

.ad-native--loaded {
  padding: 0;
  min-height: auto;
  overflow: hidden;
  border-style: solid;
}

.ad-native--loaded .ftgm-ad {
  border-radius: var(--radius-sm);
}

.ad-native:empty {
  min-height: 50px;
}

/* ---- Display ads (reference: header_space / 300px centered) ---- */
.header_space {
  min-height: 250px;
  text-align: center;
  padding: 8px 0 12px;
}

.header_space > div[id^="div-gpt-ad-"] {
  display: inline-block;
  margin: 0 auto;
}

.gpt-ad-wrap {
  text-align: center;
  padding: 12px 0;
}

.gpt-ad-wrap--inline {
  padding: 12px 0;
  margin: 8px 0;
}

.gpt-slot--result {
  margin: 16px auto;
  text-align: center;
}

/* ---- Game promo box (below top ad on home) ---- */
.game-promo-box {
  background: #111827;
  border: none;
  border-radius: 24px;
  padding: 22px;
  margin: 0;
  text-align: center;
}

.game-promo-box__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0 0 12px;
  color: #ffffff;
}

.game-promo-box__title-main,
.game-promo-box__title-sub {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.game-promo-box__cta-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}

.game-promo-box__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  width: 72%;
  max-width: 240px;
  min-height: 52px;
  padding: 14px 28px;
  border-radius: 14px;
  background: #3b82f6;
  border: none;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.25),
    0 10px 28px rgba(59, 130, 246, 0.38);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.game-promo-box__cta:hover {
  background: #2563eb;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.35),
    0 12px 32px rgba(37, 99, 235, 0.45);
  color: #fff;
}

.game-promo-box__cta:active {
  transform: scale(0.98);
}

.game-promo-box__ad-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #1a2030;
  color: #9ca3af;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid rgba(156, 163, 175, 0.35);
  pointer-events: none;
  line-height: 1.2;
}

/* ---- Redeem Box (rewarded ad buttons) ---- */
.redeem-box {
  background: linear-gradient(160deg, var(--card), rgba(56, 189, 248, 0.04));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}

.redeem-box__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
  text-align: center;
  color: var(--text-secondary);
}

.redeem-box__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.redeem-btn-wrap {
  position: relative;
  min-width: 0;
  display: flex;
}

.redeem-btn-wrap .btn-app,
.redeem-btn-wrap .watchAdButton {
  width: 100%;
}

.btn-app--redeem {
  position: relative;
  min-height: 48px;
  height: 100%;
  padding: 12px 32px 12px 14px;
  font-size: 0.85rem;
  line-height: 1.25;
  border-radius: 12px;
  text-align: center;
  white-space: normal;
  text-wrap: balance;
}

.btn-app--redeem .ad-label {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(0, 0, 0, 0.72);
  padding: 2px 5px;
  border-radius: 4px;
  border: none;
  pointer-events: none;
}

.ad-label {
  position: absolute;
  top: -6px;
  right: -4px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 200, 83, 0.15);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0, 200, 83, 0.3);
}

/* ---- Greeting ---- */
.greeting {
  padding: 20px var(--section-px) 8px;
}

.greeting__hi {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.greeting__title {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ---- Score Card ---- */
.score-card-main {
  background: linear-gradient(145deg, rgba(22, 26, 34, 0.95) 0%, rgba(0, 230, 118, 0.1) 100%);
  border: 1px solid rgba(0, 230, 118, 0.22);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}

.score-card-main:hover {
  border-color: rgba(0, 230, 118, 0.4);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 230, 118, 0.08);
}

.score-card-main::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  pointer-events: none;
}

.score-ring {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring__bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
}

.score-ring__fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 213.6;
  stroke-dashoffset: 213.6;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-ring__value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring__num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.score-ring__label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-card-main__info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.score-card-main__info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ---- Quick Actions ---- */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 24px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body[data-page="home"] .home-top-stack {
  display: flex;
  flex-direction: column;
}

body[data-page="home"] .home-block--promo-below-ad {
  padding-left: var(--section-px);
  padding-right: var(--section-px);
  padding-bottom: 4px;
}

body[data-page="home"] .home-block--promo-below-ad .game-promo-box {
  margin-top: 16px;
}

body[data-page="home"] .gpt-ad-wrap--home-hero {
  padding-top: 8px;
  padding-bottom: 0;
}

body[data-page="home"] .gpt-ad-wrap--top {
  padding-bottom: 0;
}

/* ---- Home hero (rotating layouts — app shell only) ---- */
body[data-home-mode="desktop"] .home-hero {
  display: none !important;
}

@media (max-width: 1023px) {
  .gpt-ad-wrap--top {
    padding-top: 12px;
  }

  .home-hero {
    background: linear-gradient(155deg, rgba(0, 230, 118, 0.1) 0%, var(--card) 45%, rgba(56, 189, 248, 0.06) 100%);
    border: 1px solid rgba(0, 230, 118, 0.2);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    margin-bottom: 4px;
    box-shadow: var(--shadow-sm);
  }

  .home-hero__badge {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(0, 230, 118, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
  }

  .home-hero__icon {
    font-size: 1.35rem;
    color: var(--primary);
  }

  .home-hero__title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
  }

  .home-hero__text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
  }

  body[data-home-mode="app"][data-home-variant="quiz-first"] .redeem-box {
    border-color: rgba(0, 230, 118, 0.35);
    background: linear-gradient(160deg, rgba(0, 230, 118, 0.08), var(--card));
  }

  body[data-home-mode="app"][data-home-variant="explore-first"] .home-hero {
    background: linear-gradient(155deg, rgba(56, 189, 248, 0.12) 0%, var(--card) 50%);
    border-color: rgba(56, 189, 248, 0.25);
  }

  body[data-home-mode="app"][data-home-variant="save-first"] .home-hero__badge {
    background: rgba(251, 191, 36, 0.18);
  }

  body[data-home-mode="app"][data-home-variant="save-first"] .home-hero__icon {
    color: var(--accent-gold);
  }

  body[data-home-mode="app"][data-home-variant="learn-first"] .home-hero {
    background: linear-gradient(155deg, rgba(167, 139, 250, 0.12) 0%, var(--card) 55%);
    border-color: rgba(167, 139, 250, 0.25);
  }
}

.section-head {
  margin: 24px 0 14px;
}

.section-head .section-title {
  margin: 0 0 5px;
}

.section-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 32em;
}

.section-title a {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-action {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 88px;
  padding: 16px;
  background: linear-gradient(165deg, rgba(30, 35, 45, 0.55) 0%, var(--card) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.quick-action::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.quick-action:active {
  transform: scale(0.97);
}

.quick-action:hover {
  transform: translateY(-2px);
  background: linear-gradient(165deg, rgba(36, 42, 54, 0.7) 0%, var(--card-hover) 100%);
  border-color: rgba(0, 230, 118, 0.22);
  box-shadow: var(--shadow-md);
}

.quick-action__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: var(--transition);
}

.quick-action__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.quick-action:hover .quick-action__icon {
  transform: scale(1.06);
}

.quick-action:nth-child(1) .quick-action__icon {
  background: linear-gradient(145deg, rgba(0, 230, 118, 0.28), rgba(0, 200, 83, 0.1));
  color: var(--primary);
  box-shadow: 0 6px 20px rgba(0, 230, 118, 0.18);
}

.quick-action:nth-child(2) .quick-action__icon {
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.28), rgba(56, 189, 248, 0.08));
  color: var(--accent-blue);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.15);
}

.quick-action:nth-child(3) .quick-action__icon {
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.28), rgba(251, 191, 36, 0.08));
  color: var(--accent-gold);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.15);
}

.quick-action:nth-child(4) .quick-action__icon {
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.28), rgba(167, 139, 250, 0.08));
  color: #c4b5fd;
  box-shadow: 0 6px 20px rgba(167, 139, 250, 0.15);
}

.quick-action__label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.quick-action__desc {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ---- App Cards ---- */
.app-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-card {
  background: linear-gradient(160deg, var(--card) 0%, rgba(22, 26, 34, 0.6) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.app-card:active {
  transform: scale(0.98);
}

.app-card:hover {
  border-color: rgba(0, 230, 118, 0.2);
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.app-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.app-card__icon--quiz {
  background: linear-gradient(135deg, rgba(0, 200, 83, 0.2), rgba(0, 200, 83, 0.05));
}

.app-card__icon--score {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.05));
  color: #38bdf8;
}

.app-card__icon--challenge {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.05));
  color: #fbbf24;
}

.app-card__icon--tools {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(167, 139, 250, 0.05));
  color: #a78bfa;
}

.app-card__icon--facts {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.2), rgba(244, 114, 182, 0.05));
  color: #f472b6;
}

.app-card__body {
  flex: 1;
  min-width: 0;
}

.app-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.app-card__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.app-card__arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.app-card:has(.app-card__badge) .app-card__body {
  padding-right: 56px;
}

.app-card__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(0, 200, 83, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ---- Buttons ---- */
.btn-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  width: 100%;
}

.btn-app:active {
  transform: scale(0.97);
}

.btn-app--primary {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #000;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-app--primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--primary-glow);
}

.btn-app--outline {
  background: transparent;
  border: 2px solid rgba(0, 200, 83, 0.4);
  color: var(--primary);
}

.btn-app--ghost {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-app--sm {
  padding: 10px 18px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-app--share {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* ---- Quiz Cards ---- */
.quiz-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.quiz-item:hover {
  border-color: rgba(0, 230, 118, 0.2);
  box-shadow: var(--shadow-md);
}

.quiz-item__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.quiz-item__emoji {
  font-size: 2rem;
}

.quiz-item__title {
  font-size: 1rem;
  font-weight: 600;
}

.quiz-item__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Tool List ---- */
.tool-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.tool-item:hover {
  border-color: rgba(0, 230, 118, 0.18);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tool-item:active {
  transform: scale(0.98);
}

.tool-item__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(0, 200, 83, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.1rem;
}

.tool-item__info {
  flex: 1;
}

.tool-item__title {
  font-size: 0.95rem;
  font-weight: 600;
}

.tool-item__desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tool-item__arrow {
  color: var(--text-muted);
}

.tool-item--priority {
  border-color: rgba(0, 200, 83, 0.25);
  background: linear-gradient(135deg, var(--card), rgba(0, 200, 83, 0.04));
}

/* ---- Challenge Cards ---- */
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.challenge-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.challenge-item:hover {
  border-color: rgba(0, 230, 118, 0.15);
  box-shadow: var(--shadow-md);
}

.challenge-item__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.challenge-item__title {
  font-size: 1rem;
  font-weight: 600;
}

.challenge-item__amount {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.challenge-item__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.challenge-progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 8px;
}

.challenge-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #69f0ae);
  border-radius: 100px;
  transition: width 0.8s ease;
}

.challenge-item__status {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ---- Facts Reels Feed ---- */
.facts-feed {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  overflow: hidden;
}

.facts-feed__header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(15, 17, 21, 0.9), transparent);
}

.facts-feed__stack {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.facts-feed__stack::-webkit-scrollbar {
  display: none;
}

.fact-reel {
  height: 100dvh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 24px 100px;
  position: relative;
}

.fact-reel__tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: rgba(0, 200, 83, 0.12);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
  width: fit-content;
}

.fact-reel__title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.25;
}

.fact-reel__text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 400px;
}

.fact-reel__swipe {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

/* ---- Profile ---- */
.profile-hero {
  text-align: center;
  padding: 32px var(--section-px) 24px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 16px;
  color: #000;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 700;
}

.profile-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}

.stat-box__num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-box__label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-menu__item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

button.profile-menu__item {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.profile-menu__item i {
  color: var(--primary);
  width: 20px;
  text-align: center;
}

.profile-menu__item span {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.profile-menu__item .fa-chevron-right {
  color: var(--text-muted);
  font-size: 0.75rem;
}

@keyframes slideUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---- Home popup display ad (light overlay) ---- */
.ad-popup {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px var(--section-px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.ad-popup.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.ad-popup.is-dismissed {
  display: none !important;
}

.ad-popup__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgb(11 13 16 / 0%);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  cursor: pointer;
}

.ad-popup__panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--app-max);
  pointer-events: auto;
}

.ad-popup__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.94) translateY(12px);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.ad-popup.is-open .ad-popup__dialog {
  transform: scale(1) translateY(0);
}

.ad-popup__header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.ad-popup__tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ad-popup__close {
  position: relative;
  z-index: 40;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: var(--transition);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ad-popup__close i {
  pointer-events: none;
}

.ad-popup__close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.ad-popup__body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  min-height: 280px;
  max-height: min(600px, 72vh);
  padding: 0;
  background: var(--bg-elevated);
  overflow: hidden;
  isolation: isolate;
}

.gpt-slot--popup {
  width: 100%;
  max-width: 320px;
  min-width: 0;
  min-height: 280px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.gpt-slot--popup iframe {
  max-width: 100% !important;
}

.gpt-slot--popup.is-pending {
  min-height: 480px;
}

.gpt-slot--popup.is-collapsed {
  min-height: 0;
}

body.ad-popup-open {
  overflow: hidden;
}

/* ---- Full Screen Modal (Quiz/Score) ---- */
.app-modal {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 400;
  width: 100%;
  max-width: var(--app-max);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(-50%) translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
}

.app-modal.is-open {
  transform: translateX(-50%) translateY(0);
}

.app-modal__header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.app-modal__close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.app-modal__title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.app-modal__progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
}

.app-modal__progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  width: 0%;
}

.app-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
}

.app-modal__footer {
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.app-modal__footer .btn-app {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 0.9rem;
}

.question-text {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.4;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 18px 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  transition: var(--transition);
}

.option-btn:hover,
.option-btn:active {
  border-color: var(--primary);
  background: rgba(0, 200, 83, 0.06);
}

.result-screen {
  text-align: center;
  padding: 20px 0;
}

.result-screen__emoji {
  font-size: 4rem;
  margin-bottom: 16px;
}

.result-screen__score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.result-screen__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.result-screen__text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ---- Calculator Page ---- */
.calc-page {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.calc-form-app {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 0 var(--section-px) 16px;
}

.form-group-app {
  margin-bottom: 18px;
}

.form-group-app label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group-app input,
.form-group-app select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group-app input:focus,
.form-group-app select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.calc-result-app {
  background: linear-gradient(160deg, var(--card), rgba(0, 200, 83, 0.06));
  border: 1px solid rgba(0, 200, 83, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin: 0 var(--section-px);
}

.calc-result-app__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.calc-result-app__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 8px 0 20px;
}

.calc-result-app__row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.calc-result-app__row span:first-child {
  color: var(--text-secondary);
}

.calc-result-app__row span:last-child {
  font-weight: 600;
}

.page-title-bar {
  padding: 8px var(--section-px) 20px;
}

.page-title-bar h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-title-bar p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.breadcrumb-app {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.breadcrumb-app a {
  color: var(--primary);
}

/* ---- Page Content (human-written blocks) ---- */
.page-intro {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 20px;
}

.content-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin: 16px var(--section-px);
  box-shadow: var(--shadow-sm);
}

.content-block h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.content-block p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 10px;
}

.content-block p:last-child {
  margin-bottom: 0;
}

.content-block ul {
  margin: 8px 0 0 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.content-block li {
  margin-bottom: 6px;
}

.content-article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin: 24px var(--section-px);
  box-shadow: var(--shadow-sm);
}

.content-article h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
  line-height: 1.35;
}

.content-article h2:first-child {
  margin-top: 0;
}

.content-article h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px;
}

.content-article p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 14px;
}

.content-article ul,
.content-article ol {
  margin: 0 0 14px 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.content-article li {
  margin-bottom: 8px;
}

.content-article a {
  color: var(--primary);
}

.content-tip {
  background: rgba(0, 200, 83, 0.06);
  border: 1px solid rgba(0, 200, 83, 0.18);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px var(--section-px);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.content-tip strong {
  color: var(--primary);
  font-weight: 600;
}

.content-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: 16px 4px 8px;
  text-align: center;
}

.app-footer {
  border-top: 1px solid var(--border);
  padding: 24px var(--section-px) calc(16px + env(safe-area-inset-bottom, 0px));
  margin-top: 8px;
}

.app-footer__nav {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 4px;
  margin: 0 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.app-footer__nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-align: center;
}

.app-footer__nav-item i {
  font-size: 1.2rem;
}

.app-footer__nav-item:hover,
.app-footer__nav-item.active {
  color: var(--primary);
}

.app-footer__nav-item.active i {
  transform: scale(1.08);
}

.app-footer p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.55;
  text-align: center;
  margin-bottom: 8px;
}

.app-footer a {
  color: var(--text);
  font-size: 0.8rem;
  transition: var(--transition);
}

.app-footer a:hover {
  color: var(--primary);
}

.app-footer__links {
  margin: 10px 0 6px !important;
}

.app-footer__links a {
  margin: 0 4px;
  color: var(--primary);
}

/* ---- Site footer columns ---- */
.app-footer--site {
  text-align: left;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 24px;
  margin-bottom: 20px;
}

.site-footer__heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.site-footer__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer__list a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.site-footer__list a:hover {
  color: var(--primary);
}

.site-footer__note,
.site-footer__copy {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.55;
  text-align: center;
  margin: 0;
}

.site-footer__note {
  margin-bottom: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.legal-page .content-block h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 20px 0 10px;
  color: var(--text);
}

.legal-page .content-block h2:first-child {
  margin-top: 0;
}

/* ---- Facts feed ---- */
.facts-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  border: 1px solid var(--border);
}

.facts-feed {
  left: 50% !important;
  transform: translateX(-50%) !important;
  max-width: var(--app-max);
  width: 100%;
}

.facts-feed--overlay[hidden] {
  display: none !important;
}

.facts-feed--overlay:not([hidden]) {
  display: block;
}

/* ---- Bootstrap overrides ---- */
.btn-app {
  line-height: 1.2;
}

select option {
  background: var(--card);
  color: var(--text);
}

/* ---- Small screens ---- */
@media (max-width: 360px) {
  .quick-action {
    min-height: 82px;
    padding: 14px 12px;
    gap: 12px;
  }

  .quick-action__icon {
    width: 44px;
    height: 44px;
    font-size: 1.05rem;
  }

  .quick-action__desc {
    font-size: 0.64rem;
  }

  .score-card-main {
    flex-direction: column;
    text-align: center;
  }

  .score-card-main__info .btn-app {
    width: 100%;
    justify-content: center;
  }

  .greeting__title {
    font-size: 1.35rem;
  }
}

/* ---- Desktop Navigation (injected via app.js) ---- */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 12px;
}

.desktop-nav__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}

.desktop-nav__link i {
  font-size: 0.95rem;
  opacity: 0.85;
}

.desktop-nav__link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.desktop-nav__link.active {
  color: var(--primary);
  background: rgba(0, 230, 118, 0.1);
}

/* ---- Desktop: centered mobile shell (480px max, same layout as phone) ---- */
@media (min-width: 481px) {
  body {
    background: #06080b;
  }

  .app {
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}