@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Initial loader */
.loader-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 40vh;
}

.loader-bar {
    width: 120px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.loader-fill {
    height: 100%;
    width: 40%;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    animation: loader-slide 0.8s ease-in-out infinite;
}

@keyframes loader-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Page transitions */
#main-container {
    transition: opacity 0.1s ease;
}

#main-container.fade-out {
    opacity: 0;
}

:root {
    /* Border Radius */
    --radius-xs: 0.125rem;   /* 2px - micro elements */
    --radius-sm: 0.25rem;    /* 4px - badges, small elements */
    --radius-md: 0.5rem;     /* 8px - standard components */
    --radius-lg: 0.75rem;    /* 12px - cards, panels */
    --radius-full: 9999px;   /* pills, circles */

    /* Opacity Scale */
    --opacity-subtle: 0.05;      /* internal dividers, faint borders */
    --opacity-muted: 0.1;        /* component borders */
    --opacity-soft: 0.2;         /* backgrounds, overlays */
    --opacity-glass-edge: 0.3;   /* glass inset shadows */
    --opacity-badge: 0.3;        /* type badge backgrounds */
    --opacity-medium: 0.4;       /* sidebar panels, badge borders */
    --opacity-overlay: 0.5;      /* dark overlays, containers */
    --opacity-text: 0.75;        /* text on gradients */
    --opacity-strong: 0.8;       /* floating elements */

    /* Typography Scale */
    --text-xs: 0.75rem;      /* 12px - badges, meta */
    --text-sm: 0.875rem;     /* 14px - secondary content */
    --text-base: 1rem;       /* 16px - body */
    --text-lg: 1.125rem;     /* 18px - card names */
    --text-xl: 1.25rem;      /* 20px - section headers */
    --text-2xl: 1.5rem;      /* 24px - h2 */
    --text-3xl: 2rem;        /* 32px - h1 */

    /* Line Height */
    --leading-tight: 1.25;   /* headings */
    --leading-normal: 1.5;   /* compact UI text */
    --leading-relaxed: 1.7;  /* body text */

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-glass:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.02);

    /* Colors - Placeholder */
    --color-placeholder: #475569;

    /* Liquid Glass System (theme-independent) */
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --glass-highlight-hover: rgba(255, 255, 255, 0.25);
    --glass-shadow-inset: rgba(0, 0, 0, 0.1);
    --glass-edge-width: 1.5px;
}

/* ===== SEASONAL THEMES ===== */
/* Glass vars must live on body (not :root) so they resolve with body's --bg-rgb */
body[data-season="summer"] {
    --bg-base: #081510;
    --bg-rgb: 8, 21, 16;
    --season-image: url('cozy-glade/img/Year 1 Summer.png');
    --season-icon-color: #4fff90;
    background-color: var(--bg-base) !important;
}

body[data-season="spring"] {
    --bg-base: #0a1628;
    --bg-rgb: 10, 22, 40;
    --season-image: url('cozy-glade/img/Year 1 Spring.png');
    --season-icon-color: #7fffd8;
    background-color: var(--bg-base) !important;
}

body {
    --glass-subtle: rgba(var(--bg-rgb), 0.4);
    --glass-medium: rgba(var(--bg-rgb), 0.6);
    --glass-strong: rgba(var(--bg-rgb), 0.8);
    transition: background-color 0.8s ease;
}

* {
    font-family: 'Inter', sans-serif;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Markdown content styling */
.markdown-content {
    line-height: var(--leading-relaxed);
}

.markdown-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #f1f5f9;
    border-bottom: 2px solid #334155;
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #e2e8f0;
}

.markdown-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
}

.markdown-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
}

.markdown-content p {
    margin-bottom: 1rem;
    color: #cbd5e1;
}

.markdown-content ul, .markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    color: #cbd5e1;
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content li {
    margin-bottom: 0.5rem;
}

.markdown-content strong {
    color: #f1f5f9;
    font-weight: 600;
}

.markdown-content em {
    color: #94a3b8;
    font-style: italic;
}

.markdown-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #94a3b8;
    font-style: italic;
    background: #1e293b;
    padding: 1rem;
    border-radius: 0.375rem;
}

.markdown-content blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #334155;
    margin: 2rem 0;
}

.markdown-content code {
    background: #1e293b;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #60a5fa;
}

