/* ─── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    padding: 1.25rem 1rem;
    position: sticky;
    /* Sits below the sticky .top-nav (≈42px tall on desktop) */
    top: 42px;
    align-self: flex-start;
    height: calc(100vh - 42px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s, border-color 0.3s;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-accent) transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-accent);
    border-radius: 4px;
    border: 1px solid transparent;
    background-clip: content-box;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); background-clip: content-box; }
[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, rgba(34, 28, 21, 0.95) 0%, rgba(24, 20, 16, 0.95) 100%);
    box-shadow: none;
}
.sidebar h2 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
}
.sidebar-section { margin-bottom: 1.25rem; }
.sidebar-link {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    font-size: 11.5px;
    border-radius: 3px;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}
.sidebar-link:hover {
    background: var(--overlay-gold-soft);
    color: var(--text-primary);
    border-left-color: var(--gold);
}
.sidebar-link.perm  { color: var(--sage); }
.sidebar-link.quest { color: var(--tan); }
.sidebar-link.story { color: var(--tan); }
.sidebar-link.boss  { color: var(--burnt); }
.sidebar-link.system{ color: var(--steel); }

/* Zones dropdown (collapses on mobile, always open on desktop) */
.zones-details { margin-bottom: 1.25rem; }
.zones-details > summary.zones-summary {
    cursor: pointer; list-style: none;
    font-family: 'Cinzel', serif; color: var(--gold);
    font-size: 11px; text-transform: uppercase; letter-spacing: 2px;
    margin-bottom: 0.75rem; padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle); font-weight: 600;
    display: flex; align-items: center; justify-content: space-between;
}
.zones-details > summary.zones-summary::-webkit-details-marker { display: none; }
.zones-details > summary.zones-summary::after {
    content: "▸"; font-size: 9px; opacity: 0.6; margin-left: 0.5rem;
}
.zones-details[open] > summary.zones-summary::after { content: "▾"; }
@media (min-width: 901px) {
    /* Modern browsers: force content visible regardless of [open] state */
    details.zones-details::details-content { content-visibility: visible !important; }
    /* Only neuter the summary where we actually keep content open */
    @supports selector(::details-content) {
        .zones-details > summary.zones-summary { cursor: default; pointer-events: none; }
        .zones-details > summary.zones-summary::after { display: none; }
    }
}

/* Progress info panel */
.progress-info {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}
.progress-bar-bg { height: 5px; background: var(--bg-base); border-radius: 3px; overflow: hidden; margin-bottom: 0.4rem; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); width: 0%; transition: width 0.3s; }
.progress-bar-fill.complete { background: linear-gradient(90deg, #4a7a2a, var(--sage)); }
.progress-label {
    font-size: 9.5px; color: var(--gold); margin-bottom: 0.2rem; font-weight: 600;
    font-family: 'Cinzel', serif; letter-spacing: 1.5px; text-transform: uppercase;
}
.progress-label.complete { color: var(--sage); margin-top: 0.5rem; }
.progress-text { font-size: 10.5px; color: var(--text-muted); text-align: right; font-family: 'IBM Plex Mono', monospace; }

/* Sidebar buttons */
.btn {
    width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-base) 100%);
    border: 1px solid var(--border-subtle); border-top-color: rgba(255, 255, 255, 0.06);
    color: var(--text-body); padding: 0.55rem 0.7rem; border-radius: 4px; cursor: pointer;
    font-size: 11px; font-weight: 600; line-height: 1; margin-top: 0.45rem;
    font-family: 'Cinzel', serif; letter-spacing: 1.2px; text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 2px rgba(0, 0, 0, 0.18);
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    position: relative; overflow: hidden;
}
.btn::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 45%);
    pointer-events: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 10px rgba(0, 0, 0, 0.25); }
.btn:active { transform: translateY(0); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); }
.btn:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }

/* Reset = warning tone */
.btn { color: var(--burnt); border-color: rgba(200, 112, 96, 0.35); }
.btn:hover { background: linear-gradient(180deg, var(--overlay-burnt) 0%, var(--bg-elevated) 100%); border-color: var(--burnt); color: var(--burnt); }

/* Export = sage */
.btn.export { color: var(--sage); border-color: rgba(155, 184, 122, 0.35); }
.btn.export:hover { background: linear-gradient(180deg, var(--overlay-sage) 0%, var(--bg-elevated) 100%); border-color: var(--sage); color: var(--sage); }

