/* ==========================================================================
   CALENDRIER DE L'AVENT — STYLE MOBILE-FIRST & PIXEL COSY
   ========================================================================== */

:root {
  --bg-outer: #0d0914;
  --glass-dark: rgba(20, 12, 28, 0.84);
  --glass-card: rgba(34, 20, 42, 0.90);
  --wood-warm: #5d2606;
  --accent-orange: #ff7315;
  --accent-gold: #ffd166;
  --accent-green: #2ec4b6;
  --accent-red: #ef476f;
  --text-light: #fff8f0;
  --text-muted: #d4c3b8;
  --border-warm: rgba(255, 168, 96, 0.35);
  --font-pixel: 'Pixelify Sans', 'Courier New', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', monospace;
  --font-ui: var(--font-pixel);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-pixel);
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-outer);
  color: var(--text-light);
  font-family: var(--font-pixel);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

input,
textarea,
select {
  font-family: var(--font-pixel);
  user-select: text;
  -webkit-user-select: text;
}

button {
  font-family: var(--font-pixel);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   CONTENEUR TÉLÉPHONE (Plein écran sur mobile, aperçu iPhone sur PC)
   ========================================================================== */

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 25%, #23183b 0%, #0b0711 100%);
}

#phone-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #1c1118;
  display: flex;
  flex-direction: column;
}

@media (min-width: 521px) {
  #phone-viewport {
    width: 412px;
    height: min(93dvh, 884px);
    border-radius: 34px;
    border: 6px solid #2b2138;
    box-shadow:
      0 24px 70px rgba(0, 0, 0, 0.78),
      0 0 0 1px rgba(255, 255, 255, 0.08);
  }
}

/* Fond pixel-art recadré de 5% pour masquer les bords roses haut/bas de background.png */
.scene-bg {
  position: absolute;
  inset: -5.5%;
  background-image: url('../assets/placeholder/background.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  z-index: 0;
  filter: brightness(0.92);
}

.scene-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(14, 9, 22, 0.55) 0%,
    rgba(14, 9, 22, 0.18) 45%,
    rgba(14, 9, 22, 0.68) 100%
  );
}

/* Neige légère en arrière-plan */
.snow-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -12px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: snowfall linear infinite;
}

@keyframes snowfall {
  0% {
    transform: translateY(-10px) translateX(0);
    opacity: 0.9;
  }
  50% {
    transform: translateY(50dvh) translateX(12px);
  }
  100% {
    transform: translateY(105dvh) translateX(-8px);
    opacity: 0.2;
  }
}

/* ==========================================================================
   PLACEHOLDER RECTANGLE NOIR + TEXTE BLANC (Règle stricte des ressources manquantes)
   ========================================================================== */

.black-placeholder {
  background-color: #000000;
  color: #ffffff;
  border: 1.5px dashed rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.35;
  min-height: 90px;
  word-break: break-word;
}

.black-placeholder.tall {
  min-height: 185px;
}

.black-placeholder.square-item {
  width: 68px;
  height: 68px;
  min-height: 68px;
  padding: 6px;
  font-size: 0.80rem;
  line-height: 1.15;
  border-radius: 8px;
  flex-shrink: 0;
}

.black-placeholder.mini-room-item {
  width: 66px;
  min-height: 52px;
  padding: 5px 6px;
  font-size: 0.86rem;
  line-height: 1.15;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
}

/* Vrais sprites pixel-art pour les objets d'inventaire (ex: brick.png) */
.item-sprite-box {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(255, 209, 102, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  flex-shrink: 0;
}

.item-sprite-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

.placed-sprite-object {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.55));
}

.placed-sprite-object img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

/* Styles du mini-jeu Jour 13 (Angry Bricks) */
.copgame-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.copgame-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(0, 0, 0, 0.42);
  border: 1.5px solid var(--border-warm);
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 0.88rem;
  font-weight: 700;
}

.copgame-bricks-left {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.copgame-brick-icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
}

.copgame-brick-icon.used {
  opacity: 0.22;
  filter: grayscale(1);
}

