/* CSS variables used by the ported panel styles (from wiki_dynamic_production.css) */
:root {
    /* Color Palette - Earthy, Fantasy-Inspired */
    --color-primary: #5a4738;
    --color-primary-light: #8b7355;
    --color-primary-dark: #3a2f28;
    --color-secondary: #3498db;
    --color-secondary-light: #5dade2;
    --color-accent: #e67e22;
    --color-success: #27ae60;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;

    /* Neutrals */
    --color-bg-primary: #fff8eb;
    --color-bg-secondary: #f4e8d0;
    --color-bg-tertiary: #e8d4b0;
    --color-bg-card: #ffffff;
    --color-text-primary: #2c3e50;
    --color-text-secondary: #666666;
    --color-text-tertiary: #888888;
    --color-border-primary: #8b7355;
    --color-border-secondary: #d4c0a0;
    --color-border-tertiary: #ecf0f1;

    /* Shadows & Elevation */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(139, 115, 85, 0.12);
    --shadow-lg: 0 4px 16px rgba(139, 115, 85, 0.15);
    --shadow-xl: 0 8px 24px rgba(139, 115, 85, 0.20);
    --shadow-hover: 0 6px 20px rgba(139, 115, 85, 0.18);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;

/* wiki_panels.css — fact panels + timeline/map panels for the consolidated wiki page.
   Created in the playtest-platform project (2026-10); styles cherry-picked/derived
   from wiki_dynamic_production.css where noted. */

/* ── Entry fact panels (WHERE / WHEN / RELATIONS) ────────────────────────── */

.fact-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px 0 4px 0;
}

.fact-panel {
    background: #f6f1e7;
    border: 1px solid #d8cbb2;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.92em;
}

.fact-panel-wide {
    grid-column: 1 / -1;
}

.fact-label {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b7355;
    margin-bottom: 3px;
}

.fact-value {
    color: #333;
    line-height: 1.5;
}

.fact-default {
    color: #9a8f7d;
    font-style: italic;
}

.fact-map-btn {
    margin-left: 8px;
    padding: 3px 10px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.88em;
}

.fact-map-btn:hover {
    background: #2980b9;
}

.fact-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fact-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 12px;
    background: #fff;
    border: 1.5px solid #95a5a6;
    border-left-width: 4px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    color: #333;
    transition: background 0.2s, transform 0.15s;
}

.fact-chip:hover {
    background: #f4e8d0;
    transform: translateY(-1px);
}

.fact-chip-type {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Hidden-lore collapsibles inside entry content */
.modal-body details, .topic-detail-content details {
    border: 1px solid #d8cbb2;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 10px 0;
    background: #fbf8f1;
}

.modal-body details summary, .topic-detail-content details summary {
    cursor: pointer;
    font-weight: 600;
    color: #8b7355;
}

/* Metric tables rendered from the corpus factbook */
.modal-body table, .topic-detail-content table {
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.9em;
}

.modal-body table th, .modal-body table td,
.topic-detail-content table th, .topic-detail-content table td {
    border: 1px solid #d8cbb2;
    padding: 5px 10px;
    text-align: left;
}

.modal-body table th, .topic-detail-content table th {
    background: #f0e9da;
}

/* ── Timeline + wiki-map panels (ported from wiki_dynamic_production.css) ── */

.map-panel,
.context-image-panel {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-base);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
    color: white;
    cursor: pointer;
    user-select: none;
}

.panel-header h3 {
    margin: 0;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.panel-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.panel-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.panel-toggle.collapsed {
    transform: rotate(-90deg);
}

.panel-toggle.collapsed:hover {
    transform: rotate(-90deg) scale(1.1);
}

.panel-content {
    max-height: 400px;
    transition: max-height var(--transition-base);
    overflow: hidden;
}

.panel-content.collapsed {
    max-height: 0;
}

.timeline-container,
.map-container {
    min-height: 250px;
    position: relative;
}

.timeline-placeholder,
.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    color: var(--color-text-tertiary);
    font-style: italic;
    text-align: center;
    padding: var(--space-lg);
    background: var(--color-bg-secondary);
}

/* Timeline in main panel (full width) */
.timeline-panel-main {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-top: var(--space-lg);
    transition: all var(--transition-base);
}

.timeline-panel-main .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
    color: white;
    cursor: pointer;
    user-select: none;
}

.timeline-panel-main .panel-header h3 {
    margin: 0;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.timeline-panel-main .panel-content {
    max-height: 350px;
    transition: max-height var(--transition-base);
    overflow: hidden;
}

.timeline-panel-main .panel-content.collapsed {
    max-height: 0;
}

.timeline-panel-main .timeline-container {
    min-height: 300px;
