:root {
    --bg-main: #020202;
    --surface: #0a0a0a;
    --surface-accent: #111111;
    --primary: #5c0f0f;
    --primary-bright: #941818;
    --primary-glow: rgba(92, 15, 15, 0.6);
    --text-parchment: #c8b998;
    --text-muted: #666666;
    --border-dim: #1a1a1a;
    --cinzel: 'Cinzel', serif;
    --inter: 'Inter', sans-serif;
    --grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");

    /* Estilos de Relieve */
    --relief-gold: #d4af37;
    --relief-red: #8b0000;
    --relief-silver: #a9a9a9;
    --relief-white: #ffffff;
    --relief-selected: var(--text-parchment);
    --gold-glow: #d4af37;
    --crimson-glow: #941818;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    opacity: 0.04;
    pointer-events: none;
    z-index: 1000;
    background-image: var(--grain);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-parchment);
    font-family: var(--inter);
    line-height: 1.6;
    overflow-x: hidden;
}

#main-header {
    background: #000;
    border-bottom: 1px solid var(--border-dim);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 3.5rem;
    padding: 1rem 2rem;
}

.campaign-title {
    font-family: var(--cinzel);
    font-size: 2.2rem;
    color: var(--text-parchment);
    text-shadow:
        2px 2px 2px #1a1813,
        -1px -1px 0px rgba(255, 255, 255, 0.1),
        0 0 30px #941818,
        0 0 60px rgba(148, 24, 24, 0.9);
    letter-spacing: 0.3rem;
}

.nav-main {
    display: flex;
    gap: 0.5rem;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--cinzel);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    text-shadow: 1px 1px 2px #000;
    letter-spacing: 0.05rem;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text-parchment);
    border-bottom-color: var(--primary-bright);
    text-shadow: 0 0 10px var(--primary-glow);
}

.nav-item.active {
    border-bottom-width: 3px;
    background: linear-gradient(to top, rgba(92, 15, 15, 0.1), transparent);
}

#router-view {
    max-width: 1300px;
    margin: 0 auto;
    padding: 2.2rem 4rem 3rem;
    background: radial-gradient(circle at 50% -20%, rgba(92, 15, 15, 0.08), transparent 60%);
}

.pc-card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #000;
    border-top: 1px solid #222;
}

.pc-action-btn {
    background: transparent;
    border: none;
    border-right: 1px solid #111;
    color: var(--text-muted);
    padding: 0.8rem 0.2rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.3s;
}

.pc-action-btn:last-child {
    border-right: none;
}

.pc-action-btn .icon {
    font-size: 1rem;
    opacity: 0.6;
}

.pc-action-btn .label {
    font-size: 0.65rem;
    font-family: var(--cinzel);
    font-weight: bold;
}

.pc-action-btn:hover {
    background: #111;
    color: var(--text-parchment);
}

.pc-action-btn:hover .icon {
    opacity: 1;
    filter: drop-shadow(0 0 5px var(--primary-glow));
}

.page-fade-in {
    animation: fadeIn 0.8s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-family: var(--cinzel);
    font-size: 3.5rem;
    line-height: 1.1;
    text-align: center;
    margin-top: -0.2rem;
    margin-bottom: 3rem;
    color: var(--text-parchment);
    position: relative;
    padding-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px var(--primary-glow);
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

/* --- Helpers --- */
.parchment-card {
    background: var(--surface);
    border: 1px solid var(--border-dim);
    padding: 2rem;
    position: relative;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.5);
}

.hidden {
    display: none !important;
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(128, 0, 0, 0.1), transparent 70%);
    pointer-events: none;
}

.card-label {
    font-family: var(--cinzel);
    color: var(--primary);
    font-size: 0.8rem;
    letter-spacing: 0.2rem;
    margin-bottom: 1rem;
    display: block;
    font-weight: bold;
}

/* --- Home --- */
.home-hero {
    text-align: center;
    margin-top: -0.25rem;
    margin-bottom: 1.5rem;
    /* Reducido de 2.5rem */
}