/* Import = steel */
.btn.import { color: var(--steel); border-color: rgba(126, 158, 184, 0.35); }
.btn.import:hover { background: linear-gradient(180deg, var(--overlay-steel) 0%, var(--bg-elevated) 100%); border-color: var(--steel); color: var(--steel); }
.import-dialog { margin-top: 0.5rem; }
.import-dialog textarea {
    width: 100%; height: 60px; background: var(--bg-base); border: 1px solid var(--border-subtle);
    color: var(--text-body); padding: 0.4rem; border-radius: 3px; font-size: 10.5px; resize: none;
    font-family: 'IBM Plex Mono', monospace;
}
.import-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.import-actions button { flex: 1; padding: 0.35rem; background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-body); border-radius: 3px; cursor: pointer; font-size: 10.5px; }
.import-actions button:first-child { background: var(--overlay-sage); border-color: var(--sage); color: var(--sage); }
.import-actions button:hover { opacity: 0.85; }

.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--bg-surface); border: 1px solid var(--sage); color: var(--sage);
    padding: 0.7rem 1.5rem; border-radius: 3px; font-size: 12.5px; z-index: 1001;
    animation: fadeInOut 3s forwards; font-family: 'Cinzel', serif; letter-spacing: 0.5px;
    box-shadow: var(--shadow-md);
}
.toast.error { border-color: var(--burnt); color: var(--burnt); }
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* ─── MAIN ─────────────────────────────────────────────────── */
.main { flex: 1; max-width: 1080px; margin: 0 auto; padding: 1.75rem 2.25rem; }

.header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-subtle); }
.header .eyebrow {
    font-family: 'Cinzel', serif; color: var(--gold-deep);
    font-size: 10px; letter-spacing: 3.5px; text-transform: uppercase; margin-bottom: 0.4rem;
}
.header h1 {
    font-family: 'Cinzel', serif; color: var(--text-primary);
    font-size: 1.75rem; font-weight: 600; letter-spacing: 0.8px; margin-bottom: 0.3rem; line-height: 1.2;
}
.header .patch {
    color: var(--text-muted); font-size: 11.5px;
    font-family: 'IBM Plex Mono', monospace;
}
.header .subtitle, .subtitle {
    color: var(--text-muted); font-size: 12.5px; font-style: italic;
}

/* Endgame banner under header */
.endgame-banner, .banner-05 {
    background: linear-gradient(90deg, var(--overlay-plum) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--plum);
    padding: 0.7rem 1rem; margin: 0 0 1.5rem 0; border-radius: 4px;
    font-size: 12px; color: var(--text-body);
}
.endgame-banner .label, .banner-05 .label {
    font-family: 'Cinzel', serif; color: var(--plum); font-size: 10px;
    letter-spacing: 1.5px; text-transform: uppercase; margin-right: 0.5rem; font-weight: 600;
}
.endgame-banner a, .banner-05 a {
    color: var(--gold); text-decoration: none; font-weight: 600;
}
.endgame-banner a:hover, .banner-05 a:hover { text-decoration: underline; color: var(--gold-deep); }

/* Summary box (permanent rewards) */
.summary-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--gold);
    border-radius: 4px;
    padding: 1rem 1.25rem; margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.summary-box h3 {
    font-family: 'Cinzel', serif; color: var(--gold); font-size: 11px;
    letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 0.6rem; font-weight: 600;
}
.summary-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.4rem;
}
.summary-item {
    background: var(--overlay-sage); border: 1px solid rgba(22, 163, 74, 0.3);
    color: var(--sage); padding: 0.35rem 0.55rem; border-radius: 3px; font-size: 10.5px; font-weight: 500;
}
[data-theme="dark"] .summary-item { color: var(--sage); border-color: rgba(155, 184, 122, 0.25); }

/* Info box (routing notes) */
.info-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1rem 1.25rem; margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.info-box h3 {
    font-family: 'Cinzel', serif; color: var(--gold); font-size: 11px;
    letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 0.6rem; font-weight: 600;
}
.info-box ul { list-style: none; padding: 0; }
.info-box li {
    padding: 0.3rem 0; font-size: 12px; color: var(--text-body);
    display: flex; align-items: flex-start; gap: 0.5rem;
}
.info-box .icon { color: var(--gold); font-size: 10px; line-height: 1.5; }
.info-box strong { color: var(--text-primary); font-weight: 600; }
/* Tip list — hanging indent for long wrapping bullets (overrides .info-box li flex) */
.info-box ul.tip-list { list-style: none; padding: 0; margin: 0; }
.info-box ul.tip-list li {
    display: block; padding: 0.4rem 0 0.4rem 1.35rem; text-indent: -1.35rem;
    font-size: 12px; line-height: 1.55; color: var(--text-body); gap: 0;
}
.info-box ul.tip-list li + li { border-top: 1px dashed var(--border-subtle); }
.info-box ul.tip-list li .icon {
    display: inline-block; width: 0.9rem; margin-right: 0.45rem; text-indent: 0;
    font-size: 11px; line-height: inherit; vertical-align: baseline;
}

