/* TrendScout – couche d'application par-dessus tokens.css (direction « Verre »).
   Les couleurs, matières (glass), boutons, champs, options, stats, journal, toasts
   et tabbar viennent de tokens.css. Ici : police, mise en page et glue. */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.sr { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
svg.ic, svg.ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Corrections de tokens.css : « .v » sert à la fois de racine et de valeur de .stat */
#app.v { min-height: 100dvh; overflow: clip; }
.v .stat .v { position: static; overflow: visible; background: transparent; line-height: 1.2; }
.v h1, .v h2, .v h3, .v p { margin: 0; }

/* Fond d'orbes */
.orbs { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.v .orbs .orb { position: absolute; }
.o1 { width: 520px; height: 520px; background: var(--orb-1); top: -160px; left: -120px; }
.o2 { width: 480px; height: 480px; background: var(--orb-2); top: 12%; right: -140px; }
.o3 { width: 560px; height: 560px; background: var(--orb-3); bottom: -220px; left: 18%; }
.o4 { width: 420px; height: 420px; background: var(--orb-4); bottom: 4%; right: 4%; }

/* Mise en page */
.layout {
  position: relative; z-index: 1; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px;
  max-width: 1260px; margin: 0 auto;
  padding: 24px max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left));
}
main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side { position: sticky; top: 24px; align-self: start; height: calc(100dvh - 48px); display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-gap { height: 16px; }
.nav-count { margin-left: auto; font-size: 12px; opacity: .75; }
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.v .nav-link.is-active .nav-dot { background: var(--accent-ink); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 6px 0; }
.side-foot .caption { font-size: 11.5px; line-height: 1.45; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 20px; text-decoration: none; color: var(--text); }
.mtop .brand { padding: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--glass-thick); border: 1px solid var(--glass-edge); box-shadow: 0 3px 10px rgba(31, 90, 230, .25); display: grid; place-items: center; flex: none; }
.mtop, .v .tabbar { display: none; }
.disclaimer { display: none; margin: 0; font-size: 11.5px; line-height: 1.45; }
.tab { display: none; flex-direction: column; gap: 16px; min-width: 0; }
.tab.active { display: flex; }
.panel { padding: 28px; display: flex; flex-direction: column; gap: 16px; border-radius: 28px; }
.narrow { max-width: 360px; }