.campaign-subtitle {
    font-family: var(--inter);
    letter-spacing: 0.5rem;
    font-size: 1.2rem;
    color: var(--text-parchment);
    text-transform: uppercase;
    opacity: 0.8;
}

.campaign-title-main {
    font-family: var(--cinzel);
    font-size: 7rem;
    color: var(--text-parchment);
    background: linear-gradient(180deg, var(--text-parchment) 30%, #a89a7d 100%);
    /* Degradado suave pergamino */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
    letter-spacing: 2rem;
    margin-top: 0.2rem;
    font-weight: 900;
    /* Sombra de profundidad en punto medio de oscuridad (ajustada) */
    text-shadow:
        2px 2px 2px #1a1813,
        -1px -1px 0px rgba(255, 255, 255, 0.1);
}

.campaign-title-main::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow:
        0 0 50px #941818,
        0 0 100px rgba(148, 24, 24, 1),
        0 0 200px rgba(148, 24, 24, 0.9),
        0 0 350px rgba(148, 24, 24, 0.7),
        0 0 500px rgba(148, 24, 24, 0.4);
    pointer-events: none;
}

.chronicle-reminder {
    max-width: 850px;
    margin: 0 auto 3.5rem;
    padding: 2.5rem 4rem 4rem;
    /* Reducido de 4rem superior a 2.5rem */
    background: #c2b280;
    /* Parchment base */
    background-image:
        url("https://www.transparenttextures.com/patterns/old-paper.png"),
        radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.15) 100%);
    color: #2a1b0a;
    box-shadow:
        0 0 30px rgba(0, 0, 0, 0.8),
        inset 0 0 100px rgba(0, 0, 0, 0.1);
    position: relative;
    border: none;
    clip-path: polygon(2% 3%, 98% 1%, 99% 97%, 1% 99%, 2% 50%);
    /* Rough edges */
}

.chronicle-reminder::before {
    content: "";
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    border: none;
    /* Eliminado el borde negro solicitado */
    pointer-events: none;
}

.session-meta-top {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    /* Espacio reducido hacia la fecha */
    color: var(--text-muted);
    font-family: var(--inter);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.meta-tag {
    color: var(--primary);
    font-family: var(--cinzel);
    font-weight: bold;
}

.session-header-main {
    font-family: var(--cinzel);
    font-size: 2rem;
    color: var(--primary);
    margin-top: -0.8rem;
    /* Subimos el título hacia el label superior */
    margin-bottom: 0.15rem;
    /* Reducido para pegar más la meta-info */
    font-weight: bold;
}

.session-date {
    font-family: var(--inter);
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.7rem;
    /* Aumentado para separar de la narrativa */
}

.session-excerpt {
    font-size: 1.1rem;
    line-height: 1.8;
}

.btn-grim {
    background: linear-gradient(180deg, #222, #050505);
    border: 1px solid #333;
    border-top: 1px solid #444;
    color: var(--text-parchment);
    padding: 1rem 2rem;
    font-family: var(--cinzel);
    cursor: pointer;
    margin-top: 1.5rem;
    transition: all 0.3s;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.btn-grim:hover {
    background: var(--primary);
    border-color: var(--primary-bright);
    box-shadow: 0 0 20px var(--primary-glow);
    transform: translateY(-2px);
}

/* --- Characters --- */
.character-preview-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
    overflow-x: auto;
    /* Por si la pantalla es muy pequeña */
    padding-bottom: 1rem;
}

.pc-preview-card {
    background: #080808;
    border: 2px solid #222;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    flex: 0 1 200px;
    /* No crece, puede encogerse hasta 200px */
    min-width: 160px;
    /* Mínimo para que sea legible */
}

.pc-preview-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary-bright);
    box-shadow: 0 15px 40px rgba(255, 0, 0, 0.2);
}

.pc-img-frame {
    position: relative;
    border: 1px solid #333;
    margin: 0;
    background: #000;
}

