:root {
  --bg-main: #0f172a;
  --bg-card: #1e2537;
  --bg-card-alt: #252f43;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #38bdf8;
  --radius-lg: 16px;
  --radius-md: 10px;
  --danger: #ef4444;
  --warning: #eab308;
  --ok: #10b981;
  --border-soft: rgba(148,163,184,0.15);
  --border-mid: rgba(148,163,184,0.3);
}

#espt-app {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
  max-width: 900px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding-bottom: 120px;
}

.espt-header {
  padding: 24px 16px 8px;
}

.app-title {
  font-size: clamp(1.2rem, 1vw + 1rem, 1.6rem);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
  line-height: 1.3;
}

.app-subtitle {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 0 16px;
}

.consent-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  border: 1px solid var(--border-soft);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

#questionnaire {
  padding: 8px 16px 0;
}

.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(148,163,184,0.08);
}

.question-header {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.question-index {
  background: rgba(56,189,248,0.12);
  color: var(--accent);
  font-size: 0.75rem;
  line-height: 1;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-md);
}

.answers-row {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(70px,1fr));
  gap: 8px;
}

/* On cache l'input radio natif, mais il reste focusable/accessible */
.choice-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Le bloc cliquable qu'on stylise */
.choice-card {
  background: var(--bg-card-alt);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border: 1px solid rgba(148,163,184,0.2);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-primary);
  user-select: none;
  display: block;
  box-shadow: 0 0 0 0 rgba(56,189,248,0);
}

/* Texte interne à la carte */
.choice-main {
  font-size:1rem;
  font-weight:600;
  line-height:1.2;
}
.choice-sub {
  font-size:.7rem;
  line-height:1.2;
  opacity:.8;
}

/* ÉTAT SÉLECTIONNÉ = quand le <input> radio est :checked */
.choice-input:checked + .choice-card {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 12px 24px -4px rgba(56,189,248,.5);
}

/* focus clavier */
.choice-input:focus + .choice-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* hint échelle */
.scale-hint {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.2;
  margin-top: 8px;
  font-style: italic;
}

.submit-zone {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(15,23,42,0.95) 0%,
    rgba(15,23,42,0.8) 60%,
    rgba(15,23,42,0) 100%
  );
  padding: 24px 16px 32px;
  border-top: 1px solid rgba(148,163,184,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-primary {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #0f172a;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 260px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 20px 32px -6px rgba(56,189,248,.6);
  transition: all .15s;
}

.btn-primary[disabled]{
  opacity: .4;
  box-shadow: none;
  cursor: not-allowed;
}

.result-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid rgba(148,163,184,0.18);
  margin-top: 24px;
  max-width: 900px;
  width: 100%;
}

.result-title {
  font-size: 1.1rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.badge-score {
  background: rgba(56,189,248,0.12);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}

.score-number {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  margin: 0;
}

.score-meaning {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
  font-weight: 500;
  margin: 8px 0 16px;
}
.score-meaning[data-level="ok"] { color: var(--ok); }
.score-meaning[data-level="warn"] { color: var(--warning); }
.score-meaning[data-level="risk"] { color: var(--danger); }

.explanation-box {
  background: var(--bg-card-alt);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148,163,184,0.18);
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.45;
  margin-bottom: 16px;
}

.urgent-box {
  border-radius: var(--radius-md);
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.4);
  color: var(--danger);
  font-size: 0.8rem;
  line-height: 1.45;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-weight: 500;
}

.legal-box {
  border-radius: var(--radius-md);
  background: rgba(148,163,184,0.07);
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.4;
  padding: 12px 16px;
}

.espt-footer {
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: center;
  padding: 40px 16px 80px;
}

.hidden {
  display: none;
}

@media (min-width: 640px){
  .answers-row {
    grid-template-columns: repeat(5,minmax(70px,1fr));
  }
  .submit-zone {
    padding-left: 24px;
    padding-right: 24px;
  }
}
