/* ============================================================
   Jeu d'orientation — Style kid-friendly
   Couleurs vives, gros boutons, lisibilité maximale
   ============================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --green: #2e7d32;
  --green-light: #4caf50;
  --green-dark: #1b5e20;
  --orange: #ff9800;
  --red: #e53935;
  --blue: #1976d2;
  --yellow: #ffeb3b;
  --gray-bg: #f5f7fa;
  --gray-border: #e0e6ed;
  --text: #1a2733;
  --text-light: #5a6878;
  --white: #ffffff;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-strong: 0 8px 24px rgba(0, 0, 0, 0.15);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #e8f5e9 0%, #fff3e0 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 17px;
}

/* ----------- TOP BAR ----------- */
.topbar {
  background: var(--green);
  color: var(--white);
  padding: 16px 16px 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.logo {
  font-size: 36px;
  line-height: 1;
}

.topbar-titles {
  flex: 1;
}

.topbar-titles h1 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.topbar-titles p {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 2px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  text-decoration: none;
  line-height: 1;
}

.btn-icon:hover, .btn-icon:focus {
  background: rgba(255, 255, 255, 0.35);
}

.btn-icon-link {
  /* a <a> styled like the icon button */
}

.progress-bar {
  background: rgba(255, 255, 255, 0.25);
  height: 10px;
  border-radius: 5px;
  margin-top: 14px;
  overflow: hidden;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.progress-fill {
  background: var(--yellow);
  height: 100%;
  width: 0%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 14px;
  text-align: center;
  margin-top: 6px;
  opacity: 0.95;
}

/* ----------- MAIN ----------- */
.main {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

/* ----------- ÉCRAN D'ACCUEIL ----------- */
.accueil-hero {
  background: var(--white);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.accueil-hero h2 {
  font-size: 22px;
  color: var(--green-dark);
  margin-bottom: 10px;
}

.accueil-hero p {
  color: var(--text-light);
  font-size: 15px;
}

.etapes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.etape-cell {
  aspect-ratio: 1;
  background: var(--white);
  border: 3px solid var(--gray-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-light);
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.etape-cell.validee {
  background: var(--green-light);
  border-color: var(--green-dark);
  color: var(--white);
  transform: scale(1.05);
}

.etape-cell.validee::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 16px;
  font-weight: 900;
}

.etape-cell.pending {
  background: #fff3e0;
  border-color: var(--orange);
  color: var(--orange);
  animation: pulse-pending 1.6s infinite ease-in-out;
}

.etape-cell.pending::after {
  content: "!";
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 18px;
  font-weight: 900;
  color: var(--orange);
}

@keyframes pulse-pending {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.etape-cell-num {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

/* ----------- ÉCRAN D'ÉTAPE ----------- */
.etape-card {
  background: var(--white);
  border-radius: 20px;
  padding: 28px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.etape-badge {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  margin-right: 6px;
}

.etape-matiere {
  display: inline-block;
  background: var(--blue);
  color: var(--white);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.etape-emoji {
  font-size: 72px;
  line-height: 1;
  margin: 10px 0 6px;
}

.etape-titre {
  font-size: 22px;
  color: var(--green-dark);
  margin-bottom: 16px;
}

.etape-question {
  font-size: 18px;
  color: var(--text);
  background: #fff8e1;
  padding: 16px;
  border-radius: 14px;
  border-left: 4px solid var(--orange);
  margin: 16px 0 20px;
  text-align: left;
}

.etape-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 3px solid var(--gray-border);
  border-radius: 14px;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
  margin-bottom: 12px;
  -webkit-appearance: none;
}

.etape-input:focus {
  border-color: var(--green-light);
}

.etape-feedback {
  min-height: 28px;
  font-size: 16px;
  font-weight: 600;
  margin: 8px 0;
}

.etape-feedback.ok {
  color: var(--green-dark);
}

.etape-feedback.ko {
  color: var(--red);
}

.indice-box {
  background: #e3f2fd;
  border-left: 4px solid var(--blue);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  margin: 12px 0;
  text-align: left;
}

.indice-box.hidden {
  display: none;
}

/* ----------- BLOCUS ----------- */
.blocus-block {
  background: repeating-linear-gradient(
    45deg,
    #fff3e0 0,
    #fff3e0 14px,
    #ffe0b2 14px,
    #ffe0b2 28px
  );
  border: 3px dashed var(--orange);
  border-radius: 18px;
  padding: 22px 18px;
  margin: 16px 0;
  text-align: center;
}

.blocus-ok-mini {
  color: var(--green-dark);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 10px;
}

.blocus-emoji {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 4px;
  animation: shake 0.6s ease-in-out infinite alternate;
}

@keyframes shake {
  0% { transform: rotate(-4deg); }
  100% { transform: rotate(4deg); }
}

.blocus-titre {
  color: #e65100;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
}

.blocus-message {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.7);
  padding: 12px;
  border-radius: 10px;
}

.hidden {
  display: none;
}

/* ----------- BOUTONS ----------- */
.btn {
  display: inline-block;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
  width: 100%;
  margin-top: 8px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 0 var(--green-dark);
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--green-dark);
}

.btn-secondary {
  background: var(--gray-bg);
  color: var(--text);
  border: 2px solid var(--gray-border);
}

.btn-orange {
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 4px 0 #e65100;
}

.btn-danger {
  background: var(--red);
  color: var(--white);
}

.btn-link {
  background: transparent;
  color: var(--blue);
  text-decoration: underline;
  padding: 8px;
  font-size: 14px;
  margin-top: 4px;
}

/* ----------- ÉCRAN DE VICTOIRE ----------- */
.victoire-card {
  background: linear-gradient(135deg, #fff9c4 0%, #ffe082 100%);
  border-radius: 24px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-strong);
  animation: pop 0.5s ease;
}

@keyframes pop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.victoire-emoji {
  font-size: 96px;
  line-height: 1;
  margin-bottom: 12px;
  animation: bounce 1s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.victoire-titre {
  font-size: 24px;
  color: var(--green-dark);
  margin-bottom: 12px;
  font-weight: 900;
}

.victoire-texte {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 20px;
}

/* ----------- MODAL ----------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--white);
  border-radius: 20px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.modal-content h2 {
  color: var(--green-dark);
  margin-bottom: 12px;
}

.modal-content p {
  color: var(--text-light);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  margin-top: 0;
}

/* ----------- CONFETTIS ----------- */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: fall linear forwards;
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0.7;
  }
}

/* ----------- FOOTER ----------- */
.footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-light);
}

.footer-credit {
  margin-top: 6px;
  font-weight: 600;
  color: var(--green-dark);
}

.footer-soutien {
  margin-top: 8px;
}

.footer-soutien a {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 0 #e65100;
  transition: transform 0.1s;
}

.footer-soutien a:hover,
.footer-soutien a:focus {
  transform: translateY(-1px);
}

.footer-soutien a:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #e65100;
}

.footer-reset {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px dashed var(--gray-border);
}

.footer-reset button {
  background: transparent;
  border: 1px solid var(--gray-border);
  color: var(--text-light);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.footer-reset button:hover,
.footer-reset button:focus {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* ----------- RESPONSIVE ----------- */
@media (min-width: 500px) {
  body { font-size: 18px; }
  .topbar-titles h1 { font-size: 20px; }
  .etape-titre { font-size: 26px; }
  .etape-question { font-size: 19px; }
}