.markdown-content pre {
    background: #1e293b;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

/* Sidebar animation */
.nav-item {
    transition: all 0.2s ease;
}

.nav-item:hover {
    transform: translateX(4px);
}

/* Search highlight */
mark {
    background-color: #3b82f6;
    color: white;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
}

/* Search result cards */
/* Search result cards - Apple Liquid Glass */
.search-result-card {
    display: block;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(0, 0, 0, 0.01) 100%
    );
    backdrop-filter: blur(2px) saturate(150%);
    -webkit-backdrop-filter: blur(2px) saturate(150%);
    border-radius: var(--radius-lg);
    border: none;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.375),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.09),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.25);
    text-decoration: none;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.search-result-card:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.45),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.12),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 6px 20px rgba(0, 0, 0, 0.3);
}

.search-result-title {
    font-weight: 600;
    color: white;
    margin-bottom: 0.375rem;
}

.search-result-excerpt {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
    line-height: var(--leading-relaxed);
}

/* Sidebar glass effect - Option B "Clean Version" */
.glass-sidebar {
    position: relative;
    isolation: isolate; /* Create stacking context */
}

/* Background Image Layer */
.glass-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: var(--season-image, url('cozy-glade/img/cozy-glade-splash.png'));
    background-size: cover;
    background-position: center;
    opacity: 0.05;
}

/* Glass Layer */
.glass-sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;

    /* High contrast glass */
    background: rgba(var(--bg-rgb, 30, 41, 59), 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);

    /* The "Thick" look via shadows */
    box-shadow: 
        inset 0 1px 0 0 rgba(255, 255, 255, 0.3), /* Top white edge (light source) */
        inset 0 -1px 0 0 rgba(0, 0, 0, 0.3),     /* Bottom dark edge (shadow) */
        inset 0 0 20px rgba(255, 255, 255, 0.02), /* Subtle inner white glow */
        0 4px 10px rgba(0, 0, 0, 0.3);

    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Desktop floating bubble buttons - Apple Liquid Glass */
.bubble-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(0, 0, 0, 0.15) 50%,
        rgba(0, 0, 0, 0.25) 100%
    );
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: none;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.375),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.09),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.bubble-btn:hover {
    transform: scale(1.05);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.45),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.12),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 6px 20px rgba(0, 0, 0, 0.3);
}

.bubble-btn:active {
    transform: scale(0.95);
}

.bubble-btn svg {
    width: 22px;
    height: 22px;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.15s ease;
}

.bubble-btn:hover svg,
.bubble-btn:active svg {
    color: rgba(255, 255, 255, 1);
}

/* DM Mode button */
.dm-mode-btn.dm-mode-active {
    background: linear-gradient(
        180deg,
        rgba(139, 92, 246, 0.3) 0%,
        rgba(139, 92, 246, 0.15) 50%,
        rgba(139, 92, 246, 0.05) 100%
    );
    box-shadow:
        inset 0 1px 1px rgba(167, 139, 250, 0.4),
        inset 0 1.5px 3px rgba(167, 139, 250, 0.12),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        0 0 12px rgba(139, 92, 246, 0.25),
        0 4px 16px rgba(0, 0, 0, 0.25);
}

.dm-mode-btn.dm-mode-active svg {
    color: rgba(167, 139, 250, 1);
}

.dm-mode-btn.dm-mode-active:hover {
    box-shadow:
        inset 0 1px 1px rgba(167, 139, 250, 0.5),
        inset 0 1.5px 3px rgba(167, 139, 250, 0.15),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        0 0 16px rgba(139, 92, 246, 0.35),
        0 6px 20px rgba(0, 0, 0, 0.3);
}

/* DM-only card accent */
.dm-card {
    border: 1px solid rgba(139, 92, 246, 0.25) !important;
}

/* Desktop back button - disabled state */
#desktopBackBtn {
    transition: opacity 0.15s ease;
}

#desktopBackBtn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Desktop search container with expanding input */
.desktop-search-container {
    display: flex;
    align-items: center;
    position: relative;
    min-width: 48px;
}

.desktop-search-input {
    width: 0;
    padding: 0;
    opacity: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(0, 0, 0, 0.01) 100%
    );
    backdrop-filter: blur(2px) saturate(150%);
    -webkit-backdrop-filter: blur(2px) saturate(150%);
    border: none;
    border-radius: var(--radius-full);
    height: 48px;
    font-size: var(--text-sm);
    color: white;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.375),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.09),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.25);
    transition: width 0.25s ease, padding 0.25s ease, opacity 0.25s ease;
    outline: none;
}