/* Zone header */
.zone-header {
    background: linear-gradient(90deg, var(--overlay-gold-strong) 0%, transparent 100%);
    border-left: 3px solid var(--gold);
    padding: 0.55rem 1rem;
    margin: 1.5rem 0 0.5rem;
    color: var(--gold-deep);
    font-size: 13px; font-weight: 600;
    font-family: 'Cinzel', serif; letter-spacing: 0.8px;
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
    border-radius: 0 3px 3px 0;
}
[data-theme="dark"] .zone-header { color: var(--gold-bright); }
.zone-header .wp {
    background: var(--overlay-steel); color: var(--steel);
    padding: 0.13rem 0.4rem; border-radius: 3px; font-size: 9.5px; font-weight: 600;
    font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.5px;
    border: 1px solid rgba(29, 78, 216, 0.3);
}
[data-theme="dark"] .zone-header .wp { border-color: rgba(126, 158, 184, 0.25); }
.zone-header .town {
    background: var(--overlay-plum); color: var(--plum);
    border-color: rgba(124, 58, 237, 0.3);
}
[data-theme="dark"] .zone-header .town { border-color: rgba(184, 138, 160, 0.25); }
.zone-header .lvl, .zone-header .frag, .zone-header .map {
    background: var(--overlay-gold-strong); color: var(--gold);
    padding: 0.13rem 0.4rem; border-radius: 3px; font-size: 9.5px;
    font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.5px;
    border: 1px solid rgba(168, 115, 40, 0.3);
    margin-left: auto;
}
[data-theme="dark"] .zone-header .lvl { border-color: rgba(200, 152, 96, 0.25); }

/* Phase header */
.phase-header {
    font-family: 'Cinzel', serif; color: var(--gold); font-size: 11px;
    letter-spacing: 1.5px; text-transform: uppercase; margin: 1rem 0 0.3rem; font-weight: 600;
    display: flex; align-items: center; gap: 0.4rem;
}
.phase-header::before { content: '◆'; color: var(--gold); font-size: 9px; }

/* Steps */
.step {
    display: flex;
    background: var(--bg-surface);
    margin-bottom: 1px;
    transition: all 0.15s;
    border-left: 2px solid transparent;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
}
.step:hover { background: var(--overlay-gold-soft); }

/* Zone "mark required" toggle */
.zone-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-transform: lowercase;
    color: var(--text-muted);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    transition: all 0.15s;
    user-select: none;
}
/* If a .lvl / .frag / .map is present, it already has margin-left: auto and
   pushes the right-side group. The .zone-mark then sits next to it via the
   parent's gap. If none of those exist, the mark itself takes the auto margin
   so it still anchors to the right. */
.zone-header:not(:has(.lvl)):not(:has(.frag)):not(:has(.map)) .zone-mark {
    margin-left: auto;
}
.zone-mark:hover { color: var(--gold); background: var(--overlay-gold-soft); }
.zone-mark input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px; height: 14px;
    margin: 0; cursor: pointer;
    border: 1.5px solid var(--border-accent);
    border-radius: 3px;
    background: var(--bg-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.15s;
}
.zone-mark:hover input[type="checkbox"] { border-color: var(--gold); }
.zone-mark input[type="checkbox"]:checked {
    background: var(--gold);
    border-color: var(--gold);
}
.zone-mark input[type="checkbox"]:checked::after {
    content: '✓';
    color: white;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
}
[data-theme="dark"] .zone-mark input[type="checkbox"]:checked::after { color: var(--bg-base); }
.step.completed { opacity: 0.45; }
.step.completed .step-content { text-decoration: line-through; text-decoration-color: var(--text-dim); }
.step-check { width: 36px; display: flex; align-items: flex-start; justify-content: center; padding-top: 0.5rem; cursor: pointer; }
.checkbox {
    width: 14px; height: 14px;
    border: 1.5px solid var(--border-accent); border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; background: var(--bg-base);
}
.step:hover .checkbox { border-color: var(--gold); }
.step.completed .checkbox { background: var(--gold); border-color: var(--gold); }
.step.completed .checkbox::after { content: '✓'; color: white; font-size: 10px; font-weight: bold; }
[data-theme="dark"] .step.completed .checkbox::after { color: var(--bg-base); }
.step-content {
    flex: 1; padding: 0.45rem 0.75rem 0.45rem 0; font-size: 12.5px; color: var(--text-body);
}
.step-content .action { color: var(--text-primary); font-weight: 500; }
.step-content .npc { color: var(--tan); font-weight: 500; }
.step-content .boss { color: var(--burnt); font-weight: 600; }
.step-content .item { color: var(--steel); font-weight: 500; }
.step-content .loc { color: var(--gold); font-weight: 500; }
.step-content .skip { color: var(--text-dim); font-style: italic; }
.step-content strong { color: var(--text-primary); font-weight: 600; }
[data-theme="dark"] .step-content .item { color: var(--gold-bright); }
[data-theme="dark"] .step-content .loc { color: var(--steel); }

