/* --- Style général --- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #ffe6eb 0%, #fff0f3 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
}

.music-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: #ffffff;
  border: 1px solid #ffccd5;
  color: #d65a7f;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.main-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 1200px;
}

.card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 450px;
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  padding: 12px 15px;
  box-sizing: border-box;
  z-index: 2;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 4px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.card-counter {
  color: #b57285;
  font-size: 0.9rem;
  font-weight: 600;
}

.cash-counter {
  color: #2b9348;
  font-size: 0.9rem;
  font-weight: 700;
  background-color: #ffffff;
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid #c8e6c9;
  box-shadow: 0 2px 6px rgba(43, 147, 72, 0.15);
  transition: transform 0.2s ease, background-color 0.2s ease;
  user-select: none;
}

.cash-counter.cash-gain {
  transform: scale(1.15);
  background-color: #e8f5e9;
}

.card {
  background-color: #ffffff;
  border: 2px solid #ffccd5;
  border-radius: 24px;
  padding: 22px 20px;
  width: 100%;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  box-shadow: 0 12px 30px rgba(255, 182, 193, 0.45);
  color: #5c3d46;
  font-size: 0.85rem;
  line-height: 1.5;
  transition:
    opacity 0.4s ease-in-out,
    transform 0.4s ease-in-out;
}

.card-title {
  font-family: "Georgia", serif;
  font-size: 0.85rem;
  color: #c26d85;
  margin-bottom: 15px;
  text-transform: uppercase;
  flex-shrink: 0;
}

#message-text {
  margin: 0;
  width: 100%;
}

/* --- MINI-JEU PENDU --- */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.game-instruction {
  font-size: 0.95rem;
  color: #5c3d46;
  margin: 0 0 5px 0;
}

.hangman-word {
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 6px;
  color: #d65a7f;
  margin: 10px 0;
  min-height: 40px;
}

.hangman-keyboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 320px;
}

.letter-btn {
  background-color: #fff0f3;
  border: 1px solid #ffccd5;
  color: #d65a7f;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 8px 10px;
  min-width: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.letter-btn:hover:not(:disabled) {
  background-color: #ffccd5;
  color: white;
}

.letter-btn:disabled {
  background-color: #f0f0f0;
  border-color: #e0e0e0;
  color: #ccc;
  cursor: not-allowed;
}

.game-status {
  font-size: 0.9rem;
  font-weight: bold;
  color: #2b9348;
  margin-top: 5px;
  min-height: 20px;
}

/* --- GRILLE MORPION (TIC TAC TOE) --- */
.tictactoe-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 200px;
  margin-top: 15px;
}

.ttt-cell {
  width: 60px;
  height: 60px;
  background-color: #fff0f3;
  border: 2px solid #ffccd5;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.ttt-cell:hover {
  background-color: #ffe6eb;
}

/* Couleurs des pions */
.ttt-cell[data-symbol="X"] {
  color: #ff4d4d;
} /* Rouge pour Mimi */
.ttt-cell[data-symbol="O"] {
  color: #000000;
} /* Noir pour l'ordi */

/* --- VIDEO YOUTUBE --- */
.surah-video-container {
  width: 100%;
  margin-top: 10px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #ffccd5;
}

.surah-video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* --- OPTIONS JEUX --- */
.surah-game-area {
  width: 100%;
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.surah-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.surah-btn {
  background-color: #ffffff;
  border: 1px solid #ffccd5;
  color: #d65a7f;
  padding: 10px 5px;
  border-radius: 15px;
  font-weight: bold;
  cursor: pointer;
}

.surah-error-msg {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 20px;
}

/* --- IMAGES DE CARTE (SIDE IMAGES DANS LA CARTE) --- */
.side-images-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 24px;
}

.side-img {
  width: 48%;
  max-width: 160px;
  max-height: 96px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #ffccd5;
  cursor: zoom-in;
  background-color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.side-img:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 15px rgba(214, 90, 127, 0.25);
}

/* --- BOUTONS NAVIGATION --- */
.buttons {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
}

button:not(.letter-btn):not(.surah-btn):not(.music-btn):not(.ttt-cell) {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 30px;
  font-weight: bold;
  cursor: pointer;
}

#btn-next {
  background-color: #ffb3c1;
  color: white;
}

#btn-back {
  background-color: white;
  color: #ff8fa3;
  border: 1px solid #ffccd5;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

button:disabled,
.letter-btn:disabled,
.surah-btn:disabled,
.ttt-cell.disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

.surah-btn:disabled {
  background-color: #f8f9fa;
  border-color: #e0e0e0;
  color: #a0a0a0;
  box-shadow: none;
}

.ttt-cell.disabled,
.ttt-cell[data-symbol] {
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

.hidden {
  display: none !important;
}

/* --- ANIMATIONS SWIPE CARTE --- */
@keyframes swipeUpOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-90px);
  }
}

@keyframes swipeUpIn {
  0% {
    opacity: 0;
    transform: translateY(60px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes swipeDownOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(90px);
  }
}

@keyframes swipeDownIn {
  0% {
    opacity: 0;
    transform: translateY(-60px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.card.swipe-up-out {
  animation: swipeUpOut 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.swipe-up-in {
  animation: swipeUpIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.swipe-down-out {
  animation: swipeDownOut 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.swipe-down-in {
  animation: swipeDownIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --- MODAL IMAGE PREVIEW --- */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.82);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(6px);
  animation: modalFadeIn 0.3s ease;
}

.modal-content {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain;
  border: 3px solid #ffccd5;
  background-color: #ffffff;
  animation: modalZoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 25px;
  color: #ffffff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
  z-index: 1001;
  user-select: none;
}

.close-modal:hover {
  color: #ffccd5;
  transform: scale(1.1);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalZoomIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* --- TIERLIST MINI-JEU --- */
.tierlist-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.tierlist-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.tier-row {
  display: flex;
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.tier-label {
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: #5c3d46;
  flex-shrink: 0;
  user-select: none;
  border-right: 2px solid rgba(255, 255, 255, 0.6);
}

.tier-s { background-color: #FFE6EB; }
.tier-a { background-color: #FFD5DE; }
.tier-b { background-color: #FEC3D1; }
.tier-c { background-color: #FEB2C4; }
.tier-d { background-color: #FDA0B6; }

.tier-dropzone {
  flex: 1;
  background-color: #fffafb;
  border: 1px dashed #ffccd5;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  padding: 4px;
  min-height: 48px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tier-dropzone.drag-over {
  background-color: #ffe6eb;
  border-color: #d65a7f;
}

.tierlist-pool-title {
  font-size: 0.8rem;
  font-weight: bold;
  color: #b57285;
  margin-top: 4px;
}

.tierlist-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-content: flex-start;
  padding: 8px;
  background-color: #fff0f3;
  border: 2px dashed #ffccd5;
  border-radius: 12px;
  min-height: 60px;
  max-height: 150px;
  overflow-y: auto;
  transition: background-color 0.2s ease;
}

.tierlist-pool.drag-over {
  background-color: #ffe6eb;
}

.tier-img {
  width: 72px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #ffccd5;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
}

.tier-img:hover {
  transform: scale(1.06);
}

.tier-img.dragging {
  opacity: 0.35;
}

.tier-img.selected {
  border-color: #d65a7f !important;
  box-shadow: 0 0 10px rgba(214, 90, 127, 0.75);
  transform: scale(1.1);
}

/* --- MINI-JEU SLIDERS TAILLE --- */
.sliders-game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 5px;
}

.sliders-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 65px;
  height: 180px;
  margin: 30px 0 10px 0;
  width: 100%;
}

.slider-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.slider-tooltip {
  position: absolute;
  top: -32px;
  background-color: #d65a7f;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(214, 90, 127, 0.35);
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  transition: top 0.05s ease-out;
}

.slider-tooltip::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px 4px 0 4px;
  border-style: solid;
  border-color: #d65a7f transparent transparent transparent;
}

.vertical-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 160px;
  background: linear-gradient(to top, #ffe6eb 0%, #ffb3c1 100%);
  border-radius: 10px;
  outline: none;
  writing-mode: vertical-lr;
  direction: rtl;
  cursor: pointer;
  border: 1px solid #ffccd5;
}

.vertical-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #d65a7f;
  box-shadow: 0 4px 8px rgba(214, 90, 127, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.vertical-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #fff0f3;
}

.vertical-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #d65a7f;
  box-shadow: 0 4px 8px rgba(214, 90, 127, 0.3);
  cursor: pointer;
}

.sliders-status-msg {
  font-size: 0.8rem;
  font-weight: bold;
  color: #2b9348;
  margin-top: 6px;
  min-height: 26px;
  animation: modalFadeIn 0.3s ease;
}

/* --- REWARD TOAST POPUP --- */
.reward-toast-popup {
  position: fixed;
  top: 70px;
  right: 20px;
  background: linear-gradient(135deg, #2b9348, #55a630);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 24px;
  font-weight: bold;
  font-size: 0.8rem;
  box-shadow: 0 6px 20px rgba(43, 147, 72, 0.4);
  z-index: 999;
  animation: rewardPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.reward-toast-popup.fade-out {
  opacity: 0;
  transform: translateY(-20px) scale(0.9);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

@keyframes rewardPop {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(25px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- MINI-JEU BOUTIQUE / CADEAUX --- */
.shop-game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 5px;
}

.shop-cash-display {
  font-size: 1rem;
  font-weight: 700;
  color: #5c3d46;
  background-color: #fff0f3;
  border: 2px dashed #ffb3c1;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(214, 90, 127, 0.15);
}

.shop-cash-display span {
  color: #2b9348;
  font-size: 1.2rem;
  font-weight: 800;
}

.shop-instruction {
  font-size: 0.9rem;
  color: #5c3d46;
  font-weight: 500;
}

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  margin: 10px 0;
}

.shop-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #ffffff, #fff0f3);
  border: 2px solid #ffccd5;
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #5c3d46;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
  text-align: left;
  width: 100%;
}

.shop-btn:hover:not(:disabled) {
  transform: translateX(4px);
  border-color: #d65a7f;
  box-shadow: 0 4px 14px rgba(214, 90, 127, 0.25);
  background: #ffffff;
}

.shop-btn.bought {
  background: linear-gradient(135deg, #2b9348, #55a630) !important;
  color: #ffffff !important;
  border-color: #2b9348 !important;
  box-shadow: 0 4px 14px rgba(43, 147, 72, 0.35) !important;
}

.shop-btn:disabled:not(.bought) {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-item-img {
  width: 64px;
  height: 64px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.shop-item-name {
  flex-grow: 1;
  font-size: 0.95rem;
  font-weight: 600;
}

.shop-status-msg {
  font-size: 0.95rem;
  font-weight: bold;
  color: #2b9348;
  min-height: 24px;
  animation: modalFadeIn 0.3s ease;
}

/* --- ADAPTATION MOBILE --- */
@media (max-width: 768px) {
  .main-wrapper {
    flex-direction: column;
  }
}