/* Accueil / leçons */
/* En-têtes de page, carte « Reprendre », raccourcis */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; max-width: 1120px; }
.page-head-txt { display: flex; flex-direction: column; gap: 10px; }
.page-head .lead { font-size: 18px; max-width: 54ch; margin: 0; }
.prog-card { padding: 18px 22px; min-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.prog-top { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.prog-top > span:first-child { font-weight: 600; }
.resume { max-width: 1080px; padding: 28px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.resume-txt { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.resume-txt .badge { align-self: flex-start; }
.resume-txt .bar { max-width: 360px; margin-top: 6px; }
.resume-btn { min-height: 52px; padding: 0 30px; font-size: 16px; }
.home-cards { max-width: 1080px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.home-card { padding: 24px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); }
.home-card .muted { font-size: 15px; }
.home-card .link { margin-top: auto; }
.hc-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.hc-accent { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.hc-up { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.v .tools-seg { display: none; }
.lesson { padding: 32px; border-radius: 28px; }
.lesson .title-l { margin: 18px 0 6px; }
.prose { max-width: 68ch; display: flex; flex-direction: column; gap: 12px; }
.prose p, .prose li { font-size: 16.5px; line-height: 1.6; }
.prose ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.prose h4 { margin: 10px 0 0; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.prose code { background: var(--fill); padding: 2px 8px; border-radius: 8px; font-size: .92em; }
.prose .up { color: var(--up); } .prose .down { color: var(--down); }
.keep p { font-size: 15px; }
.keep.bad { background: color-mix(in srgb, var(--down) 10%, var(--glass-thick)); }
.keep.bad .k { color: var(--down); }
.keep ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.divider { height: 1px; background: var(--hairline); margin: 20px 0 4px; max-width: 68ch; }

/* Questions */
.opt:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.opt .txt { flex: 1; min-width: 0; }
.v .opt.is-correct, .v .opt.is-wrong { opacity: 1; }
.keep .btn { align-self: flex-start; margin-top: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.score { font-size: 20px; font-weight: 600; }


/* Parcours */
.modules { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.module { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.mod-head { display: flex; flex-direction: column; gap: 8px; }
.mod-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mod-prog { display: flex; align-items: center; gap: 12px; max-width: 360px; }
.mod-prog .bar { flex: 1; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.step-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.step-main { flex: 1 1 280px; min-width: 0; min-height: 62px; display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--glass-edge); background: var(--glass-thick); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.step-main:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--fill-strong); }
.step-main:disabled { cursor: default; opacity: .6; }
.step-row.open .step-main { box-shadow: inset 0 0 0 2px var(--accent); }
.step-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--fill); color: var(--muted); }
.step-ic.done { background: color-mix(in srgb, var(--up) 15%, transparent); color: var(--up); }
.step-ic.open { background: var(--accent); color: var(--accent-ink); }
.step-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.step-txt strong { font-weight: 600; font-size: 15.5px; }
.step-main .badge, .skip { flex: none; }
.step-kicker { margin-top: 16px; }

/* Quiz en direct */
.qz-head { display: flex; flex-direction: column; gap: 8px; max-width: 68ch; margin: 14px 0; }
.q-title { font-weight: 600; font-size: 18px; line-height: 1.4; max-width: 68ch; margin-bottom: 12px; }
.q-title:focus { outline: none; }
.opts { display: flex; flex-direction: column; gap: 8px; max-width: 68ch; }
button.opt { width: 100%; text-align: left; font: inherit; color: var(--text); }
.opt:hover:not(.is-disabled) { box-shadow: inset 0 0 0 1px var(--fill-strong); }
.opt .txt { flex: 1; min-width: 0; }
.qz-fb { max-width: 68ch; margin-top: 14px; }
.qz-fb:empty { display: none; }
.qz-fb, .keep[role="status"] { scroll-margin-bottom: 130px; }
.qz-sum { display: flex; flex-direction: column; gap: 10px; max-width: 68ch; margin-top: 8px; }
.qz-missed { max-width: 68ch; margin-top: 18px; }
.qz-missed h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.qz-missed ul { list-style: none; margin: 0; padding: 0; }
.qz-missed li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--hairline); }
#quiz-host, #rev-host { margin-top: 6px; }
.rev-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.rev-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 22px; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.rev-card:disabled { opacity: .5; cursor: default; }
.tools-seg { align-self: flex-start; }
.tools-seg button { font: 600 14px "Inter", sans-serif; cursor: pointer; }

/* Couche jeu : mentor, scènes, profil, badges */
#sim-game { display: flex; flex-direction: column; gap: 16px; }
#sim-coach:empty { display: none; }
#sim-coach .g-bubble { max-width: none; }
.g-line { display: flex; gap: 14px; align-items: flex-start; scroll-margin-bottom: 130px; }
.g-line .g-bubble { flex: 1; min-width: 0; max-width: 68ch; }
.g-line .g-av { box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.v .g-av-40 { width: 40px; height: 40px; }
.g-bubble p { font-size: 15.5px; line-height: 1.55; }
.g-bubble .who { font-size: 13px; }
.bub-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.g-line.you { justify-content: flex-end; }
.g-line.you .g-bubble { flex: 0 1 auto; max-width: min(560px, 92%); display: flex; flex-direction: column; align-items: flex-start; background: color-mix(in srgb, var(--accent) 12%, var(--glass-thick)); }
.v .g-bubble.you::before { display: none; }
.v .g-bubble.you .who { color: var(--accent); }
.q-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.q-good { background: color-mix(in srgb, var(--up) 15%, transparent); color: var(--up); }
.q-ok { background: var(--fill); color: var(--muted); }
.q-bad { background: color-mix(in srgb, var(--down) 15%, transparent); color: var(--down); }
#coach-hero { max-width: 68ch; margin: 4px 0; }
#strip { max-width: 760px; }
.g-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.strip-xp { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.v .g-mini { width: 40px; height: 40px; border-radius: 50%; background: var(--xp-soft); color: var(--xp); display: grid; place-items: center; flex: none; }
.v .g-reward { max-width: min(520px, 100%); pointer-events: auto; }

#reward-zone { position: fixed; z-index: 45; left: 0; right: 0; top: max(12px, env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }

/* Aventure */
.adv-prof-top { display: flex; gap: 18px; align-items: center; }
.adv-prof-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.adv-week { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step-av { flex: none; display: grid; }
.step-av .g-av { width: 48px; height: 48px; }
.chars-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 12px; }
.char-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 12px 18px; border-radius: 20px; background: var(--glass-thick); border: 1px solid var(--glass-edge); }
.char-card img { height: 180px; width: auto; max-width: 100%; margin-bottom: 6px; }
.char-card.unmet img { filter: grayscale(1) brightness(.9); opacity: .5; }
.char-card .trait { max-width: 22ch; }
.badges-grid { display: flex; flex-wrap: wrap; gap: 20px 14px; margin-top: 14px; }
.v .g-badge .medal svg { width: 30px; height: 30px; }

/* Scènes */
.scene-head { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 18px; align-items: flex-start; }
.scene-log { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.scene-ctl { max-width: 760px; margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice-box .q-title { margin-bottom: 10px; }
.v .g-choice:disabled { cursor: default; }
.scene-sum { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Tableaux dans les leçons */
.table-wrap { overflow-x: auto; margin: 6px 0; border-radius: 14px; background: var(--fill); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hairline); }
.prose th { font-size: 13px; font-weight: 600; color: var(--muted); }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td:first-child { font-weight: 600; }
.prose sup { font-size: .75em; }

/* Intérêts composés */
.chart-c { padding: 14px 16px 12px; }
.chart-c svg { width: 100%; height: auto; display: block; }
.legend-c { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend-c .sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* Ressources et feuille de route */
.roadmap { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.rm-item { display: flex; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--glass-thick); border: 1px solid var(--glass-edge); }
.rm-n { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.rm-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rm-txt p { font-size: 15px; }
#res-list { display: flex; flex-direction: column; gap: 22px; margin-top: 8px; }
.res-group { display: flex; flex-direction: column; gap: 12px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.res-card { padding: 16px 18px; border-radius: 18px; background: var(--glass-thick); border: 1px solid var(--glass-edge); display: flex; flex-direction: column; gap: 6px; }
.res-what { font-size: 14.5px; color: var(--muted); line-height: 1.5; }
.res-link { margin-top: auto; padding-top: 6px; }

/* Simulateur */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; padding: 18px 22px; }
.chart-card { padding: 14px 16px 12px; }
.chart-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 8px; }
.seg button { font: 600 13.5px "Inter", sans-serif; cursor: pointer; gap: 6px; }
.seg button .sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; opacity: .35; }
.seg button.on .sw { opacity: 1; }
#ohlc { margin-left: auto; font-variant-numeric: tabular-nums; min-height: 1.4em; }
canvas#chart { width: 100%; height: 440px; display: block; touch-action: pan-y; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; }
.cd { display: inline-block; width: 10px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -2px; border: 2px solid; }
.cd.up { border-color: var(--up); } .cd.down { border-color: var(--down); background: var(--down); }
.order { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field.qty { width: 150px; }
.row .end { margin-left: auto; }
.timebar { flex-wrap: wrap; justify-content: center; position: sticky; bottom: 16px; z-index: 15; display: flex; gap: 8px; padding: 8px; width: fit-content; max-width: 100%; margin: 0 auto; border-radius: 999px; }
.logs { display: flex; flex-direction: column; max-height: 320px; overflow: auto; }
.log .t { min-width: 0; overflow-wrap: anywhere; }
.log .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.logs .empty { padding: 14px 0; color: var(--muted); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }

/* Bilan */
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; padding: 20px; }
canvas#equity { width: 100%; height: 170px; display: block; }
.tips li { line-height: 1.5; }

/* Calculateur */
.calc { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.calc-out { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.schema svg { width: 100%; max-width: 420px; height: auto; display: block; }

/* Glossaire */
#gloss-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.letter { margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .06em; }
.gl { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: 6px 20px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.gl dt { font-weight: 600; } .gl dd { margin: 0; color: var(--muted); }

/* Toast */
#toast-zone { position: fixed; z-index: 40; left: 0; right: 0; bottom: 96px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 560px; animation: pop 200ms ease; }
.toast.ok .ic { background: var(--up); } .toast.err .ic { background: var(--down); } .toast.warn .ic { background: var(--warn); } .toast.info .ic { background: var(--accent); }
[data-theme="dark"] .toast .ic { color: #0B0B0F; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Tablette */
@media (max-width: 1099px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calc { grid-template-columns: 1fr; }
}

/* Mobile et petite tablette : barre d'onglets flottante */
@media (max-width: 899px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 12px;
    padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .side { display: none; }
  .mtop { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; }
  .v .tabbar { display: flex; position: fixed; z-index: 30; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .v .tabbar a { min-width: 0; padding: 0 2px; }
  .v .title-xl { font-size: 36px; }
  .page-head .lead { font-size: 15px; }
  .prog-card { min-width: 0; width: 100%; }
  .resume { padding: 18px; gap: 14px; }
  .home-card { padding: 18px; }
  .disclaimer { display: block; }
  .v .tools-seg { display: inline-flex; }
  .panel, .lesson { padding: 16px; border-radius: 18px; }
  .module { padding: 16px; }
  canvas#chart { height: 340px; }
  .timebar { bottom: calc(84px + env(safe-area-inset-bottom)); }
  #toast-zone { bottom: calc(158px + env(safe-area-inset-bottom)); }
  .timebar .btn { padding: 0 16px; }
  .gl { grid-template-columns: 1fr; gap: 2px; }
  .row .end { margin-left: 0; }
}
@media (max-width: 520px) {
  .scene-row .step-main { flex-wrap: wrap; row-gap: 8px; }
  .scene-row .step-txt { flex: 1 1 150px; }
  .scene-row .step-main .badge { margin-left: auto; }
  .adv-prof-top .g-av { width: 72px; height: 72px; }
  .g-line { gap: 10px; }
  .g-line .g-av-48 { width: 40px; height: 40px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 16px; gap: 12px; }
  .v .stats .stat .v { font-size: 16px; }
  .field.qty { flex: 1 1 130px; width: auto; }
  .order .btn-buy, .order .btn-sell { flex: 1 1 120px; }
  #ohlc { margin-left: 0; width: 100%; }
}
