  :root {
    /* Dark theme — variable NAMES kept so all existing rules re-skin at once.
       --parchment now means "primary dark surface", --ink means "light text", etc. */
    --ink:#ede4d3;            /* primary text (was dark; now warm parchment-white) */
    --parchment:#15120e;      /* page background (deep ink-black) */
    --parchment-deep:#211b14; /* raised surface */
    --surface:#1c1712;        /* card surface */
    --surface-2:#262019;      /* card surface, lighter */
    --gold:#c9a227;           /* primary accent (brighter for dark bg) */
    --gold-dim:#8a6f2e;       /* muted gold for labels */
    --gold-bright:#e8c860;    /* highlight gold */
    --oxblood:#a83c52;        /* accent red (brightened for contrast) */
    --teal:#4ea0a2;           /* accent teal (brightened) */
    --green:#5fa653;          /* alive/positive */
    --line:rgba(201,162,39,0.22);  /* hairline borders */
    --shadow:rgba(0,0,0,0.55);
    --muted:#9a8c72;
  }
  * { box-sizing:border-box; margin:0; padding:0; }
  body {
    font-family:"Crimson Pro",Georgia,serif; font-size:1.06rem; color:var(--ink); background:var(--parchment);
    background-image:
      radial-gradient(900px circle at 12% 8%, rgba(201,162,39,0.10), transparent 45%),
      radial-gradient(800px circle at 88% 92%, rgba(78,160,162,0.08), transparent 50%),
      radial-gradient(600px circle at 70% 20%, rgba(168,60,82,0.07), transparent 45%),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-attachment:fixed;
    min-height:100vh; line-height:1.6;
  }
  header.site { text-align:center; padding:2.4rem 1rem 1.3rem; border-bottom:1px solid var(--gold); position:relative; }
  header.site::after { content:"❧"; color:var(--gold); position:absolute; bottom:-0.8rem; left:50%; transform:translateX(-50%); background:var(--parchment); padding:0 0.8rem; }
  h1.brand { font-family:"Cinzel",serif; font-weight:700; font-size:clamp(1.8rem,5vw,2.8rem); letter-spacing:0.08em; color:var(--gold-bright);
    text-shadow:0 0 30px rgba(201,162,39,0.25); }
  h1.brand a { color:inherit; text-decoration:none; }
  .vault-path { font-size:0.8rem; color:var(--gold-dim); margin-top:0.3rem; font-style:italic; }
  main { max-width:980px; margin:0 auto; padding:2rem 1.5rem 4rem; }
  .back { display:inline-block; margin-bottom:1.2rem; color:var(--teal); text-decoration:none; font-weight:600; }
  .back:hover { color:var(--gold-bright); }
  .banner { background:rgba(95,166,83,0.12); border:1px solid var(--green); color:var(--green);
             padding:0.7rem 1rem; border-radius:4px; margin-bottom:1.4rem; font-size:0.95rem; }

  .tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:1.4rem; }
  .tile { display:block; text-decoration:none; color:inherit;
    background:linear-gradient(160deg,var(--surface-2) 0%,var(--surface) 100%);
    border:1px solid var(--gold); border-radius:4px; padding:1.6rem 1.5rem; position:relative;
    box-shadow:0 4px 14px var(--shadow); transition:transform .18s,box-shadow .18s; }
  .tile:hover { transform:translateY(-4px); box-shadow:0 10px 24px var(--shadow); }
  .tile .icon { font-size:2rem; display:block; margin-bottom:0.5rem; }
  .tile h2 { font-family:"Cinzel",serif; font-size:1.3rem; }
  .tile .tag { font-style:italic; color:var(--muted); margin-top:0.25rem; font-size:0.92rem; }
  .tile .count { position:absolute; top:1.2rem; right:1.3rem; font-family:"Cinzel",serif;
    font-size:0.8rem; color:var(--parchment); background:var(--oxblood); border-radius:999px; padding:0.12rem 0.65rem; }
  .progressbar { height:6px; background:var(--parchment-deep); border-radius:999px; margin-top:1rem; overflow:hidden; }
  .progressbar > span { display:block; height:100%; background:var(--green); }
  .tile .ptext { font-size:0.78rem; color:var(--muted); margin-top:0.35rem; }
  .wizard-cta { display:inline-block; margin-top:0.8rem; font-size:0.82rem; color:var(--teal); font-weight:600; }

  .note-list { list-style:none; }
  .note-list li { border-bottom:1px dashed var(--gold); }
  .note-list a { display:flex; justify-content:space-between; align-items:center; padding:0.85rem 0.5rem;
    text-decoration:none; color:var(--ink); font-size:1.1rem; transition:padding-left .15s,color .15s; }
  .note-list a:hover { padding-left:1rem; color:var(--oxblood); }
  .note-list .state { font-size:0.72rem; padding:0.1rem 0.55rem; border-radius:999px; }
  .state.tagged { background:var(--green); color:var(--parchment); }
  .state.untagged { background:var(--gold); color:var(--parchment); }
  .section-title { font-family:"Cinzel",serif; font-size:1.7rem; margin-bottom:0.4rem; display:flex; gap:0.5rem; align-items:center; }
  .section-sub { color:var(--muted); margin-bottom:1.2rem; font-style:italic; }

  .note { background:var(--surface); border:1px solid var(--gold); border-radius:4px;
    padding:2.2rem; box-shadow:0 4px 14px var(--shadow); }
  .note h1 { font-family:"Cinzel",serif; font-size:1.9rem; margin-bottom:0.9rem; border-bottom:1px solid var(--gold); padding-bottom:0.4rem; }
  .note h2,.note h3 { font-family:"Cinzel",serif; margin:1.3rem 0 0.5rem; }
  .note p { margin:0.7rem 0; }
  .note ul,.note ol { margin:0.7rem 0 0.7rem 0; padding-left:1.7rem; }
  .wikilink { color:var(--teal); font-weight:600; text-decoration:none; border-bottom:1px dotted var(--teal); }
  .wikilink:hover { background:rgba(44,85,86,0.12); }
  .embed-img { max-width:100%; height:auto; display:block; margin:0.9rem 0; border-radius:6px;
    border:1px solid var(--line); box-shadow:0 2px 10px var(--shadow); }
  .embed-link { color:var(--gold); font-weight:600; text-decoration:none; border-bottom:1px dotted var(--gold-dim); }
  .embed-link:hover { background:rgba(201,162,39,0.1); }
  .meta-table { width:100%; border-collapse:collapse; margin-bottom:1.2rem; }
  .meta-table td { padding:0.3rem 0.6rem; border-bottom:1px solid var(--parchment-deep); font-size:0.95rem; }
  .meta-table td.k { font-family:"Cinzel",serif; color:var(--gold); width:11rem; }
  .empty { font-style:italic; color:var(--muted); padding:2rem 0; }

  /* Wizard */
  .wizard { background:var(--surface-2); border:1px solid var(--gold); border-radius:6px;
    padding:2rem; box-shadow:0 6px 20px var(--shadow); }
  .wizard-head { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:0.3rem; }
  .wizard-head h2 { font-family:"Cinzel",serif; font-size:1.6rem; }
  .wizard-count { font-size:0.85rem; color:var(--gold); font-family:"Cinzel",serif; }
  .wizard .preview { background:rgba(44,85,86,0.07); border-left:3px solid var(--teal);
    padding:0.8rem 1rem; margin:1rem 0 1.6rem; font-size:0.92rem; max-height:160px; overflow:auto; }
  .field { margin-bottom:1.1rem; }
  .field label { display:block; font-family:"Cinzel",serif; font-size:0.85rem; color:var(--ink);
    letter-spacing:0.03em; margin-bottom:0.3rem; }
  .field .guessed { font-size:0.7rem; color:var(--teal); font-style:italic; margin-left:0.5rem; }
  .field input[type=text], .field input[type=date], .field textarea, .field select {
    width:100%; padding:0.55rem 0.7rem; font-family:"Crimson Pro",serif; font-size:1rem;
    border:1px solid var(--gold); border-radius:4px; background:var(--parchment);
    color:var(--ink); }
  .field textarea { min-height:80px; resize:vertical; }
  .field input:focus, .field textarea:focus, .field select:focus {
    outline:none; border-color:var(--teal); box-shadow:0 0 0 2px rgba(44,85,86,0.18); }
  .field .hint { font-size:0.75rem; color:var(--muted); margin-top:0.25rem; }
  .group { margin-bottom:1.6rem; }
  .group-title { font-family:"Cinzel",serif; font-size:1rem; color:var(--oxblood);
    letter-spacing:0.05em; text-transform:uppercase; margin:1.4rem 0 0.9rem;
    padding-bottom:0.3rem; border-bottom:1px solid var(--gold); }
  .checkbox { font-family:"Crimson Pro",serif !important; text-transform:none !important;
    letter-spacing:0 !important; color:var(--ink) !important; display:inline-flex !important;
    align-items:center; gap:0.4rem; border:none !important; }
  .checkbox input { width:auto !important; }
  .toggle-row { display:flex; justify-content:space-between; align-items:center; margin:0.9rem 0 0.2rem; }
  .toggle { font-size:0.85rem; color:var(--teal); font-weight:600; text-decoration:none;
    border:1px solid var(--teal); border-radius:4px; padding:0.3rem 0.8rem; }
  .toggle:hover { background:rgba(44,85,86,0.1); }
  .view-label { font-size:0.78rem; color:var(--gold); font-style:italic; text-transform:capitalize; }
  .actions { display:flex; gap:0.8rem; align-items:center; flex-wrap:wrap; margin-top:1.6rem; padding-top:1.2rem; border-top:1px solid var(--parchment-deep); }
  button, .btn { font-family:"Cinzel",serif; font-size:0.92rem; letter-spacing:0.03em; cursor:pointer;
    border:none; border-radius:4px; padding:0.65rem 1.3rem; text-decoration:none; display:inline-block; }
  .btn-primary { background:var(--oxblood); color:var(--parchment); }
  .btn-primary:hover { background:#561f2d; }
  .btn-ghost { background:transparent; color:var(--gold); border:1px solid var(--gold); }
  .btn-ghost:hover { background:rgba(154,123,63,0.12); }
  .btn-skip { background:transparent; color:var(--muted); border:1px solid var(--parchment-deep); }
  .nav-mini { margin-left:auto; font-size:0.8rem; color:var(--muted); }
  footer { text-align:center; color:var(--gold); font-size:0.8rem; padding:2rem; font-style:italic; }

  /* NPC card browser (Step 3) */
  .browser-head { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:0.5rem; margin-bottom:0.3rem; }
  .filters { background:var(--surface); border:1px solid var(--gold); border-radius:6px;
    padding:1rem 1.2rem; margin-bottom:1.6rem; }
  .filters form { display:flex; flex-wrap:wrap; gap:0.8rem; align-items:flex-end; }
  .filters .f { display:flex; flex-direction:column; gap:0.2rem; }
  .filters label { font-family:"Cinzel",serif; font-size:0.72rem; letter-spacing:0.04em; color:var(--oxblood); text-transform:uppercase; }
  .filters input[type=text], .filters select { padding:0.5rem 0.6rem; font-family:"Crimson Pro",serif; font-size:0.95rem;
    border:1px solid var(--gold); border-radius:4px; background:var(--parchment); color:var(--ink); min-width:9rem; }
  .filters input[type=text] { min-width:14rem; }
  .filters .searchf { flex:1; }
  .result-count { font-size:0.85rem; color:var(--muted); font-style:italic; }

  .npc-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px,1fr)); gap:1.3rem; }
  .npc-card { position:relative; display:flex; flex-direction:column; text-decoration:none; color:inherit;
    background:linear-gradient(165deg,var(--parchment) 0%,var(--parchment-deep) 100%);
    border:1px solid var(--gold); border-radius:6px; overflow:hidden;
    box-shadow:0 4px 14px var(--shadow); transition:transform .16s, box-shadow .16s; }
  .npc-card:hover { transform:translateY(-4px); box-shadow:0 12px 26px var(--shadow); }
  .npc-portrait { height:230px; background:var(--ink); display:flex; align-items:center; justify-content:center;
    overflow:hidden; border-bottom:1px solid var(--gold); }
  .npc-portrait img { width:100%; height:100%; object-fit:cover; object-position:center 25%; }
  .npc-portrait .placeholder { font-size:3rem; color:var(--gold); opacity:0.5; font-family:"Cinzel",serif; }
  .npc-body { padding:1rem 1.1rem 1.2rem; display:flex; flex-direction:column; gap:0.35rem; flex:1; }
  .npc-name { font-family:"Cinzel",serif; font-size:1.2rem; line-height:1.15; }
  .npc-sub { font-style:italic; color:var(--muted); font-size:0.9rem; }
  .pc-campaign { font-size:0.72rem; letter-spacing:0.04em; color:var(--gold-dim); margin-top:0.3rem;
    font-family:"Cinzel",serif; }
  .pc-camp-group { margin-bottom:2rem; }
  .pc-camp-group .loc-group-title { margin-bottom:1rem; }
  .npc-tags { display:flex; flex-wrap:wrap; gap:0.3rem; margin-top:0.4rem; }
  .chip { font-size:0.68rem; padding:0.12rem 0.55rem; border-radius:999px; white-space:nowrap; }
  .chip.faction { background:var(--teal); color:var(--parchment); }
  .chip.race { background:rgba(154,123,63,0.22); color:var(--ink); border:1px solid var(--gold); }
  .chip.status-alive { background:var(--green); color:var(--parchment); }
  .chip.status-dead { background:#5a5a5a; color:var(--parchment); }
  .chip.status-missing, .chip.status-unknown { background:var(--gold); color:var(--parchment); }
  .npc-stats { margin-top:auto; padding-top:0.6rem; display:flex; gap:0.9rem; font-size:0.78rem; color:var(--muted); }
  .npc-stats b { font-family:"Cinzel",serif; color:var(--oxblood); }
  .needs { font-size:0.72rem; color:var(--gold); font-style:italic; margin-top:0.3rem; }
  .empty-grid { grid-column:1/-1; text-align:center; padding:3rem 1rem; color:var(--muted); font-style:italic; }

  /* ===== Dossier (rich note view) — two-column character sheet ===== */
  .dossier { animation:fadeup .4s ease both; }
  @keyframes fadeup { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

  /* Two columns: portrait + Identity rail (left) + frontmatter masonry (right). Prose full-width below. */
  .dossier-grid { display:grid; grid-template-columns:320px 1fr; gap:1.6rem; align-items:start; margin-bottom:1.6rem; }
  .dossier-grid.no-portrait { grid-template-columns:1fr; }
  .dossier-rail { display:flex; flex-direction:column; gap:1.1rem; }
  .dossier-portrait { width:100%; aspect-ratio:3/4; border-radius:10px; overflow:hidden;
    border:1px solid var(--gold); box-shadow:0 18px 50px var(--shadow), 0 0 0 1px rgba(0,0,0,0.5),
    inset 0 0 80px rgba(0,0,0,0.55); position:relative;
    background:linear-gradient(160deg,#2a2018,#0c0906); display:flex; align-items:center; justify-content:center; }
  .dossier-portrait::after { content:""; position:absolute; inset:0; z-index:3; pointer-events:none;
    background:linear-gradient(to top, rgba(0,0,0,0.6), transparent 40%);
    box-shadow:inset 0 0 40px rgba(0,0,0,0.6); }
  .dossier-portrait img { width:100%; height:100%; object-fit:cover; position:relative; z-index:2; }
  .portrait-fallback { position:absolute; font-family:"Cinzel",serif; font-size:6rem; color:var(--gold); opacity:0.4; z-index:1;
    text-shadow:0 0 30px rgba(201,162,39,0.4); }
  .dossier-portrait.noimg img { display:none; }

  .dossier-main { min-width:0; }
  .dossier-id { margin-bottom:1.2rem; padding-bottom:1.1rem; border-bottom:1px solid var(--gold); position:relative; }
  .dossier-id::after { content:"❧"; position:absolute; bottom:-0.78rem; left:0; color:var(--gold);
    background:var(--parchment); padding-right:0.6rem; font-size:1rem; }
  .dossier-meta { display:flex; gap:0.5rem; align-items:center; margin-bottom:0.6rem; flex-wrap:wrap; }
  .type-pill { font-family:"Cinzel",serif; font-size:0.68rem; letter-spacing:0.12em; text-transform:uppercase;
    color:var(--gold-bright); background:transparent; border:1px solid var(--gold-dim); padding:0.2rem 0.7rem; border-radius:999px; }
  .status-badge { font-family:"Cinzel",serif; font-size:0.7rem; letter-spacing:0.06em; text-transform:uppercase;
    padding:0.2rem 0.7rem; border-radius:999px; color:#0c0906; font-weight:700; }
  .status-badge.alive { background:var(--green); box-shadow:0 0 16px rgba(95,166,83,0.4); }
  .status-badge.dead { background:#6a6a6a; color:#0c0906; }
  .status-badge.missing { background:var(--gold); }
  .status-badge.unknown { background:var(--teal); }
  .dossier-name { font-family:"Cinzel",serif; font-size:2.8rem; line-height:1.04; color:var(--gold-bright);
    text-shadow:0 0 24px rgba(201,162,39,0.2); }
  .dossier-sub { font-style:italic; color:var(--muted); font-size:1.1rem; margin-top:0.5rem; }

  /* MAIN zones: masonry packing so panels nest tightly with no big gaps */
  .dossier-zones { columns:2; column-gap:1.1rem; }
  @media (max-width:1050px) { .dossier-zones { columns:1; } }
  @media (max-width:760px) {
    .dossier-grid { grid-template-columns:1fr; }
    .dossier-rail { max-width:340px; margin:0 auto; width:100%; }
  }

  /* Zones look like distinct raised PANELS, not wiki rows */
  .zone { break-inside:avoid; -webkit-column-break-inside:avoid; page-break-inside:avoid;
    background:linear-gradient(158deg, #29221a 0%, var(--surface) 55%, #14100b 100%);
    border:1px solid var(--line); border-radius:10px;
    padding:1.1rem 1.3rem 1.2rem; margin:0 0 1.1rem; box-shadow:0 8px 26px var(--shadow), inset 0 1px 0 rgba(201,162,39,0.08);
    position:relative; overflow:hidden; }
  .zone::before { content:""; position:absolute; top:0; left:0; right:0; height:2px;
    background:linear-gradient(90deg, transparent, var(--gold), transparent); opacity:0.5; }
  .rail-zone { margin:0; }  /* in the flex rail, gap handles spacing */
  .zone-title { font-family:"Cinzel",serif; font-size:0.8rem; letter-spacing:0.14em; text-transform:uppercase;
    color:var(--gold); margin-bottom:0.8rem; padding-bottom:0.45rem; border-bottom:1px solid var(--line);
    display:flex; align-items:center; gap:0.4rem; }
  .zone-title::before { content:"◆"; font-size:0.5rem; color:var(--gold-dim); }
  .d-row { display:flex; gap:0.8rem; padding:0.32rem 0; align-items:baseline; border-bottom:1px solid rgba(201,162,39,0.06); }
  .d-row:last-child { border-bottom:none; }
  .d-key { font-family:"Cinzel",serif; font-size:0.66rem; letter-spacing:0.06em; text-transform:uppercase;
    color:var(--gold-dim); width:6.5rem; flex:none; padding-top:0.15rem; }
  .d-val { flex:1; color:var(--ink); font-size:1rem; }
  .muted { color:var(--muted); }
  .chips { display:flex; flex-wrap:wrap; gap:0.35rem; }
  .chip-soft { background:rgba(78,160,162,0.14); border:1px solid rgba(78,160,162,0.45); color:var(--teal);
    font-size:0.8rem; padding:0.12rem 0.65rem; border-radius:999px; }
  .yn { font-family:"Cinzel",serif; font-size:0.78rem; padding:0.1rem 0.6rem; border-radius:4px; }
  .yn.yes { background:var(--green); color:#0c0906; }
  .yn.no { background:rgba(201,162,39,0.15); color:var(--muted); }

  /* combat stat block */
  .stat-strip { display:flex; gap:0.6rem; flex-wrap:wrap; margin-bottom:0.6rem; }
  .stat { background:radial-gradient(circle at 50% 30%, #2a221a, #100c08); color:var(--ink);
    border:1px solid var(--gold-dim); border-radius:8px; padding:0.55rem 0.9rem;
    text-align:center; min-width:3.4rem; box-shadow:inset 0 0 18px rgba(0,0,0,0.5); }
  .stat-num { font-family:"Cinzel",serif; font-size:1.45rem; line-height:1; color:var(--gold-bright);
    text-shadow:0 0 14px rgba(232,200,96,0.4); }
  .stat-lbl { font-size:0.6rem; letter-spacing:0.12em; text-transform:uppercase; margin-top:0.25rem; color:var(--gold-dim); }
  .speed { font-size:0.88rem; color:var(--muted); margin-top:0.3rem; }

  /* ===== Location view: wide map banner + themed panels ===== */
  .location-view { animation:fadeup .4s ease both; }
  .loc-banner { position:relative; width:100%; border-radius:12px; overflow:hidden;
    border:1px solid var(--gold); margin-bottom:1.6rem;
    box-shadow:0 18px 50px var(--shadow), inset 0 0 0 1px rgba(0,0,0,0.4);
    background:linear-gradient(135deg,#241d15,#0e0b07); }
  .loc-banner img { width:100%; height:auto; display:block; }  /* natural ratio, no crop */
  /* fallback (no image) keeps a sensible fixed height since there's nothing to size to */
  .loc-banner.noimg { height:300px; background:
      radial-gradient(circle at 30% 30%, rgba(201,162,39,0.12), transparent 50%),
      radial-gradient(circle at 75% 70%, rgba(78,160,162,0.10), transparent 55%),
      linear-gradient(135deg,#241d15,#0e0b07); }
  .loc-banner-overlay { position:absolute; inset:0; z-index:2; display:flex; flex-direction:column;
    justify-content:flex-end; align-items:flex-start; padding:1.8rem 2rem;
    background:linear-gradient(to top, rgba(8,6,4,0.92) 0%, rgba(8,6,4,0.45) 35%, transparent 65%); }
  .loc-name { font-family:"Cinzel",serif; font-size:3rem; line-height:1.02; color:var(--gold-bright);
    text-shadow:0 2px 20px rgba(0,0,0,0.95), 0 0 30px rgba(201,162,39,0.25); margin-top:0.4rem; }
  .loc-sub { font-style:italic; color:#e8dcc0; font-size:1.15rem; margin-top:0.4rem;
    text-shadow:0 1px 8px rgba(0,0,0,0.95); }
  @media (max-width:760px) { .loc-name { font-size:2rem; } }

  /* themed panels in a tight masonry below the banner */
  .loc-zones { columns:3; column-gap:1.1rem; margin-bottom:0.5rem; }
  @media (max-width:1000px) { .loc-zones { columns:2; } }
  @media (max-width:680px) { .loc-zones { columns:1; } }

  /* ===== Locations browse: toggle, cards, groups, tree ===== */
  .view-toggle { display:flex; gap:0.4rem; margin-bottom:1.2rem; }
  .view-btn { font-family:"Cinzel",serif; font-size:0.78rem; letter-spacing:0.06em; text-transform:uppercase;
    padding:0.4rem 0.95rem; border:1px solid var(--line); border-radius:999px; color:var(--muted);
    text-decoration:none; transition:all .15s; }
  .view-btn:hover { border-color:var(--gold-dim); color:var(--gold); }
  .view-btn.active { background:var(--gold); color:#0c0906; border-color:var(--gold); font-weight:700; }

  .loc-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:1rem; }
  .loc-card { display:block; text-decoration:none; color:inherit;
    background:linear-gradient(158deg, var(--surface-2), var(--surface));
    border:1px solid var(--line); border-radius:8px; padding:0.9rem 1rem;
    box-shadow:0 4px 14px var(--shadow); transition:border-color .15s, transform .15s; }
  .loc-card:hover { border-color:var(--gold-dim); transform:translateY(-2px); }
  .loc-card-type { font-family:"Cinzel",serif; font-size:0.6rem; letter-spacing:0.12em; text-transform:uppercase;
    color:var(--gold-dim); margin-bottom:0.3rem; }
  .loc-card-name { display:block; font-family:"Cinzel",serif; font-size:1.12rem; color:var(--gold-bright);
    line-height:1.15; text-decoration:none; }
  .loc-card-name:hover { color:var(--gold); }
  .loc-card-bc { font-size:0.82rem; color:var(--muted); margin-top:0.5rem; line-height:1.9;
    display:flex; flex-wrap:wrap; align-items:center; gap:0.15rem; }
  /* breadcrumb pills — small, rounded, color-coded by location tier */
  .bc-pill { display:inline-block; font-size:0.66rem; letter-spacing:0.02em; padding:0.1rem 0.5rem;
    border-radius:999px; text-decoration:none; border:1px solid transparent; white-space:nowrap;
    font-family:"Crimson Pro",serif; transition:filter .15s; }
  .bc-pill:hover { filter:brightness(1.25); }
  .bc-sep { color:var(--gold-dim); margin:0 0.15rem; font-size:0.7rem; opacity:0.6; }
  /* tier color palette — tuned for the dark theme (tinted bg + matching text/border) */
  .bc-world      { background:rgba(201,162,39,0.16); color:#e8c75a; border-color:rgba(201,162,39,0.4); }
  .bc-continent  { background:rgba(110,168,166,0.16); color:#8fd0ce; border-color:rgba(110,168,166,0.4); }
  .bc-realm      { background:rgba(168,60,82,0.18); color:#e08aa0; border-color:rgba(168,60,82,0.45); }
  .bc-region     { background:rgba(122,140,196,0.16); color:#a9b6e6; border-color:rgba(122,140,196,0.4); }
  .bc-city       { background:rgba(190,130,70,0.16); color:#e0a86e; border-color:rgba(190,130,70,0.4); }
  .bc-settlement { background:rgba(150,150,120,0.16); color:#c9c79a; border-color:rgba(150,150,120,0.4); }
  .bc-district   { background:rgba(140,110,160,0.16); color:#c4a6d6; border-color:rgba(140,110,160,0.4); }
  .bc-poi        { background:rgba(120,160,120,0.16); color:#a6d6a6; border-color:rgba(120,160,120,0.4); }
  .bc-village    { background:rgba(176,142,90,0.16); color:#dcc090; border-color:rgba(176,142,90,0.4); }
  .bc-point-of-interest { background:rgba(120,160,120,0.16); color:#a6d6a6; border-color:rgba(120,160,120,0.4); }
  .bc-geographic-feature { background:rgba(90,150,160,0.16); color:#8ccdd8; border-color:rgba(90,150,160,0.4); }
  .bc-city-ruin  { background:rgba(150,90,90,0.18); color:#d6a0a0; border-color:rgba(150,90,90,0.45); }
  .bc-ruin       { background:rgba(150,90,90,0.18); color:#d6a0a0; border-color:rgba(150,90,90,0.45); }
  .bc-country    { background:rgba(168,60,82,0.18); color:#e08aa0; border-color:rgba(168,60,82,0.45); }
  .bc-other      { background:var(--surface); color:var(--muted); border-color:var(--line); }
  /* card type label tinted to match its own tier */
  .bc-world-text { color:#c9a227; }
  .bc-continent-text { color:#6ea8a6; }
  .bc-realm-text { color:#c96a82; }
  .bc-region-text { color:#8a96c8; }
  .bc-city-text { color:#be8246; }
  .bc-settlement-text { color:#9a9678; }
  .bc-district-text { color:#a684b6; }
  .bc-poi-text { color:#84b684; }
  .bc-village-text { color:#b08e5a; }
  .bc-point-of-interest-text { color:#84b684; }
  .bc-geographic-feature-text { color:#5a96a0; }
  .bc-city-ruin-text { color:#a05a5a; }
  .bc-ruin-text { color:#a05a5a; }
  .bc-country-text { color:#c96a82; }
  .bc-other-text { color:var(--gold-dim); }

  .loc-group { margin-bottom:1.8rem; }
  .loc-group-title { font-family:"Cinzel",serif; font-size:1.1rem; letter-spacing:0.06em; color:var(--gold);
    margin-bottom:0.8rem; padding-bottom:0.4rem; border-bottom:1px solid var(--line);
    display:flex; align-items:baseline; gap:0.6rem; }
  .loc-group-link { color:var(--gold); text-decoration:none; }
  .loc-group-link:hover { color:var(--gold-bright); }
  .loc-group-tier { font-size:0.58rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--gold-dim);
    border:1px solid var(--line); border-radius:999px; padding:0.05rem 0.5rem; }
  .loc-group-empty { color:var(--muted); font-style:italic; font-size:0.9rem; }
  .lf-label { font-family:"Cinzel",serif; font-size:0.62rem; letter-spacing:0.1em; text-transform:uppercase;
    color:var(--gold-dim); align-self:center; }

  .loc-tree { font-size:1rem; padding:1.2rem 1.4rem; }
  .tree-node { position:relative; }
  /* nested children indent with a guide line */
  .tree-children { margin-left:0.7rem; padding-left:1rem; border-left:1px solid var(--line); }
  .tree-row { display:flex; align-items:baseline; gap:0.5rem; padding:0.32rem 0; }
  .tree-caret { color:var(--gold-dim); font-size:0.7rem; cursor:pointer; width:1em; flex:none; user-select:none;
    transition:transform .15s; line-height:1.6; }
  .tree-caret:hover { color:var(--gold); }
  .tree-caret-empty { width:1em; flex:none; }
  .tree-node.collapsed > .tree-row .tree-caret { transform:rotate(-90deg); }
  .tree-node.collapsed > .tree-children { display:none; }
  .tree-link { font-family:"Cinzel",serif; color:var(--ink); text-decoration:none; font-size:1.02rem; }
  .tree-link:hover { color:var(--gold-bright); }
  .tree-tier { font-size:0.58rem; letter-spacing:0.1em; text-transform:uppercase;
    border-radius:999px; padding:0.05rem 0.5rem; border:1px solid transparent; }
  /* when a tree badge has no specific tier color, fall back to muted outline */
  .tree-tier.bc-other { color:var(--gold-dim); border-color:var(--line); }

  /* compact single-row filter bar */
  .loc-filterbar { display:flex; gap:0.6rem; align-items:center; flex-wrap:wrap; margin-bottom:1.2rem; }
  .lf-search { flex:1; min-width:180px; padding:0.5rem 0.8rem; font-family:"Crimson Pro",serif; font-size:0.98rem;
    background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:6px; }
  .lf-search:focus { outline:none; border-color:var(--gold-dim); }
  .lf-select { padding:0.5rem 0.7rem; font-family:"Crimson Pro",serif; font-size:0.95rem;
    background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:6px; cursor:pointer; }
  .lf-select:focus { outline:none; border-color:var(--gold-dim); }
  .lf-btn { font-family:"Cinzel",serif; font-size:0.78rem; letter-spacing:0.06em; background:var(--gold);
    color:#0c0906; border:none; padding:0.55rem 1.1rem; border-radius:6px; cursor:pointer; font-weight:700; }
  .lf-btn:hover { background:var(--gold-bright); }
  .lf-clear { color:var(--muted); text-decoration:none; font-size:1rem; padding:0.4rem 0.6rem;
    border:1px solid var(--line); border-radius:6px; }
  .lf-clear:hover { color:var(--oxblood); border-color:var(--oxblood); }

  /* campaign states */
  .camp-grid { display:flex; flex-direction:column; gap:0.6rem; }
  .camp-state { border:1px solid var(--line); border-radius:8px; padding:0.7rem 0.95rem;
    background:var(--surface); }
  .camp-state.current { border-color:var(--oxblood); box-shadow:0 0 0 1px var(--oxblood), 0 0 20px rgba(168,60,82,0.25); }
  .camp-name { font-family:"Cinzel",serif; font-size:0.85rem; color:var(--gold); margin-bottom:0.4rem; letter-spacing:0.03em; }
  .camp-row { display:flex; gap:0.5rem; align-items:center; }
  .disp { font-style:italic; color:var(--muted); font-size:0.9rem; }

  .prose-zone { width:100%; margin-top:0.5rem; background:linear-gradient(165deg,var(--surface-2),var(--surface));
    border:1px solid var(--line); border-radius:8px; padding:1.4rem 1.8rem 1.6rem; box-shadow:0 6px 22px var(--shadow); }
  .dossier-prose { font-size:1.02rem; line-height:1.75; color:var(--ink); max-width:75ch; }
  /* Clear typographic scale — every heading larger than body, each rank larger than the one below */
  .dossier-prose h1,.dossier-prose h2,.dossier-prose h3,
  .dossier-prose h4,.dossier-prose h5,.dossier-prose h6 {
    font-family:"Cinzel",serif; color:var(--gold); line-height:1.2; font-weight:600; }
  .dossier-prose h1 { font-size:2.1rem; margin:1.6rem 0 0.7rem; color:var(--gold-bright);
    border-bottom:1px solid var(--line); padding-bottom:0.35rem; }
  .dossier-prose h2 { font-size:1.65rem; margin:1.4rem 0 0.6rem; }
  .dossier-prose h3 { font-size:1.32rem; margin:1.2rem 0 0.5rem; color:var(--gold); }
  .dossier-prose h4 { font-size:1.12rem; margin:1rem 0 0.4rem; color:var(--gold-dim); letter-spacing:0.02em; }
  .dossier-prose h5 { font-size:1rem; margin:0.9rem 0 0.3rem; color:var(--gold-dim); text-transform:uppercase; letter-spacing:0.06em; }
  .dossier-prose h6 { font-size:0.85rem; margin:0.8rem 0 0.3rem; color:var(--muted); text-transform:uppercase; letter-spacing:0.08em; }
  .dossier-prose p { margin:0.7rem 0; }
  .dossier-prose ul,.dossier-prose ol { margin:0.6rem 0 0.6rem 0; padding-left:1.7rem; }
  .dossier-prose li { margin:0.25rem 0; }
  .dossier-prose li.task-item { list-style:none; margin-left:-1.5rem; }
  .dossier-prose li.task-item input[type=checkbox] { margin-right:0.45rem; vertical-align:middle; accent-color:var(--gold); }
  .dossier-prose li.task-done { color:var(--muted); text-decoration:line-through; }
  .dossier-prose table { border-collapse:collapse; margin:1rem 0; font-size:0.92rem;
    border:1px solid var(--line); display:block; max-width:100%; overflow-x:auto; }
  .dossier-prose th,.dossier-prose td { border:1px solid var(--line); padding:0.42rem 0.8rem;
    text-align:left; vertical-align:top; }
  .dossier-prose thead th { background:var(--surface-2); color:var(--gold-bright);
    font-family:"Cinzel",serif; font-weight:600; }
  .dossier-prose tbody tr:nth-child(even) { background:rgba(201,162,39,0.05); }
  .dossier-prose tbody tr:hover { background:rgba(78,160,162,0.08); }
  .dossier-prose strong { color:var(--gold-bright); }
  .dossier-prose em { color:var(--teal); }
  .dossier-prose a { color:var(--teal); }
  .dossier-prose blockquote { border-left:3px solid var(--gold-dim); margin:0.8rem 0; padding:0.2rem 0 0.2rem 1rem;
    color:var(--muted); font-style:italic; }
  .dossier-prose hr { border:none; border-top:1px solid var(--line); margin:1.4rem 0; }

  /* Code blocks repurposed as "inscribed plaques" — for NPC names, roles, etc.
     Themed to look set-apart and engraved rather than like raw terminal code. */
  .dossier-prose pre { background:linear-gradient(160deg, rgba(201,162,39,0.07), rgba(0,0,0,0.25));
    border-left:3px solid var(--gold); border-radius:4px; padding:0.7rem 1rem; margin:0.7rem 0;
    box-shadow:inset 0 0 20px rgba(0,0,0,0.35); overflow-x:auto; }
  .dossier-prose pre code { font-family:"Crimson Pro",Georgia,serif; font-size:1rem;
    color:var(--gold-bright); letter-spacing:0.02em; background:none; padding:0; border:none;
    white-space:pre-wrap; }
  /* inline `code` — a subtle gold-tinted nameplate, not monospace */
  .dossier-prose code { font-family:"Crimson Pro",Georgia,serif; font-size:0.97em;
    color:var(--gold-bright); background:rgba(201,162,39,0.12); border:1px solid rgba(201,162,39,0.3);
    border-radius:4px; padding:0.05em 0.4em; letter-spacing:0.01em; }

  /* Collapsible heading sections (Obsidian-style folding) */
  .fold-head { cursor:pointer; position:relative; user-select:none; }
  .fold-head .fold-arrow { display:inline-block; width:1em; margin-left:-1em; color:var(--gold-dim);
    font-size:0.7em; transition:transform .15s; opacity:0; vertical-align:middle; }
  .fold-head:hover .fold-arrow { opacity:1; }
  .fold-section.collapsed > .fold-body { display:none; }
  .fold-section.collapsed > .fold-head .fold-arrow { transform:rotate(-90deg); opacity:1; }
  .fold-section.collapsed > .fold-head { opacity:0.85; }
  .fold-body { }

  /* ===== Session note: 2-column body row with sticky side panel =====
     The metadata header spans full width above. Below, the prose body and
     a sticky panel of mini-cards (one per linked target) sit side-by-side. */
  .session-body-row { display:grid; grid-template-columns:1fr 280px; gap:1.4rem; align-items:start; }
  .session-body-main { min-width:0; }  /* prevents long content forcing the row wider */
  .session-panel { position:sticky; top:1rem;
    border:1px solid var(--line); border-radius:10px; background:rgba(40,32,40,0.4);
    padding:0.8rem; font-size:0.85rem; }
  .session-panel-head { font-family:"Cinzel",serif; font-size:0.8rem; letter-spacing:0.08em;
    text-transform:uppercase; color:var(--gold-dim); margin-bottom:0.6rem;
    padding-bottom:0.5rem; border-bottom:1px solid var(--line); }
  .session-panel-body { display:flex; flex-direction:column; gap:0.5rem; }
  .session-panel-more { font-size:0.78rem; color:var(--muted); text-align:center; padding:0.4rem 0 0;
    font-style:italic; }
  /* Cards toggled by the IntersectionObserver: hidden when their link is off-screen.
     Use display:none rather than opacity so they don't reserve space in the panel. */
  .mini-card.mini-hidden { display:none; }

  /* ===== Session side panel: stacked sections (links + tools) ===== */
  .session-panel-section + .session-panel-section { margin-top:1.2rem; padding-top:1rem;
    border-top:1px dashed var(--line); }

  /* ===== Tool iframe panels (NPC Conjurer, Loot Roller, etc.) ===== */
  .tool-panel { margin-bottom:0.6rem; border:1px solid var(--line); border-radius:8px;
    background:rgba(0,0,0,0.25); overflow:hidden; }
  .tool-panel-head { display:flex; align-items:center; gap:0.5rem; padding:0.55rem 0.7rem;
    cursor:pointer; user-select:none; font-family:"Cinzel",serif; font-size:0.85rem;
    color:var(--gold); }
  .tool-panel-head:hover { background:rgba(193,154,77,0.08); }
  .tool-panel-head .fold-arrow { color:var(--gold-dim); font-size:0.75em;
    transition:transform .15s; }
  .tool-panel-head .tool-panel-icon { font-size:1rem; }
  .tool-panel-head .tool-panel-label { flex:1; }
  .tool-panel-head .tool-panel-pop { font-size:0.85rem; color:var(--gold-dim);
    text-decoration:none; padding:0 0.25rem; opacity:0.5; }
  .tool-panel-head .tool-panel-pop:hover { opacity:1; color:var(--gold); }
  .tool-panel-body { height:600px; border-top:1px solid var(--line); background:#fff; }
  .tool-iframe { width:100%; height:100%; border:0; display:block; }
  .tool-panel.collapsed > .tool-panel-body { display:none; }
  .tool-panel.collapsed > .tool-panel-head .fold-arrow { transform:rotate(-90deg); }
  /* Narrow screens: panel drops below the body */
  @media (max-width: 880px) {
    .session-body-row { grid-template-columns:1fr; }
    .session-panel { position:static; }
  }

  /* Mini-card: compact link-target card in the session side panel */
  .mini-card { display:block; padding:0.5rem 0.65rem; border:1px solid var(--line);
    border-radius:8px; background:rgba(0,0,0,0.25); text-decoration:none; color:inherit;
    transition:transform .12s, border-color .12s, box-shadow .12s; }
  .mini-card:hover { transform:translateX(2px); border-color:var(--gold-dim);
    box-shadow:0 4px 12px rgba(0,0,0,0.3); }
  .mini-card .mini-type { font-size:0.62rem; letter-spacing:0.1em; text-transform:uppercase;
    color:var(--gold-dim); font-family:"Cinzel",serif; margin-bottom:0.15rem; }
  .mini-card .mini-name { font-weight:600; color:var(--gold); font-size:0.95rem;
    font-family:"Cinzel",serif; line-height:1.2; }
  .mini-card .mini-sub { font-style:italic; color:var(--muted); font-size:0.78rem;
    margin-top:0.15rem; }
  .mini-card .mini-chip { display:inline-block; margin-top:0.25rem; padding:0.05rem 0.45rem;
    border-radius:999px; font-size:0.7rem; background:rgba(74,140,140,0.18);
    color:#8fcccc; border:1px solid rgba(74,140,140,0.4); }
  .mini-card .mini-stats { display:flex; gap:0.55rem; margin-top:0.3rem; font-size:0.74rem;
    color:var(--rose); }
  .mini-card .mini-stats b { color:var(--gold-dim); margin-right:0.15rem; }
  /* Per-type accent stripe on the left edge */
  .mini-card.mini-npc      { border-left:3px solid #7aa3c4; }
  .mini-card.mini-pc       { border-left:3px solid #c98a8a; }
  .mini-card.mini-location { border-left:3px solid #c19a4d; }
  .mini-card.mini-org      { border-left:3px solid #b08bd6; }
  .mini-card.mini-lore     { border-left:3px solid #8fcc8f; }
  .mini-card.mini-entity   { border-left:3px solid #e8cd8f; }
  .mini-card.mini-orphan   { opacity:0.55; border-style:dashed; cursor:default; }
  .mini-card.mini-orphan .mini-type { color:var(--muted); }

  /* ===== Mini-card hover preview ===== */
  /* Hidden by default; appears on hover floating to the LEFT of the mini-card
     so it doesn't run off the right edge of the page. */
  .mini-preview { position:absolute; right:calc(100% + 12px); top:0;
    width:300px; padding:0.9rem; border:1px solid var(--gold-dim); border-radius:10px;
    background:linear-gradient(180deg, rgba(50,40,40,0.97), rgba(30,25,30,0.97));
    box-shadow:0 12px 30px rgba(0,0,0,0.55), 0 0 0 1px rgba(193,154,77,0.15);
    opacity:0; visibility:hidden; pointer-events:none;
    transform:translateY(-4px); transition:opacity .12s, transform .12s;
    z-index:50; display:flex; gap:0.7rem; align-items:flex-start;
    font-size:0.82rem; color:var(--text);
  }
  .mini-card { position:relative; }  /* anchor for the absolutely-positioned preview */
  .mini-card:hover > .mini-preview { opacity:1; visibility:visible; transform:translateY(0); }
  .mini-preview .prev-portrait { flex:none; width:78px; height:104px; border-radius:8px;
    overflow:hidden; border:1px solid var(--gold-dim); background:rgba(0,0,0,0.4);
    display:flex; align-items:center; justify-content:center; }
  .mini-preview .prev-portrait img { width:100%; height:100%; object-fit:cover; }
  .mini-preview .prev-no-img span { color:var(--gold-dim); font-family:"Cinzel",serif; font-size:1.8rem; }
  .mini-preview .prev-info { flex:1; min-width:0; }
  .mini-preview .prev-type { font-size:0.6rem; letter-spacing:0.1em; text-transform:uppercase;
    color:var(--gold-dim); font-family:"Cinzel",serif; margin-bottom:0.1rem; }
  .mini-preview .prev-name { font-family:"Cinzel",serif; font-weight:600; color:var(--gold);
    font-size:1rem; line-height:1.2; margin-bottom:0.4rem; }
  .mini-preview .prev-sub-line { font-style:italic; color:var(--muted); font-size:0.78rem;
    margin-bottom:0.4rem; }
  .mini-preview .prev-crumb { font-size:0.72rem; color:var(--muted); margin-bottom:0.4rem; }
  .mini-preview .prev-row { display:flex; gap:0.4rem; align-items:baseline; margin-bottom:0.18rem; }
  .mini-preview .prev-k { flex:none; width:78px; font-size:0.65rem; letter-spacing:0.05em;
    text-transform:uppercase; color:var(--gold-dim); }
  .mini-preview .prev-v { flex:1; color:var(--text); font-size:0.8rem; word-break:break-word; }
  .mini-preview .prev-stats { display:flex; gap:0.55rem; margin-top:0.35rem;
    font-size:0.78rem; color:var(--rose); }
  .mini-preview .prev-stats b { color:var(--gold-dim); margin-right:0.15rem; }
  .mini-preview .prev-quote { margin-top:0.45rem; padding:0.35rem 0.55rem;
    background:rgba(0,0,0,0.3); border-left:2px solid var(--gold-dim);
    font-style:italic; font-size:0.78rem; color:var(--muted); border-radius:3px; }

  /* When the hovered card is near the LEFT edge of the panel area (i.e. the
     session-panel sits close to the right of the prose), the preview to the
     left could collide with the prose. The panel is narrow (~280px) so the
     left-side preview generally fits between the prose and the panel.
     If a card is the very FIRST in the panel and the page is narrow, the
     preview falls back to appearing BELOW the card via a media query. */
  @media (max-width: 1100px) {
    .mini-preview { right:auto; left:0; top:calc(100% + 8px); }
  }

  /* ===== ==highlight== (Obsidian) — DM cue: roll/check prompts =====
     Inline-sized crimson pill with a d20 icon. Distinct from the gold heading
     pills so the eye locks onto these as "stop and prompt the players." */
  mark.hl-callout {
    display:inline-flex; align-items:center; gap:0.4rem;
    padding:0.08rem 0.55rem 0.08rem 0.4rem;
    background:rgba(178,42,42,0.18); color:#ff9a9a;
    border:1px solid rgba(204,68,68,0.55); border-radius:6px;
    font-weight:600; letter-spacing:0.01em;
    /* font-size inherits from surrounding text (no banner) */
  }
  mark.hl-callout::before {
    content:"";
    display:inline-block; width:1em; height:1em; flex:none;
    /* d20 (icosahedral die) as inline SVG, tinted to the callout color. */
    background-color:#ff9a9a;
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linejoin='round'><polygon points='12,2 22,8 22,16 12,22 2,16 2,8'/><polygon points='12,2 12,12 22,8'/><polygon points='12,2 12,12 2,8'/><polygon points='2,8 12,12 2,16'/><polygon points='22,8 12,12 22,16'/><polygon points='2,16 12,12 12,22'/><polygon points='22,16 12,12 12,22'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linejoin='round'><polygon points='12,2 22,8 22,16 12,22 2,16 2,8'/><polygon points='12,2 12,12 22,8'/><polygon points='12,2 12,12 2,8'/><polygon points='2,8 12,12 2,16'/><polygon points='22,8 12,12 22,16'/><polygon points='2,16 12,12 12,22'/><polygon points='22,16 12,12 12,22'/></svg>");
    -webkit-mask-size:contain; mask-size:contain;
    -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;
    -webkit-mask-position:center; mask-position:center;
  }

  /* ===== Previous-session recap panel (session notes) ===== */
  .prev-recap { margin:0.2rem 0 1.4rem; border:1px solid rgba(193,154,77,0.4);
    border-radius:10px; background:rgba(193,154,77,0.07); overflow:hidden; }
  .prev-recap-head { display:flex; align-items:center; gap:0.55rem; cursor:pointer;
    padding:0.7rem 1rem; user-select:none; font-family:"Cinzel",serif; }
  .prev-recap-head:hover { background:rgba(193,154,77,0.12); }
  .prev-recap-head .fold-arrow { color:var(--gold); font-size:0.8em; transition:transform .15s; }
  .prev-recap-label { color:#e8cd8f; font-weight:600; font-size:1rem; }
  .prev-recap-body { padding:0.2rem 1.1rem 1rem; border-top:1px solid rgba(193,154,77,0.25); }
  .prev-recap.collapsed > .prev-recap-body { display:none; }
  .prev-recap.collapsed > .prev-recap-head .fold-arrow { transform:rotate(-90deg); }
  .prev-recap-open { display:inline-block; margin-top:0.6rem; font-size:0.85rem; color:var(--teal); }

  /* ===== Heading pills (inside note prose): color + size by heading level ===== */
  /* Each level is a rounded, color-coded banner you click to expand/collapse.
     The arrow is always visible so it reads as an interactive control. */
  .dossier-prose .fold-head {
    display:block; width:100%;
    border-radius:10px; padding:0.45rem 0.9rem; margin:1rem 0 0.6rem;
    border:1px solid transparent; font-family:"Cinzel",serif; font-weight:600;
    line-height:1.3; transition:filter .15s, transform .12s; box-sizing:border-box;
  }
  .dossier-prose .fold-head:hover { filter:brightness(1.12); transform:translateX(2px); }
  .dossier-prose .fold-head .fold-arrow {
    display:inline-block; margin:0 0.45rem 0 0; opacity:0.9; width:auto;
    color:inherit; font-size:0.8em; vertical-align:baseline;
  }
  /* emphasis inside a heading stays part of the heading line, inheriting its color */
  .dossier-prose .fold-head em,.dossier-prose .fold-head strong { color:inherit; font-style:italic; }
  .dossier-prose .fold-head strong { font-style:normal; }
  .dossier-prose .fold-section.collapsed > .fold-head .fold-arrow { opacity:1; }
  /* H1 — largest, gold */
  .dossier-prose h1.fold-head { font-size:1.45rem;
    background:rgba(193,154,77,0.18); color:#e8cd8f; border-color:rgba(193,154,77,0.45); }
  /* H2 — rose */
  .dossier-prose h2.fold-head { font-size:1.22rem;
    background:rgba(176,108,124,0.18); color:#e0a9b6; border-color:rgba(176,108,124,0.45); }
  /* H3 — periwinkle */
  .dossier-prose h3.fold-head { font-size:1.08rem;
    background:rgba(122,134,196,0.18); color:#aeb6e6; border-color:rgba(122,134,196,0.45); }
  /* H4 — teal */
  .dossier-prose h4.fold-head { font-size:0.98rem;
    background:rgba(74,140,140,0.18); color:#8fcccc; border-color:rgba(74,140,140,0.45); }
  /* H5 — sage */
  .dossier-prose h5.fold-head { font-size:0.9rem;
    background:rgba(150,150,120,0.18); color:#c9c79a; border-color:rgba(150,150,120,0.45); }
  /* H6 — muted */
  .dossier-prose h6.fold-head { font-size:0.84rem;
    background:rgba(140,140,150,0.15); color:#b9b9c4; border-color:rgba(140,140,150,0.4); }


  .done { text-align:center; padding:2rem; }
  .done .big { font-size:3rem; }
