@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/figtree-latin.woff2) format('woff2');
}

:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #151922;
  --surface2: #1f2531;
  --soft: rgba(107, 149, 255, 0.12);
  --text: #eeece6;
  --dim: rgba(238, 236, 230, 0.66);
  --accent: #6b95ff;
  --ink: #0a1020;
  --ok: #4fd18b;
  --danger: #ff7a6b;
  --u: 8px;
  --r-card: 24px;
  --r-field: 14px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }
::selection { background: var(--accent); color: var(--ink); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Figtree, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  caret-color: var(--accent);
}

a { color: var(--accent); font-weight: 600; text-decoration: none; text-underline-offset: 0.18em; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-size: 0.9em; background: var(--surface2); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }

/* En-tête : marque + étapes */
.topbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--u) * 3.5) calc(var(--u) * 6) 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--u) * 3);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 4px; flex: 0 1 780px; padding: 6px; border-radius: 999px; background: var(--surface); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--dim);
  font: 700 14px Figtree, system-ui, sans-serif;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 160ms var(--ease-out);
}
.tabs button:active { transform: scale(0.97); }
.tabs button[aria-current] { background: var(--surface2); color: var(--text); }
.tabs button[data-state='missing'] { color: var(--danger); }
.tab-state { display: none; width: 20px; height: 20px; border-radius: 999px; font-size: 12px; font-weight: 900; align-items: center; justify-content: center; color: var(--ink); }
.tabs button[data-state='done'] .tab-state { display: flex; background: var(--ok); }
.tabs button[data-state='missing'] .tab-state { display: flex; background: var(--danger); }
@media (hover: hover) and (pointer: fine) { .tabs button:hover { color: var(--text); } }
.sub { margin: 8px 0 -6px; font-size: 20px; font-weight: 800; }

/* Carte de l'étape + liste en direct */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--u) * 3.5) calc(var(--u) * 6) calc(var(--u) * 4);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: calc(var(--u) * 3);
  align-items: start;
}
.card { background: var(--surface); border-radius: var(--r-card); }
form.card { padding: 40px 44px; display: flex; flex-direction: column; gap: 22px; min-height: 640px; }
.step { display: flex; flex-direction: column; gap: 22px; }
.step[hidden] { display: none; }

h1 { margin: 0; font-size: 64px; line-height: 0.95; letter-spacing: -0.035em; font-weight: 900; text-wrap: balance; }
h1:focus { outline: none; }
.kicker { margin: 0 0 -12px; font-size: 15px; font-weight: 700; color: var(--accent); }
.lead { margin: -8px 0 0; font-size: 18px; color: var(--dim); max-width: 36em; text-wrap: pretty; }

.field { display: flex; flex-direction: column; gap: var(--u); }
.field label, .choice legend { font-size: 15px; font-weight: 700; }
.opt { font-weight: 500; color: var(--dim); }
.row { display: flex; gap: var(--u); }
.row input { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(var(--u) * 2); }
input[type='text'], input[type='email'], input[type='password'], input[type='url'] {
  width: 100%;
  min-width: 0;
  height: 56px;
  padding: 0 18px;
  border-radius: var(--r-field);
  border: 2px solid transparent;
  background: var(--surface2);
  color: var(--text);
  font: 500 16px Figtree, system-ui, sans-serif;
  transition: border-color 160ms var(--ease-out);
}
input::placeholder { color: rgba(238, 236, 230, 0.4); }
input:focus { outline: none; border-color: var(--accent); }
.form-hint { margin: 0; font-size: 14px; color: var(--dim); }
.form-hint:empty { display: none; }