/* Styles spécifiques au Runner Kikibu (Jour 14) */
.kikibu-bees-hud {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.kikibu-bee-slot {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  opacity: 0.25;
  filter: grayscale(1);
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.kikibu-bee-slot.caught {
  opacity: 1;
  filter: none;
  transform: scale(1.12);
}

/* ==========================================================================
   JOUR 2 (2/12) — BON À GRATTER PEACH 24H (ticket_peach.png)
   ========================================================================== */

.scratch-stage-wrap {
  position: relative;
  width: 100%;
  padding: 12px 10px;
  border-radius: 16px;
  border: 2.5px solid var(--accent-orange);
  background: radial-gradient(circle at 50% 45%, #2f1d42 0%, #170e24 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  touch-action: none;
}

.scratch-ticket-stack {
  position: relative;
  width: 100%;
  aspect-ratio: 320 / 210;
  touch-action: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6));
}

.scratch-base-canvas,
.scratch-foil-canvas,
.scratch-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.scratch-base-canvas {
  image-rendering: pixelated;
}

.scratch-foil-canvas {
  touch-action: none;
  cursor: grab;
}

.scratch-foil-canvas:active {
  cursor: grabbing;
}

.scratch-fx-canvas {
  pointer-events: none;
}

.scratch-won-banner {
  background: linear-gradient(90deg, rgba(46, 196, 182, 0.24), rgba(255, 209, 102, 0.24));
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 10px;
  text-align: center;
  width: 100%;
  animation: slideUp 0.2s ease-out;
}

/* ==========================================================================
   JOUR 3 (3/12) — PUZZLE PHOTO 4x3 (puzzle_full.jpg)
   ========================================================================== */

.puzzle-stage-wrap {
  position: relative;
  width: 100%;
  padding: 8px;
  border-radius: 16px;
  border: 2.5px solid var(--accent-orange);
  background: #170e24;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
  touch-action: none;
}

.puzzle-board {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  background: #0d0714;
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
  transition: gap 0.35s ease;
}

.puzzle-board.solved {
  gap: 0px;
  box-shadow: 0 0 0 2px var(--accent-gold);
}

.puzzle-guide-preview {
  position: absolute;
  inset: 0;
  background-image: url('../assets/placeholder/puzzle_full.jpg');
  background-size: 100% 100%;
  background-position: center;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.2s ease;
}

.puzzle-guide-preview.visible {
  opacity: 0.78;
}

.puzzle-tile {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: url('../assets/placeholder/puzzle_full.jpg');
  background-size: 400% 300%;
  background-repeat: no-repeat;
  image-rendering: auto;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  cursor: grab;
  touch-action: none;
  transition: transform 0.14s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.puzzle-board.solved .puzzle-tile {
  border: none;
  border-radius: 0;
  cursor: default;
}

.puzzle-tile.correct:not(.selected) {
  border-color: rgba(128, 255, 219, 0.55);
}

.puzzle-tile.selected {
  z-index: 4;
  border: 2.5px solid var(--accent-gold);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.9);
  transform: scale(0.95);
}

.puzzle-tile.drop-target {
  border: 2.5px dashed #80ffdb;
  filter: brightness(1.18);
}

.puzzle-hud-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ==========================================================================
   JOUR 15 (15/12) — LES DEVOIRS DE KIKIBU (CALCUL MENTAL - background_calcul.png)
   ========================================================================== */

.modal-sheet.tall-game-sheet {
  height: 94%;
  max-height: 94%;
}

.modal-sheet.tall-game-sheet .modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 10px 12px calc(12px + var(--safe-bottom));
  gap: 8px;
}

.modal-sheet.tall-game-sheet .modal-body > * {
  flex: 1 1 0;
  min-height: 0;
}

.math-game-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.math-classroom-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  border-radius: 16px;
  border: 2.5px solid var(--accent-orange);
  overflow: hidden;
  background-color: #1c2820;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fond flouté doux sur les côtés + image entière nette au centre (0% rogné, visage 100% visible !) */
.math-classroom-stage::before {
  content: '';
  position: absolute;
  inset: -12px;
  background-image: url('../assets/placeholder/background_calcul.png');
  background-size: cover;
  background-position: center;
  filter: blur(10px) brightness(0.55);
  z-index: 0;
}

.math-classroom-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  width: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

