/* ============================================================
	 IRON PATH — style.css
	 ============================================================ */

:root {
  --bg: #060c1a;
  --bg-soft: #0c1730;
  --panel: rgba(12, 23, 48, 0.82);
  --panel-strong: rgba(16, 31, 63, 0.92);
  --panel-border: rgba(0, 168, 255, 0.22);
  --panel-border-strong: rgba(0, 168, 255, 0.42);
  --primary: #00a8ff;
  --primary-soft: rgba(0, 168, 255, 0.18);
  --text: #f0f4ff;
  --muted: #9fb4d7;
  --muted-strong: #c7d7f3;
  --gold: #ffc840;
  --success: #00e676;
  --danger: #ff4d5e;
  --shadow: 0 20px 60px rgba(1, 8, 20, 0.55);
  --shadow-soft: 0 14px 30px rgba(1, 8, 20, 0.3);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --header-h: 88px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Exo 2", sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at top center,
      rgba(0, 168, 255, 0.18),
      transparent 38%
    ),
    radial-gradient(
      circle at 80% 18%,
      rgba(0, 108, 255, 0.15),
      transparent 28%
    ),
    linear-gradient(180deg, #071022 0%, #040915 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

body::before {
  background:
    linear-gradient(rgba(0, 168, 255, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 168, 255, 0.075) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 50%, transparent 100%);
  opacity: 0.45;
}

body::after {
  background:
    radial-gradient(
      circle at 15% 20%,
      rgba(0, 168, 255, 0.12),
      transparent 24%
    ),
    radial-gradient(
      circle at 82% 76%,
      rgba(255, 200, 64, 0.08),
      transparent 20%
    );
  filter: blur(30px);
  z-index: -3;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

blockquote,
p,
h1,
h2,
h3 {
  margin: 0;
}

.app {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  min-height: 100vh;
  padding: calc(var(--header-h) + 38px) 22px 22px 22px;
  transition:
    opacity 0.45s ease,
    visibility 0.45s ease;
}

.app.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 18px 22px;
  background: linear-gradient(
    180deg,
    rgba(15, 29, 60, 0.75),
    rgba(9, 20, 42, 0.72)
  );
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 4px 20px rgba(1, 8, 20, 0.3);
  backdrop-filter: blur(12px);
  z-index: 100;
  transition: all 0.3s ease;
}

.header--scrolled {
  background: linear-gradient(
    180deg,
    rgba(15, 29, 60, 0.95),
    rgba(9, 20, 42, 0.92)
  );
  backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px rgba(1, 8, 20, 0.6);
  border-bottom-color: var(--panel-border-strong);
}

.header__left,
.header__center,
.header__right {
  display: flex;
  align-items: center;
}

.header__left {
  gap: 12px;
}

.header__center {
  flex-direction: column;
  flex: 1 1 220px;
  gap: 4px;
  justify-content: center;
  text-align: center;
}

.header__right {
  justify-content: flex-end;
}

.header__logo {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(0, 168, 255, 0.22),
    rgba(0, 168, 255, 0.08)
  );
  border: 1px solid rgba(0, 168, 255, 0.3);
  font-size: 1.55rem;
  box-shadow: inset 0 0 18px rgba(0, 168, 255, 0.12);
  animation: bolt-flicker 4s ease-in-out infinite;
}

.header__brand,
.panel__title,
.character__tier-name,
.character__level,
.gender-screen__title,
.gender-card__name,
.modal__level,
.overlay__title,
.stat-card__val {
  font-family: "Rajdhani", sans-serif;
  letter-spacing: 0.04em;
}

.header__brand {
  font-size: 1.7rem;
  font-weight: 700;
}

.header__streak {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 200, 64, 0.12);
  border: 1px solid rgba(255, 200, 64, 0.18);
  color: #ffe293;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.header__streak-icon {
  display: inline-block;
  animation: fire-flicker 1.5s ease-in-out infinite alternate;
}

.header__date {
  color: var(--muted);
  font-size: 0.94rem;
  text-transform: capitalize;
}

.main-grid {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 22px;
  padding-top: 100px;
}

.panel {
  position: relative;
  padding: 24px;
  background: linear-gradient(
    180deg,
    rgba(15, 28, 58, 0.94),
    rgba(8, 18, 38, 0.92)
  );
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 168, 255, 0.09), transparent 42%);
  pointer-events: none;
}

.panel--left {
  order: 1;
  flex: 1.05 1 300px;
}

.panel--center-top {
  order: 2;
  flex: 1.1 1 340px;
}