/* Reward tags */
.reward-tag {
    display: inline-block;
    background: var(--overlay-sage); border: 1px solid rgba(22, 163, 74, 0.35);
    color: var(--sage); padding: 0.1rem 0.4rem; border-radius: 3px;
    font-size: 9.5px; margin-left: 0.4rem;
    font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.3px; font-weight: 600;
}
[data-theme="dark"] .reward-tag { border-color: rgba(155, 184, 122, 0.3); }
.reward-tag.craft { background: var(--overlay-gold-strong); border-color: rgba(168, 115, 40, 0.35); color: var(--gold); }
.reward-tag.gem   { background: var(--overlay-steel); border-color: rgba(29, 78, 216, 0.35); color: var(--steel); }
.reward-tag.optional { background: var(--overlay-plum); border-color: rgba(124, 58, 237, 0.35); color: var(--plum); }
.reward-tag.perm  { background: var(--overlay-sage); border-color: rgba(22, 163, 74, 0.45); color: var(--sage); font-weight: 700; }
.reward-tag.quest { background: var(--overlay-gold-strong); border-color: rgba(168, 115, 40, 0.4); color: var(--gold); }

/* Notes */
.note {
    background: var(--bg-elevated);
    border-left: 2px solid var(--border-accent);
    padding: 0.5rem 0.8rem; margin: 0.3rem 0 0.3rem 38px;
    font-size: 11.5px; color: var(--text-muted); font-style: italic;
    border-radius: 0 3px 3px 0;
}
.note.warning, .note.warn {
    background: var(--overlay-burnt); border-left-color: var(--burnt);
    color: var(--burnt); font-style: normal;
}
.note.tip {
    background: var(--overlay-steel); border-left-color: var(--steel);
    color: var(--steel); font-style: normal;
}
.note.success {
    background: var(--overlay-sage); border-left-color: var(--sage);
    color: var(--sage); font-style: normal;
}
.note.new {
    background: var(--overlay-plum); border-left-color: var(--plum);
    color: var(--text-body); font-style: normal;
}
.note .label {
    font-family: 'Cinzel', serif; font-size: 9.5px; letter-spacing: 1.5px;
    text-transform: uppercase; margin-right: 0.5rem; font-weight: 600;
    color: var(--gold);
}
.note.warning .label, .note.warn .label { color: var(--burnt); }
.note.tip .label { color: var(--steel); }
.note.success .label { color: var(--sage); }
.note.new .label { color: var(--plum); }
.note.new strong { color: var(--text-primary); font-weight: 600; }
.note.new .loc { color: var(--gold); font-weight: 500; }

/* Footer nav */
.footer-nav {
    margin-top: 2rem; padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    display: flex; justify-content: space-between;
    font-size: 12px; font-family: 'Cinzel', serif; letter-spacing: 1px;
}
.footer-nav a { color: var(--gold); text-decoration: none; text-transform: uppercase; transition: color 0.15s; font-weight: 600; }
.footer-nav a:hover { color: var(--gold-deep); }
[data-theme="dark"] .footer-nav a:hover { color: var(--gold-bright); }