.desktop-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.desktop-search-container.expanded .desktop-search-input {
    width: 240px;
    padding: 0 56px 0 20px;
    opacity: 1;
}

.desktop-search-container.expanded .bubble-btn {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.desktop-search-container .bubble-btn {
    position: absolute;
    right: 0;
}

/* Mobile bottom bar - Apple Liquid Glass */
.mobile-bottom-bar {
    position: relative;
    height: 56px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(0, 0, 0, 0.01) 100%
    );
    backdrop-filter: blur(2px) saturate(150%);
    -webkit-backdrop-filter: blur(2px) saturate(150%);
    border: none;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.375),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.09),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.25);
}

.mobile-bottom-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
    padding: 0 1rem;
}

.mobile-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.15s ease, background 0.15s ease;
}

.mobile-bar-btn.active {
    color: #fff;
}

.mobile-bar-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.mobile-bar-btn svg {
    width: 24px;
    height: 24px;
}

/* Mobile bar bubble effect */
.mobile-bubble {
    position: absolute;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    bottom: -4px;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.03) 50%,
        rgba(0, 0, 0, 0.02) 100%
    );
    backdrop-filter: blur(2px) saturate(150%);
    -webkit-backdrop-filter: blur(2px) saturate(150%);
    box-shadow:
        0 0 20px rgba(255, 255, 255, 0.1),
        inset 0 2px 2px rgba(255, 255, 255, 0.5),
        inset 0 3px 6px rgba(255, 255, 255, 0.15),
        inset 0 -2px 2px rgba(0, 0, 0, 0.15),
        inset 0 -3px 6px rgba(0, 0, 0, 0.08),
        0 8px 24px rgba(0, 0, 0, 0.4);
}

.mobile-bottom-bar.dragging .mobile-bubble {
    transform: scale(1);
    transition: transform 0.15s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* Mobile modal - liquid glass */
.mobile-modal {
    background: var(--glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.mobile-modal-enter {
    animation: blurIn 0.3s ease-out;
}

.mobile-modal-exit {
    animation: blurOut 0.25s ease-in forwards;
}

@keyframes blurIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

@keyframes blurOut {
    from {
        opacity: 1;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    to {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
}

/* Mobile page item cards - Apple Liquid Glass */
.page-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(0, 0, 0, 0.01) 100%
    );
    backdrop-filter: blur(2px) saturate(150%);
    -webkit-backdrop-filter: blur(2px) saturate(150%);
    border: none;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.375),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.09),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.25);
    transition: all 0.15s ease;
}

.page-item:active {
    transform: scale(0.98);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.45),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.12),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.15);
}

.page-item-title {
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.25rem;
}

.page-item-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Safe area padding for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-bottom-bar-wrapper {
        bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* Page Cover Image (Generic) */
.page-cover {
    position: relative;
    overflow: hidden;
    width: 100%;
    /* background-image set via inline style or JS */
    background-size: cover;
    background-position: center 35%;
    padding: 10rem 0 0 0;
    animation: coverFadeIn 0.6s ease-out;
}

@keyframes coverFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (min-width: 768px) {
    .page-cover {
        padding: 16rem 0 0 0;
    }
}

.page-cover-content {
    position: relative;
    z-index: 2;
    max-width: 56rem; /* max-w-4xl */
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .page-cover-content {
        padding: 0 2rem;
    }
}

.page-cover h1 {
    /* Cover specific overrides */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    text-shadow: 0 4px 12px rgba(0,0,0,0.8);
    border-bottom: none;
    color: white;
    width: 100%;
    padding-bottom: 0;
}

/* Character Backgrounds */
.character-bg {
    background-repeat: no-repeat;
    background-image: linear-gradient(to right, rgba(var(--bg-rgb), 0.9) 0%, rgba(var(--bg-rgb), 0.6) 100%), var(--char-bg-image);
    /* Mobile: subtle background at bottom right */
    background-position: 120% 100%;
    background-size: 80% auto;
    background-attachment: fixed;
}

@media (min-width: 768px) {
    .character-bg {
        /* Desktop: peeking in from right, fixed */
        /* Positioned at right bottom, offset slightly to the right */
        background-position: 110% 100%;
        background-size: auto 85vh; /* Scale based on height to fit nicely */
        background-image: linear-gradient(to right, rgba(var(--bg-rgb), 1) 50%, rgba(var(--bg-rgb), 0.7) 100%), var(--char-bg-image);
        background-attachment: fixed;
    }
}

@media (min-width: 1280px) {
    .character-bg {
        /* Large Desktop: Make sure it doesn't overlap text too much */
        /* Align right bottom exactly */
        background-position: right bottom;
        background-size: auto 90vh;
    }
}

/* ===== BESTIARY STYLES ===== */

.bestiary-entry {
    margin-bottom: 1.5rem;
}

.bestiary-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.bestiary-number {
    font-family: monospace;
    font-size: 0.875rem;
    color: #64748b;
    background: rgba(100, 116, 139, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.bestiary-category {
    font-style: italic;
    color: #94a3b8;
    font-size: 1rem;
}

/* Type Badges */
.bestiary-types {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.type-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
}

/* Type colors - inspired by Pokemon but muted for dark theme */
.type-aquatic {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(14, 165, 233, 0.3));
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.type-beast {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(245, 158, 11, 0.3));
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.4);
}

.type-flora {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.3), rgba(34, 197, 94, 0.3));
    color: #86efac;
    border: 1px solid rgba(74, 222, 128, 0.4);
}