/* Petite bulle paniquée de Kikibu en bas de l'image sans masquer son visage ni le tableau */
.kikibu-homework-bubble {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(255, 251, 235, 0.94);
  color: #1f1300;
  border: 2px solid #2b1810;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 0.90rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Cahier de devoirs placé SOUS l'image (ne couvre jamais Kikibu !) */
.homework-notebook-card {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  background: #fffdf4;
  color: #1d160b;
  border: 3px solid var(--accent-orange);
  border-radius: 14px;
  padding: 8px 10px 9px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.homework-timer-track {
  width: 100%;
  height: 7px;
  background: #e2d9c8;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.homework-timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #06d6a0, #ffd166, #ef476f);
  transition: width 0.08s linear;
}

.homework-question-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.homework-level-tag {
  background: #1d3557;
  color: #ffffff;
  font-size: 0.80rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.homework-equation {
  font-size: 1.42rem;
  font-weight: 700;
  color: #14213d;
  text-align: center;
  letter-spacing: 1px;
  flex: 1;
}

.homework-choices-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.homework-choice-btn {
  background: #ffffff;
  color: #14213d;
  border: 2px solid #1d3557;
  border-bottom-width: 4px;
  border-radius: 10px;
  padding: 8px 4px;
  font-size: 1.05rem;
  font-weight: 700;
  transition: transform 0.1s ease, background-color 0.12s ease;
}

.homework-choice-btn:active {
  transform: translateY(2px);
}

.homework-choice-btn.correct-flash {
  background: #06d6a0;
  border-color: #048c69;
  color: #08291f;
}

.homework-choice-btn.wrong-flash {
  background: #ef476f;
  border-color: #a4133c;
  color: #ffffff;
}

.homework-grade-stamp {
  display: inline-block;
  border: 3px solid #d90429;
  color: #d90429;
  background: rgba(255, 245, 245, 0.96);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 10px;
  transform: rotate(-6deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   JOUR 4 (4/12) — GUITAR HERO ARIANA GRANDE (ari.mp4)
   ========================================================================== */

.gh-wrapper {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.gh-video-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 170px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--accent-orange);
  background: #000000;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}

.gh-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gh-vol-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(12, 8, 20, 0.78);
  border: 1px solid rgba(255, 209, 102, 0.45);
  color: #fff8eb;
  font-size: 0.80rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  pointer-events: none;
}

.gh-highway-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 220px;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid var(--accent-orange);
  background: #0e0818;
  display: flex;
  flex-direction: column;
  touch-action: none;
}

.gh-canvas {
  display: block;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  touch-action: none;
}

.gh-pads-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  background: #160c24;
  border-top: 2px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

.gh-pad-btn {
  height: 52px;
  border-radius: 12px;
  border: 2.5px solid rgba(255, 255, 255, 0.55);
  border-bottom-width: 5px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #140b00;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  touch-action: manipulation;
  transition: transform 0.06s ease, filter 0.06s ease;
}

.gh-pad-btn.lane-0 {
  background: linear-gradient(180deg, #38ef7d 0%, #06d6a0 100%);
  border-color: #b7fce6;
  border-bottom-color: #04805f;
}

.gh-pad-btn.lane-1 {
  background: linear-gradient(180deg, #ff758f 0%, #ef476f 100%);
  border-color: #ffd0da;
  border-bottom-color: #9e1b3b;
  color: #ffffff;
}

.gh-pad-btn.lane-2 {
  background: linear-gradient(180deg, #ffe066 0%, #ffb703 100%);
  border-color: #fff3b0;
  border-bottom-color: #a87000;
}

.gh-pad-btn.lane-3 {
  background: linear-gradient(180deg, #60d3ff 0%, #118ab2 100%);
  border-color: #cceeff;
  border-bottom-color: #08546e;
  color: #ffffff;
}

.gh-pad-btn.pressed,
.gh-pad-btn:active {
  transform: translateY(3px) scale(0.96);
  filter: brightness(1.22);
}

.gh-pad-key {
  font-size: 0.86rem;
  opacity: 0.85;
}

.gh-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 260px;
}

.gh-stat-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.86rem;
}

/* ==========================================================================
   JOUR 21 (21/12) — DUCK HUNT PLEIN ÉCRAN SUR BACKGROUND.PNG (SANS LES CASES)
   ========================================================================== */

#duckhunt-fullscreen {
  position: absolute;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.dh-hud {
  padding: calc(14px + var(--safe-top)) 14px 10px;
  background: rgba(16, 10, 24, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--border-warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 4;
  flex-shrink: 0;
}

.dh-hud-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.dh-counter-pill {
  background: rgba(255, 115, 21, 0.24);
  border: 1.5px solid var(--accent-orange);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.90rem;
  font-weight: 700;
}

.dh-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  touch-action: none;
  overflow: hidden;
}

.dh-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.dh-bottom-hint {
  position: absolute;
  bottom: calc(10px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: #fff8eb;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

.dh-victory-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 7, 20, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 10;
}

.dh-victory-card {
  width: 100%;
  max-width: 340px;
  background: var(--glass-card);
  border: 2.5px solid var(--accent-orange);
  border-radius: 20px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.78);
  animation: slideUp 0.22s ease-out;
}

.copgame-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid var(--accent-orange);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  background: #3aa0ff;
  touch-action: none;
}

.copgame-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.copgame-overlay {
  position: absolute;
  inset: 0;
  background: rgba(16, 9, 24, 0.82);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  z-index: 5;
}

.copgame-overlay-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-shadow: 0 2px 0 #4a1d00;
}

.copgame-overlay-sub {
  font-size: 0.84rem;
  color: var(--text-light);
}

.copgame-hint {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   JOUR 1 (1/12) — CARTE INTERACTIVE FRANCE & CHINE FLOTTANTES + POIs
   ========================================================================== */

.day1-map-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.day1-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.42);
  border: 1.5px solid var(--border-warm);
  border-radius: 12px;
  padding: 7px 11px;
  font-size: 0.88rem;
  font-weight: 700;
}

.day1-progress-pill {
  background: rgba(255, 209, 102, 0.18);
  border: 1px solid rgba(255, 209, 102, 0.5);
  color: var(--accent-gold);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.day1-sky-stage {
  position: relative;
  width: 100%;
  height: 396px;
  border-radius: 16px;
  border: 2.5px solid var(--accent-orange);
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 24%, rgba(114, 239, 221, 0.18) 0%, transparent 48%),
    radial-gradient(circle at 76% 72%, rgba(255, 183, 3, 0.16) 0%, transparent 52%),
    linear-gradient(180deg, #162447 0%, #1f4068 52%, #1b2a4a 100%);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Petits nuages / étoiles pixelisés décoratifs dans le ciel */
.day1-sky-cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  pointer-events: none;
  animation: skyDrift 9s ease-in-out infinite alternate;
}

@keyframes skyDrift {
  from { transform: translateX(-8px); }
  to { transform: translateX(10px); }
}

/* Pont pointillé lumineux reliant la France et la Chine */
.day1-connection-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.day1-connection-line {
  stroke: rgba(255, 209, 102, 0.65);
  stroke-width: 2.5;
  stroke-dasharray: 6 6;
  fill: none;
  animation: dashMarch 1.4s linear infinite;
}

@keyframes dashMarch {
  to { stroke-dashoffset: -12; }
}

/* Conteneurs d'îles flottantes */
.floating-island {
  position: absolute;
  z-index: 2;
  user-select: none;
}

.floating-island.france-island {
  top: 14px;
  left: 14px;
  width: 162px;
  height: 162px;
  animation: floatIslandA 3.4s ease-in-out infinite;
}

.floating-island.chine-island {
  bottom: 16px;
  right: 10px;
  width: 224px;
  height: 224px;
  animation: floatIslandB 4.1s ease-in-out infinite;
}

@keyframes floatIslandA {
  0%, 100% {
    transform: translateY(0px);
    filter: drop-shadow(0 14px 10px rgba(0, 0, 0, 0.48));
  }
  50% {
    transform: translateY(-10px);
    filter: drop-shadow(0 24px 14px rgba(0, 0, 0, 0.32));
  }
}

@keyframes floatIslandB {
  0%, 100% {
    transform: translateY(-8px);
    filter: drop-shadow(0 22px 14px rgba(0, 0, 0, 0.34));
  }
  50% {
    transform: translateY(4px);
    filter: drop-shadow(0 12px 9px rgba(0, 0, 0, 0.5));
  }
}

.island-map-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

.island-tag {
  position: absolute;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(14, 9, 24, 0.82);
  border: 1.5px solid rgba(255, 209, 102, 0.55);
  color: var(--accent-gold);
  font-size: 0.84rem;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
}

.france-island .island-tag {
  top: -12px;
  left: 6px;
}

.chine-island .island-tag {
  bottom: 2px;
  right: 6px;
}

/* Marqueurs POI (map_POI.png) calés au pixel près sur chaque point rouge */
.map-poi-btn {
  position: absolute;
  width: 20px;
  height: 22px;
  padding: 0;
  transform: translate(-50%, -100%);
  z-index: 4;
  background: transparent;
  transition: transform 0.15s ease;
}

.map-poi-img {
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 44px;
  height: 44px;
  /* Dans map_POI.png (32x32), la pointe basse est à x=15.5/32 (48.44%) et y=31.5/32 */
  transform: translateX(-48.44%);
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.75));
  animation: poiBounce 1.6s ease-in-out infinite;
}

.map-poi-btn.visited .map-poi-img {
  animation: none;
  filter: drop-shadow(0 0 4px #ffd166) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.8));
}

.map-poi-btn:hover,
.map-poi-btn:active {
  z-index: 8;
  transform: translate(-50%, -100%) scale(1.22);
}

@keyframes poiBounce {
  0%, 100% { transform: translateX(-48.44%) translateY(0); }
  50% { transform: translateX(-48.44%) translateY(-3px); }
}

/* Visionneuse Photo Polaroid quand on tape sur un POI */
.poi-photo-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(10, 6, 18, 0.86);
  backdrop-filter: blur(4px);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: slideUp 0.16s ease-out;
}

.poi-polaroid-card {
  width: 100%;
  max-width: 320px;
  background: #fff9f0;
  color: #241307;
  border: 3px solid var(--accent-orange);
  border-radius: 16px;
  padding: 10px 10px 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poi-polaroid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.poi-polaroid-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #7f2b00;
}

.poi-polaroid-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
  color: #241307;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poi-photo-frame {
  width: 100%;
  min-height: 210px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

.poi-photo-frame img {
  width: 100%;
  max-height: 245px;
  object-fit: contain;
  display: block;
}

.poi-photo-frame .black-placeholder {
  width: 100%;
  min-height: 210px;
  border-radius: 10px;
}

.poi-polaroid-caption {
  font-size: 0.86rem;
  text-align: center;
  color: #4a2c18;
  font-weight: 600;
}

.poi-polaroid-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
}