/* Site footer (credits + GitHub links) */
.site-footer {
    text-align: center; padding: 1.75rem 1rem 1.25rem; margin-top: 2rem;
    border-top: 1px solid var(--border-subtle); color: var(--text-muted);
    font-size: 11.5px; line-height: 1.55;
    display: flex; flex-direction: column; align-items: center; gap: 0.65rem;
}
.site-footer-tag { color: var(--text-muted); }
.site-footer-links { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.site-footer-link {
    display: inline-flex; align-items: center; gap: 0.35rem;
    color: var(--gold); text-decoration: none;
    padding: 0.32rem 0.85rem; font-size: 10.5px; font-weight: 600;
    font-family: 'Cinzel', serif; letter-spacing: 1px; text-transform: uppercase;
    border: 1px solid var(--border-subtle); border-radius: 999px;
    transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
}
.site-footer-link:hover {
    color: var(--gold-bright); border-color: var(--gold);
    background: var(--overlay-gold-soft); transform: translateY(-1px);
}
.site-footer-disclaimer { font-size: 10.5px; color: var(--text-dim); opacity: 0.85; max-width: 480px; }

/* ─── ENDGAME STORYLINE BLOCKS ─────────────────────────────── */
.storyline {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    margin-bottom: 1.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.storyline-header {
    padding: 1rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    display: flex; align-items: baseline; justify-content: space-between;
    flex-wrap: wrap; gap: 0.6rem;
}
.storyline-header h2 {
    font-family: 'Cinzel', serif; color: var(--text-primary);
    font-size: 1.2rem; font-weight: 700; letter-spacing: 1px;
}
.storyline-header .ordinal {
    font-family: 'Cinzel', serif; color: var(--gold-deep);
    font-size: 11px; letter-spacing: 3px; text-transform: uppercase; font-weight: 600;
}
.storyline-tagline {
    color: var(--text-muted); font-style: italic; font-size: 12px;
    margin-top: 0.35rem;
}
.storyline-body { padding: 1.5rem; }
.storyline-body h3 {
    font-family: 'Cinzel', serif; color: var(--text-primary);
    font-size: 14px; font-weight: 600; letter-spacing: 0.8px;
    margin-top: 1.25rem; margin-bottom: 0.5rem; text-transform: uppercase;
}
.storyline-body h3:first-child { margin-top: 0; }
.storyline-body p { color: var(--text-body); margin-bottom: 0.6rem; }
.storyline-body ul { list-style: none; padding-left: 0; margin-bottom: 0.6rem; }
.storyline-body li {
    color: var(--text-body); padding: 0.25rem 0 0.25rem 1.4rem;
    position: relative; line-height: 1.55;
}
.storyline-body li::before {
    content: '◆'; position: absolute; left: 0.2rem;
    color: var(--gold-deep); font-size: 8px; top: 0.6rem;
}
.storyline-body strong { color: var(--text-primary); font-weight: 600; }
.storyline-body em { color: var(--gold); font-style: normal; font-weight: 500; }

/* Storyline accent stripes — one per league */
.storyline.lg-breach     { border-top: 3px solid var(--c-breach); }
.storyline.lg-expedition { border-top: 3px solid var(--c-expedition); }
.storyline.lg-abyss      { border-top: 3px solid var(--c-abyss); }
.storyline.lg-ritual     { border-top: 3px solid var(--c-ritual); }
.storyline.lg-delirium   { border-top: 3px solid var(--c-delirium); }
.storyline.lg-fortress   { border-top: 3px solid var(--c-fortress); }
.storyline.lg-vaal       { border-top: 3px solid var(--c-vaal); }
.storyline.lg-meta       { border-top: 3px solid var(--gold); }

/* Tags inside storyline body */
.tag {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9.5px; font-weight: 600;
    padding: 0.13rem 0.45rem; border-radius: 3px;
    letter-spacing: 0.5px; text-transform: uppercase;
    margin: 0 0.15rem; white-space: nowrap; vertical-align: 1px;
}
.tag.hub      { background: var(--overlay-sage); color: var(--sage); border: 1px solid rgba(22, 163, 74, 0.35); }
.tag.boss     { background: var(--overlay-burnt); color: var(--burnt); border: 1px solid rgba(220, 38, 38, 0.4); }
.tag.pinnacle { background: rgba(185, 28, 28, 0.12); color: var(--crimson); border: 1px solid rgba(185, 28, 28, 0.45); font-weight: 700; }
.tag.craft    { background: var(--overlay-steel); color: var(--steel); border: 1px solid rgba(29, 78, 216, 0.35); }
.tag.atlas    { background: var(--overlay-plum); color: var(--plum); border: 1px solid rgba(124, 58, 237, 0.35); }
.tag.npc      { background: var(--overlay-tan); color: var(--tan); border: 1px solid rgba(180, 83, 9, 0.35); }
[data-theme="dark"] .tag.hub { border-color: rgba(155, 184, 122, 0.3); }
[data-theme="dark"] .tag.boss { border-color: rgba(200, 112, 96, 0.35); }
[data-theme="dark"] .tag.pinnacle { background: rgba(200, 74, 74, 0.15); border-color: rgba(200, 74, 74, 0.4); }
[data-theme="dark"] .tag.craft { border-color: rgba(126, 158, 184, 0.35); }
[data-theme="dark"] .tag.atlas { border-color: rgba(184, 138, 160, 0.35); }
[data-theme="dark"] .tag.npc   { border-color: rgba(196, 164, 126, 0.35); }

/* Callouts */
.callout {
    background: var(--bg-elevated);
    border-left: 2px solid var(--gold);
    padding: 0.8rem 1rem; margin: 0.9rem 0;
    font-size: 12.5px; border-radius: 0 3px 3px 0;
    color: var(--text-body);
}
.callout.warn { border-left-color: var(--burnt); }
.callout.tip  { border-left-color: var(--sage); }
.callout-label {
    display: block; font-family: 'Cinzel', serif;
    font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--gold); margin-bottom: 0.3rem; font-weight: 600;
}
.callout.warn .callout-label { color: var(--burnt); }
.callout.tip  .callout-label { color: var(--sage); }

/* Card grids inside storylines */
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.8rem; margin: 1rem 0;
}
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 4px; padding: 0.85rem 1rem;
}
.card h4 {
    font-family: 'Cinzel', serif; color: var(--gold);
    font-size: 13px; font-weight: 600; margin-bottom: 0.35rem; letter-spacing: 0.5px;
}
.card .role {
    font-family: 'IBM Plex Mono', monospace; color: var(--text-muted);
    font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 0.5rem;
}
.card p { color: var(--text-body); font-size: 12px; margin-bottom: 0.35rem; }

