/* Styles de la page d'accueil et de la télécommande. */
:root {
  --bg: #0f1117;
  --panel: #1a1d27;
  --panel-2: #232735;
  --line: #2e3344;
  --fg: #f3f4f8;
  --muted: #a3a9bb;
  --pink: #ff4fa3;
  --teal: #37e0d0;
  --ok: #3ddc97;
  --bad: #ff7a7a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--teal); }

h1, h2, h3, p { margin: 0; }

.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.hint {
  font-size: 14px;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--pink), #ff8a5c);
  color: #14060d;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn:disabled { opacity: 0.5; cursor: default; }

.btn.ghost {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--fg);
}

.btn.danger {
  border: 1px solid rgba(255, 122, 122, 0.5);
  background: transparent;
  color: var(--bad);
}

.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }

input[type="text"], input[type="number"], select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ---------- accueil ---------- */

.hero { padding-top: 40px; }

.logo {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
}

.hero h1 {
  margin-top: 12px;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.15;
}

.hero .lead {
  margin-top: 12px;
  font-size: 18px;
  color: var(--muted);
}

.steps {
  margin: 24px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 12px 14px 12px 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--teal);
  font-weight: 800;
  text-align: center;
  line-height: 26px;
}

.result { display: grid; gap: 16px; margin-top: 8px; }

.result h2 { font-size: 18px; }

.link-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.link-row input { min-width: 0; flex: 1; font-size: 14px; }

.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.result .hint { margin-top: 8px; }

.qr-box {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.qr-box canvas {
  flex: none;
  width: 132px;
  height: 132px;
  border-radius: 8px;
  background: #fff;
}

.preview {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(140deg, #16233f 0%, #4a2a5c 50%, #c9785a 100%);
}

.preview iframe {
  display: block;
  width: 100%;
  height: 340px;
  border: 0;
  background: transparent;
  /* Même schéma de couleurs que la page intégrée, sinon le navigateur lui donne un fond opaque. */
  color-scheme: normal;
}

.error { color: var(--bad); margin-top: 10px; }

.foot {
  margin-top: 28px;
  padding-bottom: 32px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- télécommande ---------- */

.remote { padding-bottom: env(safe-area-inset-bottom); }

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 23, 0.94);
}

.brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
}

.status { font-size: 13px; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }

.top-pct {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.top-pct small { font-size: 16px; color: var(--muted); }

.list { display: grid; gap: 10px; }

.cat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.cat-info { flex: 1; min-width: 0; }

.cat-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-count {
  font-size: 15px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cat.full .cat-count { color: var(--ok); }

.step {
  flex: none;
  width: 60px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--fg);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.step.plus {
  border: 0;
  background: linear-gradient(135deg, var(--pink), #ff8a5c);
  color: #14060d;
}

.step:active { transform: scale(0.94); }
.step:disabled { opacity: 0.35; cursor: default; transform: none; }

.settings { margin-top: 16px; }

.settings summary {
  min-height: 28px;
  font-weight: 700;
  cursor: pointer;
}

.settings h2 { margin-top: 18px; font-size: 16px; }

.field { display: grid; gap: 6px; margin-top: 14px; }
.field span { font-size: 14px; color: var(--muted); }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 10px;
}

.check input { width: 22px; height: 22px; accent-color: var(--pink); }

.edit { display: grid; gap: 8px; margin: 12px 0; }

.edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 44px;
  gap: 8px;
}

.icon {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--bad);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.settings .btn { width: 100%; margin-top: 10px; }

#fatal .panel { display: grid; gap: 14px; margin-top: 16px; }
