/* ==========================================================================
   LearnPC — styles
   ========================================================================== */
:root {
  --accent: #5b5bf6;
  --bg: #f3f5fb;
  --bg-2: #e9edf8;
  --card: #ffffff;
  --text: #1e2640;
  --muted: #6a7390;
  --border: #e1e6f2;
  --ok: #16a34a;
  --ok-bg: #e8f8ee;
  --bad: #dc2626;
  --bad-bg: #fdeceb;
  --warn: #b45309;
  --warn-bg: #fff6e0;
  --info-bg: #eaf2ff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 18px rgba(30, 38, 64, 0.07);
  --shadow-lg: 0 10px 34px rgba(30, 38, 64, 0.13);
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Cascadia Code', 'Consolas', 'SFMono-Regular', ui-monospace, monospace;
  --mc: var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 10%, transparent) 0, transparent 40%),
    radial-gradient(circle at 100% 30%, rgba(245, 158, 11, 0.07) 0, transparent 35%);
  background-attachment: fixed;
  min-height: 100vh;
}
img { max-width: 100%; }
a { color: color-mix(in srgb, var(--accent) 85%, black); font-weight: 700; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 900; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.8em; }
hr { border: 0; border-top: 2px dashed var(--border); margin: 1.2rem 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--bg-2); padding: 0.1em 0.4em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big { font-size: 1.3em; font-weight: 800; }
.huge { font-size: 2.6rem; font-weight: 900; line-height: 1.1; color: var(--mc); }
.center { text-align: center; }
.good { color: var(--ok); }
.boot { padding: 4rem; text-align: center; color: var(--muted); }

/* --- Boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35em;
  padding: 0.6em 1.1em; border-radius: 999px; border: 2px solid var(--border);
  background: var(--card); color: var(--text); font: inherit; font-weight: 800; font-size: 0.95rem;
  cursor: pointer; text-decoration: none; transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  white-space: nowrap; user-select: none;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, .choice:focus-visible, .chip:focus-visible, .quiz-choice:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: var(--bad-bg); border-color: #f5c2c0; color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-2); box-shadow: none; }
.btn-sm { padding: 0.35em 0.8em; font-size: 0.85rem; }
.btn-lg { padding: 0.75em 1.4em; font-size: 1.05rem; }
.btn-big { padding: 0.9em 1.8em; font-size: 1.3rem; }
.btn-block { width: 100%; }
.icon-btn {
  width: 2.2em; height: 2.2em; border-radius: 50%; border: 2px solid var(--border); background: var(--card);
  font: inherit; font-weight: 900; cursor: pointer; display: inline-grid; place-items: center; color: var(--text);
}
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* --- Barre du haut -------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1.2rem; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.45rem; text-decoration: none; color: var(--text); font-size: 1.35rem; font-weight: 900; }
.brand img { width: 34px; height: 34px; }
.brand b { color: var(--accent); }
.nav { display: flex; gap: 0.25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link { display: flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.85rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 800; white-space: nowrap; }
.nav-link:hover { background: var(--bg-2); color: var(--text); }
.nav-link.active { background: color-mix(in srgb, var(--accent) 14%, white); color: color-mix(in srgb, var(--accent) 80%, black); }
.user-chip { display: flex; align-items: center; gap: 0.5rem; }
.user-name { font-weight: 800; }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 1.25rem; text-decoration: none; }
/* Quand les liens ne tiennent plus (tablette en portrait…), la barre se resserre par étapes : voir fitTopbar() dans app.js. */
.topbar.fitting, .topbar.fitting * { transition: none !important; }
.topbar.fit-1 { gap: 0.6rem; }
.topbar.fit-1 .user-name, .topbar.fit-1 .hide-sm { display: none; }
.topbar.fit-1 .nav-link { padding: 0.45rem 0.65rem; }
.topbar.fit-2 { flex-wrap: wrap; row-gap: 0.3rem; }
.topbar.fit-2 .brand { flex: 1; }
.topbar.fit-2 .nav { order: 3; flex-basis: 100%; }
@media (min-width: 641px) {
  /* Sur deux lignes, il y a de nouveau la place pour le prénom et « Quitter ». */
  .topbar.fit-2 .user-name, .topbar.fit-2 .hide-sm { display: inline; }
}
.topbar.fit-3 .nav-label { display: none; }
.topbar.fit-3 .nav-link.active .nav-label { display: inline; }