.type-aerial {
    background: linear-gradient(135deg, rgba(196, 181, 253, 0.3), rgba(167, 139, 250, 0.3));
    color: #c4b5fd;
    border: 1px solid rgba(196, 181, 253, 0.4);
}

.type-subterranean {
    background: linear-gradient(135deg, rgba(180, 83, 9, 0.3), rgba(146, 64, 14, 0.3));
    color: #fbbf24;
    border: 1px solid rgba(180, 83, 9, 0.4);
}

.type-arcane {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(219, 39, 119, 0.3));
    color: #f9a8d4;
    border: 1px solid rgba(236, 72, 153, 0.4);
}

.type-nocturnal {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(79, 70, 229, 0.3));
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

/* Stats Grid */
.bestiary-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .bestiary-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.stat-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e2e8f0;
}

/* Gallery */
.bestiary-gallery {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: rgba(15, 23, 42, 0.5);
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}

.lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== COMPENDIUM INDEX STYLES ===== */

.compendium-intro {
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.compendium-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .compendium-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Overview page variant - 3 columns for compact display */
.compendium-grid-compact {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .compendium-grid-compact {
        grid-template-columns: repeat(3, 1fr);
    }
}

.compendium-card {
    display: flex;
    background: var(--card-gradient, linear-gradient(135deg, #374151, #1f2937));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 180ms ease-out,
                filter 180ms ease-out;
    text-decoration: none;
    color: inherit;
    min-height: 140px;
}

.compendium-card:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
    box-shadow: 0 8px 24px var(--card-shadow, rgba(0, 0, 0, 0.3));
}

.compendium-card-content {
    flex: 1;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Eyebrow text - for attribution like "Played by Token" or "Creatures & Beasts" */
.compendium-card-number {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.375rem;
}

/* Index number variant - for #001 style entries */
.compendium-card-number.index {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
}

.compendium-card-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compendium-card-desc {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.75);
    line-height: var(--leading-relaxed);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.compendium-card-img {
    width: 160px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}

.compendium-card-img img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 0.5rem;
    transition: transform 0.3s ease;
}

.compendium-card:hover .compendium-card-img img {
    transform: scale(1.05);
}

/* Cards without images - Apple Liquid Glass */
.compendium-card-no-img {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 50%,
        rgba(0, 0, 0, 0.01) 100%
    );
    backdrop-filter: blur(2px) saturate(150%);
    -webkit-backdrop-filter: blur(2px) saturate(150%);
    border: none;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.375),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.09),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 4px 16px rgba(0, 0, 0, 0.25);
}

.compendium-card-no-img:hover {
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.45),
        inset 0 1.5px 3px rgba(255, 255, 255, 0.12),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1),
        inset 0 -1.5px 3px rgba(0, 0, 0, 0.05),
        0 6px 20px rgba(0, 0, 0, 0.3);
}

.compendium-card-no-img .compendium-card-content {
    flex: 1;
    max-width: 100%;
}