/* TOC */
.toc {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
}
.toc-title {
    font-family: 'Cinzel', serif; color: var(--gold);
    font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
    margin-bottom: 0.85rem; font-weight: 600;
}
.toc ol { list-style: none; counter-reset: storyline; padding: 0; }
.toc ol li {
    counter-increment: storyline; padding: 0.4rem 0;
    border-bottom: 1px dotted var(--border-subtle);
}
.toc ol li:last-child { border-bottom: none; }
.toc ol li::before {
    content: counter(storyline, upper-roman) ".";
    font-family: 'Cinzel', serif; color: var(--gold-deep);
    font-size: 11px; letter-spacing: 1px; margin-right: 0.7rem;
    display: inline-block; width: 2rem; font-weight: 600;
}
.toc a {
    color: var(--text-body); text-decoration: none;
    font-size: 12.5px; transition: color 0.15s; font-weight: 500;
}
.toc a:hover { color: var(--gold); }
.toc-meta {
    color: var(--text-muted); font-size: 11px; font-style: italic;
    display: block; margin-left: 2.7rem; margin-top: 0.15rem;
}

/* Intro block (endgame guide) */
.intro-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--gold);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem; border-radius: 6px;
    box-shadow: var(--shadow-sm);
}
.intro-block p { color: var(--text-body); margin-bottom: 0.6rem; }
.intro-block p:last-child { margin-bottom: 0; }
.intro-block strong { color: var(--text-primary); font-weight: 600; }

/* ─── INDEX-SPECIFIC ───────────────────────────────────────── */
.index-container {
    max-width: 980px; margin: 0 auto;
    padding: 3rem 1.5rem 4rem; position: relative; z-index: 1;
}
.quest-log-title {
    font-family: 'Cinzel', serif; color: var(--gold);
    font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
    text-align: center; margin-bottom: 1.25rem; font-weight: 600;
}
.journey { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 2.5rem; }
.act-entry { position: relative; }
.act-entry::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: linear-gradient(180deg, var(--gold-deep), var(--gold));
    border-radius: 3px 0 0 3px;
}
.act-entry.final::before { background: linear-gradient(180deg, var(--gold), var(--gold-bright)); }
.act-entry.endgame::before { background: linear-gradient(180deg, var(--plum) 0%, var(--c-fortress) 100%); }