.main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.2rem 4rem; }
.stack { display: flex; flex-direction: column; gap: 1.3rem; }
.narrow { max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; border: 1px solid var(--border); }
.page-title { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.section-title { margin: 0.5rem 0 1rem; }
.back-link { text-decoration: none; font-weight: 800; color: var(--muted); display: inline-block; }
.back-link:hover { color: var(--text); }

/* --- Formulaires ------------------------------------------------------------ */
.form { display: flex; flex-direction: column; gap: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 700; }
.field > span { font-size: 0.95rem; }
input:not([type]), input[type='text'], input[type='password'], input[type='number'], select, textarea {
  font: inherit; font-weight: 600; padding: 0.65em 0.9em; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.hint { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.form-error { background: var(--bad-bg); color: var(--bad); padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); font-weight: 700; }
.form-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin: 0.6rem 0; }
.form-row > input { flex: 1; min-width: 180px; }
.form-row label { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; flex-wrap: wrap; }
.form-row select { width: auto; }
.check-row { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; cursor: pointer; margin: 0.4rem 0; }
.switch-row { display: flex; gap: 0.8rem; align-items: flex-start; cursor: pointer; }
.switch-row input { width: 1.4rem; height: 1.4rem; margin-top: 0.2rem; accent-color: var(--accent); flex-shrink: 0; }
.switch-row span { display: flex; flex-direction: column; }
input[type='range'] { accent-color: var(--accent); flex: 1; min-width: 120px; }
input[type='checkbox'] { accent-color: var(--accent); width: 1.15rem; height: 1.15rem; }
.input-big { font-size: 1.15rem !important; }

/* --- Connexion -------------------------------------------------------------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 2rem; max-width: 1000px; margin: 0 auto; padding: 2rem 1.2rem; }
.auth-hero { text-align: center; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 0.6rem; font-size: 3rem; font-weight: 900; }
.auth-logo img { width: 72px; height: 72px; }
.auth-logo b { color: var(--accent); }
.auth-hero p { font-size: 1.25rem; font-weight: 700; color: var(--muted); }
.auth-emojis { font-size: 2.2rem; letter-spacing: 0.2em; animation: float 4s ease-in-out infinite; }
.auth-card { max-width: 440px; width: 100%; justify-self: center; }
.auth-card h1 { font-size: 1.6rem; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 0.4rem; }
.avatar-opt { font-size: 1.6rem; aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--border); background: #fff; cursor: pointer; transition: transform 0.1s; }
.avatar-opt:hover { transform: scale(1.08); }
.avatar-opt.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, white); transform: scale(1.08); }
.color-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.color-opt { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--border); cursor: pointer; }
.color-opt.selected { box-shadow: 0 0 0 3px var(--text); }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* --- Barres de progression ----------------------------------------------- */
.progress { height: 12px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress.thin { height: 7px; }
.progress-bar { height: 100%; background: var(--mc); border-radius: 999px; transition: width 0.5s; width: 0; }

/* --- Tableau de bord enfant ------------------------------------------------ */
.hero { display: flex; gap: 1.4rem; align-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--mc) 14%, white), #fff 70%); }
.hero-avatar { width: 96px; height: 96px; flex-shrink: 0; border-radius: 28px; display: grid; place-items: center; font-size: 3.3rem; box-shadow: var(--shadow); }
.hero-text { flex: 1; }
.hero-text h1 { margin-bottom: 0.2rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.stat-chip { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.8rem; font-weight: 800; font-size: 0.9rem; }
.continue { display: flex; align-items: center; gap: 1rem; border-left: 8px solid var(--mc); }
.continue.done { border-left-color: #f59e0b; }
.continue-icon { font-size: 2.6rem; }
.continue-text { flex: 1; display: flex; flex-direction: column; }
.continue-text strong { font-size: 1.15rem; }

.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.mod-card {
  background: var(--card); border-radius: var(--radius); padding: 1.2rem; border: 1px solid var(--border);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.6rem; position: relative; overflow: hidden;
  border-top: 7px solid var(--mc); transition: transform 0.15s, box-shadow 0.15s;
}
.mod-card:hover:not(.is-locked) { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.mod-card.is-locked { filter: grayscale(0.9); opacity: 0.65; }
.mod-card.is-passed { background: linear-gradient(180deg, color-mix(in srgb, var(--mc) 7%, white), #fff 50%); }
.mod-card h3 { margin: 0; font-size: 1.2rem; }
.mod-top { display: flex; align-items: center; gap: 0.7rem; }
.mod-icon { font-size: 2.1rem; width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--mc) 14%, white); }
.mod-num { font-weight: 900; color: var(--mc); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.8rem; flex: 1; }
.mod-medal { font-size: 2rem; animation: pop 0.5s; }
.mod-summary { color: var(--muted); font-size: 0.95rem; margin: 0; flex: 1; }
.mod-meta { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.mod-status { font-weight: 800; font-size: 0.9rem; display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.mod-status.locked { color: var(--muted); }
.mod-status.passed { color: var(--ok); }
.mod-status.retry { color: var(--warn); }
.mod-status.new, .mod-status.reading { color: var(--mc); }
.stars { letter-spacing: 0.05em; }
.mod-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.mod-actions .btn-primary { background: var(--mc); border-color: var(--mc); }

.medals h2 { margin-bottom: 1rem; }
.medal-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 0.7rem; margin-bottom: 0.6rem; }
.medal { text-align: center; padding: 0.6rem 0.3rem; border-radius: var(--radius-sm); background: #fffbeb; border: 2px solid #fde68a; }
.medal.empty { background: var(--bg); border: 2px dashed var(--border); filter: grayscale(1); opacity: 0.6; }
.medal-icon { font-size: 2.2rem; line-height: 1.2; }
.medal-label { font-size: 0.8rem; font-weight: 800; color: var(--muted); }

/* --- Page module ---------------------------------------------------------------- */
.module-head { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: 0.6rem; }
.module-title { display: flex; align-items: center; gap: 0.9rem; }
.module-title h1 { margin: 0; font-size: 1.7rem; }
.module-icon { font-size: 2.4rem; width: 70px; height: 70px; border-radius: 20px; display: grid; place-items: center; background: color-mix(in srgb, var(--mc) 15%, white); flex-shrink: 0; }
.module-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.3rem; align-items: start; }
.module-aside { position: sticky; top: 80px; padding: 1rem; }
.aside-title { font-weight: 900; color: var(--muted); text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.06em; margin-bottom: 0.5rem; }
.step-list { list-style: none; margin: 0 0 0.8rem; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.step-link { display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.55rem; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 0.92rem; }
.step-link:hover:not(.disabled) { background: var(--bg); color: var(--text); }
.step-link.current { background: color-mix(in srgb, var(--mc) 13%, white); color: var(--text); }
.step-link.disabled { opacity: 0.45; }
.step-dot { width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 900; background: var(--bg-2); }
.step-link.seen .step-dot { background: color-mix(in srgb, var(--mc) 25%, white); color: color-mix(in srgb, var(--mc) 70%, black); }
.step-link.current .step-dot { background: var(--mc); color: #fff; }
.step { min-width: 0; padding: 1.8rem; display: flex; flex-direction: column; gap: 1.1rem; }
.step-kicker { color: var(--mc); font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.82rem; margin-bottom: -0.8rem; }
.step-title { font-size: 1.7rem; margin: 0; }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; padding-top: 1.2rem; border-top: 2px dashed var(--border); margin-top: 0.6rem; flex-wrap: wrap; }
.module-page .btn-primary { background: var(--mc); border-color: var(--mc); }

/* --- Blocs de contenu -------------------------------------------------- */
.prose p:last-child, .prose ul:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 0.8em; }
.prose li { margin-bottom: 0.35em; }
.prose strong { color: color-mix(in srgb, var(--mc) 60%, var(--text)); }
.big-example { font-size: 1.15rem; background: var(--bg); border-radius: var(--radius-sm); padding: 0.8rem 1rem; border-left: 5px solid var(--mc); }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 900; }
.table tbody tr:hover { background: var(--bg); }
.table th.center, .table td.center { text-align: center; }
.table-wrap { overflow-x: auto; }

.callout { display: flex; gap: 0.8rem; padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: var(--info-bg); border: 2px solid #cfe0ff; }
.callout-icon { font-size: 1.5rem; line-height: 1.2; }
.callout-body { flex: 1; }
.callout-body p:last-child, .callout p:last-child { margin-bottom: 0; }
.callout-title { font-weight: 900; margin-bottom: 0.25rem; }
.callout-tip { background: #effbf3; border-color: #c6ecd3; }
.callout-warn { background: var(--warn-bg); border-color: #fbe0a6; }
.callout-fun { background: #f7f0ff; border-color: #e3d1ff; }
.callout.compact { padding: 0.6rem 0.9rem; font-size: 0.9rem; font-weight: 700; display: block; }

.flow { display: flex; align-items: stretch; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.flow-item { flex: 1; min-width: 120px; max-width: 220px; text-align: center; padding: 0.9rem 0.6rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--mc) 9%, white); border: 2px solid color-mix(in srgb, var(--mc) 25%, white); }
.flow-icon { font-size: 2rem; }
.flow-label { font-weight: 900; }
.flow-text { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.flow-arrow { align-self: center; font-size: 1.5rem; color: var(--mc); font-weight: 900; }

.code { border-radius: var(--radius-sm); overflow: hidden; background: #1e2235; color: #e6e9f5; }
.code-lang { font-size: 0.75rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.35rem 0.9rem; background: #2a2f47; color: #a5b4fc; }
.code pre { margin: 0; padding: 0.9rem 1rem; overflow-x: auto; }
.code code { background: none; padding: 0; color: inherit; font-size: 0.95rem; }

.recap { background: linear-gradient(135deg, #fffbeb, #fff); border: 2px solid #fde68a; border-radius: var(--radius); padding: 1.2rem 1.4rem; }
.recap-title { font-weight: 900; font-size: 1.2rem; margin-bottom: 0.6rem; }
.recap ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.recap li { padding-left: 2rem; position: relative; }
.recap li::before { content: '✅'; position: absolute; left: 0; }

/* Cartes à retourner */
.reveal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.9rem; }
.flip { perspective: 900px; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.flip-inner { display: grid; transition: transform 0.55s; transform-style: preserve-3d; min-height: 150px; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--radius-sm); padding: 1rem; display: flex; flex-direction: column; justify-content: center; }
.flip-front { background: linear-gradient(135deg, var(--mc), color-mix(in srgb, var(--mc) 65%, #000)); color: #fff; align-items: center; text-align: center; gap: 0.5rem; box-shadow: var(--shadow); }
.flip-title { font-size: 1.15rem; font-weight: 900; }
.flip-hint { font-size: 0.78rem; opacity: 0.85; font-weight: 700; }
.flip-back { transform: rotateY(180deg); background: #fff; border: 2px solid color-mix(in srgb, var(--mc) 35%, white); font-size: 0.95rem; }
.flip:hover .flip-front { filter: brightness(1.07); }

/* Mini-question */
.check { background: var(--bg); border-radius: var(--radius); padding: 1.1rem 1.2rem; border: 2px dashed color-mix(in srgb, var(--mc) 40%, white); }
.check-label { font-weight: 900; color: var(--mc); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.check-q { font-weight: 800; font-size: 1.1rem; margin: 0.3rem 0 0.8rem; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice { font: inherit; font-weight: 700; padding: 0.6em 1em; border-radius: var(--radius-sm); border: 2px solid var(--border); background: #fff; cursor: pointer; color: var(--text); text-align: left; transition: transform 0.1s; }
.choice:hover:not(:disabled) { border-color: var(--mc); transform: translateY(-1px); }
.choice:disabled { cursor: default; }
.choice.right { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.choice.wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); animation: shake 0.35s; }
.check-feedback { margin-top: 0.8rem; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); font-weight: 700; }
.check-feedback.ok { background: var(--ok-bg); color: #166534; }
.check-feedback.ko { background: var(--bad-bg); color: var(--bad); }

/* Activités tri / ordre */
.activity { background: var(--bg); border-radius: var(--radius); padding: 1.1rem 1.2rem; border: 2px solid var(--border); }
.activity-title { font-weight: 900; font-size: 1.05rem; }
.activity-help { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0 0.8rem; font-weight: 600; }
.activity-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.9rem; flex-wrap: wrap; }
.activity-status { margin-top: 0.7rem; font-weight: 800; border-radius: var(--radius-sm); }
.activity-status:empty { display: none; }
.activity-status.ok, .activity-status.ko, .activity-status.warn { padding: 0.6rem 0.9rem; }
.activity-status.ok { background: var(--ok-bg); color: #166534; }
.activity-status.ko { background: var(--bad-bg); color: var(--bad); }
.activity-status.warn { background: var(--warn-bg); color: var(--warn); }
.sort-pool { display: flex; flex-wrap: wrap; gap: 0.5rem; min-height: 54px; padding: 0.6rem; border-radius: var(--radius-sm); background: #fff; border: 2px dashed var(--border); margin-bottom: 0.8rem; }
.sort-pool.empty::before { content: '👍 Tout est rangé ! Clique sur « Vérifier ».'; color: var(--muted); font-weight: 700; font-size: 0.9rem; align-self: center; }
.sort-buckets { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 0.6rem; }
.sort-bucket { background: #fff; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem; min-height: 120px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.sort-bucket.target { border-color: color-mix(in srgb, var(--mc) 50%, white); border-style: dashed; }
.sort-bucket.over, .sort-pool.over { background: color-mix(in srgb, var(--mc) 8%, white); border-color: var(--mc); }
.sort-bucket-label { font-weight: 900; text-align: center; margin-bottom: 0.5rem; font-size: 0.95rem; }
.sort-bucket-items { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; }
.chip { font: inherit; font-weight: 700; font-size: 0.92rem; padding: 0.4em 0.8em; border-radius: 999px; border: 2px solid var(--border); background: #fff; cursor: grab; color: var(--text); transition: transform 0.1s; }
.chip:hover { border-color: var(--mc); }
.chip.selected { background: var(--mc); border-color: var(--mc); color: #fff; transform: scale(1.06); box-shadow: var(--shadow); }
.chip.right { background: var(--ok-bg); border-color: var(--ok); color: #166534; }
.chip.wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.order-list { list-style: none; padding: 0; margin: 0.8rem 0 0; display: flex; flex-direction: column; gap: 0.45rem; }
.order-item { display: flex; align-items: center; gap: 0.7rem; background: #fff; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; }
.order-item.moved { animation: pop 0.3s; }
.order-item.right { border-color: var(--ok); background: var(--ok-bg); }
.order-item.wrong { border-color: var(--bad); background: var(--bad-bg); }
.order-num { width: 30px; height: 30px; border-radius: 50%; background: var(--mc); color: #fff; display: grid; place-items: center; font-weight: 900; flex-shrink: 0; }
.order-text { flex: 1; font-weight: 700; }
.order-btns { display: flex; gap: 0.3rem; }

/* --- Widgets (cadre commun) ---------------------------------------- */
.widget { background: #fff; border: 2px solid color-mix(in srgb, var(--mc) 30%, white); border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 6px 20px color-mix(in srgb, var(--mc) 10%, transparent); display: flex; flex-direction: column; gap: 0.8rem; }
.widget-title { font-weight: 900; font-size: 1.1rem; color: color-mix(in srgb, var(--mc) 75%, black); }
.widget-actions { display: flex; gap: 0.5rem; align-items: center; justify-content: center; }
.widget-actions.wrap { flex-wrap: wrap; }
.widget-actions.spread { justify-content: space-between; }
.widget-result { background: var(--bg); border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-weight: 600; }
.widget-result:empty { display: none; }
.widget-result.ok { background: var(--ok-bg); color: #14532d; }
.widget-result.ko { background: var(--bad-bg); color: #991b1b; }
.widget-result.warn { background: var(--warn-bg); color: #92400e; }
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tab { font: inherit; font-weight: 800; font-size: 0.9rem; padding: 0.45em 0.9em; border-radius: 999px; border: 2px solid var(--border); background: #fff; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--mc); border-color: var(--mc); color: #fff; }
.slider-row { display: flex; align-items: center; gap: 0.8rem; font-weight: 800; flex-wrap: wrap; }
.big-stat { text-align: center; font-size: 1.1rem; background: color-mix(in srgb, var(--mc) 8%, white); border-radius: var(--radius-sm); padding: 1rem; }
.counter-row { display: flex; align-items: center; justify-content: center; gap: 1rem; font-size: 1.1rem; }

/* Entrée → traitement → sortie */
.ipo-stage { display: flex; align-items: stretch; gap: 0.5rem; }
.ipo-box { flex: 1; border-radius: var(--radius-sm); border: 3px solid var(--border); padding: 0.9rem 0.6rem; text-align: center; transition: all 0.35s; background: #fff; }
.ipo-box.active { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 12%, white); transform: scale(1.04); box-shadow: var(--shadow-lg); }
.ipo-box.done { border-color: color-mix(in srgb, var(--mc) 45%, white); }
.ipo-icon { font-size: 2.2rem; }
.ipo-label { font-weight: 900; }
.ipo-text { font-size: 0.9rem; min-height: 3em; font-weight: 600; color: var(--muted); }
.ipo-box.active .ipo-text, .ipo-box.done .ipo-text { color: var(--text); }
.ipo-arrow { align-self: center; font-size: 1.6rem; color: var(--mc); font-weight: 900; }

/* Frise */
.tl-track { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.6rem 0.2rem 1rem; scroll-snap-type: x proximity; position: relative; }
.tl-track::before { content: ''; position: absolute; left: 0; right: 0; top: 34px; height: 4px; background: var(--bg-2); z-index: 0; min-width: 100%; }
.tl-dot { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; border: 0; background: none; cursor: pointer; font: inherit; z-index: 1; scroll-snap-align: center; min-width: 78px; color: var(--muted); }
.tl-icon { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: #fff; border: 3px solid var(--border); transition: transform 0.2s; }
.tl-dot.seen .tl-icon { border-color: color-mix(in srgb, var(--mc) 50%, white); }
.tl-dot.active .tl-icon { border-color: var(--mc); background: var(--mc); transform: scale(1.18); }
.tl-year { font-weight: 900; font-size: 0.8rem; white-space: nowrap; }
.tl-dot.active .tl-year { color: var(--mc); }
.tl-card { display: flex; gap: 1rem; align-items: flex-start; background: color-mix(in srgb, var(--mc) 7%, white); border-radius: var(--radius-sm); padding: 1rem 1.2rem; min-height: 130px; }
.tl-card.pop { animation: pop 0.35s; }
.tl-card-icon { font-size: 3rem; line-height: 1; }
.tl-card-year { font-weight: 900; color: var(--mc); }
.tl-card h4 { margin: 0.1rem 0 0.3rem; font-size: 1.2rem; }
.tl-card p { margin: 0; }

/* Intérieur du PC */
.pc-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.pc-svg { width: 100%; height: auto; display: block; }
.pc-svg .part { cursor: pointer; transition: filter 0.2s, opacity 0.2s; }
.pc-svg .part:hover { filter: brightness(1.25) drop-shadow(0 0 6px rgba(250, 204, 21, 0.9)); }
.pc-svg .part.selected { filter: brightness(1.2) drop-shadow(0 0 8px #facc15); }
.part-label { font: 900 13px var(--font); fill: #fff; stroke: #1e2640; stroke-width: 3px; paint-order: stroke; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.part.found .part-label { opacity: 1; }
.spin { animation: spin 2.4s linear infinite; }
.pc-panel { display: flex; flex-direction: column; gap: 0.6rem; }
.pc-count { font-weight: 900; }
.pc-info { background: var(--bg); border-radius: var(--radius-sm); padding: 1rem; min-height: 200px; }
.pc-info-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.pc-info-head h4 { margin: 0; font-size: 1.2rem; }
.pc-info-icon { font-size: 2rem; }
.pc-analogy { background: #fff; border-radius: 10px; padding: 0.5rem 0.8rem; }

/* Mémoire / stockage */
.mem-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.mem-panel { border-radius: var(--radius-sm); padding: 0.9rem; border: 3px solid; transition: opacity 0.3s, filter 0.3s; }
.mem-panel.ram { border-color: #93c5fd; background: #eff6ff; }
.mem-panel.sto { border-color: #fdba74; background: #fff7ed; }
.mem-panel.off { filter: grayscale(1); opacity: 0.6; }
.mem-title { font-weight: 900; }
.mem-sub { font-size: 0.8rem; color: var(--muted); font-weight: 700; margin-bottom: 0.6rem; }
.mem-items { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 44px; }
.mem-item { background: #fff; border-radius: 10px; padding: 0.35rem 0.7rem; font-weight: 800; box-shadow: var(--shadow); animation: pop 0.3s; }
.mem-item.unsaved { border: 2px dashed var(--bad); }
.mem-item small { color: var(--bad); }
.mem-item.vanish { animation: vanish 0.6s forwards; }
.mem-empty { color: var(--muted); font-weight: 700; }

/* Ampoules */
.bulbs { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
.bulb { border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; font: inherit; padding: 0.2rem; }
.bulb-glass { font-size: 2.6rem; filter: grayscale(1) brightness(0.8); opacity: 0.5; transition: all 0.2s; }
.bulb.on .bulb-glass { filter: drop-shadow(0 0 14px #facc15); opacity: 1; }
.bulb-bit { font-family: var(--mono); font-weight: 900; font-size: 1.3rem; }
.combo-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.combo { font-family: var(--mono); padding: 0.15rem 0.5rem; border-radius: 8px; background: var(--bg); font-weight: 700; }
.combo.current { background: var(--mc); color: #fff; }

/* Cartes binaires */
.bin-cards { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.4rem; }
.bin-card { border: 3px solid var(--border); border-radius: 12px; background: #f1f3f9; cursor: pointer; padding: 0.5rem 0.2rem; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; font: inherit; color: var(--muted); transition: all 0.2s; min-height: 108px; }
.bin-card.on { background: #fff; border-color: var(--mc); color: var(--text); transform: translateY(-4px); box-shadow: var(--shadow); }
.bin-val { font-size: 1.25rem; font-weight: 900; }
.bin-dots { font-size: 0.45rem; line-height: 1.2; color: var(--mc); word-break: break-all; text-align: center; max-width: 3.4em; min-height: 1.5em; }
.bin-card:not(.on) .bin-dots { opacity: 0.25; }
.bin-bit { font-family: var(--mono); font-weight: 900; font-size: 1.5rem; }
.bin-card.on .bin-bit { color: var(--mc); }
.bin-readout { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; justify-content: center; font-weight: 700; }
.bin-challenge { text-align: center; padding: 0.7rem; border-radius: var(--radius-sm); background: var(--warn-bg); font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }
.bin-challenge:empty { display: none; }
.bin-challenge.ok { background: var(--ok-bg); color: #14532d; }

/* Texte → binaire */
.tb-head, .tb-row { display: grid; grid-template-columns: 70px 80px 1fr; gap: 0.5rem; align-items: center; padding: 0.35rem 0.6rem; }
.tb-head { font-size: 0.78rem; font-weight: 900; color: var(--muted); text-transform: uppercase; }
.tb-table { display: flex; flex-direction: column; gap: 0.25rem; max-height: 360px; overflow-y: auto; }
.tb-row { background: var(--bg); border-radius: 10px; }
.tb-char { font-size: 1.5rem; font-weight: 900; text-align: center; }
.tb-code { font-weight: 900; color: var(--mc); }
.tb-bin { word-break: break-all; }

/* Couleurs RVB */
.rgb-layout { display: grid; grid-template-columns: 1fr 160px; gap: 1rem; align-items: center; }
.rgb-swatch { width: 100%; aspect-ratio: 1; border-radius: 24px; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.08), var(--shadow); }
.rgb-name { width: 3.5em; }
.rgb-name-r { color: #e11d48; } .rgb-name-g { color: #16a34a; } .rgb-name-b { color: #2563eb; }
.rgb-r { accent-color: #e11d48; } .rgb-g { accent-color: #16a34a; } .rgb-b { accent-color: #2563eb; }
.rgb-v { width: 2.5em; text-align: right; }
.goals { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.goal { padding: 0.25rem 0.7rem; border-radius: 999px; background: var(--bg); font-weight: 700; font-size: 0.88rem; border: 2px solid transparent; }
.goal.done { background: var(--ok-bg); border-color: var(--ok); }
.goal.done::after { content: ' ✓'; color: var(--ok); font-weight: 900; }

/* Pixels */
.px-layout { display: flex; gap: 1.2rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.px-grid { display: grid; gap: 2px; background: #cbd2e1; padding: 2px; border-radius: 8px; width: min(300px, 80vw); aspect-ratio: 1; touch-action: none; user-select: none; }
.px-cell { background: #fff; cursor: pointer; border-radius: 2px; }
.px-cell:hover { background: #e2e8f0; }
.px-cell.on { background: #1e2640; }
.px-code { font-size: 1.05rem; line-height: 1.55; letter-spacing: 0.12em; background: var(--bg); padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); }
.px-code .row-ok { color: var(--ok); font-weight: 900; }

/* Flip-book */
.fb-canvas { width: 100%; max-width: 520px; height: auto; align-self: center; border-radius: var(--radius-sm); border: 2px solid var(--border); }

/* Explorateur de fichiers */
.fx-missions ul { list-style: none; padding: 0; margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-weight: 700; }
.fx-missions li.done { color: var(--ok); }
.fx-window { border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.fx-crumbs { display: flex; align-items: center; gap: 0.3rem; padding: 0.5rem 0.7rem; background: var(--bg); border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.fx-crumb { font: inherit; font-weight: 800; border: 0; background: #fff; border-radius: 8px; padding: 0.2rem 0.6rem; cursor: pointer; color: var(--text); }
.fx-crumb:hover { background: color-mix(in srgb, var(--mc) 15%, white); }
.fx-sep { color: var(--muted); font-weight: 900; }
.fx-body { display: grid; grid-template-columns: 1fr 1fr; min-height: 230px; }
.fx-list { display: flex; flex-direction: column; padding: 0.4rem; gap: 0.15rem; border-right: 2px solid var(--border); }
.fx-item { font: inherit; font-weight: 700; text-align: left; border: 0; background: none; padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer; color: var(--text); }
.fx-item:hover { background: color-mix(in srgb, var(--mc) 10%, white); }
.fx-item.folder { color: #92400e; }
.fx-item.up { color: var(--muted); }
.fx-details { padding: 0.9rem; }
.fx-file-head { display: flex; align-items: center; gap: 0.6rem; font-size: 1.1rem; margin-bottom: 0.6rem; }
.fx-big { font-size: 2.2rem; }
.fx-details dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.8rem; margin: 0; font-size: 0.92rem; }
.fx-details dt { font-weight: 900; color: var(--muted); }
.fx-details dd { margin: 0; }
.fx-path { word-break: break-all; }

/* Robot */
.robot-levels { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.lvl { font: inherit; font-weight: 800; font-size: 0.88rem; padding: 0.35em 0.9em; border-radius: 999px; border: 2px solid var(--border); background: #fff; cursor: pointer; color: var(--muted); }
.lvl.active { border-color: var(--mc); color: var(--text); background: color-mix(in srgb, var(--mc) 12%, white); }
.lvl.done { color: var(--ok); }
.robot-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.robot-grid { display: grid; gap: 4px; background: #c7d7c0; padding: 6px; border-radius: var(--radius-sm); max-width: 420px; width: 100%; justify-self: center; }
.robot-cell { aspect-ratio: 1; background: #ecf7e6; border-radius: 6px; display: grid; place-items: center; font-size: clamp(1.1rem, 4vw, 1.9rem); position: relative; }
.robot-cell.goal { background: #fff7d1; }
.robot-bot { position: relative; display: grid; place-items: center; animation: pop 0.25s; }
.robot-bot.bump { animation: shake 0.4s; }
.robot-dir { position: absolute; top: -0.85em; left: 50%; margin-left: -0.5em; width: 1em; text-align: center; font-size: 0.55em; color: var(--mc); font-weight: 900; transform-origin: 50% 1.75em; }
.robot-side { display: flex; flex-direction: column; gap: 0.8rem; }
.robot-palette { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.cmd { background: color-mix(in srgb, var(--mc) 10%, white); border-color: color-mix(in srgb, var(--mc) 35%, white); }
.robot-program { background: var(--bg); border-radius: var(--radius-sm); padding: 0.7rem; border: 2px dashed var(--border); }
.loop-head { font-weight: 900; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.loop-head select { width: auto; padding: 0.2em 0.5em; }
.loop-body, .prog-body { display: flex; flex-wrap: wrap; gap: 0.35rem; min-height: 44px; align-items: center; }
.loop-body { border-left: 5px solid var(--mc); padding-left: 0.6rem; margin-left: 0.3rem; }
.prog-chip { font: inherit; font-size: 1.15rem; width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--border); background: #fff; cursor: pointer; }
.prog-chip:hover { border-color: var(--bad); }
.prog-chip.active { background: var(--mc); border-color: var(--mc); transform: scale(1.12); }

/* Nombre mystère */
.guess-form { display: flex; gap: 0.5rem; justify-content: center; }
.guess-form input { max-width: 140px; text-align: center; }
.guess-history { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-top: 0.6rem; }
.guess-chip { padding: 0.25rem 0.7rem; border-radius: 999px; font-weight: 800; font-size: 0.88rem; background: var(--bg); }
.guess-chip.up { background: #e0f2fe; } .guess-chip.down { background: #fce7f3; } .guess-chip.win { background: var(--ok-bg); color: var(--ok); }
.guess-log { font-size: 0.88rem; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.6rem; }

/* Variables */
.var-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; }
.var-code { background: #1e2235; border-radius: var(--radius-sm); padding: 0.6rem 0; color: #e6e9f5; }
.var-line { display: flex; gap: 0.7rem; padding: 0.3rem 0.9rem; border-left: 4px solid transparent; transition: background 0.2s; }
.var-line code { background: none; color: inherit; padding: 0; }
.var-line.current { background: rgba(165, 180, 252, 0.2); border-left-color: #a5b4fc; }
.var-line.skipped { opacity: 0.4; text-decoration: line-through; }
.var-ln { color: #6b7394; font-family: var(--mono); width: 1.2em; text-align: right; }
.var-boxes { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 0.4rem 0 0.8rem; min-height: 90px; align-items: flex-end; }
.var-box { display: flex; flex-direction: column; align-items: center; }
.var-val { min-width: 74px; height: 64px; padding: 0 0.6rem; display: grid; place-items: center; font-size: 1.6rem; font-weight: 900; background: #fde68a; border-radius: 6px 6px 12px 12px; border: 3px solid #d97706; border-top-width: 8px; }
.var-box.changed .var-val { animation: pop 0.45s; background: #fcd34d; }
.var-name { font-family: var(--mono); font-weight: 800; background: #fff; border: 2px solid #d97706; border-radius: 6px; padding: 0 0.5rem; margin-top: -6px; font-size: 0.9rem; }
.var-out { background: #0f172a; color: #86efac; border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; min-height: 60px; }
.var-out .muted { color: #64748b; }

/* Paquets */
.net-stage { position: relative; background: linear-gradient(180deg, #f0f9ff, #fff); border-radius: var(--radius-sm); border: 2px solid var(--border); }
.net-svg { width: 100%; height: auto; display: block; }
.net-edge { stroke: #cbd5e1; stroke-width: 5; stroke-linecap: round; }
.net-node circle { fill: #fff; stroke: var(--mc); stroke-width: 3; }
.net-node.router circle { stroke: #94a3b8; }
.net-emoji { font-size: 22px; }
.net-label { font: 800 13px var(--font); fill: #475569; }
.net-layer { position: absolute; inset: 0; pointer-events: none; }
.packet { position: absolute; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 8px; color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 0.85rem; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25); }
.pk-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; min-height: 1.6em; }
.pk-chip { color: #fff; padding: 0.2rem 0.6rem; border-radius: 8px; font-size: 0.85rem; font-weight: 700; white-space: pre; animation: pop 0.3s; }

/* URL */
.browser { border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.browser-dots { background: var(--bg-2); padding: 0.45rem 0.7rem; display: flex; gap: 0.35rem; }
.browser-dots i { width: 12px; height: 12px; border-radius: 50%; background: #f87171; }
.browser-dots i:nth-child(2) { background: #fbbf24; } .browser-dots i:nth-child(3) { background: #34d399; }
.url-bar { display: flex; flex-wrap: wrap; align-items: center; padding: 0.7rem; gap: 2px; background: #fff; font-family: var(--mono); font-size: 1.05rem; }
.url-lock { margin-right: 0.4rem; }
.url-part { font: inherit; border: 0; border-bottom: 4px solid; background: none; padding: 0.15rem 0.1rem; cursor: pointer; color: var(--text); border-radius: 4px 4px 0 0; }
.url-part:hover, .url-part.active { background: var(--bg-2); }
.url-c0 { border-color: #16a34a; } .url-c1 { border-color: #94a3b8; } .url-c2 { border-color: #e11d48; } .url-c3 { border-color: #f59e0b; } .url-c4 { border-color: #3b82f6; } .url-c5 { border-color: #a855f7; }
.url-part.active { font-weight: 900; }
.url-info { background: var(--bg); border-radius: var(--radius-sm); padding: 0.9rem 1rem; min-height: 90px; }
.url-info h4 { margin: 0 0 0.4rem; }
.url-info p { margin: 0; }

/* DNS */
.dns-chat { display: flex; flex-direction: column; gap: 0.5rem; max-height: 340px; overflow-y: auto; padding: 0.2rem; }
.dns-chat:empty { display: none; }
.dns-msg { max-width: 85%; padding: 0.55rem 0.9rem; border-radius: 16px; animation: pop 0.3s; display: flex; flex-direction: column; }
.dns-msg.left { align-self: flex-start; background: #e0f2fe; border-bottom-left-radius: 4px; }
.dns-msg.right { align-self: flex-end; background: #fef3c7; border-bottom-right-radius: 4px; }
.dns-msg.sys { align-self: center; background: var(--bg); text-align: center; flex-direction: row; gap: 0.4rem; }
.dns-who { font-size: 0.75rem; font-weight: 900; color: var(--muted); }

/* Mots de passe */
.pw-meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.pw-meter span { height: 12px; border-radius: 999px; background: var(--bg-2); transition: background 0.3s; }
.pw-verdict { font-size: 1.15rem; font-weight: 700; }
.pw-checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.3rem 1rem; font-weight: 700; font-size: 0.92rem; }
.pw-checks li.ko { color: var(--muted); }

/* Hameçonnage */
.phish-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.mail { border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; font-size: 0.97rem; }
.mail-head { background: var(--bg); padding: 0.7rem 0.9rem; border-bottom: 2px solid var(--border); display: flex; flex-direction: column; gap: 0.15rem; }
.mail-k { font-weight: 900; color: var(--muted); }
.mail-body { padding: 0.9rem; }
.mail-body p { margin-bottom: 0.6em; }
.mail-link { color: #2563eb; text-decoration: underline; word-break: break-all; }
.clue { cursor: pointer; border-radius: 4px; transition: background 0.2s; }
.clue:hover { background: #fef9c3; }
.clue.found { background: #fecaca; box-shadow: 0 0 0 2px #f87171; }
.phish-count { font-weight: 900; background: var(--warn-bg); padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); margin-bottom: 0.6rem; }
.phish-count.ok { background: var(--ok-bg); color: #14532d; }
.phish-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.phish-item { background: var(--bg); border-radius: 10px; padding: 0.5rem 0.7rem; font-size: 0.88rem; color: var(--muted); }
.phish-item.found { background: #fff1f2; color: var(--text); border-left: 4px solid #f87171; animation: pop 0.3s; }

/* César */
.cz-rows { overflow-x: auto; display: flex; flex-direction: column; gap: 2px; padding-bottom: 0.3rem; }
.cz-row { display: flex; gap: 2px; }
.cz-row span { min-width: 1.6em; text-align: center; padding: 0.2rem 0; background: var(--bg); border-radius: 4px; font-weight: 800; }
.cz-row.shifted span { background: color-mix(in srgb, var(--mc) 15%, white); color: color-mix(in srgb, var(--mc) 70%, black); }
.cz-row .cz-lab { min-width: 4.8em; background: none !important; color: var(--muted) !important; text-align: left; font-family: var(--font); font-size: 0.8rem; }
.cz-output { font-size: 1.3rem; font-weight: 900; background: #1e2235; color: #a5f3fc; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); word-break: break-word; letter-spacing: 0.05em; }
.cz-challenge { background: #f7f0ff; border-radius: var(--radius-sm); padding: 0.9rem 1rem; border: 2px dashed #c4b5fd; }

/* IA */
.knn-canvas { width: 100%; max-width: 620px; height: auto; align-self: center; border-radius: var(--radius-sm); border: 2px solid var(--border); cursor: crosshair; background: #f8fafc; }
.nw-start { font-size: 1.3rem; font-weight: 900; text-align: center; padding: 0.4rem; }
.nw-quiz { display: flex; flex-direction: column; gap: 0.7rem; align-items: stretch; }
.nw-quiz .choices { justify-content: center; }
.nw-quiz > .btn { align-self: center; }
.nw-bars, .nw-cands { display: flex; flex-direction: column; gap: 0.35rem; }
.nw-bar { display: grid; grid-template-columns: minmax(110px, auto) 1fr 3.5em; gap: 0.6rem; align-items: center; font: inherit; font-weight: 800; background: none; border: 0; padding: 0.3rem 0.4rem; border-radius: 10px; text-align: left; color: var(--text); }
.nw-bar.best { background: var(--ok-bg); }
.nw-bar.clickable { cursor: pointer; border: 2px solid var(--border); background: #fff; }
.nw-bar.clickable:hover { border-color: var(--mc); }
.nw-track { height: 14px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.nw-fill { display: block; height: 100%; background: var(--mc); border-radius: 999px; animation: grow 0.6s; }
.nw-pct { text-align: right; font-family: var(--mono); font-size: 0.85rem; }
.nw-sentence { font-size: 1.35rem; font-weight: 800; background: #fffbeb; border-radius: var(--radius-sm); padding: 0.8rem 1rem; border: 2px solid #fde68a; }

/* --- Quiz -------------------------------------------------------------------------- */
.quiz { max-width: 820px; margin: 0 auto; padding: 1.8rem; }
.quiz-page .btn-primary { background: var(--mc); border-color: var(--mc); }
.quiz-intro { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 1rem 0; }
.quiz-big-icon { font-size: 4rem; }
.spin-slow { animation: spin 2s linear infinite; }
.quiz-rules { list-style: none; padding: 0; margin: 0.4rem 0 1rem; font-weight: 700; display: flex; flex-direction: column; gap: 0.35rem; }
.quiz-dots { display: flex; gap: 0.35rem; justify-content: center; flex-wrap: wrap; margin-bottom: 0.8rem; }
.qdot { width: 14px; height: 14px; border-radius: 50%; background: var(--bg-2); transition: all 0.2s; }
.qdot.answered { background: color-mix(in srgb, var(--mc) 50%, white); }
.qdot.current { background: var(--mc); transform: scale(1.35); }
.quiz-count { text-align: center; color: var(--mc); font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; }
.quiz-q { text-align: center; font-size: 1.5rem; margin: 0.4rem 0 1.2rem; }
.quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.quiz-choice { display: flex; align-items: center; gap: 0.8rem; font: inherit; font-weight: 700; font-size: 1.02rem; padding: 0.9rem 1rem; border-radius: var(--radius-sm); border: 3px solid var(--border); background: #fff; cursor: pointer; text-align: left; color: var(--text); transition: all 0.12s; }
.quiz-choice:hover { border-color: color-mix(in srgb, var(--mc) 60%, white); transform: translateY(-2px); }
.quiz-choice.selected { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 12%, white); box-shadow: var(--shadow); }
.quiz-letter { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; font-weight: 900; background: var(--bg-2); }
.quiz-choice.selected .quiz-letter { background: var(--mc); color: #fff; }
.result-head { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.2rem; }
.result-score { width: 140px; height: 140px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: baseline; justify-content: center; padding-top: 38px; border: 10px solid; animation: pop 0.6s; }
.result-score.pass { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.result-score.fail { border-color: #f59e0b; background: var(--warn-bg); color: var(--warn); }
.result-note { font-size: 2.6rem; font-weight: 900; line-height: 1; }
.result-on { font-weight: 900; font-size: 1.1rem; }
.result-text h2 { margin: 0.2rem 0; }
.result-medal { font-size: 1.3rem; font-weight: 900; }
.badge { display: inline-block; padding: 0.3rem 0.8rem; border-radius: 999px; font-weight: 800; font-size: 0.88rem; margin: 0.2rem 0.3rem 0 0; }
.badge-record { background: #ede9fe; color: #5b21b6; }
.badge-unlock { background: var(--ok-bg); color: #166534; }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0 1.4rem; }
.correction { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.7rem; counter-reset: q; }
.corr-item { border-radius: var(--radius-sm); padding: 0.8rem 1rem; border-left: 6px solid; background: var(--bg); }
.corr-item.ok { border-color: var(--ok); }
.corr-item.ko { border-color: var(--bad); background: #fff8f8; }
.corr-head { display: flex; gap: 0.5rem; font-weight: 800; }
.corr-answers { margin: 0.4rem 0 0 1.9rem; font-size: 0.95rem; }
.corr-explain { margin: 0.4rem 0 0 1.9rem; font-size: 0.92rem; color: var(--muted); font-weight: 600; }

/* --- Résultats & tableaux --------------------------------------------- */
.note-pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-weight: 900; font-size: 0.88rem; white-space: nowrap; }
.note-great { background: #dcfce7; color: #166534; }
.note-good { background: #e0f2fe; color: #075985; }
.note-ok { background: #fef9c3; color: #854d0e; }
.note-bad { background: #fee2e2; color: #991b1b; }
.note-none { background: var(--bg-2); color: var(--muted); }
.attempt-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.attempt-head h1 { font-size: 1.5rem; margin: 0; }
.attempt-head p { margin: 0; }
.attempt-head > div:nth-child(2) { flex: 1; }
.attempt-note .note-pill { font-size: 1.4rem; padding: 0.4rem 1rem; }
.empty-state { text-align: center; padding: 3rem 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.empty-icon { font-size: 3.5rem; }
.profile-preview { display: flex; align-items: center; gap: 1rem; }

/* --- Administration ------------------------------------------------------------ */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.stat-icon { font-size: 1.5rem; }
.stat-value { font-size: 1.8rem; font-weight: 900; line-height: 1.2; }
.stat-label { color: var(--muted); font-weight: 700; font-size: 0.88rem; }
.kid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.kid-card { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 0.8rem; border-top: 6px solid var(--mc); transition: transform 0.15s, box-shadow 0.15s; font-weight: 600; }
.kid-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kid-head { display: flex; align-items: center; gap: 0.8rem; }
.kid-name { font-size: 1.25rem; }
.kid-stats { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-weight: 800; font-size: 0.9rem; align-items: center; }
.kid-medals { display: flex; gap: 0.3rem; font-size: 1.35rem; flex-wrap: wrap; }
.kid-medals .dim { filter: grayscale(1); opacity: 0.35; }
.cell-off { opacity: 0.45; font-size: 0.8rem; }
.table tr.row-off td { color: var(--muted); opacity: 0.7; }
.track-switches { display: grid; gap: 0.7rem; margin: 0.6rem 0 0.4rem; }
.track-switch { padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); border: 2px solid var(--border); transition: opacity 0.15s, border-color 0.15s; }
.track-switch:hover { border-color: var(--accent); }
.track-switch.off { opacity: 0.55; border-style: dashed; }
.kid-diplomas { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.kid-diploma { padding: 0.15rem 0.6rem; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 0.85rem; font-weight: 800; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; width: 40px; height: 40px; font-size: 1.3rem; flex-shrink: 0; vertical-align: middle; }
.avatar.sm { width: 30px; height: 30px; font-size: 1rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.9rem; border-radius: 18px; }
.avatar.xl { width: 90px; height: 90px; font-size: 3rem; border-radius: 26px; }
.kid-link { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.matrix th .th-icon { font-size: 1.3rem; display: block; text-transform: none; }
.matrix th .th-label { display: block; font-size: 0.68rem; max-width: 90px; margin: 0 auto; text-transform: none; letter-spacing: 0; line-height: 1.2; }
.cell-note { display: inline-block; min-width: 2.6em; padding: 0.25rem 0.4rem; border-radius: 8px; font-weight: 900; }
.cell-reading { font-size: 0.8rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.activity-list li { display: flex; align-items: center; gap: 0.8rem; padding: 0.45rem 0.6rem; border-radius: 10px; flex-wrap: wrap; }
.activity-list li:hover { background: var(--bg); }
.act-who { font-weight: 900; min-width: 120px; }
.act-what { flex: 1; font-weight: 600; }
.user-header { display: flex; gap: 1.2rem; align-items: center; border-top: 6px solid var(--mc); flex-wrap: wrap; }
.user-header h1 { margin: 0; }
.user-header-text { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.user-header-text .widget-actions { justify-content: flex-start; margin-top: 0.5rem; }
.mini-progress { display: inline-block; width: 70px; height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; vertical-align: middle; }
.mini-progress > div { height: 100%; background: var(--accent); }
.row-actions { display: flex; gap: 0.3rem; }
.url-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.url-list code { font-size: 1.05rem; padding: 0.3rem 0.6rem; }

/* --- Dialogues & notifications --------------------------------------------- */
.dialog { border: 0; border-radius: var(--radius); padding: 0; box-shadow: var(--shadow-lg); width: min(460px, calc(100vw - 2rem)); color: var(--text); }
.dialog::backdrop { background: rgba(20, 25, 45, 0.45); backdrop-filter: blur(2px); }
.dialog-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.9rem; }
.dialog-body h3 { margin: 0; font-size: 1.3rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.4rem; }
#toasts { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.toast { background: #1e2640; color: #fff; padding: 0.7rem 1.2rem; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(12px); transition: all 0.3s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok { background: #15803d; }
.toast-error { background: #b91c1c; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

.track-count { margin-left: 0.6rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--bg-2); color: var(--muted); font-size: 0.8rem; font-weight: 800; vertical-align: middle; }

/* --- Parcours IA : activités -------------------------------------------------- */
/* Une image en nombres */
.pn-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(380px, 100%); aspect-ratio: 1; align-self: center; gap: 1px; background: #cbd5e1; border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden; }
.pn-cell { display: grid; place-items: center; min-width: 0; padding: 0; border: 0; font: 700 clamp(0.5rem, 2.3vw, 0.8rem) var(--mono); cursor: pointer; transition: background 0.3s; }
.pn-cell:hover { position: relative; z-index: 1; outline: 2px solid var(--mc); outline-offset: -2px; }

/* Dessine un chiffre */
.dd-layout { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 1rem 1.4rem; }
.dd-col { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.dd-canvas { width: 240px; height: 240px; max-width: 72vw; max-height: 72vw; background: #fff; border: 3px dashed color-mix(in srgb, var(--mc) 50%, white); border-radius: var(--radius-sm); touch-action: none; cursor: crosshair; }
.dd-label { font-weight: 800; font-size: 0.9rem; color: var(--muted); }
.dd-see { display: grid; grid-template-columns: repeat(8, 1fr); width: 128px; height: 128px; gap: 1px; background: #cbd5e1; border: 1px solid #cbd5e1; }
.dd-see i { background: #fff; transition: background 0.3s; }
.dd-guess { min-width: 10rem; text-align: center; font-weight: 700; }
.dd-big { font-size: 4.2rem; font-weight: 900; line-height: 1; color: var(--mc); }
.dd-bars { width: 13rem; display: flex; flex-direction: column; gap: 0.3rem; }
.dd-bars .nw-bar { grid-template-columns: 1.6em 1fr 3.2em; }
.dd-neighbors { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.dd-nrow { display: flex; gap: 1rem; }
.dd-n { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; font-weight: 900; }
.dd-mini { display: grid; grid-template-columns: repeat(8, 1fr); width: 52px; height: 52px; gap: 1px; background: #e2e8f0; border: 1px solid #cbd5e1; }
.dd-teach { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-align: center; }
.dd-teach[hidden] { display: none; }
.dd-digits { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
.dd-digits .btn { min-width: 2.5rem; font-weight: 900; }

/* Filtres de contours */
.ef-layout { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.8rem; }
.ef-layout figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.ef-layout figcaption { font-weight: 800; font-size: 0.85rem; color: var(--muted); }
.ef-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(220px, 40vw); aspect-ratio: 1; gap: 1px; background: #e2e8f0; border: 1px solid #cbd5e1; }
.ef-grid i { transition: background 0.35s; }
.ef-arrow { font-size: 1.6rem; color: var(--mc); font-weight: 900; }

/* Neurone */
.nr-layout { display: grid; grid-template-columns: minmax(0, 2.3fr) auto minmax(0, 1fr) auto minmax(0, 0.75fr); align-items: center; gap: 0.6rem; }
.nr-inputs { display: flex; flex-direction: column; gap: 0.5rem; }
.nr-row { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem; align-items: center; gap: 0.5rem; }
.nr-w input[type='range'] { min-width: 0; }
.nr-in { display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.6rem; font: inherit; font-weight: 800; font-size: 0.9rem; text-align: left; color: var(--muted); background: #fff; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.nr-in:disabled { cursor: default; }
.nr-in.on { color: var(--text); border-color: var(--mc); background: color-mix(in srgb, var(--mc) 10%, white); }
.nr-icon { font-size: 1.3rem; }
.nr-label { flex: 1; min-width: 0; }
.nr-val { font-family: var(--mono); font-size: 1.05rem; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 6px; background: var(--bg-2); }
.nr-in.on .nr-val { background: var(--mc); color: #fff; }
.nr-w { display: flex; flex-direction: column; gap: 0.15rem; }
.nr-w input { width: 100%; accent-color: var(--mc); }
.nr-wlabel { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.nr-wv { display: inline-block; min-width: 1.6em; margin-left: 0.2em; text-align: center; font-family: var(--mono); font-size: 1rem; color: var(--text); }
.nr-wv.pos { color: var(--ok); }
.nr-wv.neg { color: var(--bad); }
.nr-wv.flash { animation: nrFlash 0.9s ease-out; }
@keyframes nrFlash { 0% { background: #fde047; border-radius: 6px; transform: scale(1.5); } 100% { background: transparent; transform: scale(1); } }
.nr-arrow { font-size: 1.5rem; color: var(--mc); font-weight: 900; }
.nr-neuron { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.8rem 0.6rem; text-align: center; border-radius: 999px / 60%; background: color-mix(in srgb, var(--mc) 10%, white); border: 3px solid var(--mc); }
.nr-sigma { font-size: 1.8rem; font-weight: 900; color: var(--mc); line-height: 1; }
.nr-calc { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; overflow-wrap: anywhere; }
.nr-seuil { font-weight: 900; font-size: 0.85rem; padding: 0.15rem 0.5rem; border-radius: 999px; }
.nr-seuil.yes { background: var(--ok-bg); color: #166534; }
.nr-seuil.no { background: var(--bad-bg); color: #991b1b; }
.nr-verdict { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; text-align: center; font-weight: 900; padding: 0.5rem; border-radius: var(--radius-sm); }
.nr-verdict.yes { background: var(--ok-bg); color: #166534; }
.nr-verdict.no { background: var(--bad-bg); color: #991b1b; }
.nr-out-icon { font-size: 2.4rem; line-height: 1; }
.nr-out-text { font-size: 0.9rem; }
.nr-mission { font-weight: 800; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--mc) 8%, white); border: 2px dashed color-mix(in srgb, var(--mc) 40%, white); }
.nr-seuil-row { justify-content: center; }
.nr-seuil-row input[type='range'] { flex: 0 1 280px; accent-color: var(--mc); }
.tab.done::after { content: ' ✓'; }
.nr-truth td, .nr-truth th { padding: 0.35rem 0.6rem; }
.nr-truth tr.bad td { background: var(--bad-bg); }
.nt-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.nt-card { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.5rem 0.3rem; text-align: center; border-radius: var(--radius-sm); border: 2px solid var(--ok); background: var(--ok-bg); transition: transform 0.2s; }
.nt-card.wrong { border-color: var(--bad); background: var(--bad-bg); }
.nt-card.active { transform: scale(1.06); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mc) 40%, transparent); }
.nt-food { font-size: 1.5rem; line-height: 1.2; }
.nt-want { font-size: 0.8rem; font-weight: 800; }
.nt-guess { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.nt-score { text-align: center; font-weight: 900; }
.nt-score.ok { color: var(--ok); }

/* La souris qui apprend */
.rl-layout { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 1rem 1.5rem; }
.rl-board { position: relative; display: grid; grid-template-columns: repeat(var(--w), minmax(0, 1fr)); grid-template-rows: repeat(var(--h), minmax(0, 1fr)); width: min(320px, 82vw); aspect-ratio: var(--w) / var(--h); gap: 3px; padding: 3px; background: #cbd5e1; border-radius: var(--radius-sm); }
.rl-cell { position: relative; display: grid; place-items: center; background: #fff; border-radius: 6px; transition: background 0.3s; }
.rl-cell.wall { background: #94a3b8; }
.rl-item { font-size: clamp(1.2rem, 6vw, 1.9rem); }
.rl-arrow { position: absolute; right: 3px; bottom: 1px; font-size: 0.8rem; }
.rl-mouse { position: absolute; width: calc(100% / var(--w)); height: calc(100% / var(--h)); display: grid; place-items: center; font-size: clamp(1.3rem, 7vw, 2.1rem); transition: left 0.15s linear, top 0.15s linear; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25)); }
.rl-side { display: flex; flex-direction: column; gap: 0.5rem; width: min(300px, 100%); }
.rl-stats { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.rl-chart { display: flex; align-items: flex-end; gap: 2px; height: 70px; padding: 4px; background: var(--bg); border-radius: 8px; }
.rl-chart i { flex: 1; min-width: 3px; border-radius: 2px 2px 0 0; background: #94a3b8; }
.rl-chart i.cheese, .lg.cheese { background: #22c55e; }
.rl-chart i.trap, .lg.trap { background: #ef4444; }
.rl-chart i.lost, .lg.lost { background: #94a3b8; }
.lg { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 2px; vertical-align: middle; }
.rl-check { display: flex; align-items: center; gap: 0.3rem; font-weight: 700; }
.rl-side .slider-row input { flex: 1; accent-color: var(--mc); }

/* Du bruit à l'image */
.dn-layout { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.dn-canvas { width: min(256px, 70vw); aspect-ratio: 1; image-rendering: pixelated; border-radius: 10px; box-shadow: var(--shadow); }
.dn-status { font-weight: 800; color: var(--mc); min-height: 1.4em; text-align: center; }

/* Atelier du prompt */
.pb-row { display: flex; flex-direction: column; gap: 0.35rem; }
.pb-label { font-weight: 900; }
.pb-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pb-chips .chip { cursor: pointer; }
.pb-prompt { padding: 0.7rem 1rem; border-radius: var(--radius-sm); background: #1e2235; color: #e0e7ff; font-family: var(--mono); font-weight: 600; }
.pb-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; font-weight: 800; }
.pb-bar { display: flex; gap: 3px; }
.pb-bar i { width: 2.2rem; height: 0.6rem; border-radius: 999px; background: var(--bg-2); }
.pb-bar i.on { background: var(--mc); }
.pb-stage { position: relative; aspect-ratio: 16 / 9; width: min(100%, 520px); align-self: center; overflow: hidden; border-radius: var(--radius-sm); background: #e2e8f0; display: grid; place-items: center; }
.pb-empty { color: var(--muted); font-weight: 800; padding: 1rem; text-align: center; }
.pb-stage[data-place='space'] { background: radial-gradient(circle at 30% 30%, #312e81, #0f172a 70%); }
.pb-stage[data-place='sea'] { background: linear-gradient(#7dd3fc, #0369a1); }
.pb-stage[data-place='forest'] { background: linear-gradient(#bbf7d0, #166534); }
.pb-stage[data-place='city'] { background: linear-gradient(#fde68a, #94a3b8); }
.pb-subject { font-size: clamp(3.5rem, 14vw, 6rem); line-height: 1; z-index: 1; }
.pb-action { position: absolute; left: 58%; top: 52%; font-size: clamp(1.8rem, 7vw, 3rem); z-index: 2; }
.pb-decor { position: absolute; font-size: clamp(1.4rem, 5vw, 2.2rem); opacity: 0.85; }
.pb-decor.d0 { left: 8%; top: 12%; }
.pb-decor.d1 { right: 10%; top: 18%; }
.pb-decor.d2 { left: 14%; bottom: 10%; }
.pb-style-tag { position: absolute; right: 0.5rem; bottom: 0.5rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: rgba(255, 255, 255, 0.85); font-size: 0.8rem; font-weight: 800; z-index: 3; }
.pb-stage[data-style='cartoon'] .pb-subject, .pb-stage[data-style='cartoon'] .pb-action { filter: saturate(1.6) drop-shadow(3px 3px 0 #000); }
.pb-stage[data-style='water'] { filter: saturate(0.75) brightness(1.08); }
.pb-stage[data-style='water'] .pb-subject, .pb-stage[data-style='water'] .pb-action, .pb-stage[data-style='water'] .pb-decor { filter: blur(1px); opacity: 0.85; }
.pb-stage[data-style='pixel'] { background-blend-mode: normal; }
.pb-stage[data-style='pixel']::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(0, 0, 0, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.12) 1px, transparent 1px); background-size: 10px 10px; pointer-events: none; }
.pb-stage[data-style='pixel'] .pb-subject, .pb-stage[data-style='pixel'] .pb-action { filter: contrast(1.4) saturate(1.3); }
.pb-stage[data-style='photo'] { box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45); }
.pb-stage[data-style='photo'] .pb-subject { filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.45)); }
.pb-guessed { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; }
.pb-random { padding: 0.15rem 0.6rem; border-radius: 999px; border: 2px dashed #f59e0b; background: #fffbeb; font-size: 0.85rem; font-weight: 800; }

/* Simulateur de recommandations */
.rb-feed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.rb-tile { display: flex; flex-direction: column; gap: 0.3rem; padding: 0; font: inherit; text-align: left; color: var(--text); background: #fff; border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.rb-tile:hover { transform: translateY(-2px); border-color: var(--tc); }
.rb-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; font-size: 2.2rem; background: color-mix(in srgb, var(--tc) 22%, white); }
.rb-dur { position: absolute; right: 0.3rem; bottom: 0.3rem; padding: 0 0.35rem; border-radius: 4px; background: rgba(15, 23, 42, 0.8); color: #fff; font-size: 0.7rem; font-weight: 800; }
.rb-title { padding: 0 0.5rem; font-weight: 800; font-size: 0.88rem; line-height: 1.25; }
.rb-theme { padding: 0 0.5rem 0.5rem; font-size: 0.75rem; font-weight: 800; color: var(--tc); }
.rb-meter { padding: 0.5rem 0.8rem; border-radius: var(--radius-sm); background: var(--bg); }
.rb-meter.bubble { background: #fef3c7; border: 2px solid #f59e0b; }
.rb-bars { display: flex; flex-direction: column; gap: 0.3rem; }
@media (max-width: 760px) {
  .nr-layout { grid-template-columns: 1fr; }
  .nr-arrow { justify-self: center; transform: rotate(90deg); }
  .nt-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rb-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .nr-row { grid-template-columns: 1fr; }
}

/* --- Parcours « Les dangers d'Internet » : activités ------------------------------- */
/* Le détective de la photo */
.pc-counter { font-weight: 900; color: color-mix(in srgb, var(--mc) 75%, black); }
.pc-post { max-width: 560px; width: 100%; margin: 0 auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.pc-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.8rem; }
.pc-avatar { width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 50%; background: #fed7aa; font-size: 1.2rem; }
.pc-who { display: flex; flex-direction: column; line-height: 1.25; font-weight: 800; font-size: 0.92rem; }
.pc-who .pc-text:last-child { font-weight: 600; color: var(--muted); font-size: 0.82rem; }
.pc-photo { display: block; width: 100%; height: auto; }
.pc-caption { padding: 0.55rem 0.8rem 0.7rem; font-size: 0.92rem; }
.pc-spot, .pc-decoy { cursor: pointer; }
.pc-text.pc-spot { border-radius: 6px; padding: 0 0.15rem; transition: background 0.15s; }
.pc-text.pc-spot:hover { background: #fef9c3; }
.pc-text.found { background: #fee2e2; box-shadow: 0 0 0 2px #ef4444; }
g.pc-spot:hover, g.pc-decoy:hover, text.pc-decoy:hover { filter: brightness(1.12); }
.pc-ring { fill: none; stroke: #ef4444; stroke-width: 4; stroke-dasharray: 6 4; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.pc-ring.on { opacity: 1; }
.pc-safe { display: none; pointer-events: none; }
.pc-post.safe .pc-safe { display: inline; }
.pc-post.safe .pc-ring { opacity: 0; }
.pc-post.safe .pc-text.found { background: #dcfce7; box-shadow: 0 0 0 2px #16a34a; }
.pc-hint { animation: pcHint 0.5s ease-in-out 3; }
@keyframes pcHint { 50% { filter: drop-shadow(0 0 8px #facc15) brightness(1.3); background: #fef08a; } }
.pc-found { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.92rem; }
.pc-found:empty { display: none; }

/* Une photo qui fait le tour */
.sp-stage { position: relative; max-width: 520px; width: 100%; margin: 0 auto; border-radius: var(--radius-sm); background: radial-gradient(circle at 50% 50%, #fff7ed, #f8fafc 70%); border: 1px solid var(--border); }
.sp-svg { display: block; width: 100%; height: auto; }
.sp-edge { stroke: #e2e8f0; stroke-width: 1.5; transition: stroke 0.4s; }
.sp-edge.lit { stroke: #fb923c; }
.sp-node circle { fill: #e2e8f0; stroke: #fff; stroke-width: 2; transition: fill 0.4s; }
.sp-node.r0 circle { fill: #fde68a; }
.sp-node.lit circle { fill: #f97316; }
.sp-node.r0.lit circle { fill: #fbbf24; }
.sp-node.gone circle { fill: #cbd5e1; }
.sp-node.pop { transform-box: fill-box; transform-origin: center; animation: pop 0.5s ease-out; }
.sp-extra { font-size: 13px; font-weight: 800; fill: #c2410c; }
.sp-counter { position: absolute; top: 0.5rem; left: 0.6rem; padding: 0.2rem 0.7rem; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-weight: 900; font-size: 0.9rem; }
.sp-counter.big { background: #fee2e2; color: #b91c1c; }

/* Conversation simulée */
.ch-phone { max-width: 460px; width: 100%; margin: 0 auto; border-radius: 22px; border: 6px solid #1f2937; background: #f1f5f9; overflow: hidden; box-shadow: var(--shadow-lg); }
.ch-top { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.8rem; background: #1f2937; color: #fff; }
.ch-app { font-size: 0.75rem; color: #cbd5e1; font-weight: 600; }
.ch-thread { display: flex; flex-direction: column; gap: 0.45rem; height: 300px; overflow-y: auto; padding: 0.8rem 0.7rem; scroll-behavior: smooth; }
.ch-row { display: flex; align-items: flex-end; gap: 0.4rem; max-width: 88%; animation: pop 0.25s ease-out; }
.ch-row.out { align-self: flex-end; }
.ch-avatar { flex: none; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; background: #e2e8f0; font-size: 1.05rem; }
.ch-avatar.big { width: 2.3rem; height: 2.3rem; font-size: 1.3rem; background: #374151; }
.ch-bubble { padding: 0.45rem 0.75rem; border-radius: 16px 16px 16px 4px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); font-size: 0.95rem; line-height: 1.35; }
.ch-row.out .ch-bubble { border-radius: 16px 16px 4px 16px; background: var(--mc); color: #fff; }
.ch-name { font-size: 0.75rem; font-weight: 900; }
.ch-system { align-self: center; padding: 0.25rem 0.8rem; border-radius: 999px; background: #e2e8f0; color: #334155; font-size: 0.82rem; font-weight: 800; }
.ch-dots { display: inline-flex; gap: 3px; }
.ch-dots i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: chDot 1s infinite; }
.ch-dots i:nth-child(2) { animation-delay: 0.15s; }
.ch-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chDot { 50% { transform: translateY(-4px); opacity: 0.5; } }
.ch-panel { display: flex; flex-direction: column; gap: 0.6rem; }
.ch-prompt { font-weight: 900; }
.ch-choices { display: grid; gap: 0.45rem; }
.ch-choice { font: inherit; font-weight: 700; text-align: left; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); border: 2px solid var(--border); background: #fff; color: var(--text); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.ch-choice:hover:not(:disabled) { border-color: var(--mc); }
.ch-choice.action { border-style: dashed; }
.ch-choice.right { border-color: var(--ok); background: var(--ok-bg); color: #14532d; }
.ch-choice.wrong { border-color: var(--bad); background: var(--bad-bg); color: #991b1b; text-decoration: line-through; }
.ch-choice:disabled { cursor: default; }
.ch-coach { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); font-weight: 600; }
.ch-coach.ok { background: var(--ok-bg); color: #14532d; }
.ch-coach.ko { background: var(--bad-bg); color: #991b1b; }
.ch-owl { font-size: 1.6rem; line-height: 1; }

/* Cartes à juger */
.vc-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.vc-progress { padding: 0.15rem 0.7rem; border-radius: 999px; background: var(--bg-2); color: var(--muted); font-size: 0.85rem; font-weight: 800; }
.vc-stage { display: flex; flex-direction: column; gap: 0.8rem; }
.vc-mock { max-width: 520px; width: 100%; margin: 0 auto; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); background: #fff; border: 1px solid var(--border); animation: pop 0.35s ease-out; }
.vc-big { font-weight: 900; font-size: 1.1rem; line-height: 1.25; }
.vc-mock p { margin: 0.35rem 0 0; }
.vc-fake-btn { display: inline-block; margin-top: 0.6rem; padding: 0.45rem 1rem; border-radius: 999px; background: #16a34a; color: #fff; font-weight: 900; font-size: 0.9rem; }
.vc-popup { border: 3px solid #ef4444; }
.vc-popup-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.7rem; background: #ef4444; color: #fff; font-weight: 800; font-size: 0.85rem; }
.vc-popup-bar .vc-x { margin-left: auto; opacity: 0.8; }
.vc-popup-body { padding: 1rem; text-align: center; background: repeating-linear-gradient(45deg, #fffbeb 0 14px, #fef3c7 14px 28px); }
.vc-popup .vc-big { color: #b91c1c; font-size: 1.35rem; }
.vc-timer { margin-top: 0.5rem; font-weight: 900; color: #b91c1c; }
.vc-popup .vc-fake-btn { background: #dc2626; animation: vcPulse 1.2s infinite; }
@keyframes vcPulse { 50% { transform: scale(1.06); } }
.vc-msg { background: #f8fafc; padding: 0.8rem; }
.vc-msg-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.vc-msg-av { width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border-radius: 50%; background: #e0e7ff; font-size: 1.25rem; }
.vc-sub { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.vc-msg-bubble { padding: 0.6rem 0.85rem; border-radius: 16px 16px 16px 4px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.vc-msg.sms .vc-msg-bubble { background: #e2e8f0; }
.vc-link { margin-top: 0.35rem; color: #2563eb; text-decoration: underline; font-weight: 700; word-break: break-all; }
.vc-ad { position: relative; display: flex; align-items: center; gap: 1rem; padding: 1rem; background: linear-gradient(135deg, #ede9fe, #fce7f3); }
.vc-ad-tag { position: absolute; top: 0.4rem; right: 0.6rem; font-size: 0.7rem; color: var(--muted); font-weight: 800; }
.vc-ad-emoji { font-size: 3rem; line-height: 1; }
.vc-url { display: flex; gap: 0.4rem; align-items: center; padding: 0.4rem 0.7rem; background: #e2e8f0; font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }
.vc-site-body { padding: 0.9rem 1rem; }
.vc-news-src { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.45rem 0.9rem; background: #0f172a; color: #fff; font-size: 0.85rem; }
.vc-news-src span { color: #cbd5e1; }
.vc-news-body { display: flex; gap: 0.9rem; align-items: center; padding: 0.9rem 1rem; }
.vc-news-img { flex: none; width: 4.5rem; height: 4.5rem; display: grid; place-items: center; border-radius: 10px; background: #e0f2fe; font-size: 2.6rem; }
.vc-tools { display: flex; flex-direction: column; gap: 0.4rem; max-width: 520px; width: 100%; margin: 0 auto; }
.vc-tools-title { font-weight: 800; font-size: 0.9rem; color: var(--muted); }
.vc-tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.vc-clue { flex: 1; min-width: 200px; padding: 0.35rem 0.7rem; border-radius: 10px; background: #fef9c3; font-size: 0.9rem; font-weight: 600; }
.vc-answers { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.vc-answer { min-width: 11rem; }
.vc-answer.right { background: var(--ok-bg); border-color: var(--ok); color: #14532d; opacity: 1; }
.vc-answer.wrong { background: var(--bad-bg); border-color: var(--bad); color: #991b1b; opacity: 1; }

/* Ma journée équilibrée */
.sd-bar { display: flex; height: 2.4rem; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.sd-bar span { display: grid; place-items: center; min-width: 0; overflow: hidden; color: #fff; font-size: 1rem; transition: flex 0.25s; }
.sd-bar .sd-free { background: repeating-linear-gradient(45deg, #f1f5f9 0 8px, #e2e8f0 8px 16px); color: var(--muted); font-weight: 900; }
.sd-total { font-weight: 900; }
.sd-total.ok { color: var(--ok); }
.sd-total.ko { color: var(--warn); }
.sd-rows { display: grid; gap: 0.35rem; }
.sd-row { display: grid; grid-template-columns: 0.8rem minmax(0, 1fr) 2.2rem 3.4rem 2.2rem; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem; border-radius: 10px; }
.sd-row:hover { background: var(--bg); }
.sd-dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; }
.sd-label { font-weight: 700; }
.sd-val { text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; }
.sd-row .btn { padding: 0.2rem 0; font-size: 1rem; font-weight: 900; }
.sd-lock { text-align: center; }
.sd-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.92rem; }
.sd-rules li.ok { color: #15803d; }
.sd-rules li.ko { color: #b45309; }

/* Le piège de la vidéo suivante */
.at-phone { position: relative; max-width: 360px; width: 100%; margin: 0 auto; border-radius: 24px; border: 7px solid #111827; background: #0f172a; color: #fff; overflow: hidden; box-shadow: var(--shadow-lg); }
.at-top { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.9rem; background: #dc2626; }
.at-clock { font-weight: 800; font-variant-numeric: tabular-nums; }
.at-screen { min-height: 250px; display: grid; place-items: center; padding: 1rem; }
.at-home, .at-video, .at-next { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; width: 100%; text-align: center; }
.at-thumb { width: 100%; max-width: 260px; aspect-ratio: 16 / 9; display: grid; place-items: center; border-radius: 12px; background: #1e293b; font-size: 3.4rem; }
.at-thumb.playing { animation: atWobble 1.2s ease-in-out infinite; }
@keyframes atWobble { 50% { transform: scale(1.04) rotate(-1deg); } }
.at-title { font-weight: 800; }
.at-progress { width: 100%; max-width: 260px; height: 6px; border-radius: 999px; background: #334155; overflow: hidden; }
.at-progress-fill { height: 100%; background: #ef4444; transform-origin: left center; transform: scaleX(0); }
.at-next-label { font-size: 0.95rem; color: #cbd5e1; }
.at-next-label strong { color: #fff; font-size: 1.2rem; }
.at-next-actions { display: flex; align-items: center; gap: 1rem; }
.at-cancel { font: inherit; font-size: 0.72rem; color: #94a3b8; background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 0.2rem; }
.at-notif { position: absolute; top: 2.8rem; left: 0.6rem; right: 0.6rem; z-index: 2; padding: 0.5rem 0.7rem; border-radius: 12px; background: rgba(255, 255, 255, 0.95); color: #111827; font-size: 0.85rem; font-weight: 800; box-shadow: var(--shadow-lg); animation: pop 0.3s ease-out; }
.at-stats { font-weight: 800; }

/* Une partie en ligne simulée */
.gl-game { max-width: 640px; width: 100%; margin: 0 auto; border-radius: 16px; border: 4px solid #1f2937; background: #111827; color: #e5e7eb; overflow: hidden; box-shadow: var(--shadow-lg); }
.gl-top { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.45rem 0.9rem; background: linear-gradient(90deg, #15803d, #0e7490); color: #fff; }
.gl-game-name { font-weight: 900; }
.gl-mode { font-size: 0.75rem; font-weight: 700; opacity: 0.85; }
.gl-score { padding: 0.15rem 0.7rem; border-radius: 999px; background: rgba(0, 0, 0, 0.35); font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gl-scene { display: flex; justify-content: space-between; align-items: flex-end; height: 58px; padding: 0 1.2rem 0.15rem; background: linear-gradient(#38bdf8, #bae6fd 68%, #4ade80 68%); font-size: 2rem; line-height: 1; }
.gl-field { font-size: 1.25rem; letter-spacing: 0.3rem; padding-bottom: 0.2rem; }
.gl-body { display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); }
.gl-side { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.6rem; background: #1f2937; }
.gl-side-title { font-size: 0.72rem; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; color: #9ca3af; }
.gl-team { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.gl-player { display: flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.4rem; border-radius: 10px; background: #111827; font-size: 0.85rem; font-weight: 800; transition: opacity 0.2s; }
.gl-player.blocked { opacity: 0.45; }
.gl-player.blocked .gl-pname { text-decoration: line-through; }
.gl-team-dot { font-size: 0.6rem; }
.gl-av { flex: none; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 50%; font-size: 1rem; }
.gl-pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.gl-pname { overflow-wrap: anywhere; }
.gl-pname small { color: #9ca3af; font-weight: 700; }
.gl-flags { display: flex; gap: 0.15rem; font-size: 0.75rem; }
.gl-player.talking .gl-mic { display: inline-block; animation: glTalk 0.4s ease-in-out infinite alternate; }
@keyframes glTalk { to { transform: scale(1.4); } }
.gl-log { display: flex; flex-direction: column; gap: 0.3rem; height: 270px; overflow-y: auto; padding: 0.6rem 0.8rem; font-size: 0.92rem; line-height: 1.35; scroll-behavior: smooth; }
.gl-line { animation: pop 0.25s ease-out; overflow-wrap: anywhere; }
.gl-name { font-weight: 900; }
.gl-line.sys { align-self: flex-start; padding: 0.15rem 0.6rem; border-radius: 8px; background: #374151; color: #fde68a; font-size: 0.82rem; font-weight: 800; }
.gl-line.voice { padding: 0.35rem 0.6rem; border-radius: 10px; border-left: 4px solid #ef4444; background: #450a0a; animation: shake 0.35s ease-in-out 2; }
.gl-voice-tag { margin-right: 0.4rem; padding: 0 0.4rem; border-radius: 6px; background: #ef4444; color: #fff; font-size: 0.72rem; font-weight: 900; }
.gl-shout { font-weight: 900; color: #fecaca; }
.gl-line.me { padding: 0.2rem 0.5rem; border-radius: 8px; background: #172554; }
.gl-line.hidden, .gl-line.typing { color: #9ca3af; font-size: 0.82rem; font-style: italic; }
@media (max-width: 640px) {
  .gl-body { grid-template-columns: 1fr; }
  .gl-team { flex-direction: row; flex-wrap: wrap; }
  .gl-player { flex: 1 1 45%; min-width: 0; }
  .gl-log { height: 250px; }
  .gl-scene { height: 48px; font-size: 1.6rem; }
}
@media (max-width: 640px) {
  .sd-row { grid-template-columns: 0.7rem minmax(0, 1fr) 2rem 3rem 2rem; gap: 0.35rem; font-size: 0.9rem; }
  .ch-thread { height: 260px; }
  .vc-answer { min-width: 0; flex: 1 1 9rem; }
}

/* --- Programmer pour de vrai : la tortue à blocs ---------------------------------- */
.pg-goal { padding: 0.7rem 1rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--mc) 9%, white); border-left: 5px solid var(--mc); font-weight: 700; }
.pg-palette { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem 0.8rem; border-radius: var(--radius-sm); background: var(--bg); border: 2px dashed transparent; transition: border-color 0.15s, background 0.15s; }
.pg-palette.trash { border-color: var(--bad); background: var(--bad-bg); }
.pg-palette.trash::after { content: '🗑️ Lâche le bloc ici pour le supprimer'; font-weight: 800; color: var(--bad); text-align: center; }
.pg-cat { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.pg-cat-label { min-width: 7.5rem; color: var(--muted); font-size: 0.82rem; font-weight: 800; }
.pg-block { --bc: #4c97ff; --bd: #3373cc; color: #fff; background: var(--bc); border-radius: 9px; border-bottom: 3px solid var(--bd); font-weight: 800; font-size: 0.92rem; line-height: 1.3; user-select: none; -webkit-user-select: none; }
.pg-block.cat-move { --bc: #4c97ff; --bd: #3373cc; }
.pg-block.cat-loop { --bc: #f59e0b; --bd: #c27c08; }
.pg-block.cat-pen { --bc: #0fbd8c; --bd: #0b8e69; }
.pg-block.cat-look { --bc: #9966ff; --bd: #774dcb; }
.pg-block.cat-var { --bc: #e0457b; --bd: #b8325f; }
.pg-pal { font: inherit; font-weight: 800; font-size: 0.88rem; padding: 0.4rem 0.75rem; border-top: 0; border-left: 0; border-right: 0; cursor: grab; touch-action: none; transition: transform 0.1s, filter 0.1s; }
.pg-pal:hover { transform: translateY(-1px); filter: brightness(1.07); }
.pg-pal:active { cursor: grabbing; }
.pg-pal:focus-visible { outline: 3px solid color-mix(in srgb, var(--bc) 45%, transparent); outline-offset: 2px; }
.pg-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 1rem; align-items: start; }
.pg-col { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.pg-script { min-height: 19rem; padding: 0.8rem; border-radius: var(--radius-sm); border: 2px solid var(--border); background-color: #fbfcff; background-image: radial-gradient(#dfe5f2 1.2px, transparent 1.2px); background-size: 18px 18px; overflow-x: auto; }
.pg-hat { display: inline-block; padding: 0.55rem 0.9rem 0.45rem; border-radius: 18px 18px 8px 8px; background: #ffbf00; border-bottom: 3px solid #cc9900; color: #3f2d00; font-weight: 900; font-size: 0.92rem; user-select: none; }
.pg-list { display: flex; flex-direction: column; align-items: flex-start; }
.pg-slot { align-self: stretch; min-height: 0.55rem; margin: 1px 0; border-radius: 6px; cursor: pointer; transition: background 0.12s; }
.pg-slot:hover { background: color-mix(in srgb, var(--mc) 12%, transparent); }
.pg-slot.cursor { display: flex; align-items: center; min-height: 1.7rem; padding: 0 0.6rem; border: 2px dashed color-mix(in srgb, var(--mc) 55%, white); background: color-mix(in srgb, var(--mc) 6%, white); color: color-mix(in srgb, var(--mc) 80%, black); font-size: 0.8rem; font-weight: 800; }
.pg-slot.drop { min-height: 1.7rem; background: color-mix(in srgb, var(--mc) 30%, white); box-shadow: inset 0 0 0 2px var(--mc); }
.pg-script .pg-block { min-width: 12.5rem; max-width: 100%; padding: 0.3rem 0.35rem 0.3rem 0.65rem; cursor: grab; transition: box-shadow 0.12s, opacity 0.12s; }
.pg-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; min-height: 1.9rem; touch-action: none; }
.pg-line input.pg-num, .pg-line input.pg-text, .pg-line select.pg-color { width: auto; padding: 0.12em 0.45em; border: 0; border-radius: 999px; background: #fff; color: var(--text); font-weight: 800; font-size: 0.9rem; text-align: center; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); }
.pg-line input.pg-num { width: 4.4em; }
.pg-line input.pg-text { width: 8.5em; text-align: left; }
.pg-line select.pg-color { padding-right: 0.3em; }
.pg-line input:focus, .pg-line select:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6); }
.pg-del { flex: none; width: 1.55rem; height: 1.55rem; margin-left: auto; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.22); color: #fff; font: inherit; font-size: 0.75rem; font-weight: 900; cursor: pointer; }
.pg-del:hover { background: rgba(0, 0, 0, 0.25); }
.pg-block.container { padding-bottom: 0; }
.pg-mouth { margin: 0.25rem 0 0 0.5rem; padding: 0.15rem 0.45rem 0.25rem; min-height: 2.2rem; border-radius: 7px 0 0 7px; background: color-mix(in srgb, #fff 84%, var(--bc)); }
.pg-foot { height: 0.75rem; }
.pg-block.running { box-shadow: 0 0 0 3px #facc15, 0 0 14px 3px rgba(250, 204, 21, 0.75); }
.pg-block.dragging { opacity: 0.35; }
.pg-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: 0.92; padding: 0.35rem 0.7rem; transform: rotate(2deg); box-shadow: var(--shadow-lg); }
.pg-ghost.trash { filter: grayscale(0.7); opacity: 0.6; }
.pg-canvas { display: block; width: 100%; max-width: 400px; aspect-ratio: 1; margin: 0 auto; border: 2px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.pg-col .widget-actions select.pg-speed { width: auto; padding: 0.4em 0.6em; }
.pg-tools { justify-content: flex-start; }
.pg-py { border-radius: var(--radius-sm); background: #0f172a; color: #e2e8f0; overflow: hidden; }
.pg-py summary { padding: 0.6rem 0.9rem; cursor: pointer; font-weight: 800; color: #fff; background: #1e293b; }
.pg-pycode { margin: 0; padding: 0.8rem 1rem; overflow-x: auto; font-family: var(--mono); font-size: 0.92rem; line-height: 1.55; white-space: pre; tab-size: 4; }
.pg-py .muted { padding: 0 1rem 0.8rem; color: #94a3b8; }
.py-kw { color: #c084fc; font-weight: 700; }
.py-str { color: #86efac; }
.py-num { color: #fdba74; }
.py-com { color: #94a3b8; font-style: italic; }
@media (max-width: 820px) {
  .pg-layout { grid-template-columns: 1fr; }
  .pg-cat-label { min-width: 0; flex-basis: 100%; }
}
@media (pointer: coarse) {
  .pg-slot { min-height: 1.05rem; } /* plus facile à toucher du doigt entre deux blocs */
  /* Écran tactile : des zones plus grandes pour le doigt, sans changer la mise en page. */
  .vbar .vseg { height: 2.6rem; margin-block: -0.5rem; }
  .back-link { padding-block: 0.55rem; margin-block: -0.55rem; }
  input[type='range'] { min-height: 2rem; }
}
@media (max-width: 640px) {
  .widget.widget-blockCode { padding: 0.8rem; }
  .pg-palette { padding: 0.6rem; }
  .pg-pal { padding: 0.35rem 0.6rem; font-size: 0.82rem; }
  .pg-script { padding: 0.5rem; }
  .pg-script .pg-block { min-width: 0; padding-left: 0.5rem; }
  .pg-mouth { margin-left: 0.25rem; padding: 0.15rem 0.3rem 0.25rem; }
  .pg-line { gap: 0.3rem; }
  .pg-line input.pg-num { width: 3.6em; }
  .pg-line input.pg-text { width: 7em; }
}

/* --- Diplômes ------------------------------------------------------------------- */
.dip-strip { display: flex; align-items: center; gap: 0.8rem; margin: -0.3rem 0 1rem; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); border: 2px dashed var(--border); background: var(--card); color: var(--text); text-decoration: none; font-weight: 700; transition: border-color 0.15s; }
.dip-strip:hover { border-color: #f59e0b; }
.dip-strip.earned { border: 2px solid #f59e0b; background: linear-gradient(90deg, #fffbeb, #fef3c7); }
.dip-strip-icon { flex: none; font-size: 1.6rem; line-height: 1; }
.dip-strip:not(.earned) .dip-strip-icon { filter: grayscale(1); opacity: 0.7; }
.dip-strip-text { flex: 1; min-width: 0; }
.dip-strip-bar { flex: none; width: 90px; height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.dip-strip-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f59e0b, #eab308); }
.dip-strip.dip-new { margin: 0.9rem 0 0; animation: pop 0.6s ease-out both; }
.dip-list { display: grid; gap: 0.7rem; }
.dip-card { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 1rem; border-radius: var(--radius-sm); border: 2px solid var(--border); background: var(--card); color: var(--text); text-decoration: none; transition: border-color 0.15s; }
.dip-card:hover { border-color: #f59e0b; }
.dip-card.earned { border-color: #f59e0b; background: linear-gradient(90deg, #fffbeb, var(--card)); }
.dip-card-icon { position: relative; flex: none; font-size: 2.2rem; line-height: 1; }
.dip-card:not(.earned) .dip-card-icon { filter: grayscale(1); opacity: 0.7; }
.dip-card-lock { position: absolute; right: -0.45rem; bottom: -0.3rem; font-size: 1rem; }
.dip-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.dip-card .mini-progress { width: 140px; margin-top: 0.25rem; }
.dip-card .mini-progress > span { display: block; height: 100%; background: #f59e0b; }

.diploma-page { display: flex; flex-direction: column; gap: 1rem; }
.dip-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dip-tip { margin: -0.4rem 0 0; }
.dip-status h2 { margin-bottom: 0.4rem; }
.dip-checklist { list-style: none; margin: 0.7rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 0.45rem 1.2rem; }
.dip-checklist li { display: flex; align-items: center; gap: 0.3rem; font-weight: 700; }
.dip-checklist li.ok { color: var(--ok); }
.dip-checklist .btn { margin-left: auto; }
.dip-scroll { overflow-x: auto; padding: 0.2rem 0.2rem 1rem; }

/* La feuille : A4 paysage. Les tailles sont en cqw (% de la largeur de la feuille) pour s'adapter à l'écran comme au papier. */
.diploma { position: relative; container-type: inline-size; width: 100%; min-width: 720px; max-width: 1060px; margin: 0 auto; aspect-ratio: 297 / 210; overflow: hidden; border-radius: 6px; box-shadow: var(--shadow-lg); color: #1f2937; line-height: 1.25; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.diploma-page.preview .diploma { filter: grayscale(0.6); }
.diploma-page.preview .diploma::after { content: 'À décrocher !'; position: absolute; inset: 0; display: grid; place-items: center; transform: rotate(-16deg); color: rgba(220, 38, 38, 0.32); font-size: 9cqw; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; pointer-events: none; }
.dip-frame { position: absolute; inset: 2.2cqw; display: flex; flex-direction: column; align-items: center; }
.dip-number { font-size: 1.15cqw; font-weight: 800; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; opacity: 0.75; }
/* Les cases des modules : `--cols` par ligne, et la dernière ligne incomplète est centrée. */
.dip-mods { --cols: 4; --gap: 0.7cqw; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.dip-mods > .dip-mod { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 0; }
.dip-mod { display: flex; align-items: center; gap: 0.7cqw; padding: 0.7cqw 0.9cqw; border-radius: 0.8cqw; background: rgba(255, 255, 255, 0.85); border: 0.15cqw solid color-mix(in srgb, var(--mc) 45%, white); font-size: 1.25cqw; }
.dip-mod.todo { opacity: 0.45; }
.dip-mod-icon { flex: none; font-size: 2.2cqw; line-height: 1; }
.dip-mod-title { flex: 1; min-width: 0; font-weight: 800; line-height: 1.15; }
.dip-mod-note { flex: none; font-weight: 900; color: color-mix(in srgb, var(--mc) 75%, black); }
.dip-signs { display: flex; gap: 3cqw; }
.dip-sign { display: flex; flex-direction: column; align-items: center; gap: 0.4cqw; color: #6b7280; font-size: 1.15cqw; font-weight: 700; }
.dip-line { display: block; width: 17cqw; height: 4.2cqw; border-bottom: 0.15cqw solid #9ca3af; }
.dip-name, .permis-name { font-family: 'Dancing Script', 'Segoe Script', 'Brush Script MT', cursive; font-weight: 700; }

/* Diplôme des bases : parchemin, bleu marine et or */
.dip-bases { background: radial-gradient(circle at 50% 40%, #fffdf6 0, #fdf6e3 65%, #f6e7bf 100%); }
.dip-bases::before { content: ''; position: absolute; inset: 1cqw; border: 0.55cqw solid #1e3a8a; border-radius: 0.6cqw; pointer-events: none; }
.dip-bases .dip-frame { padding: 1.4cqw 3cqw 1.2cqw; border: 0.2cqw solid #ca8a04; border-radius: 0.4cqw; }
.dip-corner { position: absolute; color: #ca8a04; font-size: 2.4cqw; line-height: 1; }
.dip-corner.tl { top: 0.5cqw; left: 0.8cqw; }
.dip-corner.tr { top: 0.5cqw; right: 0.8cqw; }
.dip-corner.bl { bottom: 0.5cqw; left: 0.8cqw; }
.dip-corner.br { bottom: 0.5cqw; right: 0.8cqw; }
.dip-top { align-self: stretch; display: flex; align-items: center; justify-content: space-between; padding: 0 1.4cqw; }
.dip-brand { display: inline-flex; align-items: center; gap: 0.6cqw; color: #1e3a8a; font-size: 1.5cqw; font-weight: 800; }
.dip-brand img { width: 2.6cqw; height: 2.6cqw; }
.dip-bases .dip-number { color: #1e3a8a; }
.dip-title { margin-top: 0.2cqw; padding-left: 0.22em; color: #a16207; font-size: 6.8cqw; font-weight: 900; line-height: 1; letter-spacing: 0.22em; text-transform: uppercase; text-shadow: 0 0.18cqw 0 #fde68a; }
.dip-subtitle { margin-top: 0.5cqw; color: #1e3a8a; font-size: 2.5cqw; font-weight: 800; }
.dip-awarded { margin-top: 2cqw; color: #6b7280; font-size: 1.6cqw; font-weight: 700; font-style: italic; }
.dip-name { max-width: 100%; padding: 0 2.5cqw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-bottom: 0.15cqw solid #ca8a04; color: #1e3a8a; font-size: 6.8cqw; line-height: 1.2; }
.dip-text { max-width: 72cqw; margin-top: 1.4cqw; text-align: center; font-size: 1.75cqw; font-weight: 600; }
.dip-mention { margin: 1.4cqw 0 1.8cqw; padding: 0.5cqw 2.2cqw; border-radius: 999px; background: #1e3a8a; color: #fff; font-size: 1.9cqw; font-weight: 900; }
.dip-mention.plain { background: none; color: #15803d; }
.dip-bottom { align-self: stretch; margin-top: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 2cqw; padding: 0 1cqw; }
.dip-bottom .dip-signs { justify-self: end; }
.dip-date { padding-bottom: 1.4cqw; color: #1e3a8a; font-size: 1.6cqw; font-weight: 800; }
.dip-seal { flex: none; width: 10.5cqw; height: 10.5cqw; display: grid; place-content: center; justify-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 60%, #b45309); box-shadow: 0 0 0 0.45cqw #fef3c7, 0 0 0 0.7cqw #d97706; color: #78350f; transform: rotate(-8deg); }
.dip-seal span { font-size: 4.4cqw; line-height: 1; }
.dip-seal small { font-size: 1.15cqw; font-weight: 900; letter-spacing: 0.08em; }

/* Brevet du surfeur averti : même mise en page, couleurs de l'océan, vagues au fond */
.dip-surf { background: repeating-radial-gradient(circle at 50% 190%, transparent 0 2.4cqw, rgba(14, 116, 144, 0.06) 2.4cqw 2.9cqw), radial-gradient(circle at 50% 35%, #f5feff 0, #e0f7fa 60%, #c3ecf2 100%); }
.dip-surf::before { border-color: #0e7490; }
.dip-surf .dip-frame { border-color: #22d3ee; }
.dip-surf .dip-corner { color: #0891b2; }
.dip-surf .dip-brand, .dip-surf .dip-number, .dip-surf .dip-subtitle, .dip-surf .dip-name, .dip-surf .dip-date { color: #0e7490; }
.dip-surf .dip-title { color: #0e7490; text-shadow: 0 0.18cqw 0 #a5f3fc; }
.dip-surf .dip-name { border-bottom-color: #22d3ee; }
.dip-surf .dip-mention { background: #0e7490; }
.dip-surf .dip-seal { background: radial-gradient(circle at 35% 30%, #cffafe, #22d3ee 55%, #0e7490); box-shadow: 0 0 0 0.45cqw #ecfeff, 0 0 0 0.7cqw #0891b2; color: #083344; }

/* Permis IA : une carte façon permis de conduire, violet et rose */
.dip-ia { background: repeating-radial-gradient(circle at 15% 110%, rgba(124, 58, 237, 0.06) 0 0.5cqw, transparent 0.5cqw 1.1cqw), linear-gradient(135deg, #fdf2f8 0%, #f5f3ff 55%, #eef2ff 100%); }
.dip-ia::before { content: ''; position: absolute; inset: 1cqw; border: 0.35cqw solid #7c3aed; border-radius: 2.4cqw; pointer-events: none; }
.dip-ia .dip-frame { align-items: stretch; gap: 1.5cqw; padding: 0 1.6cqw 1cqw; }
.permis-band { display: flex; align-items: center; gap: 1.4cqw; margin: 0 -1.6cqw; padding: 1.4cqw 2.4cqw; border-radius: 1.6cqw 1.6cqw 0 0; background: linear-gradient(90deg, #7c3aed, #c026d3 60%, #db2777); color: #fff; }
.permis-flag { font-size: 4.4cqw; line-height: 1; }
.permis-head { flex: 1; display: flex; flex-direction: column; gap: 0.3cqw; }
.permis-title { font-size: 4.6cqw; font-weight: 900; line-height: 1; letter-spacing: 0.12em; text-transform: uppercase; }
.permis-sub { font-size: 1.45cqw; font-weight: 700; opacity: 0.92; }
.permis-body { display: flex; align-items: center; gap: 2.6cqw; padding: 0.4cqw 1cqw 0; }
.permis-photo { flex: none; width: 15cqw; height: 18.5cqw; display: grid; place-items: center; border-radius: 1.3cqw; font-size: 10cqw; line-height: 1; box-shadow: inset 0 0 0 0.3cqw rgba(255, 255, 255, 0.6), 0 0.4cqw 1cqw rgba(76, 29, 149, 0.25); }
.permis-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.8cqw; }
.pf { display: grid; grid-template-columns: 2.6cqw 12cqw minmax(0, 1fr); align-items: baseline; gap: 0.6cqw; padding-bottom: 0.55cqw; border-bottom: 0.1cqw dashed #c4b5fd; font-size: 1.65cqw; }
.pf-n { color: #7c3aed; font-weight: 900; }
.pf-l { color: #6b7280; font-weight: 700; }
.pf-v { color: #1f2937; font-weight: 800; }
.permis-name { color: #4c1d95; font-size: 3.9cqw; line-height: 1.05; }
.permis-stamp { flex: none; display: flex; flex-direction: column; align-items: center; margin-right: 1cqw; padding: 0.7cqw 1.8cqw; border: 0.45cqw double #16a34a; border-radius: 1cqw; background: rgba(255, 255, 255, 0.45); color: #16a34a; font-size: 2.9cqw; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; transform: rotate(-12deg); }
.permis-stamp small { font-size: 1.15cqw; letter-spacing: 0.04em; }
.permis-section { margin-bottom: 0.6cqw; color: #7c3aed; font-size: 1.45cqw; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.permis-cats { --gap: 0.9cqw; }
.permis-cats .dip-mod { padding: 0.85cqw 1cqw; font-size: 1.35cqw; }
.permis-cats .dip-mod-icon { font-size: 2.4cqw; }
.permis-rules ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6cqw 2cqw; font-size: 1.5cqw; font-weight: 700; }
.permis-rules li { display: flex; gap: 0.6cqw; }
.dip-ia .dip-signs { margin-top: auto; justify-content: flex-end; }

@media (max-width: 640px) {
  .dip-strip, .dip-card { flex-wrap: wrap; }
  .dip-strip-text { flex: 1 1 calc(100% - 2.6rem); }
  .dip-strip .btn, .dip-strip-bar { margin-left: 2.4rem; }
  .dip-card-text { flex: 1 1 calc(100% - 3.2rem); }
  .dip-card .btn { margin-left: 3.1rem; }
}

@media print {
  html, body { background: #fff !important; }
  .topbar, #toasts, .dip-toolbar, .dip-tip, .dip-status, .read-btn { display: none !important; }
  .main { max-width: none; margin: 0; padding: 0; }
  .dip-scroll { overflow: visible; padding: 0; }
  .diploma { width: 297mm; height: 209mm; min-width: 0; max-width: none; aspect-ratio: auto; margin: 0; border-radius: 0; box-shadow: none; break-inside: avoid; }
}

/* --- Mes erreurs ---------------------------------------------------------------- */
.errors-card { border-left-color: #8b5cf6; }
.mod-errors { align-self: flex-start; font-size: 0.85rem; font-weight: 800; color: #7c3aed; background: #f3e8ff; padding: 0.15rem 0.6rem; border-radius: 999px; text-decoration: none; }
.mod-errors:hover { background: #e9d5ff; }
.error-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.error-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); border: 1px solid var(--border); border-left: 6px solid var(--mc); background: var(--card); }
.error-icon { font-size: 1.6rem; }
.error-text { flex: 1; min-width: 0; }
.quiz-choice.right { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.quiz-choice.wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); animation: shake 0.35s; }
.quiz-choice:disabled { cursor: default; transform: none; }
.result-actions.center { justify-content: center; }

/* --- Lecture à voix haute ------------------------------------------------------ */
.read-btn { float: right; position: relative; z-index: 1; width: 2.3rem; height: 2.3rem; margin: 0 0 0.4rem 0.7rem; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 2px solid var(--border); background: var(--card); color: var(--text); font-size: 1.05rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s, background 0.15s; }
.read-btn:hover { transform: scale(1.08); border-color: var(--mc); }
.read-btn:focus-visible { outline: 3px solid var(--mc); outline-offset: 2px; }
.read-btn.on { background: var(--mc); border-color: var(--mc); color: #fff; animation: readPulse 1.2s ease-in-out infinite; }
.read-btn.inline { float: none; display: inline-grid; vertical-align: middle; width: 2rem; height: 2rem; margin: -0.3rem 0 -0.3rem 0.5rem; font-size: 0.95rem; text-transform: none; letter-spacing: 0; }
@keyframes readPulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mc) 45%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--mc) 0%, transparent); } }
.reading { border-radius: 10px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--mc) 10%, transparent); background: color-mix(in srgb, var(--mc) 5%, transparent); }
.rw { border-radius: 4px; transition: background 0.12s, box-shadow 0.12s; }
.rw-on { background: color-mix(in srgb, var(--mc) 30%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mc) 30%, transparent); }

/* --- Mini-films ------------------------------------------------------------- */
.vplayer { --u: 6px; position: relative; border-radius: var(--radius); overflow: hidden; background: #0b1120; box-shadow: var(--shadow-lg); outline: none; }
.vplayer:focus-visible { box-shadow: 0 0 0 3px var(--mc), var(--shadow-lg); }
.vframe { width: 100%; margin: 0 auto; }
.vstage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #fff; color: #1e293b; cursor: pointer; user-select: none; -webkit-user-select: none; font-family: var(--font); }
.vstill { cursor: inherit; }
.vlayer { position: absolute; inset: 0; overflow: hidden; color: #1e293b; }
.vlayer[data-bg='light'] { background: #f8fafc; background: radial-gradient(120% 120% at 12% 8%, color-mix(in srgb, var(--mc) 16%, white) 0%, #ffffff 58%); }
.vlayer[data-bg='title'] { background: var(--mc); background: radial-gradient(110% 110% at 50% 28%, color-mix(in srgb, var(--mc) 80%, white) 0%, var(--mc) 45%, color-mix(in srgb, var(--mc) 55%, #0b1120) 100%); color: #fff; }
.vlayer[data-bg='dark'] { background: #0f172a; background: radial-gradient(100% 100% at 50% 35%, color-mix(in srgb, var(--mc) 30%, #0f172a) 0%, #0b1120 75%); color: #f1f5f9; }
.vlayer[data-bg='night'] { background: #05070d; color: #f1f5f9; }
.vlines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.vi { position: absolute; transform: translate(-50%, -50%); width: max-content; font-size: calc(var(--s, 4) * var(--u)); line-height: 1.12; text-align: center; pointer-events: none; }
.vi-loop, .vi-fx, .vi-in { position: relative; transform-origin: center; }
.vi-in { transition: filter 0.4s, opacity 0.4s; }
.vi-e { --s: 10; }
.vi-t { --s: 4; }
.vi-card { --s: 2.9; }
.vi-box { --s: 3; }
.vi-bits { --s: 5; }
.vi-px { --s: 4; }
.vi-dot, .vi-ring { --s: 20; }
.vi-bar, .vi-code { --s: 3; }
.vi-board, .vi-bot { --s: 10; }
.v-emoji { display: block; line-height: 1; filter: drop-shadow(0 0.05em 0.05em rgba(15, 23, 42, 0.2)); }
.v-text { display: inline-block; max-width: calc(var(--mw, 90) * var(--u)); font-weight: 800; white-space: normal; overflow-wrap: break-word; }
.vk-tag .v-text { background: #fff; color: #1e293b; padding: 0.3em 0.75em; border-radius: 999px; border: 0.1em solid color-mix(in srgb, var(--c, var(--mc)) 45%, white); box-shadow: 0 0.2em 0.6em rgba(15, 23, 42, 0.14); }
.vk-big .v-text { font-weight: 900; color: var(--c, var(--mc)); }
.vlayer[data-bg='dark'] .vk-big .v-text, .vlayer[data-bg='night'] .vk-big .v-text { color: color-mix(in srgb, var(--c, var(--mc)) 45%, white); }
.vlayer[data-bg='title'] .vk-big .v-text { color: #fff; }
.vk-giant .v-text { font-weight: 900; line-height: 1; color: var(--c, inherit); }
.vk-title .v-text { font-weight: 900; color: #fff; line-height: 1.15; text-shadow: 0 0.08em 0.25em rgba(0, 0, 0, 0.28); }
.vk-kicker .v-text { text-transform: uppercase; letter-spacing: 0.14em; font-weight: 800; color: #fff; opacity: 0.9; }
.vk-note .v-text { font-weight: 700; opacity: 0.75; }
.vk-url .v-text, .vk-mono .v-text, .vk-screen .v-text { font-family: var(--mono); font-weight: 700; }
.vk-url .v-text { background: #fff; color: #0f172a; border: 0.08em solid #cbd5e1; border-radius: 0.45em; padding: 0.35em 0.7em; box-shadow: 0 0.2em 0.6em rgba(15, 23, 42, 0.12); }
.vk-bubble .v-text { position: relative; background: #fff; color: #1e293b; border-radius: 0.9em; padding: 0.5em 0.85em; box-shadow: 0 0.25em 0.8em rgba(15, 23, 42, 0.16); }
.vk-bubble .v-text::after { content: ''; position: absolute; left: 1.1em; bottom: -0.45em; border-width: 0.5em 0.4em 0; border-style: solid; border-color: #fff transparent transparent; }
.vk-packet .v-text { display: grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 0.3em; box-sizing: border-box; border-radius: 0.35em; background: var(--c, var(--mc)); color: #fff; font-weight: 900; box-shadow: 0 0.15em 0.4em rgba(15, 23, 42, 0.25), inset 0 -0.12em 0 rgba(0, 0, 0, 0.15); }
.vk-screen .v-text { background: #dcfce7; color: #14532d; padding: 0.3em 0.6em; border-radius: 0.3em; border: 0.12em solid #475569; box-shadow: inset 0 0.08em 0.25em rgba(0, 0, 0, 0.18); }
.v-card { box-sizing: border-box; width: calc(var(--w, 22) * var(--u)); min-height: calc(var(--h, 0) * var(--u) * 0.5625); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2em; padding: 0.5em 0.4em; background: #fff; color: #1e293b; border-radius: 0.7em; border: 0.08em solid color-mix(in srgb, var(--c, var(--mc)) 30%, white); border-top: 0.4em solid var(--c, var(--mc)); box-shadow: 0 0.35em 1em rgba(15, 23, 42, 0.14); }
.v-card-ic { font-size: 2.3em; line-height: 1; }
.v-card-t { font-weight: 900; font-size: 1.1em; line-height: 1.1; }
.v-card-s { font-size: 0.78em; font-weight: 700; color: #64748b; line-height: 1.2; }
.v-box { box-sizing: border-box; width: calc(var(--w, 30) * var(--u)); height: calc(var(--h, 20) * var(--u) * 0.5625); display: flex; align-items: center; justify-content: center; padding: 0 0.6em; border-radius: 0.5em; background: var(--c, var(--mc)); color: #fff; font-weight: 900; box-shadow: 0 0.25em 0.8em rgba(15, 23, 42, 0.15); }
.v-box-circuit { background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0.06em, transparent 0.08em) 0 0 / 0.9em 0.9em, var(--c, #15803d); border: 0.15em solid rgba(0, 0, 0, 0.2); }
.v-box-soft { background: color-mix(in srgb, var(--c, var(--mc)) 14%, white); color: #1e293b; border: 0.1em dashed color-mix(in srgb, var(--c, var(--mc)) 55%, white); box-shadow: none; }
.v-bits { display: flex; gap: 0.22em; }
.v-bit { display: flex; flex-direction: column; align-items: center; gap: 0.12em; }
.v-bit small { font-size: 0.42em; font-weight: 800; opacity: 0.75; }
.v-bit b { display: grid; place-items: center; width: 1.2em; height: 1.45em; border-radius: 0.2em; background: #e2e8f0; color: #64748b; font-family: var(--mono); font-weight: 900; box-shadow: inset 0 -0.08em 0 rgba(0, 0, 0, 0.08); transition: background 0.25s, color 0.25s, box-shadow 0.25s; }
.v-bit.on b { background: var(--c, var(--mc)); color: #fff; box-shadow: 0 0 0.45em color-mix(in srgb, var(--c, var(--mc)) 70%, transparent); }
.v-px { display: grid; background: #fff; box-shadow: 0 0 0 0.06em #cbd5e1, 0 0.3em 0.8em rgba(15, 23, 42, 0.12); }
.v-px i { display: block; width: 1em; height: 1em; box-shadow: inset 0 0 0 0.02em rgba(15, 23, 42, 0.08); }
.v-dot { width: 1em; height: 1em; border-radius: 50%; }
.v-bar { width: calc(var(--w, 30) * var(--u)); height: 0.7em; border-radius: 1em; background: rgba(148, 163, 184, 0.35); overflow: hidden; }
.v-bar-fill { height: 100%; background: var(--c, var(--mc)); transform-origin: left center; }
.v-code { background: #0f172a; color: #e2e8f0; font-family: var(--mono); font-weight: 600; text-align: left; white-space: pre; padding: 0.55em 0.7em; border-radius: 0.45em; box-shadow: 0 0.3em 0.9em rgba(15, 23, 42, 0.25); }
.v-code-l { padding: 0.06em 0.3em; border-radius: 0.2em; transition: background 0.25s; }
.v-code-l.hl { background: color-mix(in srgb, var(--mc) 70%, transparent); color: #fff; }
.v-board { display: grid; background: #fff; border-radius: 0.06em; box-shadow: 0 0.04em 0.12em rgba(15, 23, 42, 0.15); }
.v-cell { width: 1em; height: 1em; display: grid; place-items: center; box-shadow: inset 0 0 0 0.012em #cbd5e1; }
.v-cell span { font-size: 0.6em; line-height: 1; }
.v-bot { position: relative; width: 0.72em; height: 0.72em; display: grid; place-items: center; border-radius: 0.18em; background: var(--mc); box-shadow: 0 0.05em 0.12em rgba(15, 23, 42, 0.3); }
.v-bot-face { font-size: 0.5em; line-height: 1; }
.v-bot-dir { position: absolute; inset: -0.17em; }
.v-bot-dir::before { content: ''; position: absolute; left: 50%; top: 0; transform: translateX(-50%); border-left: 0.11em solid transparent; border-right: 0.11em solid transparent; border-bottom: 0.15em solid var(--mc); }
.v-ring { box-sizing: border-box; width: 1em; height: 1em; border-radius: 50%; border: 0.025em dashed var(--c, var(--mc)); background: color-mix(in srgb, var(--c, var(--mc)) 10%, transparent); }
.vi.dim .vi-in { filter: grayscale(1) brightness(0.85); opacity: 0.4; }
.vi.struck .vi-fx::after { content: ''; position: absolute; left: -8%; right: -8%; top: 50%; height: max(3px, 0.1em); margin-top: -0.05em; background: #ef4444; border-radius: 1em; box-shadow: 0 0 0 0.03em #fff; transform: rotate(-14deg); animation: vstrike 0.35s ease-out both; }
@keyframes vstrike { from { transform: rotate(-14deg) scaleX(0); } }
.voverlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; align-content: center; gap: 0.6rem; padding: 1rem; text-align: center; cursor: default; }
.voverlay[hidden] { display: none; }
.vposter { background: rgba(11, 17, 32, 0.08); cursor: pointer; }
.vbig { width: clamp(3.2rem, 12%, 5.6rem); aspect-ratio: 1; border-radius: 50%; border: 0; background: #fff; color: var(--mc); font-size: clamp(1.3rem, 4vw, 2.3rem); display: grid; place-items: center; padding: 0 0 0 0.15em; box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.3); cursor: pointer; transition: transform 0.15s; }
.vbig:hover { transform: scale(1.08); }
.vposter-info { color: #fff; font-weight: 800; font-size: clamp(0.8rem, 1.8vw, 1rem); background: rgba(11, 17, 32, 0.5); padding: 0.25rem 0.8rem; border-radius: 999px; }
.vend { background: rgba(11, 17, 32, 0.66); color: #fff; }
.vend-emoji { font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1; }
.vend-title { font-size: clamp(1.15rem, 3.2vw, 1.9rem); font-weight: 900; }
.vend-text { font-size: clamp(0.85rem, 1.9vw, 1.05rem); max-width: 34rem; opacity: 0.92; }
.vend-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.vsubs { display: flex; align-items: center; gap: 0.7rem; min-height: 3.4em; padding: 0.55rem 0.9rem; background: #111827; color: #7c879b; font-weight: 700; font-size: clamp(0.95rem, 1.7vw, 1.15rem); line-height: 1.35; }
.vsubs[hidden] { display: none; }
.vmascot { flex: none; font-size: 1.7em; line-height: 1; }
.vmascot.talk { animation: vtalk 0.32s ease-in-out infinite alternate; }
@keyframes vtalk { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-3px) rotate(4deg); } }
.vsubs-text .w { transition: color 0.15s; }
.vsubs-text .w.said { color: #fff; }
.vbar { display: flex; align-items: center; gap: 0.2rem; padding: 0.35rem 0.5rem; background: #0b1120; }
.vbtn { flex: none; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; padding: 0; border: 0; border-radius: 0.6rem; background: transparent; color: #fff; font-size: 1.1rem; cursor: pointer; }
.vbtn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.vbtn:disabled { opacity: 0.35; cursor: default; }
.vbtn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.vbtn-play { background: var(--mc); }
.vbtn-play:hover:not(:disabled) { background: color-mix(in srgb, var(--mc) 80%, white); }
.vchap { flex: 1; display: flex; align-items: center; gap: 3px; min-width: 3rem; padding: 0 0.4rem; }
.vseg { flex: 1 1 0; min-width: 4px; height: 1.6rem; display: flex; align-items: center; padding: 0; border: 0; background: transparent; cursor: pointer; }
.vseg i { position: relative; display: block; width: 100%; height: 0.42rem; overflow: hidden; border-radius: 1rem; background: rgba(255, 255, 255, 0.2); }
.vseg i::after { content: ''; position: absolute; inset: 0; background: var(--mc); transform-origin: left center; transform: scaleX(var(--p, 0)); }
.vseg.current i { height: 0.62rem; }
.vcount { flex: none; min-width: 3.4em; color: #94a3b8; font-size: 0.8rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.vpanel { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.4rem; padding: 0.7rem 0.9rem; background: #111827; color: #e2e8f0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.92rem; }
.vpanel[hidden] { display: none; }
.vpanel .vfield { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-weight: 700; }
.vpanel .vfield select { width: auto; max-width: 16rem; margin: 0; padding: 0.3rem 0.5rem; background: #1f2937; color: #fff; border: 1px solid #374151; border-radius: 0.5rem; font: inherit; }
.vpanel .vfield input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--mc); }
.vnote { color: #94a3b8; font-weight: 600; }
.vplayer:fullscreen { display: flex; align-items: center; justify-content: center; background: #000; border-radius: 0; }
.vplayer:fullscreen .vframe { width: min(100vw, calc((100vh - 7.5rem) * 16 / 9)); }
.vplayer:-webkit-full-screen { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: #000; border-radius: 0; }
.vplayer:-webkit-full-screen .vframe { width: min(100vw, calc((100vh - 7.5rem) * 16 / 9)); }
.step .vplayer { margin: 0.1rem 0 0.3rem; }

/* Vidéothèque */
.film-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }
.film-tile { display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform 0.15s, box-shadow 0.15s; }
.film-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.film-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--mc); }
.film-thumb .vstage { width: 100%; }
.film-play { position: absolute; inset: 0; display: grid; place-items: center; }
.film-play span { width: 3.2rem; height: 3.2rem; display: grid; place-items: center; padding-left: 0.15em; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--mc); font-size: 1.3rem; box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.film-tile:hover .film-play span { transform: scale(1.1); }
.film-dur { position: absolute; right: 0.5rem; bottom: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: rgba(11, 17, 32, 0.75); color: #fff; font-size: 0.8rem; font-weight: 800; }
.film-info { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.8rem 1rem 1rem; }
.film-mod { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.film-title { font-weight: 900; font-size: 1.08rem; line-height: 1.25; }
.film-seen { align-self: flex-start; margin-top: 0.2rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: 0.8rem; font-weight: 800; }
.film-tile.locked { filter: grayscale(0.85); opacity: 0.7; }
.film-lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 12px, transparent 12px 24px), var(--mc); }
.film-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.film-page .vplayer, .film-page .film-links { width: 100%; max-width: min(100%, 980px, calc((100vh - 15rem) * 16 / 9)); min-width: min(100%, 560px); margin-inline: auto; }

/* --- Animations ------------------------------------------------------------- */
@keyframes pop { 0% { transform: scale(0.85); opacity: 0.4; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes vanish { to { opacity: 0; transform: scale(0.4) translateY(-12px); } }
@keyframes grow { from { width: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* --- Responsive ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .module-layout { grid-template-columns: 1fr; }
  .module-aside { position: static; order: 2; }
  .pc-layout, .phish-layout, .robot-layout, .var-layout { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; gap: 1rem; padding-top: 1.5rem; }
  .auth-logo { font-size: 2.2rem; }
  .auth-logo img { width: 52px; height: 52px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .main { padding: 1rem 0.8rem 3rem; }
  .card { padding: 1.1rem; }
  .step { padding: 1.2rem; }
  .topbar { padding: 0.5rem 0.7rem; gap: 0.5rem; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .brand { flex: 1; }
  .nav-label, .hide-sm, .user-name { display: none; }
  .nav-link { padding: 0.4rem 0.8rem; font-size: 1.2rem; }
  .nav-link.active .nav-label { display: inline; font-size: 0.9rem; }
  h1, .module-title h1, .step-title { font-size: 1.45rem; }
  .hero { flex-direction: column; text-align: center; }
  .hero-stats { justify-content: center; }
  .continue { flex-wrap: wrap; }
  .quiz { padding: 1.1rem; }
  .quiz-q { font-size: 1.25rem; }
  .quiz-choices { grid-template-columns: 1fr; }
  .result-head { flex-direction: column; text-align: center; }
  .ipo-stage, .flow { flex-direction: column; }
  .ipo-arrow, .flow-arrow { transform: rotate(90deg); }
  .flow-item { max-width: none; }
  .mem-layout, .fx-body { grid-template-columns: 1fr; }
  .fx-list { border-right: 0; border-bottom: 2px solid var(--border); }
  .sort-buckets { grid-template-columns: 1fr; }
  .bin-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rgb-layout { grid-template-columns: 1fr; }
  .rgb-swatch { max-width: 160px; justify-self: center; }
  .tb-head, .tb-row { grid-template-columns: 50px 60px 1fr; }
  .nw-bar { grid-template-columns: 100px 1fr 3em; }
  .step-nav .btn-lg { padding: 0.6em 1em; font-size: 0.95rem; }
  .vcount { display: none; }
  .vbtn { width: 2.15rem; height: 2.15rem; font-size: 1rem; }
  .vsubs { font-size: 0.95rem; padding: 0.5rem 0.7rem; }
}
