/* ================= Tokens ================= */
:root {
  --bg: #EDF0F4;
  --surface: #FFFFFF;
  --surface-2: #F5F7FA;
  --ink: #16202E;
  --ink-2: #5A6678;
  --line: #D9DEE6;
  --blue: #1F6FEB;
  --blue-soft: #E3EDFF;
  --led: #1FB860;
  --led-glow: rgba(31, 184, 96, .45);
  --led-soft: #E2F7EA;
  --amber: #E89A00;
  --amber-soft: #FFF3D9;
  --red: #D93C41;
  --port: #C9D0DA;
  --code-bg: #182030;
  --code-ink: #DCE6F5;
  --radius: 14px;
  --font: "Bricolage Grotesque", system-ui, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151D;
    --surface: #19202B;
    --surface-2: #212A37;
    --ink: #E8EDF4;
    --ink-2: #93A0B4;
    --line: #2C3645;
    --blue: #5B9BFF;
    --blue-soft: #1D2B45;
    --led: #3DDC84;
    --led-glow: rgba(61, 220, 132, .5);
    --led-soft: #183324;
    --amber: #FFB938;
    --amber-soft: #3A2C12;
    --red: #FF6B70;
    --port: #354052;
    --code-bg: #0D1219;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 800; margin: 0 0 .35rem; }
h2 { font-size: 1.3rem; font-weight: 700; margin: 2.25rem 0 .9rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
code { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: .05em .35em; border-radius: 5px; font-size: .86em; }

/* ================= Barre du haut ================= */
#topbar {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  padding: .7rem clamp(1rem, 4vw, 2rem);
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.25rem; color: var(--ink); letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.brand-ports { display: inline-flex; gap: 3px; padding: 5px 6px; background: var(--blue); border-radius: 6px; }
.brand-ports i { width: 5px; height: 9px; border-radius: 1.5px; background: var(--led); box-shadow: 0 0 6px var(--led-glow); }
.brand-ports i:last-child { background: rgba(255,255,255,.45); box-shadow: none; }
#nav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
#nav a { padding: .45rem .85rem; border-radius: 999px; color: var(--ink-2); font-weight: 600; }
#nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
#nav a.active { background: var(--ink); color: var(--surface); }
.who { display: flex; align-items: center; gap: .6rem; }
.who-chip { display: flex; align-items: center; gap: .5rem; padding: .25rem .75rem .25rem .3rem; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: .9rem; }
.who-chip:hover { text-decoration: none; background: var(--line); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-weight: 800; font-size: .85rem; flex-shrink: 0; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.6rem; }

/* Cloche + panneau de notifications */
.bell { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.bell:hover, .bell[aria-expanded=true] { background: var(--surface-2); }
.bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); line-height: 1; }
.notif-panel {
  position: fixed; top: 64px; right: clamp(.5rem, 3vw, 2rem); z-index: 40;
  width: min(400px, calc(100vw - 1rem)); max-height: min(560px, calc(100vh - 90px));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(10, 15, 25, .25); animation: rise .15s ease-out; overflow: hidden;
}
.np-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.np-head b { font-size: 1.05rem; }
.linkish { font: inherit; font-size: .85rem; font-weight: 700; color: var(--blue); background: none; border: 0; cursor: pointer; padding: 0; }
.np-list { overflow-y: auto; flex: 1; }
.np-item { display: flex; gap: .7rem; padding: .8rem 1.1rem; color: var(--ink); border-bottom: 1px solid var(--line); }
.np-item:hover { background: var(--surface-2); text-decoration: none; }
.np-item .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .45rem; flex-shrink: 0; background: transparent; }
.np-item.unread .dot { background: var(--blue); }
.np-item.unread { background: color-mix(in srgb, var(--blue-soft) 55%, transparent); }
.np-txt { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.np-txt b { font-weight: 700; font-size: .95rem; }
.np-txt span { font-size: .88rem; color: var(--ink-2); overflow-wrap: anywhere; }
.np-txt time { font-size: .78rem; color: var(--ink-2); }
.np-empty { padding: 2rem 1rem; text-align: center; color: var(--ink-2); margin: 0; }
.np-foot { padding: .8rem 1.1rem; font-size: .85rem; color: var(--ink-2); border-top: 1px solid var(--line); }

/* Barre d'onglets (téléphone) */
.tabbar { display: none; }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.settings h2 { margin-top: 0; font-size: 1.1rem; }
fieldset.recip { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem .6rem; }
fieldset.recip legend { padding: 0; }
.check { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 600; cursor: pointer; }
.check:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.check input { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; }

main { max-width: 1080px; margin: 0 auto; padding: 2.25rem clamp(1rem, 4vw, 2rem) 5rem; }

/* ================= Boutons & champs ================= */
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 1.5px solid transparent; border-radius: 10px;
  padding: .6rem 1.1rem;
  background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  transition: transform .08s, background .15s;
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--line); }
.btn.danger:hover { background: var(--red); color: #fff; border-color: var(--red); filter: none; }
.btn.sm { padding: .32rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.big { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn:disabled { opacity: .45; cursor: default; }

label.lbl { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
input:not([type=checkbox]):not([type=file]):not([type=radio]), select, textarea {
  font: inherit; width: 100%;
  padding: .6rem .75rem;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field { margin-bottom: 1rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1; min-width: 170px; }
.error { color: var(--red); font-size: .9rem; min-height: 1.3em; font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; }

/* ================= LED / ports (la signature) ================= */
.ports { display: flex; gap: 4px; align-items: center; }
.ports i {
  flex: 1; height: 9px; border-radius: 3px; background: var(--port);
  transition: background .25s, box-shadow .25s;
}
.ports i.on { background: var(--led); box-shadow: 0 0 6px var(--led-glow); }
.ports i.final { flex: 2.2; background: transparent; border: 1.5px dashed var(--port); }
.ports i.final.on { background: var(--blue); border-color: var(--blue); box-shadow: 0 0 6px rgba(31,111,235,.45); }
.ports.big i { height: 16px; border-radius: 4px; }
.ports.big i.next { background: var(--amber); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.ports-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-2); margin-top: .45rem; font-weight: 600; }

/* ================= Puces ================= */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.chip { font-size: .78rem; font-weight: 700; padding: .18rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.cat { background: color-mix(in srgb, var(--cat) 16%, transparent); color: color-mix(in srgb, var(--cat) 75%, var(--ink)); }
.chip.todo { background: var(--surface-2); }
.chip.doing { background: var(--amber-soft); color: var(--amber); }
.chip.done { background: var(--led-soft); color: var(--led); }
.chip.user { background: var(--blue-soft); color: var(--blue); }
.chip.new { background: var(--blue); color: #fff; }

/* ================= Accueil ================= */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.hero p { font-size: 1.1rem; margin: 0; }

.level { display: flex; align-items: center; gap: .9rem; }
.ring { flex-shrink: 0; display: block; }
.ring circle { fill: none; }
.ring .track { stroke: var(--port); }
.ring .arc { stroke: var(--led); stroke-linecap: round; filter: drop-shadow(0 0 3px var(--led-glow)); }
.ring text { fill: var(--ink); font-family: var(--font); font-weight: 800; font-size: 22px; }
.ring.sm text { font-size: 15px; }
.level-txt b { display: block; font-size: 1.05rem; }
.level-txt span { font-size: .85rem; color: var(--ink-2); }

.resume {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem 2rem; align-items: center;
  background: var(--ink); color: var(--surface);
  border-radius: 18px; padding: 1.6rem 1.8rem; margin-bottom: 2rem;
  position: relative; overflow: hidden;
}
.resume .lead { font-size: .9rem; opacity: .7; font-weight: 600; margin: 0 0 .2rem; }
.resume h2 { margin: 0 0 .3rem; font-size: clamp(1.3rem, 3vw, 1.75rem); color: var(--surface); }
.resume .next { margin: 0 0 1rem; opacity: .85; }
.resume .next b { color: var(--surface); opacity: 1; }
.resume .ports i { background: color-mix(in srgb, var(--surface) 22%, transparent); }
.resume .ports i.on { background: var(--led); }
.resume .ports i.final { background: transparent; border-color: color-mix(in srgb, var(--surface) 35%, transparent); }
.resume .btn { background: var(--led); color: #0B2416; }
.resume::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: var(--cat, var(--blue)); opacity: .25; filter: blur(40px); pointer-events: none;
}

.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filter { font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; padding: .4rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); }
.filter:hover { color: var(--ink); }
.filter[aria-pressed=true] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.filter .n { opacity: .6; margin-left: .25rem; }
.filters select { width: auto; padding: .38rem .7rem; border-radius: 999px; font-weight: 600; font-size: .9rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.tcard {
  display: flex; flex-direction: column; gap: .65rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.1rem 1.5rem; color: var(--ink);
  position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.tcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--cat); }
a.tcard:hover { text-decoration: none; border-color: var(--cat); transform: translateY(-2px); }
.tcard h3 { font-size: 1.12rem; }
.tcard .desc { font-size: .9rem; color: var(--ink-2); margin: 0; }
.tcard .foot { margin-top: auto; }
.tcard .actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; padding-top: .3rem; }

.students { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.student { display: flex; gap: .9rem; align-items: center; }
.student .name { font-weight: 800; font-size: 1.1rem; text-transform: capitalize; }

.inbox { display: flex; flex-direction: column; gap: .5rem; }
.inbox a { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
.inbox a:hover { text-decoration: none; border-color: var(--blue); }
.inbox .t { flex: 1; font-weight: 600; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-2); background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.empty b { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: .3rem; }

/* ================= Page d'un travail ================= */
.back { display: inline-block; font-weight: 700; margin-bottom: 1.25rem; }
.t-head { margin-bottom: 1.75rem; }
.t-head h1 { margin-top: .6rem; }
.t-head .desc { font-size: 1.1rem; color: var(--ink-2); max-width: 65ch; }
.t-progress { display: flex; align-items: center; gap: 1.25rem; margin-top: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.t-progress .ports { flex: 1; }
.t-progress .pct { font-weight: 800; font-size: 1.6rem; min-width: 4.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.xp-gain { font-weight: 700; color: var(--led); white-space: nowrap; }

.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .55rem; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: background .2s, border-color .2s; }
.step.done { background: var(--led-soft); border-color: transparent; }
.step-row { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; cursor: pointer; }
.step-n { font-weight: 800; color: var(--ink-2); min-width: 1.6rem; font-variant-numeric: tabular-nums; }
.step-title { flex: 1; font-weight: 600; font-size: 1.02rem; }
.step.done .step-title { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* La case à cocher = un port de switch avec sa LED */
input.port {
  appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0; cursor: pointer;
  width: 34px; height: 26px; border-radius: 6px;
  background: var(--surface-2); border: 2px solid var(--port);
  position: relative; transition: border-color .2s, background .2s;
}
input.port::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--port); transition: background .2s, box-shadow .2s;
}
input.port:hover { border-color: var(--led); }
input.port:checked { border-color: var(--led); background: var(--surface); }
input.port:checked::after { background: var(--led); box-shadow: 0 0 10px 2px var(--led-glow); animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.3); } 60% { transform: translate(-50%, -50%) scale(1.5); } 100% { transform: translate(-50%, -50%) scale(1); } }
input.port:disabled { cursor: default; opacity: .6; }

.step details { padding: 0 1rem .85rem calc(1rem + 34px + .9rem); }
.step summary { cursor: pointer; color: var(--blue); font-size: .9rem; font-weight: 700; width: fit-content; list-style: none; }
.step summary::-webkit-details-marker { display: none; }
.step summary::before { content: "▸ "; display: inline-block; transition: transform .15s; }
.step details[open] summary::before { transform: rotate(90deg); }
.explanation { margin-top: .6rem; padding: .85rem 1.1rem; background: var(--surface-2); border-radius: 10px; font-size: .97rem; max-width: 75ch; }
.step.done .explanation { background: var(--surface); }
.explanation ul { margin: .35rem 0; padding-left: 1.3rem; }
.explanation p { margin: .35rem 0; }
.codeblock { position: relative; margin: .5rem 0; }
.codeblock pre { margin: 0; background: var(--code-bg); color: var(--code-ink); padding: .75rem 1rem; border-radius: 8px; overflow-x: auto; }
.codeblock pre code { background: none; border: 0; padding: 0; color: inherit; font-size: .86rem; line-height: 1.55; }
.copy { position: absolute; top: .4rem; right: .4rem; font: inherit; font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 6px; border: 0; cursor: pointer; background: rgba(255,255,255,.12); color: var(--code-ink); }
.copy:hover { background: rgba(255,255,255,.22); }

/* Étape finale : le résumé PDF */
.step.final { border: 2px dashed var(--line); background: var(--surface); scroll-margin-top: 5.5rem; }
.step.final.done { border: 2px solid var(--blue); background: var(--surface); }
.step.final .step-row { cursor: default; }
.final-body { padding: 0 1.1rem 1.1rem; }
.lock { display: flex; gap: .7rem; align-items: center; color: var(--ink-2); }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center;
  border: 2px dashed var(--blue); border-radius: 12px; padding: 1.8rem 1rem;
  background: var(--blue-soft); cursor: pointer; transition: transform .15s, background .15s;
}
.drop:hover, .drop.over { transform: scale(1.01); background: color-mix(in srgb, var(--blue) 18%, var(--surface)); }
.drop .icon { font-size: 2rem; line-height: 1; }
.drop b { font-size: 1.05rem; }
.file-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .8rem; }
.pdf-view { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.two h2 { margin-top: 0; font-size: 1.1rem; }
.feedback-text { font-size: 1rem; }

.congrats { text-align: center; padding: 1.1rem; background: var(--led-soft); color: var(--led); border-radius: var(--radius); font-weight: 800; font-size: 1.1rem; margin-top: 1rem; }

/* ================= Éditeur de template ================= */
.step-editor { display: flex; gap: .75rem; align-items: flex-start; padding: 1rem; margin-bottom: .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.step-editor .num { font-weight: 800; color: var(--ink-2); padding-top: .55rem; min-width: 1.6rem; }
.step-editor .fields { flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.step-editor .acts { display: flex; flex-direction: column; gap: .3rem; }
.hint { font-size: .85rem; color: var(--ink-2); font-weight: 400; }
.upload-field { display: flex; align-items: center; gap: .6rem; font-size: .85rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.upload-field input { padding: .35rem .6rem !important; font-size: .9rem; }

/* Fichiers déposés */
.file-chip { display: inline-block; background: var(--blue-soft); color: var(--blue); margin-left: .3rem; vertical-align: middle; }
.deliver { padding: 0 1rem .85rem calc(1rem + 34px + .9rem); }
.drop.small-drop { flex-direction: row; justify-content: center; flex-wrap: wrap; padding: 1rem; gap: .3rem .6rem; }
.drop.small-drop .icon { font-size: 1.3rem; }
.files { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.file { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.step:not(.done) .file { background: var(--surface-2); }
.file .ext { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--ink); color: var(--surface); font-family: var(--mono); font-weight: 600; font-size: .78rem; text-transform: lowercase; }
.file .thumb { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; flex-shrink: 0; display: block; background: var(--surface-2); }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-txt a { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-more { display: inline-block; cursor: pointer; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .8rem .6rem; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { color: var(--ink-2); font-size: .85rem; font-weight: 700; }
td.acts { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* ================= Connexion ================= */
.login-wrap { min-height: calc(100vh - 7rem); display: grid; place-items: center; }
.login { width: 100%; max-width: 400px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-bottom: 1.5rem; text-align: center; }
.login-brand h1 { font-size: 2.8rem; margin: 0; letter-spacing: -.04em; }
.switch-face {
  display: flex; gap: 6px; padding: 10px 12px; background: #1A2230; border: 1px solid var(--line); border-radius: 10px;
}
.switch-face i { width: 18px; height: 14px; border-radius: 3px; background: #333E50; }
.switch-face i.lit { animation: light .35s forwards; animation-delay: calc(var(--i) * 110ms + 200ms); }
@keyframes light { to { background: var(--led); box-shadow: 0 0 8px var(--led-glow); } }
.login .btn { width: 100%; margin-top: .4rem; }

/* ================= Modale / toast / confettis ================= */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 15, 25, .55); display: grid; place-items: center; z-index: 50; padding: 1rem; animation: fade .15s; }
.modal { width: 100%; max-width: 470px; background: var(--surface); border-radius: 16px; padding: 1.5rem; animation: rise .2s ease-out; }
.modal h2 { margin-top: 0; }
.modal .buttons { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface);
  padding: .7rem 1.25rem; border-radius: 12px; font-weight: 700; z-index: 100;
  animation: rise .2s ease-out;
}
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 90; pointer-events: none; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); } }

@media (max-width: 1020px) {
  #logout, .who-chip .lv { display: none; }
  #nav a { padding: .45rem .7rem; }
}

/* ================= Jeu ================= */
:root { --gold: #F5B301; --gold-soft: #FFF4CC; }
@media (prefers-color-scheme: dark) { :root { --gold: #FFC93C; --gold-soft: #3A3014; } }

a.level { color: var(--ink); border-radius: 14px; padding: .3rem .6rem .3rem .3rem; }
a.level:hover { text-decoration: none; background: var(--surface); }
.tab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: .35rem; vertical-align: top; }
.tabbar .tab-dot { position: absolute; margin: 2px 0 0 26px; }
.tabbar a { position: relative; }
.flame { font-weight: 700; color: var(--amber); margin-right: .4rem; }

.game-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin: -.5rem 0 1.5rem; }
.gs-item { display: flex; flex-direction: column; gap: .1rem; padding: .85rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.gs-item:hover { text-decoration: none; border-color: var(--blue); }
.gs-big { font-size: 1.5rem; font-weight: 800; color: var(--ink); line-height: 1.2; }
.gs-big small { font-size: .9rem; color: var(--ink-2); }
.gs-item.hot { background: linear-gradient(135deg, var(--amber-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }
.gs-item.chest-call { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }
.wobble { display: inline-block; animation: wobble 1.4s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes wobble { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-12deg); } 80% { transform: rotate(10deg); } 90% { transform: rotate(-6deg); } }

.chip.reward { background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 55%, var(--ink)); }
.chip.reward.ready { background: var(--gold); color: #2B2100; animation: pulse-gold 1.8s ease-in-out infinite; }
.chip.reward.given { background: var(--led-soft); color: var(--led); }
@keyframes pulse-gold { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 30%, transparent); } }

.reward-banner { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding: .9rem 1.2rem; border-radius: var(--radius); background: var(--gold-soft); border: 1.5px dashed var(--gold); }
.reward-banner.ready { border-style: solid; box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 20%, transparent); }
.reward-banner.given { background: var(--led-soft); border-color: transparent; }
.rb-icon { font-size: 2rem; line-height: 1; }
.rb-txt { flex: 1; display: flex; flex-direction: column; }
.rb-txt span { font-size: .9rem; color: var(--ink-2); }
.reward-banner .btn { background: var(--gold); color: #2B2100; }

.reward-box { border: 1.5px dashed var(--line); border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; }
.reward-box[open] { border-color: var(--gold); }
.reward-box summary { cursor: pointer; font-weight: 700; }
.reward-box[open] summary { margin-bottom: .8rem; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.emoji-pick input { position: absolute; opacity: 0; pointer-events: none; }
.emoji-pick span { display: grid; place-items: center; width: 40px; height: 40px; font-size: 1.35rem; border-radius: 10px; border: 1.5px solid var(--line); cursor: pointer; transition: transform .1s; }
.emoji-pick span:hover { transform: scale(1.1); }
.emoji-pick input:checked + span { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 2px var(--gold); }
.emoji-pick input:focus-visible + span { outline: 3px solid var(--blue); }

/* Écran de victoire / coffre */
.celebrate { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; background: rgba(8, 12, 20, .72); backdrop-filter: blur(4px); animation: fade .2s; }
.cel-card { position: relative; width: 100%; max-width: 420px; text-align: center; padding: 2.2rem 1.6rem 1.6rem; background: var(--surface); border-radius: 22px; animation: pop-in .45s cubic-bezier(.2, 1.4, .4, 1); overflow: hidden; }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } }
.cel-card h2 { margin: .2rem 0 .3rem; font-size: 1.8rem; position: relative; }
.cel-card p, .cel-card .btn, .cel-card .row { position: relative; }
.cel-card .btn { margin-top: 1rem; }
.cel-kicker { font-weight: 700; color: var(--ink-2); margin: 1rem 0 0; }
.cel-glow { position: absolute; left: 50%; top: 95px; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--blue) 22%, transparent) 0 10deg, transparent 10deg 20deg);
  animation: spin 14s linear infinite; pointer-events: none; mask-image: radial-gradient(circle, #000 15%, transparent 60%); -webkit-mask-image: radial-gradient(circle, #000 15%, transparent 60%); }
.cel-glow.gold { background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--gold) 35%, transparent) 0 10deg, transparent 10deg 20deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.cel-level { position: relative; width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 3.2rem; font-weight: 800; box-shadow: 0 0 0 8px var(--blue-soft), 0 0 40px rgba(31, 111, 235, .5); animation: pop-in .6s .1s cubic-bezier(.2, 1.6, .4, 1) both; }

.medal { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; background: radial-gradient(circle at 35% 30%, #FFF6D0, var(--gold) 70%); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15), 0 3px 0 color-mix(in srgb, var(--gold) 60%, #000); }
.medal.big { position: relative; width: 120px; height: 120px; margin: 0 auto; font-size: 3.6rem; animation: pop-in .6s .1s cubic-bezier(.2, 1.6, .4, 1) both; }

.chest-idle { position: relative; display: block; font-size: 4.5rem; line-height: 1; animation: bob 2s ease-in-out infinite; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .25)); }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
.chest { position: relative; display: block; margin: 0 auto; width: 150px; height: 150px; border: 0; background: none; cursor: pointer; font-size: 6rem; line-height: 150px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .3)); -webkit-tap-highlight-color: transparent; }
.chest:not(.opened) .chest-emoji { display: inline-block; animation: bob 2s ease-in-out infinite; }
.chest.shake .chest-emoji { animation: shake .45s; }
@keyframes shake { 0%, 100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-14deg) scale(1.08); } 40% { transform: rotate(12deg) scale(1.12); } 60% { transform: rotate(-8deg) scale(1.08); } 80% { transform: rotate(5deg); } }
.chest[data-taps="1"] .chest-emoji { filter: brightness(1.1); }
.chest[data-taps="2"] .chest-emoji { filter: brightness(1.25) drop-shadow(0 0 12px var(--gold)); }
.chest.opened .chest-emoji { display: inline-block; animation: reveal .7s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes reveal { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* Page Trophées */
.trophy-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.25rem; align-items: center; margin-bottom: 1rem; }
.th-level { display: flex; align-items: center; gap: 1.2rem; }
.th-level > div { flex: 1; }
.th-level h1 { margin-bottom: .5rem; }
.xpbar { height: 10px; background: var(--port); border-radius: 999px; overflow: hidden; margin-top: .45rem; }
.xpbar.big { height: 14px; margin-top: 0; }
.xpbar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--led), color-mix(in srgb, var(--led) 60%, var(--blue))); box-shadow: 0 0 8px var(--led-glow); transition: width .6s; }
.th-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.th-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.th-stat b { font-size: 1.35rem; }
.th-stat span { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.th-stat.hot { background: linear-gradient(135deg, var(--amber-soft), var(--surface) 75%); }

.road { overflow-x: auto; padding: .5rem 0 1rem; scroll-behavior: smooth; scrollbar-width: thin; }
.road-track { list-style: none; margin: 0; padding: 0 1rem; display: flex; }
.node { position: relative; flex: 0 0 92px; display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.node::before { content: ""; position: absolute; top: 61px; left: -50%; width: 100%; height: 6px; background: var(--port); z-index: 0; }
.node:first-child::before { display: none; }
.node.past::before, .node.current::before { background: var(--led); box-shadow: 0 0 6px var(--led-glow); }
.node-reward { height: 36px; font-size: 1.7rem; line-height: 36px; }
.node-reward.locked { filter: grayscale(.4); opacity: .8; }
.node-reward.ready { animation: wobble 1.4s ease-in-out infinite; }
.node-dot { position: relative; z-index: 1; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface); border: 3px solid var(--port); color: var(--ink-2); }
.node.past .node-dot { background: var(--led); border-color: var(--led); color: #0B2416; }
.node.current .node-dot { width: 54px; height: 54px; margin: -5px 0; background: var(--blue); border-color: var(--blue); color: #fff; font-size: 1.2rem; box-shadow: 0 0 0 6px var(--blue-soft); animation: pulse-blue 2s ease-in-out infinite; }
@keyframes pulse-blue { 50% { box-shadow: 0 0 0 11px color-mix(in srgb, var(--blue) 12%, transparent); } }
.node-label { font-size: .75rem; font-weight: 700; color: var(--ink-2); text-align: center; max-width: 88px; min-height: 1.2em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node.current .node-label { color: var(--blue); }

.chests { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.chest-card { font: inherit; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.3rem 1rem 1rem; border-radius: 16px; border: 2px solid var(--gold); background: radial-gradient(circle at 50% 30%, var(--gold-soft), var(--surface) 70%); transition: transform .15s; }
.chest-card:hover { transform: translateY(-3px) scale(1.02); }
.chest-card .chest-idle { font-size: 3.4rem; }
.chest-card b { text-align: center; font-size: .95rem; }
.chest-card .btn { background: var(--gold); color: #2B2100; pointer-events: none; }

.loots { display: flex; flex-direction: column; gap: .55rem; }
.loot { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.loot-icon { font-size: 1.7rem; width: 2.2rem; text-align: center; }
.loot-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.loot-txt span { font-size: .87rem; color: var(--ink-2); }
.loot-pct { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.loot.won { border-color: var(--gold); background: var(--gold-soft); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; }
.badge-tile { font: inherit; color: var(--ink); cursor: pointer; position: relative; height: 150px; border: 0; padding: 0; background: none; perspective: 700px; }
.badge-tile > span { position: absolute; inset: 0; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem; padding: .8rem; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
.bt-back { transform: rotateY(180deg); font-size: .85rem; }
.bt-back small { color: var(--ink-2); }
.badge-tile.flipped .bt-front { transform: rotateY(-180deg); }
.badge-tile.flipped .bt-back { transform: rotateY(0); }
.badge-tile b { font-size: .88rem; line-height: 1.2; }
.badge-tile.on .bt-front { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.badge-tile.off .medal { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--port); color: var(--ink-2); font-weight: 800; }
.badge-tile.off b { color: var(--ink-2); }

/* ================= Quiz ================= */
.ports i.quiz { flex: 1.4; background: transparent; border: 1.5px dashed var(--port); }
.ports i.quiz.on { background: #A26BFA; border-color: #A26BFA; box-shadow: 0 0 6px rgba(162, 107, 250, .5); }
.step.quiz-step { border: 2px dashed color-mix(in srgb, #A26BFA 45%, var(--line)); scroll-margin-top: 5.5rem; }
.step.quiz-step.done { border-style: solid; border-color: #A26BFA; background: var(--surface); }
.step.quiz-step .step-row { cursor: default; }
.step.quiz-step.done .step-title, .step.final.done .step-title { text-decoration: none; color: var(--ink); }
.quiz-score { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.quiz-score b { font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.quiz-score.ok { background: color-mix(in srgb, #A26BFA 14%, var(--surface)); }
.quiz-score.retry { background: var(--amber-soft); }
.quiz-form { display: flex; flex-direction: column; gap: .8rem; }
.qcard { border: 1.5px solid var(--line); border-radius: 12px; padding: .9rem 1rem 1rem; margin: 0; background: var(--surface-2); transition: border-color .2s; }
.qcard.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 7%, var(--surface)); }
.qcard legend { font-weight: 700; padding: 0 .3rem; display: flex; gap: .5rem; align-items: baseline; }
.qn { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #A26BFA; color: #fff; font-size: .8rem; }
.qbad { color: var(--red); }
.qchoices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem; margin-top: .6rem; }
.qchoice { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 500; transition: border-color .15s, transform .1s; }
.qchoice:hover { border-color: #A26BFA; }
.qchoice:has(input:checked) { border-color: #A26BFA; background: color-mix(in srgb, #A26BFA 12%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, #A26BFA 30%, transparent); }
.qchoice input { accent-color: #A26BFA; width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.quiz-form .btn { align-self: flex-start; background: #8B55F0; }
.quiz-review { margin: .6rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.quiz-review li { display: flex; flex-direction: column; gap: .15rem; }
.qr-answer { color: var(--led); font-weight: 700; }
.qr-wrong { color: var(--red); font-size: .9rem; }
.quiz-review .muted p { margin: 0; }

/* ================= Quêtes ================= */
.quest-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.quest-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .55rem; }
.qg-head { display: flex; justify-content: space-between; align-items: baseline; }
.quest { display: flex; align-items: center; gap: .8rem; padding: .55rem .6rem; border-radius: 10px; }
.quest.done { background: var(--gold-soft); }
.quest.claimed { opacity: .6; }
.q-emoji { font-size: 1.5rem; width: 2rem; text-align: center; }
.q-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.q-txt b { font-size: .95rem; }
.q-txt .xpbar { margin-top: .3rem; height: 7px; }
.q-reward { font-weight: 800; font-size: .85rem; color: var(--ink-2); white-space: nowrap; }
.q-claim { background: var(--gold); color: #2B2100; animation: pulse-gold 1.8s ease-in-out infinite; }
.gs-item.coins .gs-big { color: color-mix(in srgb, var(--gold) 70%, var(--ink)); }

/* ================= Calendrier d'activité ================= */
.heat { padding: 1rem 1.1rem .8rem; }
.heat-scroll { overflow-x: auto; padding-bottom: .3rem; }
.heat-months { display: grid; grid-auto-flow: column; grid-auto-columns: 15px; gap: 4px; font-size: .7rem; color: var(--ink-2); height: 1.1rem; white-space: nowrap; }
.heat-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 15px; gap: 4px; }
.heat-col { display: grid; grid-template-rows: repeat(7, 15px); gap: 4px; }
.heat i, .heat-legend i { display: block; width: 15px; height: 15px; border-radius: 4px; background: var(--port); }
.heat i.future { background: transparent; }
.heat i.l1 { background: color-mix(in srgb, var(--led) 35%, var(--port)); }
.heat i.l2 { background: color-mix(in srgb, var(--led) 60%, var(--port)); }
.heat i.l3 { background: color-mix(in srgb, var(--led) 82%, var(--port)); }
.heat i.l4 { background: var(--led); box-shadow: 0 0 6px var(--led-glow); }
.heat i.today { outline: 2px solid var(--blue); outline-offset: 1px; }
.heat-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }
.heat-legend { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--ink-2); }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; }

/* ================= Fiches ================= */
.fiches { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.fiche, .rv-card { font: inherit; color: var(--ink); position: relative; height: 170px; padding: 0; border: 0; background: none; cursor: pointer; perspective: 800px; }
.fiche > span, .rv-card > span { position: absolute; inset: 0; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1rem; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
.fiche .f-front, .rv-card .f-front { border-top: 5px solid var(--cat, var(--blue)); }
.fiche .f-front b { font-size: 1.25rem; }
.f-back { transform: rotateY(180deg); font-size: .95rem; line-height: 1.45; background: var(--surface-2) !important; }
.f-back small { color: var(--ink-2); font-size: .75rem; }
.fiche.flipped .f-front, .rv-card.flipped .f-front { transform: rotateY(-180deg); }
.fiche.flipped .f-back, .rv-card.flipped .f-back { transform: rotateY(0); }
.f-cat { font-size: .72rem; font-weight: 700; color: color-mix(in srgb, var(--cat, var(--blue)) 75%, var(--ink)); }
.f-dots { display: flex; gap: 4px; }
.f-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--port); }
.f-dots i.on { background: var(--gold); }
.fiche.locked { cursor: default; }
.fiche.locked .f-front { border: 1.5px dashed var(--line); background: transparent; }
.revise { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 1rem; animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1); }
.rv-top { display: flex; justify-content: space-between; align-items: center; color: #fff; }
.rv-top .muted { color: rgba(255, 255, 255, .75); }
.rv-top .btn { color: #fff; border-color: rgba(255, 255, 255, .3); }
.rv-card { height: 260px; width: 100%; }
.rv-card .f-front b { font-size: 2rem; }
.rv-card .f-back { font-size: 1.15rem; }
.rv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.rv-actions .btn.ghost { background: var(--surface); }

/* ================= Boutique ================= */
.shop-hero { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.75rem; }
.coin-big { font-size: 3.6rem; line-height: 1; animation: coin-spin 3s ease-in-out infinite; display: inline-block; }
@keyframes coin-spin { 0%, 70%, 100% { transform: rotateY(0); } 85% { transform: rotateY(180deg); } }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; padding: 1.3rem 1rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.shop-item.can { border-color: var(--gold); background: radial-gradient(circle at 50% 20%, var(--gold-soft), var(--surface) 70%); }
.si-emoji { font-size: 3rem; line-height: 1.1; }
.si-price { font-weight: 800; font-size: 1.1rem; }
.shop-item .btn { width: 100%; background: var(--gold); color: #2B2100; }
.si-need { width: 100%; display: flex; flex-direction: column; gap: .3rem; }
.coin-fly { position: fixed; top: -40px; font-size: 1.8rem; z-index: 90; pointer-events: none; animation: coin-fall linear forwards; }
@keyframes coin-fall { to { transform: translateY(110vh) rotate(540deg); } }

/* ================= Éditeur : quiz, fiches, IA ================= */
.choice-ed { display: flex; align-items: center; gap: .5rem; }
.choice-ed input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--led); flex-shrink: 0; }
.choice-ed:has(input[type=radio]:checked) input:not([type=radio]) { border-color: var(--led); }
.glo-row { display: grid; grid-template-columns: minmax(120px, 1fr) 3fr auto; gap: .5rem; margin-bottom: .5rem; }
.ai-box { margin-top: 1.5rem; padding: 1.2rem 1.3rem; border-radius: 16px; border: 1.5px solid color-mix(in srgb, #A26BFA 50%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, #A26BFA 12%, var(--surface)), var(--surface) 60%); }
.ai-head { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; }
.ai-head > div { display: flex; flex-direction: column; }
.ai-spark { font-size: 1.8rem; line-height: 1; }
.ai-box #ai-go { background: #8B55F0; }
.ai-box.working .ai-spark { display: inline-block; animation: spin 1.6s linear infinite; }

@media (max-width: 720px) {
  .trophy-hero { grid-template-columns: 1fr; }
  .game-strip { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .gs-item { padding: .7rem .8rem; font-size: .78rem; }
  .gs-big { font-size: 1.25rem; }
  .glo-row { grid-template-columns: 1fr auto; }
  .glo-row input[data-gk="def"] { grid-column: 1 / -1; grid-row: 2; }
  .reward-banner { flex-wrap: wrap; }
  .reward-banner .btn { width: 100%; }
}

@media (max-width: 720px) {
  .two { grid-template-columns: 1fr; }
  .resume { grid-template-columns: 1fr; }
  .step details, .deliver { padding-left: 1rem; }
  .file .btn.ghost { display: none; }
  .upload-field { flex-wrap: wrap; white-space: normal; }
  .t-progress { flex-wrap: wrap; }
  /* En haut : juste le logo et la cloche. La navigation passe en bas, comme une appli. */
  #topbar { padding-top: calc(.6rem + env(safe-area-inset-top)); }
  #topbar nav, #whoami, #logout { display: none; }
  .who { margin-left: auto; }
  .notif-panel { top: calc(60px + env(safe-area-inset-top)); left: .5rem; right: .5rem; width: auto; max-height: calc(100vh - 150px); }
  body.logged main { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
  body.logged #toast { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .tabbar[hidden] { display: none; }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem;
    padding: .35rem 0; color: var(--ink-2); font-size: .72rem; font-weight: 700; border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 44px; height: 28px; padding: 3px 10px; border-radius: 999px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: background .2s; }
  .tabbar a.active { color: var(--ink); }
  .tabbar a.active svg { background: var(--blue-soft); color: var(--blue); }
  .hero .btn.big { width: 100%; }
  .table-wrap th:nth-child(2), .table-wrap td:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