.poi-nav-btn {
  flex: 1;
  background: #2b1810;
  color: #fff9f0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.poi-nav-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   ÉCRANS GÉNÉRAUX & CONNEXION (AUTH)
   ========================================================================== */

.screen {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Barres de défilement discrètes et élégantes sur PC comme mobile */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 168, 96, 0.38) transparent;
}

*::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 168, 96, 0.38);
  border-radius: 999px;
}

#auth-screen {
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
}

.auth-card {
  width: 100%;
  max-width: 356px;
  background: var(--glass-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid var(--border-warm);
  border-radius: 24px;
  padding: 22px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.auth-seal-wrap {
  width: 148px;
  height: 178px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease;
  margin-bottom: 6px;
}

.auth-seal-wrap:active {
  transform: scale(0.93) rotate(-4deg);
}

.seal-sprite {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}

.speech-bubble {
  background: #fff9f2;
  color: #2b1810;
  border: 2.5px solid var(--accent-orange);
  border-radius: 16px;
  padding: 10px 13px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

.auth-bubble {
  margin-bottom: 14px;
  width: 100%;
}

.pixel-title {
  font-family: var(--font-pixel);
  font-size: 1.55rem;
  color: var(--accent-gold);
  text-shadow: 0 2px 0 #5d2606;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

#auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

#password-input {
  width: 100%;
  padding: 13px 44px 13px 15px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(12, 7, 18, 0.82);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.2s;
}

#password-input:focus {
  border-color: var(--accent-gold);
}

.icon-ghost-btn {
  position: absolute;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-error {
  color: #ff8fa3;
  background: rgba(239, 71, 111, 0.18);
  border: 1px solid rgba(239, 71, 111, 0.45);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.90rem;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(180deg, #ff8826 0%, #e85800 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.96rem;
  padding: 13px 18px;
  border-radius: 14px;
  border-bottom: 3px solid #9e3800;
  box-shadow: 0 6px 16px rgba(232, 88, 0, 0.38);
  transition: transform 0.12s, filter 0.12s;
}

.primary-btn:active {
  transform: translateY(2px);
  filter: brightness(0.95);
}

.primary-btn:disabled {
  background: #4e4556;
  border-bottom-color: #2f2935;
  box-shadow: none;
  opacity: 0.75;
  cursor: default;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 10px 14px;
  border-radius: 12px;
}

.secondary-btn:active {
  transform: scale(0.97);
}

.full-width {
  width: 100%;
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.shake {
  animation: shakeX 0.36s ease;
}

/* ==========================================================================
   BARRE SUPÉRIEURE (TOP BAR)
   ========================================================================== */

#top-bar {
  padding: calc(10px + var(--safe-top)) 12px 9px;
  background: var(--glass-dark);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--border-warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  z-index: 10;
}

.top-bar-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.app-mini-title {
  font-family: var(--font-pixel);
  font-size: 0.98rem;
  color: var(--accent-gold);
  white-space: nowrap;
}

.mode-badge {
  background: #ffbe0b;
  color: #1f1300;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.date-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.top-pill-btn {
  background: rgba(255, 255, 255, 0.13);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.seal-mini-trigger {
  padding: 4px 7px;
  border-color: rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.14);
}

.top-seal-icon {
  width: 22px;
  height: 24px;
  object-fit: contain;
}

.top-pill-btn.icon-only {
  padding: 6px 8px;
}

.top-pill-btn.danger-pill {
  background: rgba(239, 71, 111, 0.28);
  border-color: rgba(255, 117, 143, 0.65);
  color: #ffd6de;
}

.top-pill-btn:active {
  transform: scale(0.94);
}

/* ==========================================================================
   VUES CENTRALES & GRILLE DU CALENDRIER
   ========================================================================== */

#views-container {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.subview {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}

.case-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background-image: url('../assets/placeholder/case_v2.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, filter 0.18s ease;
}

.case-tile:active {
  transform: scale(0.92);
}

.case-number {
  font-family: var(--font-pixel);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff6e0;
  text-shadow: 2px 2px 0 #260f03;
  line-height: 1;
}

.case-status-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  font-size: 0.90rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
}

.case-reward-dot {
  position: absolute;
  bottom: 7px;
  font-size: 0.86rem;
  background: rgba(20, 8, 2, 0.65);
  color: #ffe6a7;
  padding: 1px 5px;
  border-radius: 5px;
  font-weight: 700;
}

/* Case verrouillée (jour futur en mode TIRAMISU) */
.case-tile.locked {
  filter: grayscale(0.48) brightness(0.72);
}

/* Case du jour prête à être ouverte */
.case-tile.today-ready {
  animation: casePulse 2s ease-in-out infinite;
}

@keyframes casePulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(255, 209, 102, 0.55));
  }
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 11px rgba(255, 209, 102, 0.95));
  }
}

