/* =========================================
   VARIABLES & RESET UI/UX SENIOR
========================================= */
[data-page="home"] {
  --font-main: var(--font-ui);

  /* Palette Dark Modern */
  --bg-deep: var(--app-bg, #020617);
  --bg-glass: var(--app-surface-weak, rgba(30, 41, 59, 0.4));

  --text-main: var(--app-text, #f1f5f9);
  --text-muted: var(--app-muted, #94a3b8);
  --border-subtle: var(--border-subtle, rgba(255, 255, 255, 0.08));
  --border-active: var(--border-highlight, rgba(255, 255, 255, 0.2));

  --radius-xl: 24px;

  --ease-spring: cubic-bezier(0.25, 0.8, 0.25, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Navigation rail width */
  --rail-width: 80px;

  /* Card component tokens */
  --bg-card-glass: var(--bg-glass);
  --bg-card-hover: var(--card-bg-hover, rgba(30, 41, 59, 0.7));
  --border-highlight: var(--border-active);
  --radius-card: var(--radius-xl);

  --brand-sweep: var(--accent-sweep);
  --home-gold: var(--app-accent-gold, #fbbf24);
  --home-gold-glow: rgb(var(--accent-gold-rgb, 245 158 11) / 0.45);
  --home-blue: var(--app-accent-blue, #3b82f6);
  --home-blue-glow: rgb(var(--accent-blue-rgb, 59 130 246) / 0.45);
  --home-purple: var(--app-accent-purple, #8b5cf6);
  --home-purple-glow: rgb(var(--accent-purple-rgb, 139 92 246) / 0.45);
  --home-chip-bg: rgba(15, 23, 42, 0.55);
  --home-chip-link-bg: rgba(255, 255, 255, 0.06);
  --home-chip-link-border: rgba(255, 255, 255, 0.12);
}

[data-page="home"],
[data-page="home"] *,
[data-page="home"] *::before,
[data-page="home"] *::after {
  box-sizing: border-box;
}

[data-page="home"] {
  margin: 0;
  padding: 0;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle at 50% 0%, rgb(var(--accent-purple-rgb, 139 92 246) / 0.15), transparent 50%),
    radial-gradient(circle at 100% 0%, rgb(var(--accent-green-rgb, 34 197 94) / 0.1), transparent 40%),
    radial-gradient(circle at 0% 100%, rgb(var(--accent-gold-rgb, 245 158 11) / 0.1), transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* Layout shell pour gerer sidebar + content */
[data-page="home"] .app-shell {
  display: block;
  min-height: 100vh;
}

@media (min-width: 1025px) {
  [data-page="home"] .app-shell {
    display: grid;
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
    transition: grid-template-columns 420ms var(--ease-spring);
  }

  [data-page="home"] .nav-rail {
    grid-column: 1;
    align-self: start;
  }

  [data-page="home"] .container {
    grid-column: 2;
    min-width: 0;
  }
}

/* =========================================
   LAYOUT CENTRE & HEADER
========================================= */
[data-page="home"] .container {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 12px 32px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

[data-page="home"] .home-center {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
}

[data-page="home"] .home-layout {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: start;
}

@media (min-width: 1025px) {
  [data-page="home"] .container {
    min-height: 100vh;
  }
}

@media (max-width: 1024px) {
  /* Reserve space for the bottom floating nav */
  [data-page="home"] .container {
    padding: 24px;
    padding-bottom: 110px;
  }

  [data-page="home"] .home-layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
  }

  [data-page="home"] .home-center {
    max-width: 100%;
    margin: 0;
  }

  [data-page="home"] .sidebar-right {
    width: 100%;
    margin-top: 0;
    margin-bottom: 120px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    position: static;
    top: auto;
    border-radius: 0;
    backdrop-filter: none;
  }

  [data-page="home"] .wallet-container {
    margin-bottom: 16px;
  }
}

/* Footer pinned to bottom when there is space (keeps cards+title centered). */
[data-page="home"] .footer {
  margin-top: auto;
}

@media (max-width: 768px) {
  [data-page="home"] .container {
    padding: 16px;
    padding-bottom: 110px;
  }

  [data-page="home"] .hero-section.header-dashboard {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
  }

  [data-page="home"] .level-indicator {
    align-self: center;
  }

  [data-page="home"] .header-titles {
    align-items: center;
    text-align: center;
  }

  [data-page="home"] .brand-title-left {
    white-space: normal;
  }

  [data-page="home"] .card-icon-box {
    margin-bottom: 0;
  }
}

[data-page="home"] .hero-section {
  position: relative;
  z-index: 2;
}

[data-page="home"] .hero-section.header-dashboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  margin-bottom: 24px;
  padding-bottom: 0;
  border-bottom: none;
}

[data-page="home"] .header-titles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

[data-page="home"] .brand-title-left {
  font-size: clamp(2.2rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1;
  background: linear-gradient(135deg, #2ecc71 0%, #3498db 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(46, 204, 113, 0.2));
}

[data-page="home"] .level-indicator {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 6px 6px 16px;
  border-radius: 50px;
  gap: 12px;
  height: 44px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-page="home"] .level-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

[data-page="home"] .level-value {
  font-weight: 800;
  color: #fff;
  font-size: 0.95rem;
  padding-right: 4px;
}

[data-page="home"] .level-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

[data-page="home"] .level-btn:hover {
  background: var(--home-blue);
  color: #fff;
}

[data-page="home"] .level-btn svg {
  width: 14px;
  height: 14px;
}

[data-page="home"] .sidebar-right {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-self: start;
  margin-top: 24px;
  position: sticky;
  top: 24px;
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.5);
}

[data-page="home"] .wallet-container {
  background: linear-gradient(180deg, rgb(var(--accent-gold-rgb, 245 158 11) / 0.12), transparent);
  border: 1px solid rgb(var(--accent-gold-rgb, 245 158 11) / 0.25);
  border-radius: 20px;
  padding: 22px;
  text-align: center;
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
}

[data-page="home"] .wallet-container.mg {
  background: linear-gradient(180deg, rgb(var(--accent-cyan-rgb, 34 211 238) / 0.12), transparent);
  border: 1px solid rgb(var(--accent-cyan-rgb, 34 211 238) / 0.25);
}

[data-page="home"] .glow-coin {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  background: var(--home-gold);
  border-radius: 50%;
  box-shadow: 0 0 26px var(--home-gold);
  opacity: 0.25;
  filter: blur(8px);
}

[data-page="home"] .wallet-container.mg .glow-coin {
  background: var(--home-blue);
  box-shadow: 0 0 26px var(--home-blue);
}

[data-page="home"] .balance-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--home-gold);
}

[data-page="home"] .balance-amount {
  font-family: var(--font-mono, monospace);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 8px 0 12px;
  text-shadow: 0 0 18px var(--home-gold-glow);
}

[data-page="home"] .wallet-container.mg .balance-label {
  color: var(--home-blue);
}

[data-page="home"] .wallet-container.mg .balance-amount {
  text-shadow: 0 0 18px var(--home-blue-glow);
}

[data-page="home"] .btn-topup {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  display: block;
  text-decoration: none;
  text-align: center;
}

[data-page="home"] .btn-topup:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
}

[data-page="home"] .sidebar-right .section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

[data-page="home"] .sidebar-right .section-title.section-title--compact {
  margin-bottom: 16px;
}

[data-page="home"] .sidebar-right .section-title::after {
  content: "";
  height: 1px;
  flex-grow: 1;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.15), transparent);
}

[data-page="home"] .continue-widget {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

[data-page="home"] .continue-widget__title {
  margin: 0;
  font-size: 1rem;
  color: #f8fafc;
  font-weight: 700;
  line-height: 1.3;
}

[data-page="home"] .continue-widget__stats {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

[data-page="home"] .continue-widget__stat {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.58rem 0.8rem;
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

[data-page="home"] a.continue-widget__stat {
  color: #e2e8f0;
  cursor: pointer;
}

[data-page="home"] a.continue-widget__stat:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

[data-page="home"] .continue-widget__stat.is-disabled {
  opacity: 0.7;
}

[data-page="home"] .continue-widget__stat::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

[data-page="home"] .continue-widget__stat.is-green::before {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

[data-page="home"] .continue-widget__stat.is-orange::before {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

[data-page="home"] .continue-widget__stat.is-red::before {
  background: #f43f5e;
  box-shadow: 0 0 6px #f43f5e;
}

[data-page="home"] .continue-widget__cta {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

[data-page="home"] .continue-widget__cta:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: translateY(-2px);
}

[data-page="home"] .quest-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

[data-page="home"] .quest-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  text-decoration: none;
  color: inherit;
}

[data-page="home"] .quest-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

[data-page="home"] .quest-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

[data-page="home"] .quest-meta {
  flex: 1;
}

[data-page="home"] .quest-meta h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

[data-page="home"] .progress-mini {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

[data-page="home"] .progress-mini-fill {
  height: 100%;
  width: 0%;
  background: var(--home-purple);
  border-radius: 4px;
}

[data-page="home"] .reward-tag {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  color: rgba(110, 231, 183, 0.9);
  font-weight: 700;
  margin-top: 6px;
  display: block;
}

[data-page="home"] .data-card--primary {
  border-color: rgb(var(--accent-gold-rgb, 245 158 11) / 0.25);
  box-shadow: 0 0 0 1px rgb(var(--accent-gold-rgb, 245 158 11) / 0.12) inset;
}

[data-page="home"] .card-theme--gold {
  --theme-color: var(--home-gold);
  --theme-color-glow: var(--home-gold-glow);
}

[data-page="home"] .card-theme--blue {
  --theme-color: var(--home-blue);
  --theme-color-glow: var(--home-blue-glow);
}

[data-page="home"] .card-theme--purple {
  --theme-color: var(--home-purple);
  --theme-color-glow: var(--home-purple-glow);
}

@media (max-width: 480px) {
  [data-page="home"] .brand-title-left {
    font-size: 1.75rem;
  }
}


/* =========================================
   STRUCTURE DES SECTIONS & ETAT "BIENTOT"
========================================= */
[data-page="home"] .section-header {
  width: 100%;
  display: flex;
  align-items: center;
  margin-top: 24px;
  margin-bottom: 20px;
}

[data-page="home"] .section-header h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
  margin: 0;
}

[data-page="home"] .section-divider {
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  flex-grow: 1;
  margin-left: 20px;
  opacity: 1;
}

[data-page="home"] .section-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

[data-page="home"] .section-grid.preparation-grid {
  grid-template-columns: repeat(2, 1fr);
}

[data-page="home"] .data-card {
  min-height: 180px;
  padding: 24px 28px;
  aspect-ratio: auto;
}

[data-page="home"] .card-icon-box {
  margin-bottom: 16px;
}

[data-page="home"] .card-icon-box .emoji-icon {
  font-size: 2.5rem;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

@media (min-width: 768px) {
  [data-page="home"] .section-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  [data-page="home"] .section-grid.preparation-grid {
    grid-template-columns: 1fr;
  }
}

[data-page="home"] .data-card.coming-soon {
  opacity: 0.82;
  pointer-events: none;
  filter: grayscale(0.4);
  border-style: dashed;
}

[data-page="home"] .data-card.coming-soon .card-content p {
  color: rgba(226, 232, 240, 0.85);
}

[data-page="home"] .card-subtitle strong,
[data-page="home"] .card-subtitle b {
  color: var(--primary, #10b981);
  font-weight: 600;
  letter-spacing: 0.01em;
}

[data-page="home"] .data-card.coming-soon .card-subtitle strong,
[data-page="home"] .data-card.coming-soon .card-subtitle b {
  color: #cbd5e1;
}

[data-page="home"] .badge-soon {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--home-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =========================================
   ANIMATION SYMBOLES MATHEMATIQUES
========================================= */
[data-page="home"] .math-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

[data-page="home"] .math-symbol {
  position: absolute;
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  color: rgba(255, 255, 255, 0.25);
  font-weight: 300;
  font-family: "Times New Roman", "Georgia", serif;
  animation: home-float-up linear infinite;
  opacity: 0;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

@keyframes home-float-up {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  5% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.4;
  }
  95% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-100vh) rotate(360deg);
    opacity: 0;
  }
}

/* Variations de couleurs pour certains symboles */
[data-page="home"] .math-symbol.green {
  color: rgba(16, 185, 129, 0.4);
  text-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

[data-page="home"] .math-symbol.blue {
  color: rgba(59, 130, 246, 0.4);
  text-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

[data-page="home"] .math-symbol.rose {
  color: rgba(244, 63, 94, 0.4);
  text-shadow: 0 0 15px rgba(244, 63, 94, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  [data-page="home"] .math-symbol {
    animation: none;
    opacity: 0.2;
  }
}