.pc-img-placeholder {
    height: 250px;
    background: linear-gradient(0deg, rgba(92, 15, 15, 0.4) 0%, transparent 40%), #050505;
    background-image: url("https://www.transparenttextures.com/patterns/dark-matter.png");
}

.pc-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    filter: sepia(0.2) contrast(1.1);
}

.pc-lvl-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    font-family: var(--cinzel);
    font-size: 0.7rem;
}

.pc-info-mini {
    padding: 1.5rem 1rem;
    text-align: center;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    position: relative;
    z-index: 2;
}

.pc-info-mini h3 {
    font-family: var(--cinzel);
    margin-bottom: 0.4rem;
    color: var(--text-parchment);
    font-size: 1.3rem;
    text-shadow: 1px 1px 2px #000;
}

.pc-class-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--cinzel);
    letter-spacing: 0.1rem;
}

.character-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.char-sheet-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
}

.char-sheet-sidebar {
    border-right: 1px solid var(--border-dim);
    padding-right: 2rem;
}

.char-portrait-large {
    width: 100%;
    height: 350px;
    background: #000;
    border: 1px solid var(--border-dim);
}

.char-portrait-large-img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    filter: sepia(0.2) contrast(1.1);
}

.char-rank {
    background: var(--primary);
    color: #fff;
    padding: 5px 15px;
    font-family: var(--cinzel);
    margin: -15px auto 0;
    display: block;
    width: fit-content;
    position: relative;
    border: 1px solid #000;
}

.char-quick-stats {
    margin-top: 2rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dotted var(--border-dim);
    font-size: 0.9rem;
}

.stat-row span:first-child {
    color: var(--text-parchment);
    font-family: var(--cinzel);
    font-size: 0.8rem;
}

.char-sheet-name {
    font-family: var(--cinzel);
    font-size: 3rem;
    color: var(--text-parchment);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-dim);
}

.char-sheet-section {
    margin-bottom: 2rem;
}

.char-sheet-section h4 {
    font-family: var(--cinzel);
    color: var(--text-parchment);
    margin-bottom: 0.8rem;
    background: rgba(128, 0, 0, 0.05);
    padding: 5px 10px;
}

/* --- NPCs & Map --- */
.npc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.npc-frame {
    border: 3px double var(--border-dim);
    padding: 10px;
    margin-bottom: 1rem;
    background: #000;
}

.npc-portrait {
    height: 150px;
    background: #1a1a1a;
}

.npc-portrait-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    filter: sepia(0.3) contrast(1.1);
}

.location-tag {
    display: block;
    color: var(--primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin: 0.5rem 0;
}

.map-container {
    max-width: 1000px;
    margin: 0 auto;
}

.map-visual-wrapper {
    position: relative;
    max-width: 100%;
    border: 2px solid var(--border-dim);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    background: #050505;
}

.map-image-large {
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(0.3) contrast(1.1) brightness(0.85);
    transition: filter 0.5s ease;
}

.map-image-large:hover {
    filter: sepia(0.2) contrast(1.15) brightness(0.95);
}

.map-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 15px var(--primary-bright);
    transition: all 0.3s;
    transform: translate(-50%, -50%);
    /* Center the marker exactly on its coordinates */
    z-index: 5;
}

.marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(148, 24, 24, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: marker-pulse-anim 2s infinite ease-in-out;
}

@keyframes marker-pulse-anim {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

.map-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
    background: var(--text-parchment);
    box-shadow: 0 0 20px var(--text-parchment);
    z-index: 10;
}

