/* ═══════════════════════════════════════════════════
   The Lakeblood Chronicles — Reader & Library Styles
   ═══════════════════════════════════════════════════ */

body {
    background: #f7f7f7;
    color: #222;
    font-family: 'Georgia', 'Times New Roman', serif;
}

/* ═══ Library / Bookshelf View ════════════════════ */

.chronicles-library {
    max-width: 800px;
    margin: 0 auto;
}

.library-header {
    text-align: center;
    margin-bottom: 2.5em;
}
.library-title {
    font-size: 2.2em;
    font-weight: 700;
    color: #181818;
    margin: 0;
    letter-spacing: -0.02em;
}
.library-subtitle {
    font-size: 0.95em;
    color: #888;
    font-style: italic;
    margin: 0.4em 0 0;
}

/* Campaign sections */
.library-campaign {
    margin-bottom: 3em;
}
.campaign-header {
    display: flex;
    align-items: baseline;
    gap: 0.8em;
    border-bottom: 2px solid #181818;
    padding-bottom: 0.4em;
    margin-bottom: 0.6em;
}
.campaign-title {
    font-size: 1.3em;
    font-weight: 700;
    color: #181818;
    margin: 0;
}
.campaign-years {
    font-size: 0.82em;
    color: #999;
    font-style: italic;
    letter-spacing: 0.03em;
}
.campaign-party {
    font-size: 0.88em;
    color: #666;
    margin-bottom: 1.2em;
    letter-spacing: 0.01em;
}
.campaign-party .party-dot {
    font-weight: 700;
}

/* Adventure party key squares */
.adventure-party {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em 1em;
    margin: 0.6em 0 1.2em;
}
.party-key {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    text-decoration: none;
    color: inherit;
    font-size: 0.82em;
    transition: opacity 0.15s ease;
}
.party-key:hover { opacity: 0.75; }
.party-key:visited { color: inherit; }
.party-key-square {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--pk-color, #888);
    border-radius: 2px;
    flex-shrink: 0;
}
.party-key-name {
    font-weight: 600;
    color: var(--pk-color, #666);
}
.party-key-legacy .party-key-name {
    color: #999;
}
.campaign-legacy .adventure-party {
    margin-bottom: 0.8em;
}

/* Party keys inside book group — compact column layout */
.book-group .adventure-party {
    flex-direction: column;
    gap: 0.2em;
    margin: 0;
    padding: 0;
}

/* Bookshelf row */
.bookshelf-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.8em;
}

/* Book group — wraps book card + party key */
.book-group {
    display: flex;
    flex-direction: column;
}

/* Individual book card */
.book-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.book-card:visited { color: inherit; }

/* Book cover — styled as a physical book */
.book-cover {
    aspect-ratio: 2/3;
    background: #2c1810;
    border: 2px solid #44332a;
    position: relative;
    overflow: hidden;
    box-shadow: 3px 3px 12px rgba(0,0,0,0.15), inset -2px 0 6px rgba(0,0,0,0.2);
}

/* Spine edge effect */
.book-cover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(to right,
        rgba(0,0,0,0.25) 0%,
        rgba(0,0,0,0.08) 40%,
        rgba(255,255,255,0.06) 60%,
        transparent 100%
    );
    z-index: 2;
}

.book-cover-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.2em;
    text-align: center;
    background:
        linear-gradient(135deg, rgba(139,26,26,0.15) 0%, transparent 50%),
        linear-gradient(225deg, rgba(139,26,26,0.08) 0%, transparent 50%);
}
.book-emblem {
    width: 42px;
    height: 42px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 0.8em;
}
.book-cover-title {
    font-size: 1.1em;
    font-weight: 700;
    color: #e8d5c4;
    line-height: 1.25;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.book-cover-sub {
    font-size: 0.72em;
    color: rgba(232,213,196,0.55);
    font-style: italic;
    margin-top: 0.3em;
}

/* Book info below cover */
.book-info {
    padding: 0.6em 0;
}
.book-title {
    font-size: 0.92em;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
}
.book-meta {
    font-size: 0.78em;
    color: #999;
    margin-top: 0.15em;
}
.book-status {
    display: inline-block;
    font-size: 0.65em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8B1A1A;
    border: 1px solid #8B1A1A;
    padding: 0.15em 0.5em;
    margin-top: 0.35em;
}

/* Campaign I — lost chronicles */
.campaign-legacy .campaign-header {
    border-bottom-color: #ccc;
}
.campaign-legacy .campaign-title {
    color: #999;
}
.campaign-lost {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 1em 1.2em;
    background: rgba(0,0,0,0.03);
    border: 1px dashed #ccc;
    color: #999;
    font-style: italic;
    font-size: 0.92em;
}

/* ── Layout ─────────────────────────────────────── */
.dossier-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 48px;
}
/* Header styles handled by header.js — do not duplicate here */

