:root {
  --bg: #0c0f1d;
  --bg2: #11152a;
  --panel: #161b33;
  --panel2: #1d2340;
  --line: #2a3156;
  --text: #e9ebf7;
  --muted: #a3a9c9;
  --dim: #767ea6;
  --accent: #8f7dff;
  --accent2: #38c8f0;
  --ok: #3fd39a;
  --warn: #ffb547;
  --bad: #ff6b81;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --side: 264px;
  --top: 60px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font: 0.92em ui-monospace, "Cascadia Code", Consolas, monospace; background: #0a0d1a; border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: rgba(12, 15, 29, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; }
.brand img { border-radius: 7px; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); font-size: 24px; padding: 6px; cursor: pointer; }
.top-progress { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.top-progress .bar { width: 160px; }

/* ---------- Mise en page ---------- */
.layout { display: grid; grid-template-columns: var(--side) 1fr; min-height: calc(100vh - var(--top)); }
.sidebar {
  position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto;
  padding: 18px 12px 24px; border-right: 1px solid var(--line); background: var(--bg2);
}
.sidebar .group { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 16px 10px 6px; }
.sidebar .group:first-child { margin-top: 0; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none; position: relative;
}
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: linear-gradient(90deg, rgba(143, 125, 255, .22), rgba(143, 125, 255, .06)); color: var(--text); }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--panel); font-size: 17px; flex: none; }
.nav-link.active .nav-ico { background: var(--accent); color: #fff; }
.nav-txt { flex: 1; min-width: 0; }
.nav-txt b { display: block; font-weight: 600; font-size: 14px; }
.nav-txt small { display: block; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-pct { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.nav-pct.done { color: var(--ok); }
.side-foot { margin: 22px 10px 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.side-foot button { margin-top: 8px; }

main { min-width: 0; padding: 28px clamp(16px, 4vw, 48px) 80px; max-width: 1180px; width: 100%; }
main:focus { outline: none; }

/* ---------- Composants ---------- */
.bar { height: 8px; background: #252b4d; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: inherit; transition: width .4s ease; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--panel); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: transparent; border-color: rgba(255, 107, 129, .4); color: var(--bad); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  background: var(--panel2); color: var(--muted); font-size: 12.5px; border: 1px solid var(--line); white-space: nowrap;
}
button.chip { cursor: pointer; font: inherit; font-size: 12.5px; }
button.chip:hover { color: var(--text); border-color: var(--accent); }
button.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.page-head { margin-bottom: 24px; }
.page-head .eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 36px); margin: 6px 0 10px; }
.page-head p { color: var(--muted); max-width: 760px; margin: 0; font-size: 16px; }
.section-title { font-size: 20px; margin: 36px 0 14px; display: flex; align-items: center; gap: 10px; }

/* Bannière de phase */
.banner { position: relative; border-radius: 18px; overflow: hidden; min-height: 320px; display: flex; align-items: flex-end; margin-bottom: 26px; border: 1px solid var(--line); }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12, 15, 29, 0) 0%, rgba(12, 15, 29, .55) 38%, rgba(12, 15, 29, .97) 78%); }
.banner-body { position: relative; z-index: 1; padding: 22px 24px; width: 100%; }
.banner h1 { font-size: clamp(26px, 3.4vw, 38px); }
.banner p { color: #d6d9ee; max-width: 760px; margin: 8px 0 14px; }
.banner .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.banner .bar { flex: 1; min-width: 140px; max-width: 320px; }

/* ---------- Accueil ---------- */
.hero { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); min-height: 380px; display: flex; align-items: flex-end; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(12, 15, 29, .95) 0%, rgba(12, 15, 29, .6) 45%, rgba(12, 15, 29, 0) 75%), linear-gradient(0deg, rgba(12, 15, 29, .7), transparent 50%); }
.hero-body { position: relative; z-index: 1; padding: clamp(22px, 4vw, 40px); max-width: 600px; }
.hero h1 { font-size: clamp(30px, 4.6vw, 48px); letter-spacing: -.01em; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: #d6d9ee; font-size: 16.5px; margin: 12px 0 20px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12.5px; color: var(--dim); }
.stat .bar { margin-top: 10px; }
.timeline { display: grid; gap: 12px; counter-reset: ph; }
.phase-card { display: grid; grid-template-columns: 52px 1fr auto; gap: 16px; align-items: center; padding: 16px 18px; text-decoration: none; color: inherit; transition: border-color .2s, transform .2s; }
.phase-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.phase-num { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: var(--panel2); color: var(--accent2); }
.phase-card.done .phase-num { background: rgba(63, 211, 154, .15); color: var(--ok); }
.phase-card h3 { font-size: 16.5px; }
.phase-card p { margin: 2px 0 8px; color: var(--muted); font-size: 13.5px; }
.phase-card .bar { max-width: 360px; }
.phase-side { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.phase-side b { display: block; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.howto { padding: 18px 20px; }
.howto h3 { font-size: 16px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.howto ul { margin: 0; padding-left: 18px; color: var(--muted); }
.howto li { margin: 4px 0; }

/* ---------- Étapes ---------- */
.steps { display: grid; gap: 14px; }
.step { overflow: hidden; }
.step > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; }
.step > summary::-webkit-details-marker { display: none; }
.step-n { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--panel2); font-weight: 700; color: var(--accent2); font-variant-numeric: tabular-nums; }
.step.done .step-n { background: var(--ok); color: #06261a; }
.step h3 { font-size: 16.5px; }
.step-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.step-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.step-right .ring { --p: 0; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), #252b4d 0); display: grid; place-items: center; }
.step-right .ring::after { content: ""; width: 24px; height: 24px; border-radius: 50%; background: var(--panel); }
.step.done .ring { background: conic-gradient(var(--ok) 100%, #252b4d 0); }
.chev { transition: transform .2s; font-size: 18px; }
.step[open] .chev { transform: rotate(180deg); }
.step-body { padding: 0 18px 20px 76px; }
.step-intro { color: var(--muted); margin: 0 0 14px; }
.step-items { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.task label { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; align-items: start; }
.task label:hover { background: rgba(255, 255, 255, .03); }
.task input { appearance: none; width: 20px; height: 20px; margin: 2px 0 0; border: 2px solid #4a5285; border-radius: 6px; display: grid; place-items: center; cursor: pointer; transition: .15s; }
.task input:checked { background: var(--ok); border-color: var(--ok); }
.task input:checked::after { content: ""; width: 10px; height: 6px; border: solid #06261a; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }
.task input:checked + span { color: var(--dim); text-decoration: line-through; text-decoration-color: rgba(163, 169, 201, .4); }
.codeblock { position: relative; margin: 4px 0 8px 34px; background: #080b16; border: 1px solid var(--line); border-radius: 10px; }
.codeblock .cb-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.codeblock pre { margin: 0; padding: 12px 14px; overflow-x: auto; font: 13px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; color: #cfd6ff; white-space: pre; }
.copy { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 7px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.copy:hover { color: var(--text); }
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; margin-top: 12px; font-size: 14px; }
.callout svg { font-size: 18px; margin-top: 2px; }
.callout.tip { background: rgba(56, 200, 240, .08); border: 1px solid rgba(56, 200, 240, .25); }
.callout.tip svg { color: var(--accent2); }
.callout.warn { background: rgba(255, 181, 71, .08); border: 1px solid rgba(255, 181, 71, .3); }
.callout.warn svg { color: var(--warn); }
.step-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; margin: 4px 0 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid rgba(42, 49, 86, .6); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- Schéma Jarvis ---------- */
.diagram { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0; align-items: center; padding: 22px; margin-bottom: 26px; }
.d-col { display: grid; gap: 10px; }
.d-node { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; position: relative; }
.d-node b { display: block; font-size: 14px; }
.d-node small { color: var(--muted); font-size: 12.5px; }
.d-col.left .d-node::after, .d-col.right .d-node::before { content: ""; position: absolute; top: 50%; width: 34px; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.d-col.left .d-node::after { right: -36px; }
.d-col.right .d-node::before { left: -36px; }
.d-center { margin: 0 36px; padding: 20px 18px; text-align: center; border-radius: 16px; background: linear-gradient(160deg, rgba(143, 125, 255, .3), rgba(56, 200, 240, .15)); border: 1px solid var(--accent); width: 190px; }
.d-center .big { font-size: 30px; }
.d-center b { display: block; font-size: 16px; margin-top: 6px; }
.d-center small { color: #d6d9ee; font-size: 12.5px; }
.d-tag { display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent2); margin-bottom: 2px; }

/* ---------- Plan ---------- */
.plan-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.plan { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #000; user-select: none; }
.plan img { display: block; width: 100%; height: auto; }
.hot { position: absolute; border: 1.5px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; padding: 0; transition: background .15s, border-color .15s; }
.hot:hover, .hot:focus-visible, .hot.lit { background: rgba(143, 125, 255, .28); border-color: var(--accent); }
.hot.sel { background: rgba(56, 200, 240, .3); border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(56, 200, 240, .25); }
.plan.filtering .hot:not(.lit) { pointer-events: none; }
.plan-tip { position: absolute; pointer-events: none; background: rgba(8, 11, 22, .92); border: 1px solid var(--line); padding: 5px 10px; border-radius: 8px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -130%); opacity: 0; transition: opacity .1s; z-index: 5; }
.compass { position: absolute; font-size: 11px; color: #fff; background: rgba(8, 11, 22, .75); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.compass.n { top: 6px; left: 50%; transform: translateX(-50%); }
.compass.s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.compass.w { left: 4px; top: 50%; transform: rotate(-90deg) translateX(50%); transform-origin: left top; }
.compass.e { right: 4px; top: 50%; transform: rotate(90deg) translateX(-50%); transform-origin: right top; }
.plan-side { position: sticky; top: calc(var(--top) + 16px); padding: 16px; }
.plan-side h3 { font-size: 15px; margin-bottom: 10px; }
.cat-list { display: flex; flex-wrap: wrap; gap: 6px; }
.obj-list { margin-top: 14px; max-height: 50vh; overflow-y: auto; display: grid; gap: 2px; }
.obj-list button { display: flex; justify-content: space-between; gap: 8px; text-align: left; background: none; border: 0; color: var(--muted); padding: 6px 8px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; }
.obj-list button:hover, .obj-list button.lit { background: var(--panel2); color: var(--text); }
.obj-list button span:last-child { color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Achats ---------- */
.shop-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; margin-bottom: 16px; position: sticky; top: calc(var(--top) + 8px); z-index: 5; background: rgba(22, 27, 51, .96); backdrop-filter: blur(8px); }
.search { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--dim); }
.search input { flex: 1; background: none; border: 0; color: var(--text); font: inherit; padding: 9px 0; outline: none; min-width: 0; }
select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: inherit; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel2); color: var(--text); }
.shop-group { margin-bottom: 18px; overflow: hidden; }
.shop-group > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.shop-group > header h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.shop-group > header .sum { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; text-align: right; }
.row { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 14px; align-items: center; padding: 10px 18px; border-bottom: 1px solid rgba(42, 49, 86, .5); }
.row:last-child { border-bottom: 0; }
.row.bought .r-name { color: var(--dim); text-decoration: line-through; text-decoration-color: rgba(163, 169, 201, .4); }
.row .task input { margin: 0; }
.r-name { font-size: 14.5px; }
.r-sub { font-size: 12.5px; color: var(--dim); }
.r-sub button { background: none; border: 0; padding: 0; color: var(--accent2); cursor: pointer; font: inherit; }
.r-store { font-size: 12.5px; color: var(--muted); text-align: right; max-width: 180px; }
.r-price { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; min-width: 90px; }
.est { color: var(--warn); font-weight: 600; }
.stores { padding: 16px 18px; }
.store-bar { display: grid; grid-template-columns: 150px 1fr 90px; gap: 12px; align-items: center; font-size: 13.5px; margin: 7px 0; }
.store-bar .bar { height: 10px; }
.store-bar span:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.owned { padding: 14px 18px; color: var(--muted); font-size: 14px; }

/* ---------- Dépannage ---------- */
.trouble td:first-child { white-space: nowrap; }
.sources { columns: 2; column-gap: 28px; padding: 16px 20px 16px 36px; margin: 0; }
.sources li { margin: 4px 0; break-inside: avoid; font-size: 14px; }

/* ---------- Tiroir objet ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer::before { content: ""; position: absolute; inset: 0; background: rgba(4, 6, 14, .6); opacity: 0; transition: opacity .2s; }
.drawer.open { pointer-events: auto; }
.drawer.open::before { opacity: 1; }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(440px, 100%); background: var(--bg2); border-left: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; padding: 26px 24px 40px; }
.drawer.open .drawer-panel { transform: none; }
.drawer-close { position: absolute; right: 14px; top: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--text); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; font-size: 18px; }
.drawer h2 { font-size: 21px; margin: 6px 40px 6px 0; }
.drawer .cat { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.drawer p { color: var(--muted); }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.dims div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.dims small { display: block; color: var(--dim); font-size: 11.5px; }
.dims b { font-variant-numeric: tabular-nums; }
.drawer h4 { margin: 20px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.drawer .total { display: flex; justify-content: space-between; padding: 10px 10px 0; font-weight: 700; }
.goto { display: grid; gap: 6px; }
.goto a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
.goto a:hover { border-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--panel2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow); opacity: 0; transition: .25s; z-index: 60; pointer-events: none; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.confetti { position: fixed; top: -10px; width: 8px; height: 14px; z-index: 70; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .plan-wrap { grid-template-columns: 1fr; }
  .plan-side { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: block; }
  .sidebar { position: fixed; left: 0; top: var(--top); bottom: 0; width: 290px; z-index: 40; transform: translateX(-105%); transition: transform .25s; height: auto; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .top-progress .bar { width: 80px; }
  .top-progress span { display: none; }
  .diagram { grid-template-columns: 1fr; gap: 14px; }
  .d-center { margin: 0 auto; width: 100%; }
  .d-col.left .d-node::after, .d-col.right .d-node::before { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .shop-top { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .shop-top .stat { padding: 12px; }
  .shop-top .stat .v { font-size: 17px; }
  .shop-top .stat .s { display: none; }
  .filters { position: static; }
  .step-body { padding-left: 18px; }
  .codeblock { margin-left: 0; }
  .sources { columns: 1; }
  .row { grid-template-columns: 22px 1fr auto; }
  .r-store { display: none; }
  .store-bar { grid-template-columns: 100px 1fr 74px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 21px; }
  .phase-card { grid-template-columns: 42px 1fr; }
  .phase-num { width: 42px; height: 42px; font-size: 18px; }
  .phase-side { display: none; }
  .step > summary { grid-template-columns: 36px 1fr auto; padding: 14px; gap: 10px; }
  .step-n { width: 36px; height: 36px; }
  .step-right .lbl { display: none; }
  .brand span { display: none; }
}
@media print {
  .topbar, .sidebar, .filters, .step-actions, .copy, .drawer, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; }
  .card { border-color: #ccc; background: #fff; }
  details.step { break-inside: avoid; }
  details.step > .step-body { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }
