/* Bannière info chasse — haut gauche (absolute, ne suit pas le scroll) */
.th-banner {
  --th-card-gold: #b8a468;
  position: absolute;
  top: max(5.5rem, calc(env(safe-area-inset-top) + 4.5rem));
  left: max(1rem, env(safe-area-inset-left));
  right: auto;
  bottom: auto;
  z-index: 99970;
  display: flex;
  align-items: center;
  width: max-content;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.95rem 2.75rem 0.95rem 1.6rem;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.72);
  color: #ffffff;
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
  box-shadow: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: none;
  pointer-events: auto;
  animation: th-banner-in 0.45s ease-out both;
}

@keyframes th-banner-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.th-banner__link {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.th-banner__link:hover .th-banner__text,
.th-banner__link:focus-visible .th-banner__text {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.th-banner__link:focus-visible {
  outline: 2px solid rgba(184, 164, 104, 0.8);
  outline-offset: 3px;
  border-radius: 0.5rem;
}

.th-banner__content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  text-align: left;
}

.th-banner__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--th-card-gold);
}

.th-banner__text {
  margin: 0;
  font-size: 0.92rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.35;
  color: #ffffff;
  white-space: pre-line;
}

.th-banner__dismiss {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 0.2s ease, background 0.2s ease;
}

.th-banner__dismiss:hover,
.th-banner__dismiss:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

@media (max-width: 640px) {
  .th-banner {
    top: max(4.75rem, calc(env(safe-area-inset-top) + 3.75rem));
    left: max(0.75rem, env(safe-area-inset-left));
    right: max(0.75rem, env(safe-area-inset-right));
    width: auto;
    max-width: none;
    padding: 0.85rem 2.5rem 0.85rem 1.15rem;
  }
}

/* Fixed chest teaser = rendu officiel */
.th-chest {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 99980;
  width: 96px;
  height: 84px;
  padding: 0;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
  animation: th-chest-in 0.55s ease-out both;
  -webkit-tap-highlight-color: transparent;
}

.th-chest:focus,
.th-chest:focus-visible {
  outline: none;
  box-shadow: none;
}

.th-chest__glow {
  position: absolute;
  inset: -12px;
  border-radius: 20px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.55), transparent 70%);
  animation: th-chest-pulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

.th-chest__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: visible;
  background: transparent;
  animation: th-chest-bob 2.8s ease-in-out infinite;
}

.th-chest__inner--fallback {
  background: linear-gradient(160deg, #2a2218, #14110c 60%);
  border-radius: 10px;
}

.th-chest__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
}

.th-chest:hover .th-chest__inner,
.th-chest:focus-visible .th-chest__inner {
  outline: none;
  filter: brightness(1.08);
}

@keyframes th-chest-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes th-chest-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes th-chest-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.95);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .th-chest,
  .th-chest__inner,
  .th-chest__glow {
    animation: none !important;
  }
}

/* Full-screen 3D chest stage (lazy Three.js) */
html.th-chest-stage-open {
  overflow: hidden;
}

.th-chest-stage {
  position: fixed;
  inset: 0;
  z-index: 99985;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.th-chest-stage__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(40, 28, 12, 0.28), rgba(10, 8, 6, 0.4));
}

.th-chest-stage__canvas-wrap {
  position: relative;
  z-index: 1;
  width: min(94vw, 640px);
  height: min(78vh, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.th-chest-stage__hero {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.82) translateY(18px);
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.th-chest-stage__hero.is-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.th-chest-stage__hero.is-open {
  transform: scale(1.04) translateY(-6px);
  filter: drop-shadow(0 0 28px rgba(212, 175, 55, 0.35));
}

.th-chest-stage__hero-img {
  display: block;
  width: min(88%, 420px);
  height: auto;
  max-height: 72%;
  object-fit: contain;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.65));
}

.th-chest-stage__viewport {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.th-chest-stage__viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.th-chest-stage__loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  color: #f5efe6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  pointer-events: none;
}

.th-chest-stage__loader[hidden] {
  display: none !important;
}