.chronicle-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 40px;
    min-height: 60vh;
}

.chronicle-mobile-nav { display: none; }

/* ── Sidebar ────────────────────────────────────── */
.chronicle-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.sidebar-adventure-title {
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #888;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #ddd;
    transition: color 0.15s;
}
.sidebar-adventure-title[style*="cursor"] {
    cursor: pointer;
}
.sidebar-adventure-title:hover {
    color: #8B1A1A;
}
.sidebar-adventure-title.sidebar-title-active {
    color: #8B1A1A;
}
.sidebar-chapters {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-chapter-link {
    display: block;
    padding: 0.5em 0.8em;
    text-decoration: none;
    color: #555;
    font-size: 0.9em;
    line-height: 1.35;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}
.sidebar-chapter-link:visited { color: #555; }
.sidebar-chapter-link:hover {
    color: #222;
    background: rgba(0,0,0,0.03);
}
.sidebar-chapter-link.active {
    color: #222;
    font-weight: 700;
    border-left-color: #8B1A1A;
    background: rgba(139,26,26,0.05);
}
.sidebar-chapter-number {
    font-size: 0.75em;
    font-weight: 700;
    color: #999;
    margin-right: 0.3em;
    font-variant-numeric: tabular-nums;
}


/* ── Reading Pane ───────────────────────────────── */
.chronicle-reading-pane {
    max-width: 680px;
    min-width: 0;
}
.chapter-header {
    margin-bottom: 2.5em;
    padding-bottom: 1.5em;
    border-bottom: 1px solid #ddd;
}
.chapter-header .chapter-number {
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #999;
    margin-bottom: 0.3em;
}
.chapter-header .chapter-title {
    font-size: 2em;
    font-weight: 700;
    color: #181818;
    margin: 0 0 0.2em;
    line-height: 1.15;
}
.chapter-header .chapter-subtitle {
    font-size: 1.05em;
    color: #666;
    font-style: italic;
    line-height: 1.4;
}

/* ── Prose Block ────────────────────────────────── */
.chronicle-prose {
    font-size: 1.08em;
    line-height: 1.8;
    color: #222;
    margin: 0 0 1.1em;
    text-indent: 1.5em;
    letter-spacing: 0.005em;
}
.chronicle-prose:first-child,
.chronicle-prose.no-indent {
    text-indent: 0;
}
.chronicle-prose.mood-tension {
    font-style: italic;
    color: #444;
}
.chronicle-prose.mood-resolution {
    color: #2a3a2a;
}

/* Drop cap for first chapter prose */
.chapter-blocks > .chronicle-prose:first-child::first-letter {
    float: left;
    font-size: 2.6em;
    line-height: 0.9;
    padding-right: 0.06em;
    margin-top: 0.02em;
    font-weight: 700;
    color: #8B1A1A;
}

/* ── Dialogue Block ─────────────────────────────── */
.chronicle-dialogue {
    margin: 0.6em 0;
    padding-left: 1em;
    border-left: 2px solid var(--speaker-color, #888);
    line-height: 1.65;
}
.chronicle-dialogue .speaker-name {
    font-weight: 700;
    color: var(--speaker-color, #333);
}
.chronicle-dialogue .speech-text {
    font-size: 1.04em;
}
.chronicle-dialogue .speech-tone {
    font-size: 0.82em;
    color: #999;
    font-style: italic;
}

/* ── Dialogue Placeholder ───────────────────────── */
.dialogue-placeholder {
    margin: 1.4em 0 1.4em 1.5em;
    padding: 0.9em 1.2em;
    border: 1px dashed #ccc;
    border-left: 3px dashed var(--speaker-color, #bbb);
    background: #fafafa;
    color: #999;
    font-size: 0.92em;
}
.dialogue-placeholder .placeholder-label {
    font-weight: 700;
    font-size: 0.82em;
    margin-bottom: 0.25em;
}
.dialogue-placeholder .placeholder-hint {
    font-style: italic;
    line-height: 1.45;
}

/* ── Adventure Start ────────────────────────────── */
.adventure-start {
    text-align: center;
    margin: 2.5em auto;
    padding: 2em 1.5em;
    max-width: 440px;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    position: relative;
}
.advstart-context {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #999;
    margin-bottom: 0.5em;
}
.advstart-title {
    font-size: 1.55em;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.03em;
    margin-bottom: 0.25em;
}
.advstart-setting {
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #8B1A1A;
    margin-bottom: 0.7em;
}
.advstart-summary {
    font-size: 0.88em;
    color: #666;
    line-height: 1.6;
    max-width: 360px;
    margin: 0 auto 0.9em;
}
.advstart-cover {
    margin: 1.8em auto;
    max-width: 100%;
    text-align: center;
}
.advstart-cover-img {
    max-width: 100%;
    max-height: 540px;
    border: 1px solid #d5cfc5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.advstart-party {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3em;
    font-weight: 700;
    font-size: 0.88em;
}
.advstart-sep {
    color: #ccc;
    margin: 0 0.2em;
}

/* ── System Note ────────────────────────────────── */
.system-note {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    color: #555;
    border-left: 3px solid #8B1A1A;
    background: #faf8f5;
    padding: 0.75em 1.1em;
    margin: 1.6em 0;
    letter-spacing: 0.02em;
    line-height: 1.55;
    display: flex;
    align-items: flex-start;
    gap: 0.6em;
}
.system-note .system-icon {
    flex-shrink: 0;
    line-height: 1.4;
    color: #8B1A1A;
    opacity: 0.75;
}
.system-note .system-icon svg {
    width: 15px;
    height: 15px;
    vertical-align: -2px;
}
.system-note .system-text {
    white-space: pre-line;
}

/* ── Skill Check ────────────────────────────────── */
.skill-check {
    background: #f8f6f2;
    border: 1px solid #bbb;
    border-left: 4px solid var(--check-color, #888);
    border-radius: 4px;
    padding: 0;
    margin: 1.6em auto;
    max-width: 540px;
    position: relative;
    overflow: hidden;
}
.skill-check .check-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 1.1em;
    background: rgba(0,0,0,0.04);
    border-bottom: 1px solid rgba(0,0,0,0.07);
}
.skill-check .check-label {
    font-weight: 700;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #555;
}
.skill-check .check-dc {
    font-family: 'Courier New', monospace;
    font-size: 0.82em;
    font-weight: 700;
    color: #888;
    letter-spacing: 0.04em;
}
.skill-check .check-body {
    padding: 0.7em 1.1em;
}
.skill-check .check-roller-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.45em;
}
.skill-check .roller {
    font-weight: 700;
    font-size: 1em;
}
.skill-check .check-result {
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15em 0.6em;
    border-radius: 3px;
}
.skill-check .check-result.success {
    color: #2d5a27;
    background: rgba(45,90,39,0.1);
}
.skill-check .check-result.failure {
    color: #8B1A1A;
    background: rgba(139,26,26,0.1);
}
.skill-check .check-roll-row {
    display: flex;
    align-items: center;
    gap: 0.7em;
}
.skill-check .roll-value {
    font-family: 'Courier New', monospace;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--check-color, #222);
    background: #fff;
    border: 2px solid var(--check-color, #ccc);
    border-radius: 4px;
    padding: 0.1em 0.5em;
    min-width: 2.2em;
    text-align: center;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.skill-check .check-narrative {
    font-style: italic;
    color: #555;
    padding: 0.6em 1.1em 0.8em;
    font-size: 0.92em;
    line-height: 1.55;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: rgba(0,0,0,0.015);
}

/* Skill check — modifier breakdown */
.skill-check .check-breakdown {
    display: flex;
    align-items: center;
    gap: 0.35em;
    font-size: 0.8em;
    color: #777;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.02em;
}
.skill-check .check-d20 {
    color: #999;
}
.skill-check .check-dice-val {
    color: #666;
    font-weight: 700;
}
.skill-check .check-mod-sign {
    font-weight: 700;
    color: #555;
}
.skill-check .check-ability {
    font-family: 'Georgia', serif;
    font-size: 0.9em;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0,0,0,0.05);
    padding: 0.05em 0.4em;
    border-radius: 2px;
}
.skill-check .check-equals {
    color: #aaa;
}
.skill-check .check-total {
    font-weight: 700;
    color: #333;
}

/* ── Attack Block (Combat) ──────────────────────── */
.attack-block {
    background: #faf7f4;
    border: 1px solid #d4cfc8;
    border-radius: 4px;
    padding: 0;
    margin: 1.6em auto;
    max-width: 540px;
    position: relative;
    overflow: hidden;
}
/* Top accent bar in attacker color */
.attack-block::before {
    content: '';
    display: block;
    height: 3px;
    background: var(--atk-color, #888);
}
/* Header: weapon → target, AC, hit/miss */
.atk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55em 1.1em 0.45em;
    border-bottom: 1px solid #e8e4df;
}
.atk-header-left {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.atk-weapon {
    font-weight: 700;
    font-size: 0.95em;
    color: #333;
}
.atk-arrow {
    color: #bbb;
    font-size: 0.8em;
}
.atk-target {
    font-size: 0.88em;
    color: #777;
}
.atk-result {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2em 0.65em;
    border-radius: 3px;
}
.atk-result.hit {
    color: #2d5a27;
    background: rgba(45,90,39,0.1);
}
.atk-result.miss {
    color: #8B1A1A;
    background: rgba(139,26,26,0.1);
}
/* Body: attacker + two roll columns */
.atk-body {
    padding: 0.7em 1.1em;
}
.atk-attacker {
    font-weight: 700;
    font-size: 0.92em;
    margin-bottom: 0.6em;
}
.atk-rolls {
    display: flex;
    gap: 1.2em;
    flex-wrap: wrap;
}
.atk-roll-col {
    flex: 1;
    min-width: 140px;
}
.atk-roll-label {
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #999;
    margin-bottom: 0.3em;
}
.atk-roll-value {
    font-family: 'Courier New', monospace;
    font-size: 1.6em;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.15em;
}
.atk-roll-col.attack .atk-roll-value {
    color: var(--atk-color, #333);
}
.atk-roll-col.damage .atk-roll-value {
    color: #8B1A1A;
}
.atk-roll-breakdown {
    display: flex;
    align-items: center;
    gap: 0.25em;
    font-size: 0.75em;
    font-family: 'Courier New', monospace;
    color: #aaa;
}
.atk-roll-breakdown .rb-die { color: #bbb; }
.atk-roll-breakdown .rb-raw { color: #888; font-weight: 700; }
.atk-roll-breakdown .rb-mod { color: #777; font-weight: 700; }
.atk-roll-breakdown .rb-type { color: #aaa; font-style: italic; font-family: 'Georgia', serif; }
.atk-ac {
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    color: #aaa;
    margin-top: 0.2em;
}
/* Narrative */
.atk-narrative {
    font-style: italic;
    color: #555;
    padding: 0.55em 1.1em 0.7em;
    font-size: 0.9em;
    line-height: 1.55;
    border-top: 1px solid #e8e4df;
    background: rgba(0,0,0,0.015);
}

/* ── Stat Block (Encounter Card) ────────────────── */
.stat-block {
    background: #fdf5e6;
    border: 1px solid #c4a35a;
    border-top: 3px solid #8B1A1A;
    padding: 1.1em 1.3em;
    margin: 1.8em auto;
    max-width: 540px;
}
.stat-block .sb-name {
    font-size: 1.15em;
    font-weight: 700;
    color: #8B1A1A;
}
.stat-block .sb-meta {
    font-style: italic;
    font-size: 0.82em;
    color: #666;
    margin-bottom: 0.5em;
}
.stat-block .sb-divider {
    border: none;
    border-top: 1px solid #c4a35a;
    margin: 0.5em 0;
}
.stat-block .sb-line {
    font-size: 0.9em;
    line-height: 1.5;
}
.stat-block .sb-line strong { color: #333; }
.stat-block .sb-abilities {
    display: flex;
    gap: 0.8em;
    flex-wrap: wrap;
    font-size: 0.82em;
    margin: 0.5em 0;
    padding: 0.4em 0;
    border-top: 1px solid #c4a35a;
    border-bottom: 1px solid #c4a35a;
}
.stat-block .sb-ability {
    text-align: center;
    min-width: 3em;
}
.stat-block .sb-ability .ab-label {
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    color: #666;
}
.stat-block .sb-ability .ab-val {
    font-weight: 700;
    font-family: 'Courier New', monospace;
}
.stat-block .sb-flavor {
    font-style: italic;
    margin-top: 0.5em;
    color: #555;
    font-size: 0.92em;
}
.stat-block .sb-actions-title {
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8B1A1A;
    border-bottom: 1px solid #c4a35a;
    padding-bottom: 0.2em;
    margin: 0.6em 0 0.3em;
}
.stat-block .sb-action {
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 0.3em;
}
.stat-block .sb-action .action-name {
    font-style: italic;
    font-weight: 700;
}

/* ── Stat Window (Character Stats) ──────────────── */
.stat-window {
    background: #fff;
    border: 2px solid #222;
    box-shadow: 3px 3px 0 #222;
    padding: 1em 1.3em;
    margin: 1.8em auto;
    max-width: 440px;
}
.stat-window .sw-name {
    font-size: 1.1em;
    font-weight: 700;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.25em;
    margin-bottom: 0.5em;
    display: flex;
    align-items: center;
    gap: 0.4em;
}
.stat-window .sw-color {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
}
.stat-window .sw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15em 1.5em;
}
.stat-window .sw-row {
    display: flex;
    justify-content: space-between;
    padding: 0.12em 0;
}
.stat-window .sw-stat {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75em;
    letter-spacing: 0.05em;
    color: #666;
}
.stat-window .sw-val {
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
}
.stat-window .sw-val.highlight {
    color: #8B1A1A;
    background: #f5eeee;
    padding: 0 0.3em;
    border-radius: 2px;
}
.stat-window .sw-caption {
    margin-top: 0.5em;
    font-style: italic;
    font-size: 0.88em;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 0.4em;
}

/* ── Character Intro ────────────────────────────── */
.character-intro {
    display: flex;
    align-items: flex-start;
    gap: 1em;
    padding: 1em 1.2em;
    margin: 1.6em 0;
    background: #fff;
    border: 1px solid #ddd;
    border-left: 4px solid var(--char-color, #888);
}
.character-intro .ci-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #e0e0e0 center/cover no-repeat;
    flex-shrink: 0;
    border: 2px solid var(--char-color, #888);
    display: flex;
    align-items: center;
    justify-content: center;
}
.character-intro .ci-avatar .ci-letter {
    font-size: 1.4em;
    font-weight: 700;
    line-height: 1;
}
.character-intro .ci-body { flex: 1; min-width: 0; }
.character-intro .ci-name {
    font-weight: 700;
    font-size: 1.05em;
}
.character-intro .ci-class {
    font-size: 0.82em;
    color: #888;
    font-style: italic;
}
.character-intro .ci-flavor {
    margin-top: 0.3em;
    font-size: 0.95em;
    line-height: 1.5;
    color: #444;
}

/* Character intro — stat snapshot */
.character-intro .ci-stats {
    margin-top: 0.5em;
    padding-top: 0.5em;
    border-top: 1px solid rgba(0,0,0,0.08);
}
.character-intro .ci-vitals {
    font-size: 0.82em;
    color: #666;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 0.4em;
}
.character-intro .ci-ab-grid {
    display: flex;
    gap: 0.15em;
    flex-wrap: wrap;
}
.character-intro .ci-ab {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 3.2em;
    padding: 0.25em 0.35em;
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.08);
}
.character-intro .ci-ab-label {
    font-size: 0.65em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
}
.character-intro .ci-ab-val {
    font-size: 0.85em;
    font-weight: 700;
    color: #333;
}
.character-intro .ci-ab-mod {
    font-weight: 400;
    color: #888;
    font-size: 0.9em;
}
.character-intro .ci-languages {
    font-size: 0.78em;
    color: #888;
    margin-top: 0.35em;
    font-style: italic;
}

/* ── Scene Break ────────────────────────────────── */
.scene-break {
    text-align: center;
    margin: 2.2em 0;
    color: #bbb;
    line-height: 1;
}
.scene-break .scene-ornament {
    letter-spacing: 0.3em;
    font-size: 1.1em;
    color: #999;
}

/* ── Aside (DM Note) ───────────────────────────── */
.chronicle-aside {
    font-size: 0.92em;
    color: #555;
    font-style: italic;
    margin: 1.5em 0;
    padding: 0.9em 1.2em;
    background: #f0ece6;
    border: 1px solid #d5cfc5;
    line-height: 1.55;
}
.chronicle-aside .aside-attribution {
    display: block;
    font-weight: 700;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999;
    font-style: normal;
    margin-bottom: 0.4em;
}
.chronicle-aside .aside-body {
    display: block;
}

/* ── Spell Cast ─────────────────────────────────── */
.spell-cast {
    background: #f5f0ff;
    border-left: 3px solid #6a5acd;
    padding: 0.8em 1.1em;
    margin: 1.4em auto;
    max-width: 540px;
}
.spell-cast .spell-header {
    display: flex;
    align-items: center;
    gap: 0.4em;
    flex-wrap: wrap;
}
.spell-cast .spell-name {
    font-weight: 700;
    color: #4a3a8c;
}
.spell-cast .spell-caster {
    font-weight: 600;
    font-size: 0.9em;
    display: inline-flex;
    align-items: baseline;
    gap: 0.25em;
}
.spell-cast .spell-meta {
    font-size: 0.82em;
    color: #888;
    font-style: italic;
    margin: 0.15em 0 0.35em;
}
.spell-cast .spell-effect {
    font-size: 0.95em;
    line-height: 1.55;
}

/* ── Language Gate (Tabbed Branch) ───────────────── */
.language-gate {
    margin: 2em 0;
}
.language-gate .gate-header {
    font-weight: 700;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 0.5em;
}
.language-gate .gate-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #ccc;
    flex-wrap: wrap;
}
.language-gate .gate-tab {
    padding: 0.45em 1em;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    font-family: 'Georgia', serif;
    font-size: 0.88em;
    color: #888;
    background: transparent;
    transition: all 0.15s;
}
.language-gate .gate-tab:hover { color: #444; }
.language-gate .gate-tab.active {
    color: #222;
    border-color: #ccc;
    background: #fff;
    margin-bottom: -2px;
    border-bottom: 2px solid #fff;
    font-weight: 700;
}
.language-gate .gate-tab .gate-star {
    color: #8B1A1A;
    margin-left: 0.25em;
    display: inline-flex;
    align-items: center;
}
.language-gate .gate-tab .gate-star svg {
    width: 11px;
    height: 11px;
    stroke: #8B1A1A;
}
.language-gate .gate-panel {
    display: none;
    padding: 1em 1.2em;
    border: 1px solid #ccc;
    border-top: none;
    background: #fff;
    font-size: 1.02em;
    line-height: 1.7;
}
.language-gate .gate-panel.active { display: block; }

/* ── Chapter End (Adventure Summary) ─────────────── */
.chapter-end {
    margin-top: 3em;
}
.summary-divider {
    text-align: center;
    font-size: 0.72em;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #bbb;
    margin-bottom: 1.5em;
    display: flex;
    align-items: center;
    gap: 1em;
}
.summary-divider::before,
.summary-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}
.summary-cliffhanger {
    font-size: 1.05em;
    font-style: italic;
    color: #444;
    line-height: 1.65;
    margin-bottom: 1em;
}
.summary-notes {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}
.summary-note {
    font-size: 0.82em;
    color: #999;
}

/* ── Encounter Rewards ──────────────────────────── */
.encounter-rewards {
    margin: 1.6em 0;
    border: 1px solid #e8e4df;
    border-radius: 4px;
    background: #faf8f5;
    overflow: hidden;
}
.er-header {
    font-size: 0.72em;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8B1A1A;
    font-weight: 700;
    padding: 0.6em 1.2em;
    border-bottom: 1px solid #e8e4df;
    background: rgba(139,26,26,0.03);
}
.er-characters {
    padding: 0.6em 1.2em;
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}
.er-character {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    font-size: 0.88em;
}
.er-name {
    font-weight: 700;
    color: #333;
    flex-shrink: 0;
}
.er-gains {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.er-xp {
    font-family: 'Courier New', monospace;
    font-size: 0.88em;
    font-weight: 700;
    color: #8B1A1A;
    background: rgba(139,26,26,0.06);
    padding: 0.15em 0.5em;
    border-radius: 3px;
}
.er-item {
    font-size: 0.88em;
    color: #555;
    background: rgba(0,0,0,0.04);
    padding: 0.15em 0.5em;
    border-radius: 3px;
}
.er-note {
    font-size: 0.8em;
    color: #999;
    font-style: italic;
    padding: 0.5em 1.2em 0.7em;
    border-top: 1px solid #e8e4df;
}

/* ── Damage Taken ───────────────────────────────── */
.damage-taken {
    margin: 1.4em auto;
    max-width: 540px;
    border-left: 3px solid #c00;
    background: #fdf5f5;
    padding: 0.7em 1.1em;
}
.damage-taken .dt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
}
.damage-taken .dt-label {
    font-size: 0.72em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    color: #c00;
}
.damage-taken .dt-amount {
    font-family: 'Courier New', monospace;
    font-size: 1.05em;
    font-weight: 700;
    color: #c00;
}
.damage-taken .dt-body {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
    margin-top: 0.2em;
    font-size: 0.92em;
}
.damage-taken .dt-target {
    font-weight: 700;
}
.damage-taken .dt-source {
    color: #888;
    font-style: italic;
}
.damage-taken .dt-source::before {
    content: '\2190  ';
}
.damage-taken .dt-type {
    font-size: 0.85em;
    color: #999;
    background: rgba(0,0,0,0.04);
    padding: 0.1em 0.4em;
    border-radius: 3px;
}
.damage-taken .dt-narrative {
    font-size: 0.92em;
    line-height: 1.55;
    color: #555;
    font-style: italic;
    margin-top: 0.4em;
}

/* ── Equipment Change ───────────────────────────── */
.equipment-change {
    margin: 1.6em 0;
    border: 1px solid #d5cfc5;
    border-radius: 4px;
    background: #faf8f5;
    overflow: hidden;
}
.equipment-change .eq-header {
    font-size: 0.72em;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #555;
    font-weight: 700;
    padding: 0.6em 1.2em;
    border-bottom: 1px solid #e8e4df;
    background: rgba(0,0,0,0.02);
}
.equipment-change .eq-characters {
    padding: 0.6em 1.2em;
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}
.equipment-change .eq-character {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    font-size: 0.88em;
}
.equipment-change .eq-name {
    font-weight: 700;
    color: #333;
    flex-shrink: 0;
}
.equipment-change .eq-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35em;
    justify-content: flex-end;
}
.equipment-change .eq-gained {
    font-size: 0.88em;
    color: #2a6e2a;
    background: rgba(42,110,42,0.07);
    padding: 0.15em 0.5em;
    border-radius: 3px;
}
.equipment-change .eq-lost {
    font-size: 0.88em;
    color: #a33;
    background: rgba(170,51,51,0.06);
    padding: 0.15em 0.5em;
    border-radius: 3px;
}
.equipment-change .eq-narrative {
    font-size: 0.82em;
    color: #999;
    font-style: italic;
    padding: 0.5em 1.2em 0.7em;
    border-top: 1px solid #e8e4df;
}

/* ── Document (In-World) ────────────────────────── */
.chronicle-document {
    margin: 1.6em auto;
    max-width: 540px;
    background: #fdf5e6;
    border: 1px solid #d4c097;
    padding: 1.2em 1.4em;
    position: relative;
}
.chronicle-document::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #c4a35a, #d4c097, #c4a35a);
}
.chronicle-document .doc-title {
    font-weight: 700;
    font-size: 0.88em;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8B6914;
    margin-bottom: 0.6em;
    text-align: center;
}
.chronicle-document .doc-content {
    font-size: 0.9em;
    line-height: 1.6;
    color: #555;
    white-space: pre-line;
}
.chronicle-document .doc-attribution {
    font-size: 0.78em;
    color: #999;
    font-style: italic;
    margin-top: 0.8em;
    text-align: right;
}
.chronicle-document .doc-preamble {
    font-size: 0.84em;
    line-height: 1.55;
    color: #666;
    font-style: italic;
    margin-bottom: 0.7em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #e0d6c0;
}
.chronicle-document .doc-clauses {
    font-size: 0.88em;
    line-height: 1.55;
    color: #555;
}
.chronicle-document .doc-clause {
    margin-bottom: 0.35em;
    padding-left: 1.6em;
    text-indent: -1.6em;
}
.chronicle-document .doc-clause .clause-num {
    display: inline-block;
    width: 1.4em;
    text-align: right;
    margin-right: 0.2em;
    font-weight: 700;
    color: #8B6914;
    font-size: 0.9em;
}

/* ── Death Marker ───────────────────────────────── */
.death-marker {
    margin: 1.4em auto;
    max-width: 540px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #ccc;
    padding: 0.7em 1.1em;
    border-radius: 3px;
}
.death-marker .death-header {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.death-marker .death-icon {
    display: flex;
    align-items: center;
}
.death-marker .death-icon svg {
    width: 16px;
    height: 16px;
    stroke: #ccc;
}
.death-marker .death-name {
    font-weight: 700;
    font-size: 0.95em;
    color: #eee;
}
.death-marker .death-name .chronicle-charlink {
    color: #eee !important;
}
.death-marker .death-narrative {
    font-size: 0.88em;
    font-style: italic;
    color: #999;
    line-height: 1.5;
    margin-top: 0.35em;
}

/* ── Inspiration ────────────────────────────────── */
.inspiration {
    margin: 1.4em auto;
    max-width: 540px;
    border: 1px solid #6b5a2e;
    background: #2e2818;
    color: #ccc;
    padding: 0.7em 1.1em;
    border-radius: 3px;
}
.inspiration .insp-header {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.inspiration .insp-star {
    display: flex;
    align-items: center;
}
.inspiration .insp-star svg {
    width: 15px;
    height: 15px;
    stroke: #c4a35a;
}
.inspiration .insp-label {
    font-size: 0.72em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    color: #c4a35a;
}
.inspiration .insp-recipient {
    font-weight: 700;
    font-size: 0.95em;
    color: #e8dcc0;
    margin-top: 0.15em;
}
.inspiration .insp-recipient .chronicle-charlink {
    color: #e8dcc0 !important;
}
.inspiration .insp-reason {
    font-size: 0.88em;
    font-style: italic;
    color: #a09070;
    margin-top: 0.2em;
    line-height: 1.5;
}

/* ── Chapter Navigation ─────────────────────────── */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3em;
    padding-top: 1.5em;
    border-top: 1px solid #ddd;
    gap: 1em;
}
.chapter-nav .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.6em 1.4em;
    background: #fff;
    color: #222;
    border: 1px solid #888;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.chapter-nav .nav-btn .nav-arrow {
    width: 16px;
    height: 16px;
}
.chapter-nav .nav-btn:hover {
    background: #222;
    color: #fff;
}
.chapter-nav .nav-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}
.chapter-nav .nav-chapter-title {
    font-size: 0.82em;
    color: #999;
    display: block;
}

/* ── Character name links (match sheet.js pattern) ─ */
.chronicle-charlink {
    text-decoration: none;
    font-weight: 700;
    transition: opacity 0.15s;
}
.chronicle-charlink:hover { opacity: 0.75; }

/* Ensure charlinks inherit properly in structured headers */
.speaker-name .chronicle-charlink,
.ci-name .chronicle-charlink,
.placeholder-label .chronicle-charlink,
.sw-name .chronicle-charlink,
.spell-caster .chronicle-charlink {
    font-size: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
}
.ci-name .chronicle-charlink {
    font-size: 1.05em;
}
.placeholder-label .chronicle-charlink {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 1em;
}

/* ── Loading ────────────────────────────────────── */
.loading {
    text-align: center;
    color: #999;
    padding: 3em 1em;
    font-style: italic;
}

/* ═══ Phone ════════════════════════════════════════ */
@media (max-width: 700px) {
    .dossier-container {
        padding: 12px 0 32px;
    }
    .chronicle-layout {
        display: block;
    }
    .chronicle-sidebar { display: none; }
    .chronicle-mobile-nav {
        display: block;
        padding: 0 16px 12px;
    }
    .chronicle-mobile-nav select {
        width: 100%;
        font-family: inherit;
        font-size: 0.95em;
        padding: 0.5em 0.8em;
        border: 1px solid #bbb;
        background: #fff;
        color: #222;
    }
    .chronicle-reading-pane {
        padding: 0 20px;
        max-width: 100%;
    }
    .chapter-header .chapter-title { font-size: 1.6em; }
    .chapter-header { margin-bottom: 1.5em; padding-bottom: 1em; }

    .chronicle-prose { font-size: 1.02em; }
    .chapter-blocks > .chronicle-prose:first-child::first-letter {
        font-size: 2.2em;
    }

    .chronicle-dialogue { margin-left: 0; }
    .dialogue-placeholder { margin-left: 0.5em; }
    .stat-block, .stat-window, .skill-check, .spell-cast { max-width: 100%; }

    /* Attack block */
    .attack-block { max-width: 100%; }
    .atk-header {
        flex-wrap: wrap;
        gap: 0.4em;
        padding: 0.45em 0.9em;
    }
    .atk-body { padding: 0.6em 0.9em; }
    .atk-rolls { gap: 0.8em; }
    .atk-narrative { padding: 0.5em 0.9em 0.6em; }

    /* Adventure start */
    .adventure-start {
        max-width: 100%;
        padding: 1.8em 1em;
    }
    .advstart-title { font-size: 1.35em; }
    .advstart-summary { max-width: 100%; }

    /* System note */
    .system-note { font-size: 0.82em; }

    /* Encounter rewards */
    .encounter-rewards { max-width: 100%; }
    .er-header { padding: 0.5em 1em; }
    .er-characters { padding: 0.5em 1em; }
    .er-character { gap: 0.4em; }
    .er-note { padding: 0.4em 1em 0.6em; }

    /* Character intro */
    .character-intro {
        padding: 0.8em 0.9em;
        gap: 0.75em;
    }
    .character-intro .ci-avatar { width: 44px; height: 44px; }
    .character-intro .ci-avatar .ci-letter { font-size: 1.2em; }
    .character-intro .ci-ab-grid { gap: 0.1em; }
    .character-intro .ci-ab {
        min-width: 2.8em;
        padding: 0.2em 0.25em;
    }

    /* Aside */
    .chronicle-aside { padding: 0.7em 0.9em; }

    /* Language gate */
    .language-gate .gate-tab {
        padding: 0.4em 0.7em;
        font-size: 0.82em;
    }
    .language-gate .gate-panel {
        padding: 0.8em 1em;
        font-size: 0.95em;
    }

    /* Stat block ability grid */
    .stat-block .sb-abilities {
        gap: 0.5em;
        justify-content: center;
    }

    /* Chapter end */
    .chapter-end { margin-top: 2em; }

    /* New blocks */
    .damage-taken, .chronicle-document, .death-marker, .inspiration { max-width: 100%; }
    .equipment-change { max-width: 100%; }
    .equipment-change .eq-header,
    .equipment-change .eq-characters { padding: 0.5em 1em; }
    .equipment-change .eq-character { flex-direction: column; align-items: flex-start; gap: 0.2em; }
    .equipment-change .eq-items { justify-content: flex-start; }
    .chronicle-document { padding: 1em 1.1em; }

    /* Chapter nav */
    .chapter-nav {
        padding: 1em 16px 0;
        flex-wrap: wrap;
    }
    .chapter-nav .nav-btn {
        padding: 0.5em 1em;
        font-size: 0.88em;
    }
    .chapter-nav .nav-chapter-title { font-size: 0.75em; }

    /* Library mobile */
    .library-title { font-size: 1.6em; }
    .library-subtitle { font-size: 0.88em; }
    .chronicles-library { padding: 0 16px; }
    .bookshelf-row {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1.2em;
    }
    .book-cover-title { font-size: 0.95em; }
    .book-emblem { width: 32px; height: 32px; }
    .campaign-header { flex-wrap: wrap; }
    .campaign-lost { padding: 0.8em 1em; }
}