/* Case déjà ouverte */
.case-tile.opened {
  filter: brightness(1.08) saturate(1.1);
}

.case-tile.opened .case-number {
  color: var(--accent-gold);
}

/* ==========================================================================
   SOUS-VUES : LA CHAMBRE & LE MUSÉE
   ========================================================================== */

.subview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--glass-dark);
  border: 1.5px solid var(--border-warm);
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.back-pill-btn {
  background: rgba(255, 255, 255, 0.14);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
}

.subview-title {
  font-family: var(--font-pixel);
  font-size: 1rem;
  color: var(--accent-gold);
}

.subview-counter {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Bannière chasse aux objets (Jour 23) */
.hunt-banner {
  background: linear-gradient(90deg, #6a040f, #9d0208);
  border: 1.5px solid var(--accent-gold);
  border-radius: 12px;
  padding: 8px 11px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
}

.mini-tag-btn {
  background: var(--accent-gold);
  color: #1d1200;
  font-weight: 700;
  font-size: 0.90rem;
  padding: 4px 8px;
  border-radius: 8px;
}

/* Scène de la chambre */
.bedroom-stage-wrap {
  background: rgba(255, 250, 245, 0.94);
  border: 2px solid var(--accent-orange);
  border-radius: 18px;
  padding: 8px;
  margin-bottom: 10px;
  color: #2b1810;
}

.bedroom-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  overflow: hidden;
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bedroom-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 48%;
  image-rendering: pixelated;
  pointer-events: none;
}

.room-overlay-layer {
  position: absolute;
  inset: 0;
}

.placed-room-object {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  z-index: 4;
  transition: box-shadow 0.15s;
}

.placed-room-object:active {
  cursor: grabbing;
  z-index: 8;
}

.hunt-target-object {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 9;
  cursor: pointer;
  animation: casePulse 1.6s infinite;
}

.stage-hint {
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  color: #5c4033;
  margin-top: 6px;
}

/* Tiroir d'objets de la chambre */
.room-drawer {
  background: var(--glass-card);
  border: 1.5px solid var(--border-warm);
  border-radius: 16px;
  padding: 10px;
}

.drawer-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.90rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.muted-small {
  font-size: 0.90rem;
  color: var(--text-muted);
}

.inventory-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.strip-item-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 6px;
  min-width: 82px;
  flex-shrink: 0;
}