.panel--center-bottom {
  order: 3;
  flex: 1 1 300px;
}

.panel--right {
  order: 4;
  flex: 1 1 300px;
}

.panel__header,
.panel__controls,
.progress-label,
.quest-card,
.quest-card__actions,
.xp-labels,
.stats-grid,
.gender-cards,
.overlay__card,
.modal__card {
  position: relative;
  z-index: 1;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel__title {
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 700;
}

.panel__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.countdown {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 168, 255, 0.1);
  border: 1px solid rgba(0, 168, 255, 0.2);
  color: var(--muted-strong);
  font-size: 0.92rem;
  white-space: nowrap;
}

.btn {
  min-height: 44px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    opacity 0.16s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px) scale(0.985);
}

.btn:focus-visible,
.gender-card:focus-visible {
  outline: 2px solid rgba(0, 168, 255, 0.8);
  outline-offset: 2px;
}

.btn--sm {
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.92rem;
}

.btn--lg {
  min-height: 50px;
  padding: 14px 24px;
  font-size: 1rem;
}

.btn--icon-only {
  min-width: 44px;
  width: 44px;
  padding-inline: 0;
}

.btn--primary {
  background: linear-gradient(180deg, #19b5ff, #008de0);
  border-color: rgba(128, 218, 255, 0.24);
  box-shadow: 0 12px 24px rgba(0, 112, 198, 0.28);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(160, 190, 230, 0.16);
  color: var(--muted-strong);
}

.btn--danger {
  background: linear-gradient(
    180deg,
    rgba(255, 77, 94, 0.28),
    rgba(166, 29, 45, 0.35)
  );
  border-color: rgba(255, 77, 94, 0.24);
}

.btn--gold {
  background: linear-gradient(180deg, #ffd86b, #f2af1f);
  color: #201400;
  border-color: rgba(255, 218, 114, 0.28);
  box-shadow: 0 12px 28px rgba(255, 182, 34, 0.28);
}

.progress-wrap {
  display: none;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-track,
.xp-track {
  width: 100%;
  overflow: hidden;
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(173, 195, 232, 0.12);
}

.xp-track::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: bar-shine 2.5s ease-in-out infinite;
  pointer-events: none;
}

.progress-track {
  height: 14px;
  border-radius: 999px;
}

.progress-fill,
.xp-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(0, 168, 255, 0.75),
    rgba(0, 236, 255, 1)
  );
}

.progress-fill {
  transition: width 0.35s ease;
  box-shadow: 0 0 18px rgba(0, 168, 255, 0.34);
}

.quests-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quest-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    rgba(18, 34, 68, 0.95),
    rgba(10, 21, 44, 0.92)
  );
  border: 1px solid rgba(0, 168, 255, 0.16);
  box-shadow: var(--shadow-soft);
}

.quest-card__icon {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(0, 168, 255, 0.2),
    rgba(0, 168, 255, 0.06)
  );
  border: 1px solid rgba(0, 168, 255, 0.18);
  font-size: 1.7rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(0, 200, 255, 0.3));
}

.quest-card__body {
  flex: 1 1 180px;
  min-width: 0;
}

/* Variante pour les quêtes légendaires : remplit mieux l'espace */
.quest-card--legendary .quest-card__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.quest-card__cat {
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.quest-card__title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.quest-card__desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* Ajustements pour les quêtes légendaires */
.quest-card--legendary .quest-card__title {
  margin: 0;
}

.quest-card--legendary .quest-card__desc {
  margin-top: 0;
}

.quest-card--legendary .quest-card__xp {
  margin-top: 0;
}

.quest-card__xp {
  margin-top: 10px;
  color: #7bd7ff;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
}

.quest-card__xp--gold {
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255, 200, 64, 0.3);
}

.quest-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-left: auto;
}

.quest-card--done {
  opacity: 0.62;
  border-color: rgba(0, 230, 118, 0.18);
}

.quest-card--done .quest-card__icon {
  background: linear-gradient(
    180deg,
    rgba(0, 230, 118, 0.16),
    rgba(0, 230, 118, 0.05)
  );
  border-color: rgba(0, 230, 118, 0.18);
}

.quest-card--legendary {
  border-color: rgba(255, 200, 64, 0.26);
  background:
    linear-gradient(180deg, rgba(33, 28, 12, 0.46), rgba(12, 18, 36, 0.94)),
    linear-gradient(180deg, rgba(18, 34, 68, 0.96), rgba(10, 21, 44, 0.92));
  border-left: 3px solid #ffc840;
}