/* Card placeholder for entries without images */
.compendium-card-placeholder {
    width: 100%;
    height: 100%;
    min-height: 80px;
    background: var(--glass-highlight);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compendium-card-placeholder svg {
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.3);
}

/* Bestiary page placeholder for entries without images */
.bestiary-placeholder-img {
    width: 100%;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #475569;
}

.bestiary-placeholder-img svg {
    width: 48px;
    height: 48px;
}

.bestiary-placeholder-img p {
    font-size: 0.875rem;
    margin: 0;
}

/* Empty state */
.compendium-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #64748b;
}

.compendium-empty-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.compendium-empty p {
    margin-bottom: 0.5rem;
    color: #94a3b8;
}

.compendium-empty-hint {
    font-size: 0.875rem;
    color: #64748b !important;
}

/* ===== OVERVIEW PAGE ===== */

.overview-intro {
    font-size: var(--text-base);
    color: rgba(255, 255, 255, 0.6);
    line-height: var(--leading-relaxed);
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.overview-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 2.5rem;
}

.overview-detail {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.5);
}

.detail-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-right: 0.375rem;
}

.detail-label::after {
    content: ":";
}

.overview-section {
    margin-bottom: 2rem;
}

.overview-section-header {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
}

/* ===== BREADCRUMB TITLE ===== */

.breadcrumb-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #334155;
    padding-bottom: 0.5rem;
}

.breadcrumb-title a {
    font-size: 2rem;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-title a:hover {
    color: #94a3b8;
}

.breadcrumb-title .breadcrumb-caret {
    font-size: 1.5rem;
    color: #475569;
    font-weight: 400;
}

.breadcrumb-title .breadcrumb-current {
    font-size: 2rem;
    font-weight: 700;
    color: #f1f5f9;
}

/* ===== BESTIARY PAGE LAYOUT ===== */

.bestiary-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .bestiary-page {
        flex-direction: row;
        gap: 2rem;
    }
}

/* Layout variant for entries without images */
.bestiary-page-no-img {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .bestiary-page-no-img {
        flex-direction: row;
        align-items: flex-start;
        gap: 2rem;
    }

    .bestiary-page-no-img .bestiary-props {
        flex-shrink: 0;
        width: 280px;
        margin-bottom: 0;
    }

    .bestiary-page-no-img .bestiary-content {
        flex: 1;
        min-width: 0;
    }
}

@media (min-width: 1024px) {
    .bestiary-page-no-img .bestiary-props {
        width: 320px;
    }
}

/* Illustration Area */
.bestiary-illustration {
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .bestiary-illustration {
        width: 280px;
    }
}

@media (min-width: 1024px) {
    .bestiary-illustration {
        width: 320px;
    }
}

.bestiary-gallery-main {
    aspect-ratio: 1;
    background: var(--bestiary-gradient, rgba(30, 41, 59, 0.5));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: background 0.5s ease;
}

.bestiary-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.bestiary-gallery-main:hover img {
    transform: scale(1.02);
}

.bestiary-gallery-thumbs {
    display: flex;
    gap: 0.5rem;
}

.gallery-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    background: rgba(30, 41, 59, 0.5);
    transition: border-color 0.15s ease, opacity 0.15s ease;
    opacity: 0.6;
}

.gallery-thumb:hover {
    opacity: 0.9;
}