.act-link {
    display: block; background: var(--bg-surface);
    border: 1px solid var(--border-subtle); border-left: none;
    border-radius: 0 6px 6px 0;
    padding: 1rem 1.25rem; padding-left: 1.5rem;
    text-decoration: none; color: var(--text-body);
    transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.act-link:hover {
    background: var(--overlay-gold-soft);
    border-color: var(--gold); transform: translateX(2px);
    box-shadow: var(--shadow-md);
}
.act-entry.endgame .act-link {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--overlay-plum) 100%);
    border-color: rgba(124, 58, 237, 0.3);
}
.act-entry.endgame .act-link:hover {
    border-color: var(--plum);
}
.act-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; gap: 1rem; flex-wrap: wrap; }
.act-name {
    font-family: 'Cinzel', serif; color: var(--text-primary);
    font-size: 15px; font-weight: 600; letter-spacing: 0.5px;
}
.act-entry.endgame .act-name { color: var(--plum); }
.act-meta {
    font-family: 'IBM Plex Mono', monospace; color: var(--text-muted);
    font-size: 11px; letter-spacing: 0.3px;
}
.act-rewards { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.reward {
    background: var(--overlay-gold-soft); border: 1px solid rgba(168, 115, 40, 0.3);
    color: var(--gold); padding: 0.2rem 0.55rem; border-radius: 3px;
    font-size: 10.5px; font-weight: 500;
    font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.3px;
}
.reward.res {
    background: var(--overlay-steel); border-color: rgba(29, 78, 216, 0.3); color: var(--steel);
}
.reward.special {
    background: var(--overlay-sage); border-color: rgba(22, 163, 74, 0.35); color: var(--sage); font-weight: 600;
}
.reward.warn {
    background: var(--overlay-burnt); border-color: rgba(220, 38, 38, 0.35); color: var(--burnt);
}
.reward.new {
    background: var(--overlay-plum); border-color: rgba(124, 58, 237, 0.4); color: var(--plum); font-weight: 600;
}
[data-theme="dark"] .reward { border-color: rgba(200, 152, 96, 0.3); }
[data-theme="dark"] .reward.res { border-color: rgba(126, 158, 184, 0.3); }
[data-theme="dark"] .reward.special { border-color: rgba(155, 184, 122, 0.35); }
[data-theme="dark"] .reward.warn { border-color: rgba(200, 112, 96, 0.35); }
[data-theme="dark"] .reward.new { border-color: rgba(184, 138, 160, 0.4); }

.features {
    background: var(--bg-surface); border: 1px solid var(--border-subtle);
    border-radius: 6px; padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.features-title {
    font-family: 'Cinzel', serif; color: var(--gold);
    font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
    text-align: center; margin-bottom: 1rem; font-weight: 600;
}
.features-list {
    display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
    justify-content: center;
}
.feature {
    color: var(--text-muted); font-size: 11.5px;
    font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.3px;
}
.header .version {
    font-family: 'IBM Plex Mono', monospace; color: var(--text-muted);
    font-size: 11px; letter-spacing: 0.5px;
}

/* ─── ENDGAME DIAGRAM (emblem grid — minimal, compact) ────── */
.diagram-wrap {
    margin: 0 auto 2rem;
    max-width: 540px;
}
.diagram-title {
    text-align: center;
    font-family: 'Cinzel', serif;
    color: var(--text-primary);
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.85rem;
}
.atlas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 480px;
    margin: 0 auto;
}
.atlas-tile {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0.55rem 0.6rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
[data-theme="dark"] .atlas-tile { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
.atlas-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}
[data-theme="dark"] .atlas-tile:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55); }

.atlas-tile .compass-tag {
    position: absolute; top: 0.45rem; right: 0.55rem;
    font: 600 7px 'Cinzel', serif;
    letter-spacing: 1.5px; text-transform: uppercase;
    opacity: 0.6; z-index: 3;
}
.atlas-tile .name {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    line-height: 1.1;
    z-index: 2;
    margin-top: auto;
}
.atlas-tile .pinnacle {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 7px;
    letter-spacing: 0.2px;
    font-weight: 400;
    text-transform: none;
    opacity: 0.7;
    margin-top: 0.12rem;
}
.atlas-tile .symbol {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
    padding-top: 4px;
}
.atlas-tile .symbol svg { width: 56%; height: 56%; }