.quest-card--legendary .quest-card__icon {
  background: linear-gradient(
    180deg,
    rgba(255, 200, 64, 0.22),
    rgba(255, 200, 64, 0.08)
  );
  border-color: rgba(255, 200, 64, 0.2);
}

.badge {
  min-height: 40px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.badge--done {
  background: rgba(0, 230, 118, 0.12);
  color: #98ffc7;
  border: 1px solid rgba(0, 230, 118, 0.18);
}

.character {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.character__emoji {
  width: 122px;
  height: 122px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 34px;
  margin-bottom: 18px;
  font-size: 4rem;
  position: relative;
  background:
    radial-gradient(
      circle at 30% 30%,
      rgba(255, 255, 255, 0.14),
      transparent 45%
    ),
    linear-gradient(180deg, rgba(0, 168, 255, 0.24), rgba(0, 168, 255, 0.08));
  border: 1px solid rgba(0, 168, 255, 0.24);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.06),
    0 18px 40px rgba(0, 68, 132, 0.25);
}

.character__emoji::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 38px;
  border: 2px solid rgba(0, 168, 255, 0.4);
  animation: ring-pulse 3s ease-in-out infinite 1s;
  pointer-events: none;
}

.character__tier-name {
  font-size: clamp(2rem, 3vw, 2.7rem);
  font-weight: 700;
}

.character__tier-desc {
  max-width: 34ch;
  margin-top: 8px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.character__level {
  margin-top: 16px;
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  font-weight: 700;
}

.xp-section {
  width: 100%;
  margin-top: 24px;
}

.xp-track {
  height: 22px;
  border-radius: 999px;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.04);
}

.xp-fill {
  transition:
    width 0.6s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

.xp-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted-strong);
  font-size: 0.94rem;
}

.character__total-xp {
  margin-top: 18px;
  color: var(--gold);
  font-family: "Rajdhani", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.character__quote {
  width: 100%;
  min-height: 88px;
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(167, 191, 231, 0.12);
  color: var(--muted-strong);
  font-size: 1rem;
  line-height: 1.65;
  font-style: italic;
  transition: opacity 0.3s ease;
}

.character__quote::before {
  content: "\201C ";
  color: var(--primary);
}

.character__quote::after {
  content: " \201D";
  color: var(--primary);
}

.stats-grid {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
}

.stat-card {
  flex: 1 1 calc(50% - 7px);
  padding: 18px 16px;
  border-radius: 20px;
  text-align: center;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(167, 191, 231, 0.12);
}

.stat-card__icon {
  font-size: 1.35rem;
}

.stat-card__val {
  margin-top: 10px;
  font-size: 1.9rem;
  font-weight: 700;
}

.stat-card__label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.92rem;
}

.gender-screen,
.modal,
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.gender-screen,
.modal {
  z-index: 70;
}

.overlay {
  z-index: 65;
}

.gender-screen {
  padding: 24px;
  background:
    radial-gradient(
      circle at top center,
      rgba(0, 168, 255, 0.2),
      transparent 34%
    ),
    linear-gradient(180deg, rgba(5, 10, 20, 0.86), rgba(4, 7, 16, 0.96));
  backdrop-filter: blur(16px);
}

.gender-screen.visible,
.modal.visible,
.overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gender-screen.fade-out {
  opacity: 0;
}

.gender-screen__inner {
  width: min(100%, 980px);
  padding: 34px;
  border-radius: 34px;
  background: linear-gradient(
    180deg,
    rgba(14, 28, 58, 0.96),
    rgba(8, 18, 38, 0.94)
  );
  border: 1px solid rgba(0, 168, 255, 0.22);
  box-shadow: 0 28px 80px rgba(2, 8, 18, 0.6);
  text-align: center;
}

.gender-screen__logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: linear-gradient(
    180deg,
    rgba(0, 168, 255, 0.24),
    rgba(0, 168, 255, 0.08)
  );
  border: 1px solid rgba(0, 168, 255, 0.22);
  font-size: 2.8rem;
}

.gender-screen__title {
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 800;
}

.gender-screen__subtitle {
  margin-top: 8px;
  color: var(--muted-strong);
  font-size: 1.08rem;
}

.gender-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 30px;
}