.icon-btn-download {
    background: linear-gradient(135deg, var(--primary) 0%, #300 100%);
    color: var(--text-parchment);
    border: 1px solid var(--relief-gold);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 15px rgba(148, 24, 24, 0.4);
    animation: btn-pulse 3s infinite ease-in-out;
    margin-right: 30px;
}

.icon-btn-download:hover {
    transform: scale(1.15) rotate(10deg);
    background: var(--primary-bright);
    box-shadow: 0 0 25px var(--primary-glow), 0 0 10px var(--gold-glow);
    border-color: var(--text-parchment);
}

.icon-btn-download svg {
    stroke: var(--text-parchment);
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

@keyframes btn-pulse {
    0% {
        box-shadow: 0 0 10px rgba(148, 24, 24, 0.4);
    }

    50% {
        box-shadow: 0 0 25px rgba(148, 24, 24, 0.8), 0 0 5px var(--gold-glow);
    }

    100% {
        box-shadow: 0 0 10px rgba(148, 24, 24, 0.4);
    }
}

.map-marker:hover {
    background: var(--text-parchment);
}

.map-marker:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    padding: 0.5rem;
    border: 1px solid var(--primary);
    font-family: var(--cinzel);
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
}

.map-legend {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Rules & Info --- */
.rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.rules-category {
    font-family: var(--cinzel);
    color: var(--text-parchment);
    border-bottom: 1px solid var(--border-dim);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.rules-list {
    list-style: none;
}

.rules-list li {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.rules-list li strong {
    display: block;
    color: var(--text-parchment);
    font-family: var(--cinzel);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.rules-list.homebrew li {
    border-left: 2px solid var(--primary);
    padding-left: 1rem;
}

.game-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.info-category-card {
    transition: transform 0.3s;
}

.info-category-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.grim-input {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border-dim);
    padding: 1rem;
    color: var(--text-parchment);
    font-family: var(--inter);
    margin-bottom: 2rem;
}

.tab-btn {
    background: var(--surface);
    border: 1px solid var(--border-dim);
    color: var(--text-muted);
    padding: 0.8rem 2.5rem;
    font-family: var(--cinzel);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    border-color: var(--primary);
    color: var(--text-parchment);
}

#main-footer {
    margin-top: 5rem;
    padding: 3rem;
    border-top: 1px solid var(--border-dim);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--cinzel);
    background: linear-gradient(to top, #000, transparent);
}

/* --- Library Redesign --- */
.library-page {
    max-width: 1200px;
    margin: 0 auto;
}

.library-controls {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
    background: rgba(10, 10, 10, 0.6);
    padding: 2rem;
    border: 1px solid var(--border-dim);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.search-filter-row {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
}

.search-bar {
    flex: 1;
}

.sort-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sort-control label {
    font-family: var(--cinzel);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.grim-select {
    background: var(--bg-main);
    border: 1px solid var(--border-dim);
    padding: 0.8rem;
    color: var(--text-parchment);
    font-family: var(--cinzel);
    cursor: pointer;
    outline: none;
}

.grim-select:focus {
    border-color: var(--primary);
}

.library-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.lib-tab-btn {
    background: #050505;
    border: 1px solid var(--border-dim);
    color: var(--text-muted);
    padding: 1.2rem 1rem;
    font-family: var(--cinzel);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.lib-tab-btn .tab-icon {
    font-size: 1.5rem;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-parchment);
}

.lib-tab-btn .tab-icon svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    transition: all 0.4s;
}

.lib-tab-btn:hover {
    background: #111;
    border-color: var(--primary);
    color: var(--text-parchment);
}

.lib-tab-btn:hover .tab-icon svg {
    transform: translateY(-5px);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.lib-tab-btn.active {
    background: var(--primary);
    border-color: var(--primary-bright);
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
}

.lib-tab-btn.active .tab-icon {
    color: #fff;
}

/* --- Sub-Tabs for Spells --- */
.library-sub-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-dim);
}

.sub-tab-btn {
    background: transparent;
    border: 1px solid #222;
    color: var(--text-muted);
    padding: 0.6rem 1.5rem;
    font-family: var(--cinzel);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sub-tab-btn:hover {
    border-color: var(--primary);
    color: var(--text-parchment);
}

.sub-tab-btn.active {
    background: var(--surface-accent);
    color: var(--relief-selected);
    border-color: var(--primary);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

/* --- Accordion for Spells --- */
.accordion-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: rgba(20, 20, 20, 0.4);
    border: 1px solid var(--border-dim);
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
    user-select: none;
    margin-bottom: 0.5rem;
}

.accordion-header:hover {
    background: rgba(92, 15, 15, 0.1);
    border-color: var(--primary-bright);
}

.accordion-header h3 {
    margin: 0 !important;
    font-size: 1.1rem !important;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
    color: var(--primary);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
}

.accordion-item.active .accordion-content {
    max-height: 5000px;
    transition: max-height 0.6s cubic-bezier(1, 0, 1, 0);
}

.accordion-item.active .accordion-header {
    background: rgba(92, 15, 15, 0.15);
    border-bottom: none;
}

.lib-tab-btn:hover .tab-icon svg {
    transform: translateY(-3px);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.lib-tab-btn.active {
    background: linear-gradient(180deg, #1a1a1a, #0a0a0a);
    color: var(--text-parchment);
    border-color: var(--text-parchment);
    box-shadow:
        0 0 20px rgba(200, 185, 152, 0.2),
        inset 0 0 10px rgba(0, 0, 0, 1);
    text-shadow: 0 0 10px rgba(200, 185, 152, 0.5);
}

.lib-tab-btn.active .tab-icon {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(200, 185, 152, 0.4));
}

.library-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    min-height: 400px;
}

.library-item-card {
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    border-color: #1a1a1a;
    background: linear-gradient(135deg, #0d0d0d 0%, #050505 100%);
}

.library-item-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(148, 24, 24, 0.15);
}

.library-item-card h3 {
    font-family: var(--cinzel);
    color: var(--text-parchment);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.item-short-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;

    overflow: hidden;
    margin-bottom: 1.5rem;
}

.item-footer {
    border-top: 1px solid #1a1a1a;
    padding-top: 1rem;
}

.item-tag {
    font-size: 0.7rem;
    font-family: var(--cinzel);
    color: var(--primary-bright);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.library-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem;
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--cinzel);
}

/* --- Library Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1001;
    border: 2px solid var(--primary);
    box-shadow: 0 0 50px rgba(0, 0, 0, 1);
    animation: modalSlideUp 0.4s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--primary-bright);
}

.modal-title {
    font-family: var(--cinzel);
    font-size: 2.5rem;
    color: var(--text-parchment);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}

.modal-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-row {
    font-size: 1.1rem;
    line-height: 1.6;
    word-wrap: break-word;
    word-break: break-word;
}

.detail-row strong {
    color: var(--primary-bright);
    font-family: var(--cinzel);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.3rem;
}

.loading {
    text-align: center;
    padding: 5rem;
    font-family: var(--cinzel);
    color: var(--primary);
    letter-spacing: 5px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }

}

/* --- CREATION MANUAL & RULES ENHANCEMENTS --- */
.creation-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.creation-header {
    text-align: center;
    margin-bottom: 4rem;
}

.creation-intro {
    font-family: var(--cinzel);
    color: var(--text-muted);
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.creation-stepper {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    position: relative;
}

.creation-stepper::before {
    content: '';
    position: absolute;
    left: 25px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--border-dim) 10%, var(--border-dim) 90%, transparent);
}

.creation-step-card {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--border-dim);
    position: relative;
    transition: all 0.4s;
}

.creation-step-card:hover {
    transform: translateX(10px);
    border-color: var(--primary);
    box-shadow: -5px 5px 20px rgba(255, 0, 0, 0.1);
}

.step-badge {
    width: 50px;
    height: 50px;
    background: var(--bg-main);
    border: 1px solid var(--primary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--cinzel);
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
}

.step-icon-main {
    width: 40px;
    color: var(--text-parchment);
    opacity: 0.6;
}

.step-content h3 {
    font-family: var(--cinzel);
    color: var(--text-parchment);
    margin-bottom: 0.5rem;
}

.step-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.creation-actions {
    margin-top: 4rem;
    display: flex;
    justify-content: center;
}

/* Rules Reorganization */
.rules-category-section {
    margin-bottom: 4rem;
}

.rules-cat-title {
    font-family: var(--cinzel);
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary);
    font-size: 1.4rem;
    letter-spacing: 2px;
}

