/* Quali'IUT — thème inspiré de la charte du réseau des IUT (bleu nuit #07133A, rouge #E31421, Barlow)
   et des repères d'interface de Netflix / Spotify : fond sombre, rails horizontaux, listes « playlist ». */
:root {
  --font: "Barlow", system-ui, sans-serif;
  --serif: "Barlow Semi Condensed", "Barlow", sans-serif;
  --iut-navy: #07133A; --iut-navy-2: #002349; --iut-red: #E31421; --iut-red-2: #ff3b47; --iut-yellow: #ffb73b;
  --bg: #f4f5f9; --surface: #ffffff; --surface-2: #f7f8fb; --line: #dfe3ec;
  --text: #0b1430; --muted: #5b6480; --accent: #c8101c; --accent-ink: #fff; --accent-soft: #fde8ea; --accent-2: #E31421;
  --radius: 10px;
}
[data-theme="dark"] {
  --bg: #050914; --surface: #0e1428; --surface-2: #0a1022; --line: #1c2542;
  --text: #eef1f8; --muted: #9aa3bd; --accent: #ff4a55; --accent-ink: #fff; --accent-soft: rgba(227, 20, 33, .16); --accent-2: #ffb73b;
  --good: #5fd38a; --good-bg: rgba(95, 211, 138, .12); --warn: #ffc65c; --warn-bg: rgba(255, 183, 59, .13);
  --danger: #ff7a7a; --danger-bg: rgba(255, 90, 90, .13); --info: #8db8ff; --info-bg: rgba(110, 160, 255, .13);
  --neutral: #c8cfe0; --neutral-bg: #1a2240; --muted-bg: #151c36;
}
body { font-size: 15.5px; }
h1 { font-family: var(--serif); font-weight: 800; letter-spacing: -.01em; }