.gender-card {
  flex: 1 1 calc(50% - 9px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  border-radius: 28px;
  text-align: left;
  background: linear-gradient(
    180deg,
    rgba(18, 34, 68, 0.95),
    rgba(10, 21, 44, 0.92)
  );
  border: 1px solid rgba(0, 168, 255, 0.2);
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.gender-card:active {
  transform: scale(0.988);
}

.gender-card__icon {
  font-size: 3rem;
}

.gender-card__name {
  margin-top: 14px;
  font-size: 1.5rem;
  font-weight: 700;
}

.gender-card__desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.72);
  backdrop-filter: blur(12px);
}

.modal__card,
.overlay__card {
  width: min(100% - 32px, 620px);
  position: relative;
  padding: 34px 30px;
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(
    180deg,
    rgba(18, 34, 68, 0.98),
    rgba(8, 18, 38, 0.96)
  );
  border: 1px solid rgba(0, 168, 255, 0.24);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.modal__card::before,
.overlay__card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top center,
    rgba(0, 168, 255, 0.16),
    transparent 45%
  );
  pointer-events: none;
}

.modal__emoji,
.overlay__emoji {
  position: relative;
  z-index: 1;
  font-size: 4.2rem;
}

.modal__level {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 800;
}

.modal__tier {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  font-family: "Rajdhani", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
}

.modal__tier-desc,
.modal__quote,
.overlay__msg,
.overlay__countdown {
  position: relative;
  z-index: 1;
}

.modal__tier-desc {
  min-height: 1.6em;
  margin-top: 8px;
  color: var(--muted);
}

.modal__quote {
  margin: 20px auto 24px;
  max-width: 34ch;
  color: var(--muted-strong);
  font-size: 1.04rem;
  line-height: 1.65;
}

.overlay__title {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
}

.overlay__msg {
  margin-top: 12px;
  color: var(--muted-strong);
  font-size: 1.02rem;
  line-height: 1.6;
}

.overlay__bonus {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  color: var(--success);
  font-family: "Rajdhani", sans-serif;
  font-size: 2rem;
  font-weight: 800;
}

.overlay__bonus--gold {
  color: var(--gold);
}

.overlay__countdown {
  margin-top: 10px;
  color: var(--muted);
}

.overlay--legendary .overlay__card {
  border-color: rgba(255, 200, 64, 0.28);
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #ffffff 0%,
    #ffc840 45%,
    rgba(255, 200, 64, 0) 100%
  );
  box-shadow: 0 0 14px rgba(255, 200, 64, 0.65);
  animation: sparkle-burst 1s ease-out forwards;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 360px);
}

.toast {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(10, 22, 44, 0.94);
  border: 1px solid rgba(0, 168, 255, 0.22);
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  transform: translateY(16px);
}

.toast--in {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.toast--out {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.xp-popup {
  position: fixed;
  z-index: 85;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 200, 64, 0.16);
  border: 1px solid rgba(255, 200, 64, 0.22);
  color: var(--gold);
  font-family: "Rajdhani", sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  transform: translate(-50%, 0) scale(0.95);
  opacity: 0;
  pointer-events: none;
}

.xp-popup--active {
  animation: xp-rise 0.9s ease forwards;
}

@keyframes xp-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.9);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -48px) scale(1.06);
  }
}

@keyframes sparkle-burst {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(0) scale(0.2);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--dist)) scale(1);
  }
}

@keyframes bolt-flicker {
  0%,
  90%,
  100% {
    filter: drop-shadow(0 0 8px var(--primary));
    opacity: 1;
  }
  95% {
    opacity: 0.5;
  }
}

@keyframes fire-flicker {
  0% {
    transform: scale(1) rotate(-3deg);
    filter: drop-shadow(0 0 4px #ff8000);
  }
  100% {
    transform: scale(1.1) rotate(3deg);
    filter: drop-shadow(0 0 10px #ff5000);
  }
}

@keyframes bar-shine {
  0% {
    left: -100%;
  }
  60% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes ring-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.2;
  }
}

@media (min-width: 881px) {
  .btn:hover,
  .gender-card:hover {
    transform: translateY(-1px);
  }

  .btn--primary:hover {
    box-shadow: 0 14px 28px rgba(0, 112, 198, 0.38);
  }

  .btn--ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(160, 190, 230, 0.26);
  }

  .btn--danger:hover {
    background: linear-gradient(
      180deg,
      rgba(255, 77, 94, 0.34),
      rgba(166, 29, 45, 0.42)
    );
  }

  .btn--gold:hover {
    box-shadow: 0 16px 32px rgba(255, 182, 34, 0.34);
  }

  .quest-card:hover {
    border-color: var(--panel-border-strong);
    transform: translateY(-2px);
  }

  .gender-card:hover {
    border-color: rgba(0, 168, 255, 0.4);
    box-shadow: 0 22px 44px rgba(0, 80, 150, 0.24);
  }
}

