/* ===== VARIABLES & RESET ===== */
:root {
  --bleu: #3a86ff;
  --vert: #38b000;
  --rouge: #ff4d6d;
  --jaune: #ffbe0b;
  --violet: #8338ec;
  --orange: #fb5607;
  --fond: #f0f7ff;
  --blanc: #ffffff;
  --texte: #1a1a2e;
  --radius: 16px;
  --ombre: 0 4px 20px rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--fond);
  color: var(--texte);
  min-height: 100vh;
}

/* ===== NAVBAR ===== */
nav {
  background: var(--bleu);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  box-shadow: var(--ombre);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--blanc);
  padding: 0.6rem 0.2rem;
  flex: 1;
  white-space: nowrap;
}

nav button {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: var(--blanc);
  padding: 0.45rem 0.9rem;
  min-height: 44px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

nav button:hover,
nav button.active {
  background: var(--blanc);
  color: var(--bleu);
  border-color: var(--blanc);
}
nav button:active:not(.active) {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== SECTIONS ===== */
.section {
  display: none;
  padding: 2rem 1rem 3rem;
  max-width: 960px;
  margin: 0 auto;
}
.section.active {
  display: block;
}

/* ===== ACCUEIL ===== */
.hero {
  text-align: center;
  padding: 3rem 1rem;
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--bleu);
  margin-bottom: 0.5rem;
}
.hero p {
  font-size: 1.15rem;
  color: #555;
  margin-bottom: 2rem;
}

.cards-accueil {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.card-accueil {
  background: var(--blanc);
  border-radius: var(--radius);
  padding: 1.8rem 1rem;
  min-height: 44px;
  box-shadow: var(--ombre);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  border-top: 6px solid var(--bleu);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.card-accueil:nth-child(1) {
  border-color: var(--orange);
}
.card-accueil:nth-child(2) {
  border-color: var(--violet);
}
.card-accueil:nth-child(3) {
  border-color: var(--vert);
}
.card-accueil:nth-child(4) {
  border-color: var(--rouge);
}

@media (hover: hover) and (pointer: fine) {
  .card-accueil:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  }
}
.card-accueil:active {
  transform: scale(0.97);
  box-shadow: var(--ombre);
}
.card-accueil .icon {
  font-size: 3rem;
  margin-bottom: 0.7rem;
}
.card-accueil h2 {
  font-size: 1.1rem;
  color: var(--texte);
}

/* ===== TITRES SECTIONS ===== */
.section-title {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 900;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== CARDS GENERIQUES ===== */
.card {
  background: var(--blanc);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--ombre);
  margin-bottom: 1.5rem;
}
.card h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: var(--bleu);
}

/* ===== QUIZ ===== */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.quiz-opt {
  background: #eef2ff;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  min-height: 44px;
  cursor: pointer;
  font-size: 1rem;
  text-align: left;
  transition:
    background 0.15s,
    border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) {
  .quiz-opt:hover {
    background: #dde8ff;
  }
}
.quiz-opt:active:not(:disabled) {
  background: #dde8ff;
  transform: scale(0.98);
}
.quiz-opt.correct {
  background: #d4edda;
  border-color: var(--vert);
  color: #155724;
}
.quiz-opt.wrong {
  background: #f8d7da;
  border-color: var(--rouge);
  color: #721c24;
}
.quiz-opt:disabled {
  cursor: default;
}

.feedback {
  margin-top: 0.7rem;
  font-weight: 700;
  font-size: 1rem;
  min-height: 1.4rem;
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
}
.feedback.ok {
  color: var(--vert);
}
.feedback.ko {
  color: var(--rouge);
}

.btn {
  background: var(--bleu);
  color: var(--blanc);
  border: none;
  border-radius: 30px;
  padding: 0.6rem 1.4rem;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.8rem;
  transition:
    background 0.2s,
    transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    background: #2563eb;
    transform: scale(1.03);
  }
}
.btn:active {
  transform: scale(0.96);
  opacity: 0.88;
}
.btn.vert {
  background: var(--vert);
}
.btn.rouge {
  background: var(--rouge);
}
.btn.violet {
  background: var(--violet);
}
.btn.orange {
  background: var(--orange);
}

/* ===== ETIQUETTES SQUELETTE ===== */
.skeleton-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.skeleton-svg {
  width: 100%;
  max-width: 340px;
  display: block;
  margin: 0 auto;
}

/* ===== DRAG & DROP OS TYPES ===== */
.dnd-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 500px) {
  .dnd-container {
    grid-template-columns: 1fr;
  }
}

.dnd-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.8rem;
  background: #f5f5f5;
  border-radius: 12px;
  min-height: 60px;
}

.dnd-chip {
  background: var(--jaune);
  border-radius: 20px;
  padding: 0.45rem 0.85rem;
  min-height: 44px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  font-size: 0.95rem;
  border: 2px solid transparent;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: none; /* allow touch drag */
  display: inline-flex;
  align-items: center;
}
.dnd-chip:active {
  cursor: grabbing;
  transform: scale(1.08);
}
/* Visual state when chip is selected by tap (iPad) */
.dnd-chip.touch-picked {
  outline: 3px solid var(--bleu);
  outline-offset: 2px;
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(58, 134, 255, 0.45);
  position: relative;
  z-index: 10;
}