.strip-item-btn.is-placed {
  border-color: var(--accent-gold);
  background: rgba(255, 209, 102, 0.18);
}

.strip-item-label {
  font-size: 0.80rem;
  font-weight: 600;
  text-align: center;
  max-width: 84px;
  line-height: 1.15;
  white-space: normal;
}

/* Scène du musée */
.museum-stage {
  background: var(--glass-card);
  border: 1.5px solid var(--border-warm);
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.museum-backdrop {
  min-height: 150px;
  font-size: 0.95rem;
}

.museum-artworks-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.museum-frame-btn {
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.14s;
}

.museum-frame-btn:active {
  transform: scale(0.96);
}

.museum-frame-btn .black-placeholder {
  min-height: 120px;
  border-color: var(--accent-gold);
}

.museum-controls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.museum-controls button {
  flex: 1;
}

/* ==========================================================================
   LE PHOQUE AU PREMIER PLAN (Devant n'importe quel bouton ou modale quand il parle)
   ========================================================================== */

.seal-foreground {
  position: absolute;
  left: 10px;
  right: 6px;
  bottom: calc(8px + var(--safe-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
  z-index: 120; /* Premier plan absolu : devant bottom-nav (18), modales (40) et toasts (90) */
  will-change: transform, opacity;
  animation: sealPopIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.companion-bubble,
.seal-avatar-btn {
  touch-action: none;
  cursor: grab;
}

.companion-bubble:active,
.seal-avatar-btn:active {
  cursor: grabbing;
}

@keyframes sealPopIn {
  from {
    transform: translateY(26px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.companion-bubble {
  pointer-events: auto;
  cursor: pointer;
  flex: 1;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 12px 13px 10px;
  position: relative;
  border: 3px solid var(--accent-orange);
  border-radius: 14px;
  background: #fff9f0;
  color: #261409;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.88),
    0 0 0 3px rgba(34, 16, 6, 0.92);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bubble-dismiss-hint {
  align-self: flex-end;
  font-size: 0.80rem;
  font-weight: 700;
  color: #c94a00;
  animation: hintBlink 1s steps(2, start) infinite;
}

@keyframes hintBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.seal-avatar-btn {
  pointer-events: auto;
  position: relative;
  width: 142px;
  height: 184px;
  margin-right: -4px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.9));
  transition: transform 0.15s ease;
}

.seal-avatar-btn:active {
  transform: scale(0.92) rotate(4deg);
}

.seal-ball {
  position: absolute;
  top: -18px;
  left: 14px;
  width: 44px;
  height: 44px;
  object-fit: contain;
  animation: ballBounce 0.7s ease-in-out infinite alternate;
}

@keyframes ballBounce {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(-10px) rotate(25deg); }
}

/* ==========================================================================
   BARRE DE NAVIGATION INFÉRIEURE (Calendrier, Inventaire, La Chambre, Musée)
   ========================================================================== */

#bottom-nav {
  padding: 7px 8px calc(7px + var(--safe-bottom));
  background: rgba(16, 10, 24, 0.96);
  border-top: 2px solid var(--border-warm);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 6px;
  flex-shrink: 0;
  z-index: 18;
}

@media (max-width: 520px) {
  #bottom-nav {
    padding-bottom: calc(52px + var(--safe-bottom));
  }
}

.nav-btn {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  border-radius: 12px;
  padding: 5px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.90rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  color: var(--text-light);
  transition: all 0.15s ease;
}

.nav-btn.active {
  background: linear-gradient(180deg, rgba(255, 115, 21, 0.36), rgba(255, 115, 21, 0.18));
  border-color: var(--accent-orange);
  color: var(--accent-gold);
}

.nav-btn.locked {
  background: rgba(0, 0, 0, 0.44);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.25);
  color: #9e92a8;
}

.nav-btn:active {
  transform: scale(0.95);
}

.nav-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.nav-badge {
  position: absolute;
  top: -5px;
  right: -14px;
  min-width: 17px;
  height: 16px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--accent-gold);
  color: #1f1200;
  font-size: 0.86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #5d2606;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ==========================================================================
   MODALES (ACTIVITÉ DU JOUR & INVENTAIRE)
   ========================================================================== */

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 14, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-height: 90%;
  background: #21142b;
  border-top: 2.5px solid var(--accent-orange);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.22s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 14px 16px 12px;
  background: rgba(0, 0, 0, 0.26);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-header-titles {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.day-pill {
  background: var(--accent-orange);
  color: #ffffff;
  font-family: var(--font-pixel);
  font-size: 0.90rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 8px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--accent-gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-body {
  padding: 16px 16px calc(22px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body > * {
  flex-shrink: 0;
}

/* Composants internes des modales de jour */
.day-skeleton-note {
  background: rgba(255, 255, 255, 0.07);
  border-left: 3.5px solid var(--accent-gold);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.42;
}

.day-asset-preview {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: #120b18;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.day-asset-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: #120b18;
}

.day-asset-preview.teckel-appear-card {
  border: 2.5px solid var(--accent-gold);
  cursor: pointer;
  animation: teckelPopIn 0.45s cubic-bezier(0.2, 1.15, 0.4, 1);
}

.day-asset-preview.teckel-appear-card.wiggle {
  animation: teckelWiggle 0.35s ease;
}

@keyframes teckelPopIn {
  0% { transform: scale(0.7) translateY(20px); opacity: 0; }
  65% { transform: scale(1.04) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes teckelWiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-2.5deg) scale(1.03); }
  75% { transform: rotate(2.5deg) scale(1.03); }
}

.asset-caption {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.45);
}

.reward-box {
  background: rgba(46, 196, 182, 0.12);
  border: 1.5px solid rgba(46, 196, 182, 0.45);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reward-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reward-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #80ffdb;
}

.reward-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  font-style: italic;
}

.key-unlock-btn {
  background: linear-gradient(180deg, #ffd166 0%, #f4a261 100%);
  color: #241400;
  font-weight: 700;
  font-size: 0.96rem;
  padding: 13px 16px;
  border-radius: 14px;
  border-bottom: 3px solid #b06d28;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Grille de l'inventaire complet */
.inventory-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inventory-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.inventory-card-details {
  flex: 1;
}

.inventory-card-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent-gold);
}

.inventory-card-meta {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.inventory-card-desc {
  font-size: 0.88rem;
  color: #ffffff;
  margin-top: 4px;
}

/* Mini-contrôles squelette (seaux de peinture, champs voeux, etc.) */
.paint-buckets-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.paint-bucket-stub {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
}

/* ==========================================================================
   TOASTS
   ========================================================================== */

.toast-container {
  position: absolute;
  top: calc(64px + var(--safe-top));
  left: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 50;
}

.toast {
  background: rgba(20, 14, 28, 0.96);
  border: 1.5px solid var(--accent-gold);
  color: #ffffff;
  font-size: 0.90rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.18s ease-out;
}
