/* ─── Reset & base ─────────────────────────────────────────────────────────── */

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

:root {
  --accent:    #2563eb;
  --accent-dk: #1d4ed8;
  --bg:        #ffffff;
  --surface:   #f8fafc;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --muted:     #64748b;
  --radius:    12px;
  --cat-I:     #16a34a;
  --cat-II:    #ca8a04;
  --cat-III:   #ea580c;
  --cat-IV:    #dc2626;
  --cat-art:   #6366f1;
  --cat-hors:  #64748b;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Layout ───────────────────────────────────────────────────────────────── */

.app-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 32px;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */

.app-header {
  padding: 24px 0 16px;
  text-align: center;
}

.app-header h1 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.app-header p {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ─── Progress ─────────────────────────────────────────────────────────────── */

.progress-wrap {
  margin-bottom: 28px;
}

.progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
  text-align: right;
}

/* ─── Step ─────────────────────────────────────────────────────────────────── */

.step {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.question {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 16px;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.param-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.help-text--sm {
  font-size: 0.75rem;
  margin-bottom: 0;
}

.help-text {
  font-size: 0.8125rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-choice {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-choice:active,
.btn-choice.active {
  border-color: var(--accent);
  background: #eff6ff;
  color: var(--accent-dk);
}

.btn-primary {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active { background: var(--accent-dk); }

.btn-back {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.9375rem;
  cursor: pointer;
  margin-top: 12px;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Input numérique ──────────────────────────────────────────────────────── */

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.number-input {
  flex: 1;
  min-height: 52px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.125rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.number-input:focus { border-color: var(--accent); }
.number-input.error { border-color: #dc2626; }

.unit {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  min-width: 32px;
}

/* ─── Résultat ─────────────────────────────────────────────────────────────── */

.result {
  animation: fadeIn 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-category {
  font-size: 2rem;
  font-weight: 800;
  padding: 24px 20px;
  border-radius: var(--radius);
  text-align: center;
  color: #fff;
  letter-spacing: -0.02em;
}

.cat-I    { background: var(--cat-I); }
.cat-II   { background: var(--cat-II); }
.cat-III  { background: var(--cat-III); }
.cat-IV   { background: var(--cat-IV); }
.cat-Art43, .cat-Art4§3 { background: var(--cat-art); }
.cat-HorsDESP { background: var(--cat-hors); }

.result-desc {
  font-size: 0.9375rem;
  color: var(--muted);
  text-align: center;
}

.result-note {
  font-size: 0.875rem;
  color: #ea580c;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.result-table {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.result-mod-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.result-modules {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-modules li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.btn-reset { margin-top: 8px; }

.error-msg {
  color: #dc2626;
  font-size: 0.9375rem;
  text-align: center;
  padding: 24px;
}