/* Lore date styling */
.lore-date {
    display: block;
    font-family: var(--cinzel);
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary-bright);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}



.rules-cat-title {
    font-family: var(--cinzel);
    color: var(--primary);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
}

.rules-cat-title::before {
    content: '◈';
    font-size: 0.8rem;
    opacity: 0.5;
}

.rule-title {
    font-family: var(--cinzel);
    color: var(--text-parchment);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Library spacing - Horizontal Flow */
.library-grid-container {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    width: 100%;
}

@media (max-width: 1100px) {
    .library-grid-container {
        grid-template-columns: 1fr;
    }
}

.library-sub-group {
    margin-bottom: 2rem;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.lore-tabs,
.rules-tabs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 1rem;
    overflow-x: auto;
}

.lore-tabs .tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--cinzel);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lore-tabs .tab-btn.active {
    color: var(--text-parchment);
    text-shadow: 0 0 10px rgba(200, 185, 152, 0.4);
    border-bottom: 2px solid var(--text-parchment);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.rule-category-box {
    padding: 2.5rem;
    border: 1px solid #1a1a1a;
    background: linear-gradient(135deg, #0d0d0d 0%, #050505 100%);
    transition: all 0.4s;
    position: relative;
    overflow: hidden;
}

.rule-category-box:hover {
    border-color: var(--border-dim);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.rules-category {
    font-family: var(--cinzel);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-parchment);
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
}

.rules-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rules-list li strong {
    color: var(--text-parchment);
    display: block;
    font-family: var(--cinzel);
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.lore-date {
    font-family: var(--cinzel);
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-bright);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    display: block;
}

.death-description-box p {
    word-wrap: break-word;
    word-break: break-word;
}

.library-item-card h3 {
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.rules-search-container {
    margin-bottom: 3rem;
}

/* --- Necrologicas --- */
.necrology-title {
    font-family: var(--cinzel);
    font-size: 2.5rem;
    color: var(--text-muted);
    text-align: center;
    margin: 4rem 0 2rem;
    border-top: 1px solid var(--border-dim);
    padding-top: 2rem;
}

.necrology-grid {
    opacity: 0.9;
    transition: all 0.5s;
}

.necrology-grid:hover {
    opacity: 1;
}

.deceased-card .char-portrait-large-img,
.deceased-card .char-portrait-large {
    filter: grayscale(1) contrast(1.1) brightness(0.8);
    transition: filter 0.5s ease;
}

.deceased-card:hover .char-portrait-large-img,
.deceased-card:hover .char-portrait-large {
    filter: grayscale(0.7) contrast(1.1) brightness(0.9);
}

.deceased-overlay {
    position: relative;
}

.deceased-overlay::after {
    content: "✕";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    color: rgba(255, 0, 0, 0.85);
    /* More vibrant red */
    pointer-events: none;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 0, 0, 0.6);
    font-family: Arial, sans-serif;
    line-height: 1;
    z-index: 10;
}

.death-description-box {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(92, 15, 15, 0.1);
    border-left: 3px solid var(--primary);
    font-style: italic;
    color: var(--text-parchment);
}

.death-description-box strong {
    display: block;
    font-family: var(--cinzel);
    font-size: 0.8rem;
    color: var(--primary-bright);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.subsection-title {
    font-family: var(--cinzel);
    font-size: 2.2rem;
    color: var(--text-parchment);
    margin: 3rem 0 1.5rem;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.subsection-title.necrology-title {
    color: #444;
    border-color: #222;
}

/* --- Rules Modal Content --- */
.rule-full-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-parchment);
    white-space: pre-wrap;
}

.rule-preview {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Modal Lists (Heritages/Subclasses) --- */
.detail-subsection {
    margin-top: 2rem;
    border-top: 1px solid var(--border-dim);
    padding-top: 1rem;
}

.subsection-title-small {
    font-family: var(--cinzel);
    font-size: 1.2rem;
    color: var(--text-gold);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.8rem;
    border-left: 3px solid var(--accent-gold);
    border-radius: 0 4px 4px 0;
}

.info-item strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 0.3rem;
    font-size: 1.05rem;
}

.info-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* =============================================
   CINEMATIC INTRO SCREEN
   ============================================= */

#intro-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#intro-screen.fade-out {
    animation: introFadeOut 1.5s forwards;
}

@keyframes introFadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Animations for Step 1: Logo Creation */
.intro-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.intro-logo-container.visible {
    opacity: 1;
    transform: scale(1);
}

.intro-logo-img {
    max-width: 280px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.1));
    animation: logoGlow 4s infinite alternate;
}

