/*
 * Guide des assistants : mêmes couleurs que le portail booster (style neutre, sans marque).
 * Mobile d'abord : 320 px sans débordement, cibles tactiles >= 44 px, contrastes >= 4,5:1.
 */

:root {
  --bg: #0e1013;
  --card: #16191f;
  --elev: #1d2129;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f3;
  --muted: #9aa3af;
  --faint: #838b99;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --on-accent: #0e1013;
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.12);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.12);
  --err: #ef4444;
  --err-soft: rgba(239, 68, 68, 0.12);
  --radius: 14px;
  --radius-s: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

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

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

/* ---------- Barre du haut ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(14, 16, 19, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.top-in {
  max-width: 820px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.langs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.langs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-s);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid transparent;
}

.langs a[aria-current="page"] {
  color: var(--text);
  background: var(--elev);
  border-color: var(--border-strong);
}

/* ---------- Mise en page ---------- */

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 16px 96px;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 28px 0 8px;
  letter-spacing: -0.01em;
}

.lead {
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 17px;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
  margin: 48px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

h2 .num {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
  margin-right: 8px;
}

h3 {
  font-size: 18px;
  margin: 28px 0 8px;
}

p {
  margin: 0 0 12px;
}

ul,
ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

li {
  margin: 4px 0;
}

strong {
  font-weight: 650;
}

code,
.kbd {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  overflow-wrap: anywhere;
}

.btn-label {
  display: inline-block;
  font-size: 0.92em;
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid rgba(79, 140, 255, 0.4);
  border-radius: 999px;
  padding: 0 9px;
  white-space: nowrap;
}

/* ---------- Sommaire ---------- */

.toc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin: 0 0 8px;
}

.toc summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.toc ol {
  margin: 0 0 12px;
  padding-left: 24px;
  columns: 2;
  column-gap: 28px;
}

.toc li {
  break-inside: avoid;
  margin: 0;
}

.toc a {
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  padding: 3px 0;
}

.toc a:hover {
  color: var(--accent);
}

/* ---------- Blocs ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.note,
.warn,
.stop,
.good {
  border-radius: var(--radius-s);
  padding: 12px 14px;
  margin: 12px 0;
  border-left: 4px solid;
}

.note > :last-child,
.warn > :last-child,
.stop > :last-child,
.good > :last-child {
  margin-bottom: 0;
}

.note {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.warn {
  background: var(--warn-soft);
  border-color: var(--warn);
}

.stop {
  background: var(--err-soft);
  border-color: var(--err);
}

.good {
  background: var(--ok-soft);
  border-color: var(--ok);
}

.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Message prêt à copier */
.say {
  font-family: var(--font);
  background: var(--elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  margin: 8px 0 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Accès immédiat aux tâches ; les instructions restent lisibles sans JavaScript. */
.quick-start {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0 20px;
}
.quick-start h2 {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
  font-size: 20px;
}
.top-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.brand { grid-column: 1; }
.lang-caption { grid-column: 1; font-size: 12px; color: var(--muted); }
.langs { grid-column: 2; grid-row: 1 / 3; }
.quick-title { font-size: 20px; font-weight: 650; margin-bottom: 8px; }
.quick-rule, .client-mode, .client-meaning, .client-limit, .message-hint { font-size: 14px; color: var(--muted); }
.client-mode { font-size: 16px; color: var(--text); }
.client-meaning { white-space: pre-line; }
.quick-rule { padding-left: 10px; border-left: 2px solid var(--accent); }
.message-grid { display: grid; gap: 10px; }
.message-grid .card { margin: 0; min-width: 0; }
.message-grid .say { border: 0; padding: 0; background: transparent; margin-bottom: 0; }
.message-purpose { font-weight: 650; }
.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.quick-links a, [data-client-select], .copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--elev);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.quick-links a:hover, [data-client-select]:hover, .copy-button:hover {
  border-color: var(--accent);
}
[data-client-picker] { display: none; }
.guide-enhanced [data-client-picker] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}
[data-client-select][aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
[data-copy-text] {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.copy-button { margin-top: 10px; color: var(--accent); }
.copy-button:disabled { opacity: .65; cursor: progress; }
.copy-status { display: block; font-size: 13px; color: var(--muted); }
.copy-status:not(:empty) { margin-top: 6px; }
[hidden] { display: none !important; }
.booster-message { border-left: 3px solid var(--ok); }
.client-templates { margin: 10px 0 18px; }
.client-templates .say { margin-bottom: 8px; }
@media (min-width: 650px) {
  .quick-links { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .message-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 649px) {
  .quick-links a[href="#wechat"] { grid-column: 1 / -1; }
  .brand { display: none; }
  .lang-caption { display: none; }
  .lang-caption, .langs { grid-row: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
.guide-short .lead { font-size: 15px; line-height: 1.5; margin-bottom: 14px; }
.guide-short .quick-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.guide-short h2 { margin-top: 28px; }
.guide-short .steps > li { padding: 0; margin-bottom: 16px; border: 0; background: transparent; }
.guide-short .steps > li::before { display: none; }
.guide-short .short-note { color: var(--muted); font-size: 14px; }
@media (min-width: 650px) {
  .guide-short .quick-links { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.say::before {
  content: attr(data-label);
  display: block;
  font-size: 12px;
  color: var(--faint);
  margin-bottom: 4px;
}

/* Étapes numérotées */
.steps {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 14px 14px 14px 56px;
  margin: 10px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.steps > li > :last-child {
  margin-bottom: 0;
}

.where {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0 8px;
  margin: 0 6px 4px 0;
}

/* Fiches crise */
details.crisis {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 10px 0;
}

details.crisis > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 44px 12px 16px;
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 600;
  position: relative;
}

details.crisis > summary::-webkit-details-marker {
  display: none;
}

details.crisis > summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  color: var(--muted);
  font-size: 22px;
  font-weight: 400;
}

details.crisis[open] > summary::after {
  content: "−";
}

details.crisis > .body {
  padding: 0 16px 14px;
}

details.crisis dl {
  margin: 0;
}

details.crisis dt {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
}

details.crisis dd {
  margin: 2px 0 0;
}

/* Tableaux */
.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--elev);
  font-weight: 650;
  font-size: 13px;
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

td.zh {
  font-size: 16px;
}

/* Liste de règles */
.rules {
  counter-reset: rule;
  list-style: none;
  padding-left: 0;
}

.rules li {
  counter-increment: rule;
  padding-left: 34px;
  position: relative;
  margin: 8px 0;
}

.rules li::before {
  content: counter(rule);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--elev);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li {
  padding-left: 30px;
  position: relative;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 4px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--muted);
  border-radius: 4px;
}

footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  color: var(--faint);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

.top-link {
  position: static;
  margin: 16px 16px 16px auto;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--elev);
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 18px;
}
.guide-enhanced .top-link { position: fixed; margin: 0; }

@media (max-width: 600px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .toc ol {
    columns: 1;
  }

  .steps > li {
    padding-left: 50px;
  }

  .steps > li::before {
    left: 12px;
  }
}

@media print {
  .top,
  .top-link {
    display: none;
  }

  html,
  body {
    background: #fff;
    color: #000;
  }
}