.gallery-thumb.active {
    border-color: #3b82f6;
    opacity: 1;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Details Area */
.bestiary-details {
    flex: 1;
    min-width: 0;
}

.bestiary-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bestiary-details .bestiary-number {
    font-family: monospace;
    font-size: 0.75rem;
    color: #64748b;
    background: rgba(100, 116, 139, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.bestiary-meta .bestiary-types {
    display: flex;
    gap: 0.5rem;
    margin: 0;
}

/* Properties List */
.bestiary-props {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--glass-subtle);
    border-radius: var(--radius-lg);
    border: none;
    box-shadow:
        inset 0 var(--glass-edge-width) 0 0 var(--glass-highlight),
        inset 0 calc(-1 * var(--glass-edge-width)) 0 0 var(--glass-shadow-inset),
        0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 1.5rem;
}

.bestiary-prop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bestiary-prop:last-child {
    border-bottom: none;
}

.bestiary-prop.prop-header {
    justify-content: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
}

.prop-header .bestiary-number {
    font-family: monospace;
    font-size: 0.75rem;
    color: #64748b;
    background: rgba(100, 116, 139, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.prop-header .bestiary-types {
    display: flex;
    gap: 0.5rem;
    margin: 0;
}

.prop-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.prop-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: #e2e8f0;
}

.prop-value.placeholder {
    color: var(--color-placeholder);
    font-style: italic;
    font-weight: 400;
}

/* Sections */
.bestiary-section {
    margin-bottom: 1.25rem;
}

.section-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 0.375rem;
    font-weight: 600;
}

.bestiary-section p {
    margin: 0;
    color: #cbd5e1;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* Wiki auto-links */
.wiki-link {
    color: #93c5fd;
    text-decoration: none;
    border-bottom: 1px dotted rgba(147, 197, 253, 0.3);
    transition: color 0.15s, border-color 0.15s;
}

.wiki-link:hover {
    color: #bfdbfe;
    border-bottom-color: rgba(191, 219, 254, 0.6);
}

.placeholder-text {
    color: var(--color-placeholder);
    font-style: italic;
    font-weight: 400;
}

/* Season transition VFX */
.season-vfx {
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
    overflow: hidden;
}

.season-vfx .ray {
    position: absolute;
    width: 8px;
    height: 120px;
    background: linear-gradient(to bottom,
        rgba(255, 250, 200, 0.5),
        rgba(255, 240, 150, 0.3) 30%,
        rgba(255, 240, 150, 0.1) 60%,
        transparent 85%
    );
    border-radius: 40% 40% 50% 50% / 5% 5% 50% 50%;
    filter: blur(3px);
    box-shadow: 0 0 15px rgba(255, 240, 150, 0.2);
}

.season-vfx .snowflake {
    position: absolute;
    background: radial-gradient(circle,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.3) 70%,
        transparent 100%
    );
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.5);
}

/* Season toggle button */
.season-btn svg {
    color: var(--season-icon-color);
    transition: color 0.15s ease, filter 0.15s ease;
}

.season-btn:hover svg {
    color: var(--season-icon-color);
    filter: brightness(1.3);
}

/* ===== TIMELINE (Arc roadmap / activity-feed view) ===== */

.timeline {
    margin: 1.5rem 0 2rem;
    max-width: 720px;
}

.timeline-section {
    margin-bottom: 2rem;
}

.timeline-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.timeline-track {
    position: relative;
    padding-left: 1.5rem;
}

.timeline-track::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 1px;
    background: rgba(148, 163, 184, 0.25);
}

.timeline-item {
    position: relative;
    padding: 0.65rem 0 0.65rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.timeline-marker {
    position: absolute;
    left: -1.05rem;
    top: 1.1rem;
    width: 0.7rem;
    height: 1px;
    background: rgba(148, 163, 184, 0.45);
}

.timeline-item--climax .timeline-marker {
    left: -1.2rem;
    top: 0.95rem;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.timeline-item-desc {
    font-size: 0.875rem;
    line-height: 1.55;
    color: #cbd5e1;
}

.timeline-item-desc em {
    color: #94a3b8;
    font-style: normal;
    font-size: 0.8rem;
    display: inline-block;
    margin-top: 0.15rem;
}

.timeline-cutaway {
    margin-top: 0.65rem;
    padding: 0.1rem 0 0.1rem 0.85rem;
    font-style: italic;
    font-size: 0.825rem;
    line-height: 1.55;
    color: #a3b3c4;
    border-left: 2px solid rgba(148, 163, 184, 0.28);
}

.timeline-cutaway-label {
    font-style: normal;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-right: 0.4rem;
}

.timeline-cutaway--cliffhanger {
    border-left-color: rgba(248, 113, 113, 0.45);
    color: #cbd5e1;
}

.timeline-cutaway--cliffhanger .timeline-cutaway-label {
    color: #f87171;
}

.timeline-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.timeline-track--muted .timeline-item-title {
    color: #cbd5e1;
    font-weight: 500;
}

.timeline-track--muted .timeline-item-desc {
    color: #94a3b8;
}

.timeline-track--muted::before {
    background: rgba(148, 163, 184, 0.15);
}

@media (max-width: 640px) {
    .timeline-track { padding-left: 1.25rem; }
    .timeline-item { padding-left: 1rem; }
    .timeline-item-title { font-size: 0.9rem; }
    .timeline-item-desc { font-size: 0.825rem; }
}