.choice { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--u); }
.choice legend { padding: 0; margin-bottom: var(--u); }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--surface2);
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.chip:active { transform: scale(0.97); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { background: var(--accent); color: var(--ink); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.unlocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.unlocks div { background: var(--soft); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.unlocks strong { font-size: 18px; font-weight: 800; }
.unlocks span { font-size: 15px; line-height: 1.45; color: var(--dim); }

.howto { background: var(--surface2); border-radius: 16px; padding: 18px 20px; }
.howto strong { font-size: 16px; font-weight: 800; }
.howto ol { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: n; display: flex; flex-direction: column; gap: 10px; }
.howto li { counter-increment: n; position: relative; padding-left: 36px; font-size: 15px; line-height: 1.6; }
.howto li::before {
  content: counter(n);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

details.more summary, .help summary { cursor: pointer; font-weight: 700; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
details.more[open] { display: flex; flex-direction: column; gap: 14px; }
.trackers { display: flex; flex-direction: column; gap: 14px; }

/* Boutons */
.btn {
  min-height: 56px;
  padding: 0 22px;
  border-radius: var(--r-field);
  border: 0;
  background: var(--surface2);
  color: var(--text);
  font: 700 16px Figtree, system-ui, sans-serif;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), opacity 160ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn[hidden] { display: none; }
.btn-primary { background: var(--accent); color: var(--ink); border-radius: 999px; padding: 0 36px; font-weight: 800; font-size: 17px; }
.btn-ghost { background: none; color: var(--dim); padding: 0 8px; }
.btn-big { width: 100%; min-height: 60px; font-size: 18px; }

.nav { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.nav .btn-primary { margin-left: auto; }
.step-error { margin: 0; color: var(--danger); font-weight: 600; }
.step-error:empty { display: none; }

/* Liste « Ce qui sera installé » */
.summary { padding: 28px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.summary h2 { margin: 0; font-size: 16px; font-weight: 800; }
.count { margin: 0; display: flex; align-items: baseline; gap: 10px; }
#count { font-size: 72px; line-height: 0.9; font-weight: 900; letter-spacing: -0.04em; color: var(--accent); font-variant-numeric: tabular-nums; }
.count > span:last-child { font-size: 20px; font-weight: 700; color: var(--dim); }
.bar { height: 8px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
#bar { height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 500ms var(--ease-out); }
.addons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.addons li { display: flex; align-items: center; gap: 10px; min-height: 34px; font-size: 15px; font-weight: 600; }
.addons li span { flex: 1; }
.addons li small { font-size: 13px; font-weight: 700; color: var(--dim); text-align: right; }
.addons li.on svg { color: var(--ok); }
.addons li.off { color: var(--dim); }
.addons li.tmdb small { color: var(--accent); }

/* Journal d'installation */
.install-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.install-log:empty { display: none; }
.install-log li::before { content: '• '; color: var(--dim); }
.install-log li.ok::before { content: '✓ '; color: var(--ok); font-weight: 800; }
.install-log li.ko::before { content: '✗ '; color: var(--danger); font-weight: 800; }
.install-log li.done { font-weight: 700; margin-top: 4px; }
.form-warning { padding: 14px 18px; border-radius: var(--r-field); background: var(--soft); font-size: 15px; line-height: 1.45; }
.form-warning[hidden] { display: none; }
.secret { font-family: ui-monospace, monospace; user-select: all; overflow-wrap: anywhere; }

/* Aide + pied de page */
.help { max-width: 1280px; margin: 0 auto; padding: 0 calc(var(--u) * 6); }
.help h3 { font-size: 16px; margin: 18px 0 4px; }
.help p { margin: 0; max-width: 65ch; color: var(--dim); text-wrap: pretty; }
footer { max-width: 1280px; margin: 0 auto; padding: calc(var(--u) * 4) calc(var(--u) * 6) calc(var(--u) * 5); font-size: 14px; color: var(--dim); }

/* Téléphone : la liste passe sous l'étape, tout s'empile */
@media (max-width: 900px) {
  .topbar, .layout, .help, footer { padding-left: 16px; padding-right: 16px; }
  .tabs { flex-basis: 100%; flex-wrap: wrap; border-radius: 20px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  form.card { padding: 28px 20px; min-height: 0; }
  h1 { font-size: 44px; }
  .grid2, .unlocks { grid-template-columns: minmax(0, 1fr); }
  .tabs button { padding: 0 12px; font-size: 13px; }
}
