/* Human Code Source — trois ambiances : bloc, neon, tactique */
:root, [data-theme="bloc"] {
  --bg: #14161F; --surface: #1B1E2B; --surface2: #1E2130; --line: #2A2E40; --line2: #3A3F55;
  --text: #F2F3F7; --muted: #B8BDCF; --faint: #A9AEC2;
  --accent: #7FD04F; --accent-ink: #10200A; --accent-soft: #22351A; --accent-txt: #9ADF74;
  --accent2: #2DE2E6; --accent2-txt: #7FEFF1; --accent3: #FF9A1F; --accent3-txt: #FFC27A;
  --danger: #E05252; --danger-txt: #FF9C9C; --danger-soft: #3D1A1A;
  --radius: 6px; --pill: 6px;
  --display: 'Silkscreen', ui-monospace, monospace;
  --body: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
[data-theme="neon"] {
  --bg: #0E0B1F; --surface: #19142E; --surface2: #1F1838; --line: #2E2650; --line2: #4A3F7A;
  --text: #FFFFFF; --muted: #B9B3D6; --faint: #A9A2CC;
  --accent: #2DE2E6; --accent-ink: #0E0B1F; --accent-soft: #123A3C; --accent-txt: #7FEFF1;
  --accent2: #FF3EA5; --accent2-txt: #FF8CC6; --accent3: #C6FF3D; --accent3-txt: #D9FF80;
  --radius: 14px; --pill: 999px;
  --display: 'Orbitron', system-ui, sans-serif;
}
[data-theme="tactique"] {
  --bg: #23271B; --surface: #2E3324; --surface2: #343A29; --line: #4A5139; --line2: #6B7254;
  --text: #F1EBDD; --muted: #C9C2AE; --faint: #B5AE98;
  --accent: #FF8A00; --accent-ink: #1E2117; --accent-soft: #3D2A10; --accent-txt: #FFB25C;
  --accent2: #C9B98F; --accent2-txt: #E4D7B4; --accent3: #B7C77A; --accent3-txt: #D3E09F;
  --radius: 2px; --pill: 2px;
  --display: 'Saira Stencil One', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.5; }
a { color: var(--accent2-txt); }
a:hover { color: var(--text); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-family: var(--display); font-size: 12px; letter-spacing: 1px; color: var(--accent-txt); text-transform: uppercase; }
[data-theme="neon"] .label { letter-spacing: 2px; font-weight: 600; }
[data-theme="tactique"] .label { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Barre du haut */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; max-width: 1180px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; }
.brand-h { font-family: var(--display); font-size: 10px; letter-spacing: 4px; color: var(--accent-txt); }
.brand-n { font-family: var(--display); font-size: 17px; }
.brand-s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 140px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 0 20px 80px; }

/* Cartes, boutons, formulaires */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line2); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--danger-txt); border: 1px solid var(--danger); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  min-height: 48px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line2); background: var(--bg); color: var(--text); font-size: 16px; width: 100%;
}
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.flash { padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent); }
.flash-error { background: var(--danger-soft); border-color: var(--danger); }
.credits { font-size: 12px; color: var(--faint); text-align: center; padding: 24px 16px; }

/* Accueil ado */
.hero h1 { font-size: clamp(28px, 6vw, 46px); }
.hero p { font-size: 17px; color: var(--muted); max-width: 640px; }
.slot { border: 2px solid var(--accent); }
.blocks { display: grid; grid-template-columns: repeat(25, minmax(0, 1fr)); gap: 3px; }
.blocks span { height: 14px; background: var(--line); }
[data-theme="neon"] .blocks span { border-radius: 7px; }
.blocks span.on1 { background: var(--accent); } .blocks span.on2 { background: var(--accent2); } .blocks span.on3 { background: var(--accent3); }
.score { font-family: var(--display); font-size: 26px; }
.score small { color: var(--faint); font-size: 18px; }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: 13px; }
.theme-btn[aria-pressed="true"] { border-color: var(--accent); }
.who li { margin: 6px 0; color: var(--muted); }
.who strong { color: var(--text); }
.lock { display: flex; gap: 10px; align-items: center; }

/* Question */
.q-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.q-head .blocks { grid-template-columns: repeat(5, minmax(0, 1fr)); flex: 1; }
.q-head .blocks span { height: 8px; }
.scene { background: var(--surface); border: 2px solid var(--line2); border-radius: var(--radius); overflow: hidden; }
.scene-top { height: 46px; background: linear-gradient(var(--surface2), var(--surface2)); position: relative; }
.scene-top::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: repeating-linear-gradient(90deg, var(--accent) 0 16px, color-mix(in srgb, var(--accent) 75%, #000) 16px 32px); }
.scene-top span { position: absolute; left: 14px; top: 10px; }
.scene p { padding: 16px; font-size: 17px; line-height: 1.5; }
.q-title { font-size: 22px; margin: 18px 0 12px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; background: var(--surface2); border: 2px solid var(--line); border-radius: var(--radius); text-align: left; cursor: pointer; font-size: 16px; width: 100%; }
.opt .box { flex: none; width: 16px; height: 16px; border: 2px solid var(--faint); }
[data-theme="neon"] .opt .box { border-radius: 50%; }
.opt[aria-pressed="true"], .opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-pressed="true"] .box, .opt[aria-checked="true"] .box { background: var(--accent); border-color: var(--accent); }
.opt .rank { flex: none; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 13px; background: var(--line); }
.opt .rank.set { background: var(--accent); color: var(--accent-ink); }
.scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.scale button { min-height: 48px; border: 2px solid var(--line); background: var(--surface2); border-radius: var(--radius); font-family: var(--display); font-size: 14px; cursor: pointer; padding: 0; }
.scale button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.scale-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.other { margin-top: 8px; }
.q-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }

/* Bandeau ressource (« pub ») */
.pub { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 3px solid var(--accent2); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
.pub-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.pub-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pub-txt strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pub .label { color: var(--accent2-txt); }

/* Chat */
.fab { position: fixed; right: 18px; bottom: 96px; z-index: 25; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent2); color: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.chat { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: none; flex-direction: column; }
.chat.open { display: flex; }
@media (min-width: 760px) { .chat { inset: 24px 24px 24px auto; width: 420px; border: 1px solid var(--line2); border-radius: var(--radius); } }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 10px 12px; border-radius: 12px; font-size: 15px; line-height: 1.5; }
.msg p + p { margin-top: 6px; }
.msg-user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent); }
.msg-bot { align-self: flex-start; background: var(--surface2); }
.msg a.src { display: block; margin-top: 8px; padding: 8px 10px; background: var(--surface); border-left: 4px solid var(--accent2); text-decoration: none; color: var(--text); font-weight: 700; font-size: 14px; }
.chat-form { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.chat-form .row { flex-wrap: nowrap; }
.icon-btn { flex: none; width: 48px; height: 48px; border-radius: var(--radius); border: 0; background: var(--surface2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* Aide */
.help { border: 2px solid var(--danger); background: var(--danger-soft); }
.help a.tel { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.help a.tel strong { font-family: var(--display); font-size: 18px; }

/* Mini-jeu */
.game canvas { width: 100%; max-width: 640px; aspect-ratio: 2 / 1; background: var(--surface2); border: 2px solid var(--line2); border-radius: var(--radius); touch-action: manipulation; display: block; }

/* Rapports (Markdown rendu) */
.report h2 { font-size: 22px; margin: 22px 0 8px; }
.report h3 { font-size: 18px; margin: 18px 0 6px; color: var(--accent-txt); }
.report p, .report li { color: var(--text); line-height: 1.6; }
.report p { margin: 8px 0; }
.report ul { padding-left: 22px; margin: 8px 0; }
.report a.src { color: var(--accent2-txt); }
.banner-test { background: var(--accent3); color: var(--bg); text-align: center; font-weight: 700; padding: 6px; font-size: 14px; }

/* Back-office */
.bo { display: flex; min-height: 100vh; }
.bo-nav { flex: none; width: 250px; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.bo-nav a.tab { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; font-size: 15px; }
.bo-nav a.tab[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.bo-nav .count { font-family: var(--display); font-size: 12px; background: var(--accent); color: var(--accent-ink); padding: 2px 7px; }
.bo-main { flex: 1; min-width: 0; padding: 28px 32px 60px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 860px) {
  .bo { flex-direction: column; }
  .bo-nav { width: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .bo-nav .brand { width: 100%; margin-bottom: 8px; }
  .bo-main { padding: 20px 16px 60px; }
}
.qcard { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.qcard.i2 { border-left-color: var(--accent3); } .qcard.i3 { border-left-color: var(--danger); }
.qcard .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--faint); }
.pips { display: inline-flex; gap: 2px; vertical-align: middle; }
.pips i { width: 10px; height: 10px; background: var(--line2); display: inline-block; }
.pips.p1 i:nth-child(1) { background: var(--accent); }
.pips.p2 i:nth-child(-n+2) { background: var(--accent3); }
.pips.p3 i { background: var(--danger); }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 4px; background: var(--line); color: var(--muted); }
.badge.forte { background: var(--accent-soft); color: var(--accent-txt); }
.badge.moyenne { background: var(--accent-soft); color: var(--accent3-txt); }
.badge.S { background: var(--danger-soft); color: var(--danger-txt); } .badge.V { background: #3D2A10; color: var(--accent3-txt); } .badge.R { background: var(--accent-soft); color: var(--accent-txt); }
.qcard .opts-line { font-size: 13px; color: var(--faint); }
.qcard .why { font-size: 13px; color: var(--muted); }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--muted); font-weight: 500; }
.scroll-x { overflow-x: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi b { font-family: var(--display); font-size: 26px; display: block; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-size: 13px; }

.pw-hint { margin-top: 2px; }
input[aria-invalid="true"]:not(:placeholder-shown) { border-color: var(--danger); }

/* Simulation téléphone (mode bêta) : la page est chargée dans un cadre de 390 × 844 */
.sim { position: fixed; inset: 0; z-index: 100; background: rgba(5,6,10,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px; }
.sim[hidden] { display: none; }
.sim-bar { display: flex; align-items: center; gap: 16px; color: #fff; }
.sim iframe { width: 390px; height: min(844px, calc(100vh - 90px)); border: 10px solid #000; border-radius: 40px; background: var(--bg); box-shadow: 0 0 0 2px #3A3F55, 0 20px 60px rgba(0,0,0,.6); }
