/* ===== LevelPlan V8 · base : remise à zéro, typographie, coquille de l'app ===== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--tx);
  font-family: var(--font-b); font-size: var(--fs); line-height: 1.45; letter-spacing: var(--track);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; overscroll-behavior-y: none;
}
/* fond de l'atelier : un graticule à peine visible, comme une carte posée sur la table */
:root[data-skin=cartographe] body {
  background:
    radial-gradient(1200px 520px at 50% -180px, #1d2b36 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 95px, #ffffff06 95px 96px),
    repeating-linear-gradient(90deg, transparent 0 95px, #ffffff05 95px 96px),
    var(--bg);
  background-attachment: fixed;
}
:root[data-skin=cartographe][data-mode=light] body {
  background:
    radial-gradient(1200px 520px at 50% -180px, #ffffff 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 95px, #16222c0a 95px 96px),
    repeating-linear-gradient(90deg, transparent 0 95px, #16222c08 95px 96px),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; text-align: inherit; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--acs); }
img, svg { max-width: 100%; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--vgs); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--ac) 40%, transparent); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; text-wrap: balance; }
.serif { font-family: var(--font-d); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--mu); }
.small { font-size: .87em; }
.tiny { font-size: .78em; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 14px; background: var(--inv); color: var(--invtx); border-radius: 10px; }
.skip:focus { top: calc(10px + var(--safe-t)); }

/* ---------- coquille ---------- */
.app { position: relative; min-height: 100vh; min-height: 100dvh; padding: calc(var(--top-h) + var(--safe-t)) 0 calc(var(--nav-h) + var(--nav-sb) + 24px); }
.topbar {
  position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) calc(14px + var(--safe-r)) 0 calc(14px + var(--safe-l));
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar .me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; padding: 4px 6px 4px 2px; border-radius: 14px; }
.topbar .me:active { background: var(--s2); }
.topbar .av { width: 38px; height: 38px; border-radius: 12px; overflow: hidden; background: var(--s2); border: 1px solid var(--line2); flex: none; }
.topbar .av svg { width: 100%; height: 100%; display: block; }
.topbar .who { min-width: 0; line-height: 1.15; }
.topbar .who b { display: block; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who span { display: block; font-size: 12.5px; color: var(--mu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .acts { display: flex; align-items: center; gap: 6px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 99px; background: var(--s2); border: 1px solid var(--line); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; position: relative; white-space: nowrap; }
.pill .gl { color: var(--acs); display: inline-flex; }
@media (max-width: 400px) { .pill { padding: 0 9px; gap: 5px; } .topbar .acts { gap: 4px; } }
.pill .gl svg { width: 15px; height: 15px; }
.pill .dot { position: absolute; top: -10px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--ac); color: var(--actx); font-size: 10px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.ibtn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--tx2); flex: none; }
.ibtn:hover { background: var(--s2); }
.ibtn svg { width: 21px; height: 21px; }
main { display: block; max-width: 620px; margin: 0 auto; padding: 0 calc(16px + var(--safe-r)) 0 calc(16px + var(--safe-l)); outline: none; }
.view { display: none; padding-top: 8px; }
.view.on { display: block; }
.view.wide { max-width: none; }
@media (prefers-reduced-motion: no-preference) { :root:not([data-motion=reduced]) .view.on { animation: viewin .28s cubic-bezier(.2, .8, .2, 1); } }
@keyframes viewin { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- navigation ---------- */
.nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--nav-sb));
  padding: 0 calc(6px + var(--safe-r)) var(--nav-sb) calc(6px + var(--safe-l));
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--mu2); font-size: 10.5px; font-weight: 600; position: relative; min-height: 44px; }
.nav button svg { width: 22px; height: 22px; }
.nav button[aria-current=page] { color: var(--tx); }
.nav button[aria-current=page]::before { content: ""; position: absolute; top: 0; width: 22px; height: 2px; border-radius: 2px; background: var(--ac); }
.nav .badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ac); color: var(--actx); font-size: 10px; font-weight: 800; display: grid; place-items: center; }
/* l'Orbe : une boussole en laiton, au centre, à portée de pouce */
.nav .orbbtn { align-self: start; margin-top: -12px; }
@media (max-width: 1023px) { .nav .orbglyph { width: 52px; height: 52px; box-shadow: 0 0 0 4px var(--bg), 0 8px 20px #00000059; } .nav .orbglyph svg { width: 31px; height: 31px; } }
.orbglyph { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; position: relative; color: var(--ac);
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--s3) 80%, var(--ac) 8%), var(--s1) 70%);
  border: 1px solid var(--acline); box-shadow: 0 0 0 5px var(--bg), 0 10px 24px #00000059; }
.orbglyph svg { width: 34px; height: 34px; overflow: visible; }
.nav .orbbtn[aria-current=page] .orbglyph { border-color: var(--ac); }
.nav .orbbtn[aria-current=page]::before { display: none; }
.orbglyph .ring { transform-origin: 50% 50%; transform-box: fill-box; }
.thinking .orbglyph .ring, .orbglyph.thinking .ring { animation: orbspin 2.4s linear infinite; }
@keyframes orbspin { to { transform: rotate(360deg); } }

/* ---------- grand écran : rail de navigation à gauche ---------- */
@media (min-width: 1024px) {
  :root { --nav-w: 92px; }
  .app { padding: calc(var(--top-h) + var(--safe-t)) 0 40px var(--nav-w); }
  .topbar { left: var(--nav-w); }
  .nav { top: 0; right: auto; width: var(--nav-w); height: 100vh; padding: 18px 8px; grid-template-columns: 1fr; grid-auto-rows: 74px; align-content: start; gap: 6px; border-top: 0; border-right: 1px solid var(--line); }
  .nav .orbbtn { margin-top: 0; order: -1; margin-bottom: 14px; }
  .nav button[aria-current=page]::before { top: 18px; left: 0; width: 2px; height: 30px; }
  main { max-width: 760px; }
  .view.wide { max-width: 1180px; margin: 0 auto; }
}

/* ---------- utilitaires de mise en page ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.sec { margin-top: 26px; }
.sec:first-child { margin-top: 6px; }
.sech { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
.sech h2 { font-family: var(--font-d); font-size: 19px; font-weight: 600; letter-spacing: .1px; }
.sech .more { font-size: 13.5px; font-weight: 600; color: var(--acs); padding: 6px 2px; }
.pagetitle { font-family: var(--font-d); font-size: 30px; font-weight: 600; letter-spacing: -.2px; line-height: 1.1; margin: 10px 2px 4px; }
.pagesub { color: var(--mu); margin: 0 2px 14px; font-size: 14px; }
.lede { color: var(--tx2); font-size: 14.5px; margin: 6px 2px 0; max-width: 60ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
:root[data-motion=reduced] *, :root[data-motion=reduced] *::before, :root[data-motion=reduced] *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

/* V9 · colonnes de grille bornées : un contenu long (mot, nombre, lien) ne fait jamais déborder
   l'écran (cause des débordements à 320 px). Les grilles à plusieurs colonnes, définies plus loin,
   remplacent cette valeur par défaut. */
.stack, .news, .evlist, .todos, .daily .quest, .exlist, .anl, .goals, .goalcard, .mslist, .hist, .quest,
.howto, .ethcard, .hexleg, .stats, .achs, .dlog, .hbars, .plans, .plan ul, .obfeats { grid-template-columns: minmax(0, 1fr); }
