/* ===== Thème « Belle Époque » : noir profond + doré ===== */
:root {
  --bg: #0c0b10;
  --bg-soft: #15131b;
  --bg-card: #1b1924;
  --border: #2b2836;
  --text: #ece9f1;
  --muted: #968fa6;
  --accent: #d9b25f;
  --accent-2: #b8923f;
  --green: #74c47a;
  --warn: #e0a44a;
  --radius: 11px;
  --side-w: 232px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* sinon écrasé par display:flex (ex. .filter-row) */
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }

.app { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--side-w); flex-shrink: 0;
  background: linear-gradient(180deg, #131119, #0e0d12);
  border-right: 1px solid var(--border);
  padding: 18px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 1.3rem; border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, #3a3324, #1a1610);
  border: 1px solid var(--accent-2); color: var(--accent);
}
.brand-title { font-weight: 700; font-size: 1.02rem; }
.brand-sub { color: var(--muted); font-size: .76rem; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px; color: var(--text);
  font-size: .92rem; cursor: pointer;
}
.nav-link span { width: 20px; text-align: center; }
.nav-link:hover { background: #1d1a26; text-decoration: none; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(217,178,95,.18), rgba(217,178,95,.04));
  color: var(--accent); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.side-progress { margin-top: auto; }
.side-count { font-size: .8rem; color: var(--muted); margin-bottom: 6px; text-align: center; }

/* ===== Contenu ===== */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 9;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px; background: rgba(14,13,18,.92);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--border);
}
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.3rem; cursor: pointer; }
.view-title { font-size: 1.15rem; margin: 0; }
.spacer { flex: 1; }
.persist { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.file-status {
  font-size: .76rem; color: var(--muted);
  padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap;
}
.file-status.linked { color: var(--green); border-color: #2f4a31; }
.file-status.saving { color: var(--accent); }

.btn {
  background: var(--accent); color: #1a1505; border: none; border-radius: 9px;
  padding: 7px 12px; font-weight: 600; font-size: .8rem; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.btn.ghost:hover { border-color: var(--accent); }
.btn.warn { background: var(--warn); }

.filter-row { display: flex; align-items: center; gap: 12px; padding: 12px 22px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.search {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 8px 12px; min-width: 240px; font-size: .9rem;
}
.search:focus { outline: 1px solid var(--accent); }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; cursor: pointer; user-select: none; }

.view { padding: 22px; max-width: 1080px; width: 100%; margin: 0 auto; overflow-y: auto; }
.view-intro { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }

/* ===== Blocs repliables (catégorie / zone) ===== */
.block { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 13px; overflow: hidden; }
.block-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; user-select: none; }
.block-head:hover { background: #1a1822; }
.block-icon { font-size: 1.15rem; }
.block-title { font-weight: 600; font-size: 1rem; flex: 1; }
.block-count { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.mini-bar { width: 84px; height: 6px; border-radius: 999px; background: #100f15; border: 1px solid var(--border); overflow: hidden; }
.mini-fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s ease; }
.chevron { color: var(--muted); transition: transform .2s ease; }
.block.collapsed .chevron { transform: rotate(-90deg); }
.block.collapsed .block-body { display: none; }
.block-body { padding: 4px 10px 12px; }

.section-title { color: var(--accent); font-size: .76rem; text-transform: uppercase; letter-spacing: .6px; margin: 12px 8px 4px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }

/* ===== Items ===== */
.item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.item:hover { background: #201d29; }
.item input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.item-main { flex: 1; min-width: 0; }
.item-label { font-size: .92rem; }
.item.done .item-label { opacity: .5; }
.badge { display: inline-block; font-size: .68rem; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; border: 1px solid var(--border); color: var(--muted); }
.badge.loc { background: #161420; }
.badge.cat { background: #1c1830; color: #cbb8e8; border-color: #382f50; }
.badge.missable { color: #2a1c08; background: var(--warn); border-color: var(--warn); font-weight: 600; }
.badge.char { background: #15241c; color: #8fd6a8; border-color: #2f4a3a; }
.dup-num { color: var(--muted); font-size: .8em; font-variant-numeric: tabular-nums; margin-left: 2px; }

.details-toggle { background: none; border: none; color: var(--accent); cursor: pointer; font-size: .72rem; padding: 0; margin-top: 3px; }
.details { display: none; margin-top: 6px; padding: 8px 10px; background: #14121b; border: 1px solid var(--border); border-radius: 8px; font-size: .82rem; }
.item.open .details { display: block; }
.dl { display: flex; gap: 8px; padding: 2px 0; }
.dk { color: var(--accent); min-width: 130px; flex-shrink: 0; }
.dv { color: var(--text); }
.web-link { display: inline-block; margin-top: 6px; font-size: .78rem; }

.img-link {
  font-size: .68rem; color: var(--accent); margin-left: 8px;
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; white-space: nowrap;
}
.img-link:hover { border-color: var(--accent); text-decoration: none; }
.item.done .img-link { opacity: .5; }

.item-hint-inline {
  font-size: .78rem; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.item.done .item-hint-inline { opacity: .5; }

/* lien « carte » dans l'en-tête de zone */
.head-action {
  font-size: .76rem; color: var(--accent); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.head-action:hover { border-color: var(--accent); text-decoration: none; }

/* Parcours guidé */
.parcours-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.parcours-select {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 8px 12px; font-size: .9rem; min-width: 220px; cursor: pointer;
}
.parcours-select:focus { outline: 1px solid var(--accent); }
.parcours-counter { color: var(--muted); font-size: .82rem; margin-left: auto; font-variant-numeric: tabular-nums; }
.parcours-phase { color: var(--accent); font-weight: 600; }
.parcours-tag {
  background: rgba(217,178,95,.10); border: 1px solid var(--accent-2); color: var(--text);
  border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem;
}
.parcours-done {
  background: rgba(116,196,122,.1); border: 1px solid #2f4a31; color: var(--green);
  border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem;
}
.parcours-done a { color: var(--green); font-weight: 600; }

/* séparateur d'Acte (vue Par zone) */
.act-divider {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 4px 10px; padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-2);
  color: var(--accent); font-weight: 700; font-size: 1.05rem; letter-spacing: .3px;
}
.act-divider:first-child { margin-top: 4px; }
.act-count { font-size: .82rem; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* catégorie/zone terminée à 100% */
.block.complete { opacity: .62; }
.block.complete .block-title::after {
  content: "✓ terminé"; margin-left: 9px; font-size: .68rem; color: var(--green);
  border: 1px solid #2f4a31; border-radius: 999px; padding: 1px 8px; vertical-align: middle;
}
.card.complete { opacity: .7; border-color: #2f4a31; }
.done-tag { margin-left: auto; color: var(--green); font-weight: 700; }
.stat .num.accent { color: var(--accent); }

.hidden { display: none !important; }

/* ===== Vue d'ensemble ===== */
.hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.ring {
  width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), #221f2b 0);
  display: grid; place-items: center;
}
.ring-inner { width: 116px; height: 116px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; text-align: center; }
.ring-pct { font-size: 1.9rem; font-weight: 700; color: var(--accent); }
.ring-sub { font-size: .8rem; color: var(--muted); }
.hero-stats h2 { margin: 0 0 12px; font-size: 1.1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, auto); gap: 22px; margin-bottom: 12px; }
.stat { display: flex; flex-direction: column; }
.stat .num { font-size: 1.5rem; font-weight: 700; }
.stat .num.warn { color: var(--warn); }
.stat .lbl { font-size: .76rem; color: var(--muted); }

.section-h { font-size: .95rem; color: var(--muted); margin: 8px 2px 12px; text-transform: uppercase; letter-spacing: .5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: block; color: var(--text); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.card-icon { font-size: 1.2rem; }
.card-name { font-weight: 600; font-size: .92rem; }
.bar { height: 8px; background: #100f15; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .25s ease; }
.card-foot { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: 7px; }

/* ===== Référence ===== */
.ref-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ref-tab { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 7px 14px; border-radius: 9px; cursor: pointer; font-size: .85rem; }
.ref-tab.active { background: var(--accent); color: #1a1505; font-weight: 600; border-color: var(--accent); }
.ref-search { margin-bottom: 12px; }
.ref-search input { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 7px 12px; min-width: 240px; font-size: .88rem; }
.ref-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.ref-table { border-collapse: collapse; width: 100%; font-size: .8rem; white-space: nowrap; }
.ref-table th, .ref-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.ref-table th { background: #1a1822; color: var(--accent); position: sticky; top: 0; }
.ref-table tbody tr:hover { background: #1c1a26; }

/* ===== À propos ===== */
.about { max-width: 720px; }
.about h2 { margin-top: 0; }
.about h3 { color: var(--accent); font-size: 1rem; margin: 22px 0 8px; }
.about code { background: #221f2b; padding: 1px 6px; border-radius: 5px; font-size: .85em; }

/* ===== Recherche globale (barre du haut) ===== */
.global-search {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: .85rem; width: 200px;
  transition: width .15s ease;
}
.global-search:focus { outline: 1px solid var(--accent); width: 260px; }
.lang-toggle { min-width: 42px; text-align: center; font-weight: 700; }

/* ===== Stat cliquable (manquables) ===== */
.stat-link { text-decoration: none; color: inherit; padding: 4px 8px; margin: -4px -8px; border-radius: 9px; cursor: pointer; }
.stat-link:hover { background: #221f2b; text-decoration: none; }

/* ===== Prochaine étape (accueil) ===== */
.next-step {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(217,178,95,.14), rgba(217,178,95,.03));
  border: 1px solid var(--accent-2); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 20px; color: var(--text);
}
.next-step:hover { text-decoration: none; border-color: var(--accent); }
.ns-label { text-transform: uppercase; letter-spacing: .6px; font-size: .68rem; color: var(--accent); font-weight: 700; }
.ns-zone { font-weight: 700; font-size: 1.05rem; }
.ns-count { color: var(--muted); font-size: .85rem; }
.ns-go { margin-left: auto; color: var(--accent); font-weight: 600; font-size: .85rem; }

/* ===== Progression par acte (accueil) ===== */
.acts { margin-bottom: 22px; }
.act-bars { display: flex; flex-direction: column; gap: 10px; }
.act-bar-row { display: grid; grid-template-columns: 210px 1fr 110px; align-items: center; gap: 12px; }
.act-bar-name { font-size: .88rem; font-weight: 600; }
.act-bar-count { font-size: .8rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Bandeau manquables (parcours guidé) ===== */
.parcours-missable {
  background: rgba(224,164,74,.12); border: 1px solid var(--warn); color: var(--warn);
  border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem;
}
.parcours-missable strong { color: var(--warn); }

/* ===== Repère « terminé » : case verte sur les items cochés ===== */
.item.done input[type=checkbox] { accent-color: var(--green); }

/* ===== Bouton « Tout déplier / replier » (dans la barre de filtres) ===== */
.toggle-all { margin-left: auto; white-space: nowrap; }

/* ===== Bouton flottant « ↑ Remonter » ===== */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 20;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #1a1505; border: none;
  font-size: 1.2rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.55);
}
.to-top:hover { filter: brightness(1.08); }

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 6px 0 24px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .stat-grid { grid-template-columns: repeat(2, auto); gap: 16px; }

  /* Barre du haut : on empile proprement (titre, puis recherche, puis actions) */
  .topbar { flex-wrap: wrap; row-gap: 8px; padding: 10px 14px; }
  .spacer { display: none; }
  .view-title { font-size: 1.05rem; flex: 0 0 auto; }
  .persist .file-status { display: none; }
  .global-search, .global-search:focus { order: 2; flex: 1 1 100%; width: auto; }
  .persist { order: 3; flex: 1 1 100%; justify-content: flex-end; }

  .filter-row { padding: 10px 14px; }
  .toggle-all { margin-left: 0; }
  .view { padding: 16px 14px; }

  .act-bar-row { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .act-bar-row .bar { grid-column: 1 / -1; order: 3; }
  .act-bar-count { text-align: right; }
}