.dnd-zone {
  border: 3px dashed #aac;
  border-radius: 12px;
  min-height: 80px;
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-content: flex-start;
  transition: background 0.2s;
}
.dnd-zone.over {
  background: #e0f0ff;
  border-color: var(--bleu);
}
.dnd-zone h4 {
  width: 100%;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.3rem;
}

.dnd-zone .dnd-chip.placed-correct {
  background: #a8e6cf;
  border-color: var(--vert);
}
.dnd-zone .dnd-chip.placed-wrong {
  background: #ffb3b3;
  border-color: var(--rouge);
}

/* ===== CASES A COCHER ===== */
.check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.check-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.8rem;
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  border: 2px solid transparent;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) {
  .check-list li:hover {
    background: #f0f0ff;
  }
}
.check-list li:active {
  background: #f0f0ff;
}
.check-list li.selected {
  background: #e0f0ff;
  border-color: var(--bleu);
}
.check-list li.correct {
  background: #d4edda;
  border-color: var(--vert);
}
.check-list li.wrong {
  background: #f8d7da;
  border-color: var(--rouge);
}

.check-box {
  width: 24px;
  height: 24px;
  border: 3px solid #aaa;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.check-list li.selected .check-box {
  background: var(--bleu);
  border-color: var(--bleu);
  color: #fff;
}
.check-list li.correct .check-box {
  background: var(--vert);
  border-color: var(--vert);
  color: #fff;
}
.check-list li.wrong .check-box {
  background: var(--rouge);
  border-color: var(--rouge);
  color: #fff;
}

/* ===== ENTOURER ===== */
.entourer-item {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  min-height: 44px;
  line-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  margin: 0.2rem;
  font-size: 1rem;
  border: 3px solid transparent;
  transition:
    border-color 0.2s,
    background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) {
  .entourer-item:hover {
    background: #fff9c4;
  }
}
.entourer-item:active {
  background: #fff9c4;
}
.entourer-item.entoured {
  border-color: var(--orange);
  background: #fff3cd;
}
.entourer-item.entoured.correct {
  border-color: var(--vert);
  background: #d4edda;
}
.entourer-item.entoured.wrong {
  border-color: var(--rouge);
  background: #f8d7da;
}

/* ===== MUSCLE ANIMATION ===== */
.muscle-demo {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.arm-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.arm-container svg {
  cursor: pointer;
}

.arm-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--texte);
}

.arm-state {
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

/* ===== COMPLETER TEXTE ===== */
.complete-text {
  font-size: 1.05rem;
  line-height: 2;
}

.blank-input {
  border: none;
  border-bottom: 3px solid var(--bleu);
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  width: 120px;
  text-align: center;
  outline: none;
  color: var(--bleu);
  font-weight: 700;
  padding: 0 4px;
}
.blank-input.correct {
  border-color: var(--vert);
  color: var(--vert);
}
.blank-input.wrong {
  border-color: var(--rouge);
  color: var(--rouge);
}

/* ===== SCORE / PROGRESS ===== */
.progress-bar-wrap {
  background: #dde;
  border-radius: 30px;
  height: 14px;
  overflow: hidden;
  margin: 0.5rem 0 1rem;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--bleu), var(--violet));
  border-radius: 30px;
  transition: width 0.4s;
}

.score-badge {
  display: inline-block;
  background: var(--jaune);
  color: var(--texte);
  font-weight: 900;
  border-radius: 30px;
  padding: 0.3rem 0.9rem;
  font-size: 1.1rem;
  margin-left: 0.5rem;
}

/* ===== GRAND QUIZ ===== */
.grand-quiz-card {
  background: var(--blanc);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--ombre);
  max-width: 640px;
  margin: 0 auto;
}

.grand-quiz-card .question-num {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.grand-quiz-card .question-text {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
}

.result-screen {
  text-align: center;
  padding: 2rem;
}
.result-screen h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}
.result-screen .trophy {
  font-size: 5rem;
  margin-bottom: 1rem;
}

/* ===== ACCORDION ===== */
.accordion-btn {
  width: 100%;
  background: #eef2ff;
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  min-height: 44px;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  color: var(--texte);
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) {
  .accordion-btn:hover {
    background: #dde8ff;
  }
}
.accordion-btn:active {
  background: #dde8ff;
}
.accordion-btn .arrow {
  transition: transform 0.2s;
}
.accordion-btn.open .arrow {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 0.8rem 1.2rem 1rem;
  background: #f9fbff;
  border-radius: 0 0 12px 12px;
  margin-top: -0.4rem;
  margin-bottom: 0.8rem;
  font-size: 1rem;
  line-height: 1.7;
}
.accordion-content.open {
  display: block;
}

/* ===== ANIMATIONS ===== */
@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}
.pop {
  animation: pop 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fadein {
  animation: fadeIn 0.4s ease both;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  nav .logo {
    font-size: 1.1rem;
  }
  nav button {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
  }
  .dnd-container {
    grid-template-columns: 1fr;
  }
}

/* iPad portrait (768px) — agrandir les cibles tactiles */
@media (min-width: 601px) and (max-width: 900px) {
  nav {
    gap: 0.7rem;
    padding: 0 1.2rem;
  }
  nav button {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
  }
  .section {
    padding: 2rem 1.4rem 3rem;
  }
  .quiz-opt,
  .accordion-btn,
  .check-list li {
    font-size: 1.1rem;
  }
  .dnd-chip {
    font-size: 1.05rem;
    padding: 0.6rem 1.1rem;
  }
}