/* ---------- Barre latérale façon Spotify ---------- */
.side { background: #02050d; border-right: 0; padding: 18px 12px; gap: 12px; }
:root:not([data-theme="dark"]) .side { background: var(--iut-navy); color: #fff; }
.side .brand { color: #fff; padding: 6px 8px 10px; }
.side .brand span, .side .brand b { color: #fff; }
.side .brand b { font-family: var(--serif); font-size: 1.35rem; font-weight: 800; letter-spacing: .01em; }
.side .brand small { color: #9aa3bd; }
.qi-nav { display: flex; flex-direction: column; gap: 2px; background: rgba(255,255,255,.04); border-radius: 12px; padding: 8px; }
.qi-nav a { display: flex; align-items: center; gap: 12px; color: #b7bfd6; padding: 9px 10px; border-radius: 8px; font-weight: 600; font-size: .95rem; transition: color .15s, background .15s; }
.qi-nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.06); }
.qi-nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.qi-nav a.is-locked { color: #6b7493; }
.qi-nav a.is-locked:hover { color: #9aa3bd; }
.qi-nav__group { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: #6b7493; margin: 12px 10px 4px; font-weight: 700; }
.qi-nav__n { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: rgba(255,255,255,.08); color: #fff; flex: none; }
.qi-nav a.active .qi-nav__n { background: var(--iut-red); }
.qi-nav__p { margin-left: auto; font-size: .75rem; color: #8790ad; font-variant-numeric: tabular-nums; }
.qi-nav__p.ok { color: #5fd38a; font-weight: 800; }
.qi-switch { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #b7bfd6; font: inherit; font-weight: 600; font-size: .9rem; padding: 8px 10px; cursor: pointer; border-radius: 8px; text-align: left; }
.qi-switch:hover { color: #fff; background: rgba(255,255,255,.05); }
.qi-switch__track { width: 34px; height: 20px; border-radius: 99px; background: #2a3354; position: relative; flex: none; transition: background .2s; }
.qi-switch__track i { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.qi-switch[aria-checked="true"] .qi-switch__track { background: var(--iut-red); }
.qi-switch[aria-checked="true"] .qi-switch__track i { transform: translateX(14px); }
.side .nav { background: rgba(255,255,255,.03); border-radius: 12px; padding: 6px; }
.side .nav a { color: #b7bfd6; }
.side .nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.side .nav__group { color: #6b7493; }
.side .side__note { color: #6b7493; border-top-color: rgba(255,255,255,.08); }
body.mode-simple .side .nav { display: none; }
body.mode-simple .topbar .role { visibility: hidden; }
body.mode-peek .topbar .role { visibility: visible; }

/* ---------- Barre supérieure ---------- */
.topbar { border-bottom: 0; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent), color-mix(in srgb, var(--bg) 0%, transparent)); backdrop-filter: none; }
.topbar .btn--ghost { border-radius: 99px; }
#view { padding-top: 0; }

/* ---------- Boutons ---------- */
.qi-btn { display: inline-flex; align-items: center; gap: 10px; border-radius: 6px; padding: 11px 22px; font: inherit; font-weight: 700; font-size: 1.02rem; border: 0; cursor: pointer; text-decoration: none; transition: transform .12s, background .15s, opacity .15s; }
.qi-btn:hover { text-decoration: none; transform: translateY(-1px); }
.qi-btn--play { background: #fff; color: #050914; }
.qi-btn--play:hover { background: #e6e8ee; }
.qi-btn--ghost { background: rgba(130, 140, 170, .28); color: var(--text); }
.qi-btn--ghost:hover { background: rgba(130, 140, 170, .4); }
.qi-btn--red { background: var(--iut-red); color: #fff; }
.qi-btn--red:hover { background: var(--iut-red-2); }
.qi-btn--sm { padding: 7px 14px; font-size: .9rem; border-radius: 99px; }
:root:not([data-theme="dark"]) .qi-btn--play { background: var(--iut-navy); color: #fff; }

/* ---------- Héros façon Netflix ---------- */
body[data-page="accueil"] main, body[data-page="pas"] main { padding-top: 0; max-width: none; }
body[data-page="accueil"] .topbar, body[data-page="pas"] .topbar { background: transparent; }
body[data-page="accueil"] .topbar .btn--ghost, body[data-page="pas"] .topbar .btn--ghost, body[data-page="accueil"] .topbar .icon-btn, body[data-page="pas"] .topbar .icon-btn { color: #fff; }
.qi-hero { position: relative; margin: -60px -28px 8px; padding-top: 60px; min-height: 440px; display: flex; align-items: flex-end; overflow: hidden; border-radius: 0 0 0 0; isolation: isolate; }
.qi-hero__bg { position: absolute; inset: 0; z-index: -1; background: radial-gradient(1200px 500px at 85% 10%, #1b2c7a 0%, transparent 60%), radial-gradient(700px 420px at 70% 75%, rgba(227, 20, 33, .55) 0%, transparent 60%), linear-gradient(120deg, #050914 30%, #0b1a4a 100%); }
:root:not([data-theme="dark"]) .qi-hero__bg { background: radial-gradient(1200px 500px at 85% 10%, #2a46b8 0%, transparent 60%), radial-gradient(700px 420px at 70% 75%, rgba(227, 20, 33, .7) 0%, transparent 60%), linear-gradient(120deg, #07133A 30%, #10265f 100%); }
.qi-hero__bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 0%, transparent 40%), linear-gradient(to right, rgba(5, 9, 20, .85) 0%, transparent 65%); }
.qi-hero__bg span { position: absolute; border-radius: 22px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); backdrop-filter: blur(2px); transform: rotate(-12deg); }
.qi-hero__bg span:nth-child(1) { width: 260px; height: 150px; right: 8%; top: 18%; animation: qi-float 9s ease-in-out infinite; }
.qi-hero__bg span:nth-child(2) { width: 200px; height: 120px; right: 26%; top: 44%; background: rgba(227, 20, 33, .18); animation: qi-float 11s ease-in-out infinite reverse; }
.qi-hero__bg span:nth-child(3) { width: 150px; height: 90px; right: 4%; top: 58%; animation: qi-float 13s ease-in-out infinite; }
@keyframes qi-float { 50% { transform: rotate(-12deg) translateY(-14px); } }
.qi-hero__content { position: relative; padding: 0 48px 56px; max-width: 760px; color: #fff; }
.qi-hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.02; margin: 10px 0 14px; color: #fff; }
.qi-hero__lede { font-size: 1.12rem; color: #d9deea; max-width: 620px; margin: 0 0 14px; }
.qi-kicker { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: #cfd5e6; margin: 0; }
.qi-q { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--iut-red); color: #fff; font-family: var(--serif); font-weight: 800; letter-spacing: 0; font-size: 1rem; }
.qi-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: .95rem; color: #c9cfdf; margin: 0 0 22px; }
.qi-match { color: #5fd38a; }
.qi-pill { border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 0 6px; font-size: .78rem; }
.qi-hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.qi-hero .qi-btn--ghost { color: #fff; }

/* ---------- Rails ---------- */
.qi-row { margin: 26px 0 8px; }
.qi-row__head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; }
.qi-row__head h2 { font-family: var(--serif); font-size: 1.45rem; font-weight: 800; }
.qi-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 340px); gap: 22px; overflow-x: auto; padding: 8px 4px 22px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.qi-rail > * { scroll-snap-align: start; }

/* Cartes d'étape : grand numéro façon « Top 10 » */
.qi-card { position: relative; display: grid; grid-template-columns: 74px 1fr; align-items: end; }
.qi-card__num { font-family: var(--serif); font-weight: 800; font-size: 9.5rem; line-height: .78; color: var(--bg); -webkit-text-stroke: 3px #59627f; letter-spacing: -.06em; user-select: none; margin-right: -18px; z-index: 0; }
.qi-card__poster { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; min-height: 200px; border-radius: 10px; padding: 16px; color: #fff; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.qi-card__poster:hover { text-decoration: none; transform: scale(1.04); box-shadow: 0 18px 40px rgba(0,0,0,.5); }
.qi-card--eco .qi-card__poster { background: linear-gradient(150deg, #E31421 0%, #8a0c2c 55%, #2a0a2e 100%); }
.qi-card--ref .qi-card__poster { background: linear-gradient(150deg, #2b59ff 0%, #13307a 55%, #07133A 100%); }
.qi-card--c3 .qi-card__poster { background: linear-gradient(150deg, #2a7f8f, #0e3240); }
.qi-card--c4 .qi-card__poster { background: linear-gradient(150deg, #7d5bd6, #2a1a5a); }
.qi-card--c5 .qi-card__poster { background: linear-gradient(150deg, #c77d1a, #4a2a0a); }
.qi-card--c6 .qi-card__poster { background: linear-gradient(150deg, #2f8f5b, #0c3320); }
.qi-card--c7 .qi-card__poster { background: linear-gradient(150deg, #b0336d, #3a0f26); }
.qi-card.is-locked .qi-card__poster { filter: saturate(.35) brightness(.7); }
.qi-card.is-locked:hover .qi-card__poster { filter: saturate(.6) brightness(.85); }
.qi-card__art { width: 54px; height: 54px; opacity: .95; }
.qi-card__art svg { width: 100%; height: 100%; }
.qi-card__body { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
.qi-card__body small { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; opacity: .85; }
.qi-card__body b { font-family: var(--serif); font-size: 1.45rem; line-height: 1.05; }
.qi-card__body em { font-style: normal; opacity: .85; font-size: .95rem; }
.qi-card__bar { display: block; height: 4px; background: rgba(255,255,255,.3); border-radius: 2px; margin-top: 14px; overflow: hidden; }
.qi-card__bar i { display: block; height: 100%; background: #fff; border-radius: 2px; transition: width .4s; }
.qi-card--ref .qi-card__bar i { background: #fff; }
.qi-card__lock { display: inline-flex; gap: 6px; align-items: center; margin-top: 14px; font-size: .85rem; font-weight: 700; opacity: .9; }
.qi-info { position: absolute; z-index: 2; top: 10px; right: 10px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.6); background: rgba(5, 9, 20, .45); color: #fff; cursor: pointer; transition: background .15s, transform .15s; }
.qi-info:hover { background: rgba(5, 9, 20, .8); transform: scale(1.08); }
.qi-info--inline { position: static; display: inline-grid; vertical-align: middle; width: 34px; height: 34px; margin-left: 6px; }

/* Tuiles de concepts façon Spotify */
.qi-rail--tiles { grid-auto-columns: minmax(190px, 210px); }
.qi-tile { text-align: left; border: 0; border-radius: 10px; min-height: 150px; padding: 16px; color: #fff; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; transition: transform .15s; }
.qi-tile:hover { transform: translateY(-3px); }
.qi-tile b { font-family: var(--serif); font-size: 1.3rem; line-height: 1.05; }
.qi-tile span { font-size: .86rem; opacity: .9; line-height: 1.35; }
.qi-tile::after { content: ""; position: absolute; right: -18px; bottom: -18px; width: 80px; height: 80px; border-radius: 14px; background: rgba(255,255,255,.14); transform: rotate(25deg); }
.qi-tile--0 { background: #8d1b3d; } .qi-tile--1 { background: #1e3264; } .qi-tile--2 { background: #e8115b; } .qi-tile--3 { background: #148a08; }
.qi-tile--4 { background: #503750; } .qi-tile--5 { background: #0d73ec; } .qi-tile--6 { background: #e13300; } .qi-tile--7 { background: #477d95; }

.qi-shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.qi-short { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; cursor: pointer; transition: background .15s, border-color .15s; }
.qi-short:hover { background: var(--surface-2); border-color: var(--accent); }
.qi-short b { font-size: 1.02rem; } .qi-short span { color: var(--muted); font-size: .9rem; }

/* ---------- Page d'étape façon playlist ---------- */
.qi-step { position: relative; margin: -60px -28px 0; padding: 110px 40px 28px; display: grid; grid-template-columns: 200px 1fr auto; gap: 28px; align-items: end; color: #fff; }
.qi-step--eco { background: linear-gradient(180deg, #a3101c 0%, #4a0a1c 70%, var(--bg) 100%); }
.qi-step--ref { background: linear-gradient(180deg, #1d43c4 0%, #0c1f5a 70%, var(--bg) 100%); }
.qi-step--c3 { background: linear-gradient(180deg, #1f6a78, var(--bg)); } .qi-step--c4 { background: linear-gradient(180deg, #5d43a8, var(--bg)); }
.qi-step--c5 { background: linear-gradient(180deg, #9a5f12, var(--bg)); } .qi-step--c6 { background: linear-gradient(180deg, #23734a, var(--bg)); } .qi-step--c7 { background: linear-gradient(180deg, #8c2858, var(--bg)); }
.qi-step__cover { width: 200px; height: 200px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,.25); box-shadow: 0 16px 50px rgba(0,0,0,.45); }
.qi-step__cover svg { width: 46%; height: 46%; color: #fff; }
.qi-step h1 { font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; margin: 8px 0 12px; color: #fff; }
.qi-step__lede { color: #e6e9f2; max-width: 680px; font-size: 1.05rem; margin: 0 0 10px; }
.qi-step .qi-meta { margin: 0; }
.qi-step__ring { align-self: center; }
.qi-ring__bg { fill: none; stroke: rgba(255,255,255,.2); stroke-width: 7; }
.qi-ring__fg { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .5s; }
.qi-ring text { fill: #fff; font-weight: 800; font-size: 20px; font-family: var(--serif); }
.qi-step__bar { display: flex; align-items: center; gap: 18px; margin: 20px 0 6px; }
.qi-play { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--iut-red); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 22px rgba(227, 20, 33, .4); transition: transform .12s, background .15s; flex: none; }
.qi-play:hover { transform: scale(1.06); background: var(--iut-red-2); }
.qi-play svg { margin-left: 3px; width: 26px; height: 26px; }
.qi-step__hint { color: var(--muted); font-size: 1rem; }
.qi-step__hint b { color: var(--text); }
.qi-step__bar .qi-btn--sm { margin-left: auto; }

.qi-concepts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 18px; }
.qi-concepts__lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--muted); margin-right: 4px; }
.qi-chip { font: inherit; font-size: .88rem; font-weight: 600; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: help; transition: border-color .15s, background .15s; }
.qi-chip:hover, .qi-chip:focus-visible { border-color: var(--accent-2); background: var(--surface-2); }
.qi-tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: var(--muted-bg); color: var(--muted); cursor: help; white-space: nowrap; }

.qi-tracks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.qi-track { border-bottom: 1px solid var(--line); }
.qi-track__head { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 96px; gap: 16px; align-items: center; padding: 14px 10px; background: none; border: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; border-radius: 6px; transition: background .12s; }
.qi-track__head:hover { background: var(--surface); }
.qi-track__n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.qi-track.is-done .qi-track__n { background: #1ed760; color: #04120a; }
.qi-track.is-open .qi-track__n:not(:has(svg)) { background: var(--iut-red); color: #fff; }
.qi-track__t { display: flex; flex-direction: column; min-width: 0; }
.qi-track__t b { font-size: 1.06rem; }
.qi-track.is-done .qi-track__t b { color: var(--muted); }
.qi-track__t small { color: var(--muted); font-size: .9rem; }
.qi-track__tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.qi-track__state { font-size: .85rem; font-weight: 700; color: var(--muted); text-align: right; }
.qi-track.is-done .qi-track__state { color: #1ed760; }
.qi-track__body { padding: 4px 10px 22px 70px; animation: qi-in .25s ease; }
@keyframes qi-in { from { opacity: 0; transform: translateY(-4px); } }

.qi-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 10px; }
.qi-choice { position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s; }
.qi-choice:hover { border-color: var(--accent); transform: translateY(-2px); }
.qi-choice b { font-size: 1.02rem; } .qi-choice span { font-size: .88rem; color: var(--muted); }
.qi-choice--file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.qi-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.qi-ok { color: var(--good); font-weight: 600; margin: 6px 0; }
.qi-warn { color: var(--warn); background: var(--warn-bg); padding: 10px 12px; border-radius: 8px; margin: 6px 0; }
.qi-counts { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.qi-count { font-size: .85rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--muted-bg); color: var(--muted); }
.qi-count.ok { background: var(--good-bg); color: var(--good); }

.qi-tree, .qi-tree ul { list-style: none; margin: 0; padding: 0; }
.qi-tree ul { padding-left: 22px; border-left: 1px dashed var(--line); margin-left: 10px; }
.qi-tree li { margin: 6px 0; }
.qi-node { display: inline-flex; gap: 10px; align-items: baseline; padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.qi-node small { color: var(--muted); font-size: .78rem; }
.qi-node--0 { border-left: 4px solid var(--iut-red); } .qi-node--1 { border-left: 4px solid #4f8cff; } .qi-node--2 { border-left: 4px solid var(--iut-yellow); }
.qi-tree { max-height: 420px; overflow: auto; padding-right: 6px; }

.qi-roles { display: flex; flex-direction: column; gap: 2px; max-height: 460px; overflow: auto; }
.qi-role { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 8px 10px; border-radius: 8px; }
.qi-role:hover { background: var(--surface); }
.qi-role > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.qi-role small { color: var(--muted); font-size: .82rem; }
.qi-role__chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.qi-toggle { font: inherit; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: all .12s; }
.qi-toggle:hover { border-color: var(--text); color: var(--text); }
.qi-toggle.on { background: #fff; color: #050914; border-color: #fff; }
:root:not([data-theme="dark"]) .qi-toggle.on { background: var(--iut-navy); color: #fff; border-color: var(--iut-navy); }

.qi-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.qi-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.qi-list li span { flex-basis: 100%; } .qi-list li small { color: var(--muted); }
.qi-list--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.qi-list--grid li { flex-direction: column; }
.qi-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; }
.qi-form .w2 { grid-column: span 2; }
.qi-form label, .qi-inline { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.qi-inline { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 10px; }
.qi-inline select { width: auto; max-width: 100%; }
.qi-mods { grid-column: span 3; border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.qi-mods legend { font-size: .84rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; padding: 0; }
.qi-mods label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-weight: 500; }

.qi-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 6px 0; }
.qi-model { position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); border: 2px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface); cursor: pointer; transition: border-color .15s, opacity .15s; opacity: .55; }
.qi-model.on { border-color: #4f8cff; opacity: 1; }
.qi-model small { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; font-weight: 800; color: var(--muted); }
.qi-model span { font-size: .85rem; color: var(--muted); }
.qi-model i { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #4f8cff; color: #fff; }
.qi-model:not(.on) i { background: var(--muted-bg); }
.qi-secs { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow: auto; }
.qi-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
.qi-sec summary { display: flex; gap: 10px; align-items: center; padding: 12px 0; cursor: pointer; list-style: none; }
.qi-sec summary::-webkit-details-marker { display: none; }
.qi-sec summary small { margin-left: auto; color: var(--muted); }
.qi-sec ul { list-style: none; margin: 0 0 12px; padding: 0; }
.qi-sec li { display: grid; grid-template-columns: 60px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.qi-sec li small { display: block; color: var(--muted); font-size: .8rem; }
.qi-rep { font-weight: 800; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.qi-fix { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow: auto; }
.qi-fix__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 280px) auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--surface); border-radius: 8px; }
.qi-fix__row span { display: flex; flex-direction: column; min-width: 0; }
.qi-fix__row small { color: var(--muted); font-size: .78rem; }
.qi-fix__row b { font-weight: 600; font-size: .92rem; }
.qi-fix__row select { grid-column: span 2; }

.qi-badge { display: flex; gap: 16px; align-items: center; padding: 16px 18px; margin: 0 0 18px; border-radius: 12px; background: linear-gradient(100deg, rgba(30, 215, 96, .16), transparent); border: 1px solid rgba(30, 215, 96, .35); animation: qi-in .4s ease; }
.qi-badge__medal { width: 52px; height: 52px; border-radius: 50%; background: #1ed760; color: #04120a; display: grid; place-items: center; flex: none; }
.qi-badge__medal svg { width: 60%; height: 60%; }
.qi-badge b { display: block; font-family: var(--serif); font-size: 1.25rem; }
.qi-badge span { color: var(--muted); }
.qi-soon { text-align: center; padding: 48px 20px; border: 1px dashed var(--line); border-radius: 14px; margin: 10px 0; color: var(--muted); }
.qi-soon svg { width: 34px; height: 34px; }
.qi-soon h2 { color: var(--text); font-family: var(--serif); font-size: 1.5rem; margin: 10px 0 6px; }
.qi-soon .qi-hero__actions { justify-content: center; margin-top: 16px; }
.qi-nextnav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 30px 0 60px; }
.qi-next { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.qi-next:last-child { text-align: right; align-items: flex-end; }
.qi-next:hover { text-decoration: none; border-color: var(--accent); }
.qi-next small { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 700; }
.qi-next b { font-size: 1.05rem; }
.qi-next span { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: .82rem; }
.qi-next.is-locked { opacity: .65; }
.qi-howto { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Infobulle ---------- */
.qi-tooltip { position: fixed; z-index: 80; max-width: 340px; padding: 12px 14px; border-radius: 10px; background: #ffffff; color: #0b1430; box-shadow: 0 16px 40px rgba(0,0,0,.35); font-size: .9rem; line-height: 1.45; pointer-events: none; animation: qi-in .12s ease; }
.qi-tooltip b { display: block; font-size: .98rem; margin-bottom: 2px; }
.qi-tooltip p { margin: 0; color: #36405e; }
.qi-tooltip small { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: .68rem; font-weight: 800; color: #c8101c; }
.qi-tooltip ul { margin: 6px 0 0; padding-left: 16px; color: #36405e; }
.qi-tooltip ul b { display: inline; font-size: inherit; color: #0b1430; }
.qi-tooltip li { margin: 3px 0; }

/* ---------- Célébration ---------- */
.qi-burst { position: fixed; z-index: 90; pointer-events: none; }
.qi-burst i { position: absolute; width: 8px; height: 8px; border-radius: 2px; animation: qi-burst .8s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes qi-burst { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(200deg) scale(.4); opacity: 0; } }

/* ---------- Albert dans la charte ---------- */
.albert-fab { background: var(--iut-red); box-shadow: 0 8px 24px rgba(227, 20, 33, .4); }
[data-theme="dark"] .albert-fab { background: var(--iut-red); }

/* ---------- Petits écrans ---------- */
@media (max-width: 860px) {
  .qi-hero { margin: -60px -14px 8px; min-height: 420px; }
  .qi-hero__content { padding: 0 20px 36px; }
  .qi-step { margin: -60px -14px 0; padding: 90px 18px 22px; grid-template-columns: 1fr; gap: 16px; }
  .qi-step__cover { width: 120px; height: 120px; }
  .qi-step__ring { display: none; }
  .qi-rail { grid-auto-columns: minmax(250px, 80vw); }
  .qi-card { grid-template-columns: 56px 1fr; }
  .qi-card__num { font-size: 7rem; }
  .qi-track__head { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .qi-track__tags { display: none; }
  .qi-track__body { padding: 4px 6px 18px; }
  .qi-form { grid-template-columns: 1fr 1fr; } .qi-form .w2, .qi-mods { grid-column: 1 / -1; }
  .qi-fix__row { grid-template-columns: 1fr; } .qi-fix__row select { grid-column: auto; }
  .qi-role { grid-template-columns: 1fr; } .qi-role__chips { justify-content: flex-start; }
  .qi-nextnav { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .qi-hero__bg span, .qi-burst { animation: none; display: none; } .qi-card__poster, .qi-btn, .qi-tile { transition: none; } }
@media print { .qi-hero, .qi-step__bar, .qi-nav, .qi-switch { display: none !important; } }

body.is-scrolled .topbar, body.is-scrolled[data-page] .topbar { background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); }
body.is-scrolled[data-page="accueil"] .topbar .btn--ghost, body.is-scrolled[data-page="pas"] .topbar .btn--ghost, body.is-scrolled[data-page="accueil"] .topbar .icon-btn, body.is-scrolled[data-page="pas"] .topbar .icon-btn { color: var(--text); }
/* Mode clair : en-têtes d'étape entièrement foncés pour garder le texte lisible */
:root:not([data-theme="dark"]) .qi-step { border-radius: 0 0 18px 18px; margin-bottom: 18px; }
:root:not([data-theme="dark"]) .qi-step--eco { background: linear-gradient(180deg, #b5121f 0%, #5a0b1f 100%); }
:root:not([data-theme="dark"]) .qi-step--ref { background: linear-gradient(180deg, #1d43c4 0%, #0a1b52 100%); }
:root:not([data-theme="dark"]) .qi-step--c3 { background: linear-gradient(180deg, #1f6a78, #0d3a44); }
:root:not([data-theme="dark"]) .qi-step--c4 { background: linear-gradient(180deg, #5d43a8, #2e1f5e); }
:root:not([data-theme="dark"]) .qi-step--c5 { background: linear-gradient(180deg, #9a5f12, #4d2f08); }
:root:not([data-theme="dark"]) .qi-step--c6 { background: linear-gradient(180deg, #23734a, #103b25); }
:root:not([data-theme="dark"]) .qi-step--c7 { background: linear-gradient(180deg, #8c2858, #4a1530); }
:root:not([data-theme="dark"]) body:not(.is-scrolled)[data-page] .topbar .icon-btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
:root:not([data-theme="dark"]) .qi-hero { border-radius: 0 0 22px 22px; margin-bottom: 24px; }
:root:not([data-theme="dark"]) .qi-hero__bg::after { background: linear-gradient(to right, rgba(5, 9, 20, .7) 0%, transparent 65%); }
:root:not([data-theme="dark"]) .qi-hero .qi-btn--play { background: #fff; color: var(--iut-navy); }

/* ---------- Éditeur d'arborescence ---------- */
.qi-hint { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }
.qi-tbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 0 0 10px; }
.qi-tbar__add { display: flex; gap: 8px; flex: 1 1 420px; }
.qi-tbar__add input { flex: 1; min-width: 0; }
.qi-tbar__add select, .qi-tbar__sel select { max-width: 220px; }
.qi-tbar__sel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .9rem; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, #4f8cff 14%, transparent); }
.qi-drop--root { border: 1.5px dashed var(--line); border-radius: 10px; padding: 8px 12px; color: var(--muted); font-size: .85rem; margin: 0 0 8px; transition: background .15s, border-color .15s; }
body.qi-dragging .qi-drop--root { border-color: #4f8cff; color: var(--text); }
.qi-tree--edit { max-height: 70vh; }
.qi-tree--edit .qi-node { display: flex; align-items: center; gap: 10px; cursor: grab; width: max-content; max-width: 100%; transition: background .15s, box-shadow .15s, opacity .15s; }
.qi-tree--edit .qi-node:active { cursor: grabbing; }
.qi-node__txt { display: flex; flex-direction: column; line-height: 1.25; }
.qi-node__chk { margin: 0; accent-color: var(--iut-red); }
.qi-grip { color: var(--muted); display: inline-flex; }
.qi-node__btn { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600; padding: 4px 8px; border-radius: 6px; cursor: pointer; opacity: 0; }
.qi-node:hover .qi-node__btn, .qi-node__btn:focus-visible { opacity: 1; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.qi-node.is-sel { box-shadow: 0 0 0 2px #4f8cff inset; }
.qi-node.is-dragging { opacity: .4; }
.qi-node.is-over, .qi-drop--root.is-over { background: color-mix(in srgb, #4f8cff 22%, var(--surface)); box-shadow: 0 0 0 2px #4f8cff; }
.qi-node.is-bad { box-shadow: 0 0 0 2px var(--iut-red); opacity: .7; cursor: no-drop; }
.qi-empty { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; }
.qi-radio { display: grid; gap: 10px; margin: 12px 0; }
.qi-radio label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.qi-radio label span { display: flex; flex-direction: column; } .qi-radio small { color: var(--muted); }
@media (hover: none) { .qi-node__btn { opacity: 1; } }
@media (max-width: 700px) { .qi-tbar__add { flex-wrap: wrap; } .qi-tbar__add input { flex-basis: 100%; } }
.qi-tbar__add input, .qi-tbar__add select, .qi-tbar__sel select { width: auto; margin: 0; }
.qi-tbar__add .qi-btn, .qi-tbar__sel .qi-btn { width: auto; flex: 0 0 auto; }
.qi-tree--edit .qi-node { width: min(620px, 100%); padding: 7px 10px; }
.qi-tree--edit .qi-node__chk { width: 16px; height: 16px; flex: 0 0 16px; padding: 0; }
.qi-tree--edit .qi-node__txt { flex: 1 1 auto; min-width: 0; }
.qi-tree--edit .qi-node__txt b { font-size: .95rem; }
.qi-tree--edit .qi-node__btn { flex: 0 0 auto; }
.qi-tree--edit li { margin: 4px 0; }

/* ---------- Arborescence v2 : familles, repli, niveaux, opérations ---------- */
.qi-tree--edit .qi-node { border-left: 4px solid var(--cat, var(--line)); gap: 8px; }
.qi-tree--edit .qi-node:focus-visible { outline: 2px solid #4f8cff; outline-offset: 2px; }
.qi-fold { width: 22px; height: 22px; flex: 0 0 22px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; transition: transform .18s, background .15s; }
.qi-fold:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.qi-fold.is-open svg { transform: rotate(90deg); } .qi-fold svg { transition: transform .18s; }
.qi-fold--none { cursor: default; }
.qi-tchip { display: inline-block; padding: 0 6px; border-radius: 4px; font-weight: 700; font-size: .72rem; letter-spacing: .02em; color: var(--cat); background: color-mix(in srgb, var(--cat) 16%, transparent); cursor: help; }
.qi-more { color: var(--text); font-weight: 600; }
.qi-node__ops { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.qi-op { width: 26px; height: 26px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; opacity: 0; }
.qi-node:hover .qi-op, .qi-node:focus-within .qi-op, .qi-node:hover .qi-node__btn, .qi-node:focus-within .qi-node__btn { opacity: 1; }
.qi-op:hover, .qi-op:focus-visible { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); opacity: 1; }
.qi-node.is-before { box-shadow: 0 -3px 0 0 #4f8cff; }
.qi-node.is-after { box-shadow: 0 3px 0 0 #4f8cff; }
.qi-node.is-indent { box-shadow: inset 0 0 0 2px #5fd38a; transform: translateX(14px); }
.qi-node.is-outdent { box-shadow: inset 0 0 0 2px #ffb73b; transform: translateX(-14px); }
.qi-node.is-dragging.is-indent, .qi-node.is-dragging.is-outdent { opacity: .85; }
.qi-tbar--view { justify-content: space-between; font-size: .85rem; color: var(--muted); }
.qi-levels { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qi-lvl { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 3px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.qi-lvl:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.qi-legend { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.qi-legend span { display: inline-flex; align-items: center; gap: 6px; } .qi-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--cat); }
.qi-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.qi-types__cat { border: 1px solid var(--line); border-top: 3px solid var(--cat); border-radius: 10px; padding: 10px 12px; }
.qi-types__cat h4 { margin: 0 0 6px; font-size: .9rem; }
.qi-types__cat dl { margin: 0; display: grid; gap: 6px; } .qi-types__cat dt { font-weight: 700; font-size: .88rem; } .qi-types__cat dd { margin: 0; color: var(--muted); font-size: .8rem; }
@media (hover: none) { .qi-op { opacity: 1; } }
@media (max-width: 700px) { .qi-tree--edit .qi-node { flex-wrap: wrap; } .qi-node__ops { margin-left: 30px; } .qi-legend { display: none; } }
.qi-tbar__btns { display: inline-flex; gap: 8px; }
.qi-guess { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.qi-guess label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.qi-guess label span { display: flex; flex-direction: column; } .qi-guess small { color: var(--muted); }
:root:not([data-theme="dark"]) .qi-tchip { color: color-mix(in srgb, var(--cat) 55%, #000); background: color-mix(in srgb, var(--cat) 18%, #fff); }
:root:not([data-theme="dark"]) .qi-legend span { color: var(--text); }
