:root {
  --bleu: #2563eb;
  --rouge: #dc2626;
  --vert: #16a34a;
  --violet: #9333ea;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #eef2ff, #f4f6fb 40%);
  color: var(--text);
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: var(--muted);
  position: sticky;
  top: 0;
}

.hidden { display: none !important; }

.screen {
  flex: 1;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

h1 { font-size: 1.5rem; margin: 4px 0; }
h2 { font-size: 1.2rem; margin: 4px 0; }

.equation {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.equation.small { font-size: 1rem; padding: 6px 14px; margin-bottom: 4px; }

.subtitle { color: var(--muted); font-size: 0.85rem; margin-top: -4px; }

.rules-box {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: left;
  font-size: 0.92rem;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  width: 100%;
}
.rules-box ul { margin: 6px 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
}
.pill-droite { background: var(--vert); }
.pill-gauche { background: var(--rouge); }
.pill-neutre { background: var(--violet); }

.setup-box {
  width: 100%;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.setup-box label { font-weight: 600; font-size: 0.9rem; text-align: left; }
.setup-box select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
}
#name-fields { display: flex; flex-direction: column; gap: 8px; }
#name-fields input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--bleu);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37,99,235,0.35);
}
.btn-primary:active { transform: translateY(1px); }

/* Écran "passe l'appareil" */
#screen-pass { justify-content: center; gap: 18px; }
.pass-label { color: var(--muted); font-size: 0.95rem; }
.pass-hint { color: var(--muted); font-size: 0.85rem; }

/* Carte condition */
.turn-label { font-weight: 700; margin-top: 6px; }

.card {
  width: 100%;
  min-height: 150px;
  background: var(--panel);
  border-radius: var(--radius);
  border: 3px solid var(--bleu);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.card.small-card { min-height: 100px; padding: 14px; }

.card-category {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
}
.card-text { font-size: 1.1rem; font-weight: 600; line-height: 1.35; }

.card.cat-pression { border-color: var(--bleu); }
.card.cat-pression .card-category { background: var(--bleu); }
.card.cat-temperature { border-color: var(--rouge); }
.card.cat-temperature .card-category { background: var(--rouge); }
.card.cat-concentration { border-color: var(--vert); }
.card.cat-concentration .card-category { background: var(--vert); }
.card.cat-catalyseur { border-color: var(--violet); }
.card.cat-catalyseur .card-category { background: var(--violet); }

.answer-prompt { font-size: 0.9rem; color: var(--muted); margin-top: 8px; }

.answer-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.answer-btn {
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  line-height: 1.3;
}
.answer-droite { background: var(--vert); }
.answer-neutre { background: var(--violet); }
.answer-gauche { background: var(--rouge); }
.answer-btn:active { transform: translateY(1px); }

/* Révélation */
.reveal-answer { font-weight: 800; font-size: 1.05rem; }
.reveal-explication { font-size: 0.92rem; color: var(--muted); line-height: 1.4; }

#reveal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
#reveal-table td, #reveal-table th {
  padding: 10px 12px;
  border-bottom: 1px solid #eef0f4;
  font-size: 0.9rem;
  text-align: left;
}
#reveal-table th { color: var(--muted); font-weight: 600; }
.tag-ok { color: var(--vert); font-weight: 700; }
.tag-ko { color: var(--rouge); font-weight: 700; }

/* Fin de partie */
#podium {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.podium-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  font-weight: 600;
}
.podium-row.first { border: 2px solid #fbbf24; background: #fffbeb; }

@media (min-width: 480px) {
  .answer-buttons { flex-direction: row; }
  .answer-btn { flex: 1; }
}