@keyframes logoGlow {
    from {
        filter: drop-shadow(0 0 10px rgba(200, 185, 152, 0.2));
    }

    to {
        filter: drop-shadow(0 0 30px rgba(200, 185, 152, 0.5));
    }
}

.intro-campaign-name {
    font-family: var(--cinzel);
    font-size: 3.5rem;
    color: var(--text-parchment);
    letter-spacing: 0.8rem;
    margin-top: 1.5rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: all 1.5s 1s ease-out;
}

.intro-logo-container.visible .intro-campaign-name {
    opacity: 1;
    transform: translateY(0);
}

/* Animations for Step 2: Animated Text */
.intro-scroll-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    perspective: 400px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease-in;
}

.intro-scroll-wrapper.visible {
    opacity: 1;
}

.intro-scroll-inner {
    width: min(680px, 90vw);
    padding: 100vh 0 50vh;
    transform-origin: 50% 100%;
}

.intro-scroll-inner.animate {
    animation: introScroll linear forwards;
    /* duration set in JS */
}

@keyframes introScroll {
    from {
        transform: translateY(10%) rotateX(25deg);
    }

    to {
        transform: translateY(-110%) rotateX(25deg);
    }
}

.intro-session-label {
    font-family: var(--cinzel);
    font-size: 0.9rem;
    color: var(--primary-bright);
    text-transform: uppercase;
    letter-spacing: 0.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.intro-title {
    font-family: var(--cinzel);
    font-size: clamp(2rem, 5vw, 3rem);
    color: #c8b998;
    text-align: center;
    margin-bottom: 4rem;
    line-height: 1.2;
    text-shadow: 0 0 20px rgba(200, 185, 152, 0.6);
}

.intro-divider {
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--primary-bright), transparent);
    margin: 0 auto 3rem;
}