@media (max-width: 1100px) {
  .main-grid {
    flex-direction: column;
  }

  .header {
    justify-content: center;
    text-align: center;
    padding: 16px 22px;
  }

  .header__left,
  .header__center,
  .header__right {
    justify-content: center;
    flex: initial;
  }

  .panel--left,
  .panel--center-top,
  .panel--center-bottom,
  .panel--right {
    flex: 1 1 100%;
    width: 100%;
  }

  .panel--center-top {
    order: 1;
  }

  .panel--left {
    order: 2;
  }

  .panel--center-bottom {
    order: 3;
  }

  .panel--right {
    order: 4;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 14px;
  }

  .panel,
  .gender-screen__inner,
  .modal__card,
  .overlay__card {
    border-radius: 24px;
  }

  .header {
    padding: 14px 16px;
  }

  .panel {
    padding: 18px;
  }

  .panel__header,
  .quest-card,
  .xp-labels {
    gap: 12px;
  }

  .xp-labels {
    flex-wrap: wrap;
  }

  .xp-labels {
    justify-content: center;
    text-align: center;
  }

  .character__emoji {
    width: 104px;
    height: 104px;
    font-size: 3.4rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .panel__title {
    font-size: 1.5rem;
  }

  .countdown {
    width: 100%;
    text-align: center;
  }

  .quest-card__icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    font-size: 1.45rem;
  }

  .quest-card__title,
  .quest-card__desc,
  .gender-card__desc {
    font-size: 0.94rem;
  }

  .gender-screen {
    padding: 14px;
  }

  .gender-screen__inner,
  .modal__card,
  .overlay__card {
    padding: 24px 18px;
  }

  .toast-container {
    right: 12px;
    left: 12px;
    width: auto;
  }
}

@media (max-width: 424px) {
  .main-grid {
    padding-top: 150px;
  }
}

@media (max-width: 360px) {
  .panel__title {
    font-size: 1rem;
  }

  .quest-card__actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* ════════════════════════════════════════════
   OPTIMISATIONS MOBILE (FIX BLOCS BLANCS)
   ════════════════════════════════════════════ */

@media (max-width: 1100px) {
  /* Fix pour les blocs blancs sur Android/Xiaomi lors du scroll rapide */

  /* Désactiver backdrop-filter sur mobile (trop lourd sur Android) */
  .header {
    backdrop-filter: none;
    background: linear-gradient(
      180deg,
      rgba(15, 29, 60, 0.98),
      rgba(9, 20, 42, 0.96)
    );
  }

  .header--scrolled {
    backdrop-filter: none;
    background: linear-gradient(
      180deg,
      rgba(15, 29, 60, 1),
      rgba(9, 20, 42, 0.98)
    );
  }

  .panel {
    backdrop-filter: none;
    background: linear-gradient(
      180deg,
      rgba(15, 28, 58, 0.98),
      rgba(8, 18, 38, 0.96)
    );
  }

  .gender-screen {
    backdrop-filter: none;
    background:
      radial-gradient(
        circle at top center,
        rgba(0, 168, 255, 0.2),
        transparent 34%
      ),
      linear-gradient(180deg, rgba(5, 10, 20, 0.98), rgba(4, 7, 16, 1));
  }

  .modal__backdrop {
    backdrop-filter: none;
    background: rgba(3, 8, 18, 0.92);
  }

  /* Background solide pour éviter les flashs blancs */
  body {
    background-color: #060c1a;
  }

  .app {
    background-color: transparent;
  }

  /* Accélération hardware pour éviter les artifacts blancs */
  body,
  .header,
  .panel,
  .quest-card,
  .modal__card,
  .gender-screen,
  .modal__backdrop {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Optimiser les pseudo-éléments du body */
  body::before,
  body::after {
    will-change: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Optimiser le scroll */
  html {
    -webkit-overflow-scrolling: touch;
  }

  /* Forcer l'accélération GPU sur les éléments qui scrollent */
  .main-grid {
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  /* Désactiver les animations trop lourdes sur mobile */
  .character__emoji::before {
    animation: none;
  }

  .header__logo {
    animation: none;
  }

  .header__streak-icon {
    animation: none;
  }

  /* Optimiser le rendu des cartes */
  .quest-card,
  .stat-card,
  .gender-card {
    will-change: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