/* League tile color treatments */
.atlas-tile.fortress    { background: var(--c-fortress); color: #fef3c7; }
.atlas-tile.vaal        { background: var(--c-vaal);     color: #fee2e2; }
.atlas-tile.abyss       { background: var(--c-abyss);    color: #d1fae5; }
.atlas-tile.expedition  { background: var(--c-expedition); color: #fef3c7; }
.atlas-tile.breach      { background: var(--c-breach);   color: #ede9fe; }
.atlas-tile.ritual      { background: var(--c-ritual);   color: #fce7f3; }
.atlas-tile.fortress    .symbol svg { stroke: #fef3c7; }
.atlas-tile.vaal        .symbol svg { stroke: #fee2e2; }
.atlas-tile.abyss       .symbol svg { stroke: #d1fae5; }
.atlas-tile.expedition  .symbol svg { stroke: #fef3c7; }
.atlas-tile.breach      .symbol svg { stroke: #ede9fe; }
.atlas-tile.ritual      .symbol svg { stroke: #fce7f3; }

/* Delirium — metallic silver gradient */
.atlas-tile.delirium {
    background: linear-gradient(135deg,
        var(--c-delirium-a) 0%, var(--c-delirium-b) 45%,
        var(--c-delirium-a) 75%, var(--c-delirium-b) 100%);
    color: #1e293b;
}
[data-theme="dark"] .atlas-tile.delirium { color: #f8fafc; }
.atlas-tile.delirium .symbol svg { stroke: #1e293b; }
[data-theme="dark"] .atlas-tile.delirium .symbol svg { stroke: #f8fafc; }
.atlas-tile.delirium .compass-tag { color: #1e293b; }
[data-theme="dark"] .atlas-tile.delirium .compass-tag { color: #f8fafc; }

/* Spawn + compass tiles — neutral */
.atlas-tile.center, .atlas-tile.compass {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    box-shadow: none;
}
.atlas-tile.center .symbol svg, .atlas-tile.compass .symbol svg {
    stroke: var(--text-primary);
}
.atlas-tile.center .name, .atlas-tile.compass .name {
    text-align: center; align-self: center; margin-top: auto;
}

/* Subtle inner vignette on league tiles */
.atlas-tile.fortress::before, .atlas-tile.vaal::before, .atlas-tile.abyss::before,
.atlas-tile.expedition::before, .atlas-tile.breach::before, .atlas-tile.delirium::before,
.atlas-tile.ritual::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.10) 0%, transparent 55%),
                radial-gradient(circle at 70% 90%, rgba(0,0,0,0.16) 0%, transparent 60%);
    pointer-events: none;
}

.diagram-caption {
    text-align: center; color: var(--text-muted);
    font-size: 11.5px; font-style: italic; margin-top: 0.9rem;
    max-width: 480px; margin-left: auto; margin-right: auto;
}
.diagram-caption strong { color: var(--text-body); font-style: normal; font-weight: 600; }

@media (max-width: 520px) {
    .atlas-grid { gap: 6px; }
    .atlas-tile { padding: 0.35rem 0.45rem; }
    .atlas-tile .name { font-size: 8.5px; letter-spacing: 0.4px; }
    .atlas-tile .pinnacle { font-size: 6.5px; }
    .atlas-tile .compass-tag { font-size: 6px; }
}

/* ─── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    /* Flatten sidebar so progress stays at top + actions go below the guide */
    .sidebar { display: contents; }
    .container { display: flex; flex-direction: column; }

    .sidebar > * { order: 3; margin: 0.75rem 1rem 0; }
    .progress-info { order: 1; }
    .main { order: 4; margin-left: 0; padding: 1.25rem 1rem; max-width: 100%; }
    .sidebar-actions {
        order: 5; margin: 1.25rem 1rem 1rem;
        padding-top: 1rem; border-top: 1px solid var(--border-subtle);
    }

    /* Compact 2-column progress bars */
    .progress-info {
        margin: 0.75rem 1rem 0; padding: 0.55rem 0.7rem;
        display: grid; grid-template-columns: 1fr 1fr;
        column-gap: 0.85rem; row-gap: 0.15rem;
    }
    .progress-info > .progress-label { margin: 0; font-size: 8.5px; }
    .progress-info > .progress-label.complete { margin-top: 0; }
    .progress-info > .progress-bar-bg { height: 4px; margin: 0.05rem 0; }
    .progress-info > .progress-text { font-size: 9.5px; }
    .progress-info > *:nth-child(1) { grid-column: 1; grid-row: 1; }
    .progress-info > *:nth-child(2) { grid-column: 1; grid-row: 2; }
    .progress-info > *:nth-child(3) { grid-column: 1; grid-row: 3; }
    .progress-info > *:nth-child(4) { grid-column: 2; grid-row: 1; }
    .progress-info > *:nth-child(5) { grid-column: 2; grid-row: 2; }
    .progress-info > *:nth-child(6) { grid-column: 2; grid-row: 3; }

    .header h1 { font-size: 1.35rem; }
    .index-container { padding: 2rem 1rem; }
    .theme-toggle { top: 0.5rem; right: 0.5rem; padding: 0.4rem 0.7rem; font-size: 10.5px; }
}