.th-chest-stage__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(240, 215, 140, 0.25);
  border-top-color: #f0d78c;
  border-radius: 50%;
  animation: th-spin 0.8s linear infinite;
}

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

.th-chest-stage__close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 3;
  border: 0;
  background: rgba(0, 0, 0, 0.35);
  color: #f5efe6;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.th-chest-stage.is-opened .th-chest-stage__canvas-wrap {
  transform: scale(0.92);
  transition: transform 0.45s ease;
}

.th-chest-stage.is-opened .th-chest-stage__backdrop {
  background: radial-gradient(ellipse at center, rgba(40, 28, 12, 0.22), rgba(10, 8, 6, 0.34));
}

/* Modal BRAVO (above 3D stage) */
.th-modal[hidden] {
  display: none !important;
}

.th-modal {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.th-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
}

.th-modal__dialog {
  position: relative;
  width: min(100%, 420px);
  max-height: min(92vh, 740px);
  overflow: auto;
  background: #0a0a0a;
  color: #f5f5f5;
  border-radius: 4px;
  padding: 2rem 1.5rem 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
}

.th-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #d0d0d0;
}

.th-modal__discover[hidden],
.th-modal__body[hidden] {
  display: none !important;
}

.th-modal__bravo {
  margin: 0 0 0.15rem;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #cccccc;
  background: linear-gradient(180deg, #e8e8e8 0%, #999999 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

.th-modal__subtitle {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  line-height: 1.35;
  color: #ececec;
}

.th-modal__img {
  width: min(70%, 220px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1.1rem;
  display: block;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.th-modal__img--empty {
  background: radial-gradient(circle at 35% 30%, #f0d78c, #8b6914);
}

.th-modal__img--success {
  width: min(55%, 160px);
  margin-bottom: 1rem;
}

.th-modal__prize-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 0 1.15rem;
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  line-height: 1.35;
  color: #b8a468;
}

.th-modal__prize-name em {
  font-style: italic;
  font-weight: 600;
  color: #b8a468;
}

.th-modal__prize-rule {
  display: block;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1px;
  background: #b8a468;
}

.th-modal__cta-text {
  margin: 0 auto 1.35rem;
  max-width: 22rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #dedede;
  white-space: pre-line;
}

.th-modal__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
  background: linear-gradient(180deg, #f2f2f2, #cfcfcf);
  color: #111;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.th-modal__cta:hover,
.th-modal__cta:focus-visible {
  background: linear-gradient(180deg, #ffffff, #e0e0e0);
  outline: none;
}

.th-modal__body {
  text-align: left;
}

.th-modal__form > label:not(.th-modal__consent) {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: #ddd;
}

.th-modal__form input[type="email"],
.th-modal__form input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid #444;
  border-radius: 6px;
  margin-bottom: 0.85rem;
  font: inherit;
  box-sizing: border-box;
  background: #161616;
  color: #f5f5f5;
}

.th-modal .th-modal__consent {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.8rem;
  margin: 0.5rem 0 0;
  padding: 0;
  line-height: 1.45;
  background: none;
  border: 0;
  color: #ccc;
}

.th-modal .th-modal__consent input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0.2rem 0.75rem 0 0;
  padding: 0;
}

.th-modal .th-modal__consent span {
  display: block;
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
}

.th-modal .th-modal__privacy {
  display: block;
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: #aaa;
}

.th-modal__success {
  text-align: center;
  padding: 0.5rem 0.25rem 0.25rem;
}

.th-modal__success-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f0d78c;
}

.th-modal__success-text {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: #ddd;
  line-height: 1.45;
  white-space: pre-line;
}

.th-modal__success-close {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  background: linear-gradient(180deg, #f2f2f2, #cfcfcf);
  color: #111;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.th-modal .th-modal__submit {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0.7rem 1rem;
  margin-top: 1.5rem;
  background: linear-gradient(180deg, #f2f2f2, #cfcfcf);
  color: #111;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.th-modal__submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.th-modal__msg {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  text-align: center;
}

.th-modal__msg.is-error {
  color: #ff8e8e;
}

.th-modal__msg.is-ok {
  color: #f0d78c;
  font-weight: 600;
}