.intro-body-text {
    font-family: var(--cinzel);
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: rgba(200, 185, 152, 0.9);
    line-height: 2.2;
    text-align: center;
    white-space: pre-line;
}

/* Vignettes */
.intro-vignette-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, #000 20%, transparent);
    z-index: 5;
    pointer-events: none;
}

.intro-vignette-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, #000 20%, transparent);
    z-index: 5;
    pointer-events: none;
}

.intro-skip-btn {
    position: fixed;
    bottom: 3rem;
    right: 3rem;
    z-index: 10000;
    background: transparent;
    border: 1px solid rgba(200, 185, 152, 0.3);
    color: rgba(200, 185, 152, 0.5);
    font-family: var(--cinzel);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3rem;
    padding: 0.8rem 2rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.intro-skip-btn.visible {
    opacity: 1;
}

.intro-skip-btn:hover {
    border-color: var(--primary-bright);
    color: var(--text-parchment);
    background: rgba(92, 15, 15, 0.3);
    box-shadow: 0 0 20px rgba(92, 15, 15, 0.4);
    transform: translateY(-3px);
}

/* Badge in lore section */
.lore-intro-badge {
    display: inline-block;
    font-family: var(--cinzel);
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.15rem;
    color: #000;
    background: var(--primary-bright);
    padding: 0.15rem 0.5rem;
    margin-left: 0.8rem;
    vertical-align: middle;
    position: relative;
    top: -2px;
}

.header-logo {
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.1);
}