/* Base */
:root{
  --bg: #f3f4f6;            /* gris clair */
  --surface: #ffffff;
  --text: #111827;          /* quasi noir */
  --muted: #4b5563;
  --border: rgba(17, 24, 39, .12);

  --primary: #111827;
  --primaryText: #ffffff;

  --ghostBg: transparent;
  --ghostBorder: rgba(17, 24, 39, .22);

  --focus: #2563eb;

  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius: 14px;

  --chipBg: rgba(17, 24, 39, .06);
}

:root[data-theme="dark"]{
  --bg: #0b1220;
  --surface: #111a2e;
  --text: #e5e7eb;
  --muted: #a1a1aa;
  --border: rgba(229, 231, 235, .14);

  --primary: #e5e7eb;
  --primaryText: #0b1220;

  --ghostBorder: rgba(229, 231, 235, .22);

  --shadow: 0 12px 40px rgba(0,0,0,.35);

  --chipBg: rgba(229, 231, 235, .08);
}

/* Système */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg: #0b1220;
    --surface: #111a2e;
    --text: #e5e7eb;
    --muted: #a1a1aa;
    --border: rgba(229, 231, 235, .14);

    --primary: #e5e7eb;
    --primaryText: #0b1220;

    --ghostBorder: rgba(229, 231, 235, .22);

    --shadow: 0 12px 40px rgba(0,0,0,.35);

    --chipBg: rgba(229, 231, 235, .08);
  }
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

/* Accessibilité */
.skip-link{
  position: absolute;
  left: -9999px;
  top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  z-index: 999;
}
.skip-link:focus{
  left: 12px;
  outline: none;
}

:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 10px;
}

a{ color: inherit; }

/* Layout */
.topbar{
  max-width: 980px;
  margin: 18px auto 10px;
  padding: 0 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo{
  width: 70px;
  height: auto;
  border-radius: 90px;
  display: grid;
  place-items: center;
  display: block;
}

.theme{
  display: grid;
  gap: 6px;
  justify-items: end;
}
.theme__label{
  font-size: .85rem;
  color: var(--muted);
}
.theme__select{
  appearance: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

/* Page */
.page{
  max-width: 980px;
  margin: 0 auto 50px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Cards */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card--secondary{
  padding: 16px 18px;
}

.card__title{
  margin: 0 0 12px;
  font-size: 1.1rem;
}
.card__title2{
  margin: 0 0 10px;
  font-size: 1.05rem;
}

/* Form */
.form{
  display: grid;
  gap: 14px;
}

.field{
  display: grid;
  gap: 8px;
}

.field__label{
  font-size: .95rem;
  font-weight: 700;
}

.field__input{
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 12px 12px;
  font-weight: 700;
  font-size: 1rem;
}

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

/* Buttons */
.btn{
  border-radius: 12px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .01em;
}

.btn--primary{
  background: var(--primary);
  color: var(--primaryText);
  border-color: transparent;
}

.btn--ghost{
  background: var(--ghostBg);
  border-color: var(--ghostBorder);
  color: var(--text);
}

/* Error */
.error{
  margin-top: 6px;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .35);
  color: #b91c1c;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
}

/* Résultat */
.result{
  margin-top: 14px;

  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;

  padding-top: 8px;
}

.stat{
  background: var(--chipBg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px;
  text-align: center;
}

.stat__value{
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.stat__label{
  color: var(--muted);
  font-weight: 700;
}

/* Note */
.note{
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .93rem;
}

/* Bullets */
.bullets{
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-weight: 650;
}
.bullets li{ margin: 8px 0; }

/* Responsive */
@media (min-width: 640px){
  .result{
    grid-template-columns: repeat(3, 1fr);
  }
}
