/* ==========================================================================
   COMPONENTS — Modals, Overlays, Floating Tags, Animations
   Roman/Antiquity Theme
   ========================================================================== */

/* Fullscreen Background & Canvas */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    filter: brightness(0.82) contrast(1.05);
    /* Reduces 3D world brightness */
}

/* ==========================================================================
   LOADING / END SCREENS
   ========================================================================== */

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(200, 150, 90, 0.15);
    border-left-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-screen,
.end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: var(--bg-main);
    background-image:
        radial-gradient(ellipse at 30% 60%, rgba(80, 45, 10, 0.5) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 30%, rgba(100, 55, 10, 0.3) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loading-inner,
.end-inner {
    text-align: center;
    max-width: 480px;
    padding: 32px;
    /* Parchment card effect */
    background: rgba(28, 18, 8, 0.7);
    border: 1px solid var(--border-accent);
    border-top: 2px solid var(--accent-secondary);
}

.loading-inner h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.6rem;
    letter-spacing: 0.12em;
    color: var(--accent-secondary);
    margin-bottom: 8px;
    text-shadow: 0 0 30px rgba(232, 197, 106, 0.3);
}

.loading-text {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Cinzel', serif;
}

.end-btn-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-top: 28px;
}

.loading-screen .btn-primary,
.loading-screen .hint {
    display: none;
    /* Hide until engine is ready */
    opacity: 0;
}

.loading-screen.ready .spinner,
.loading-screen.ready .loading-text {
    display: none;
}

.loading-screen.ready .btn-primary,
.loading-screen.ready .hint {
    display: block;
    animation: fadeIn 1.2s ease forwards;
    /* Fade in start button */
}

/* Master Buttons */
.btn-primary {
    background: var(--accent-primary);
    margin: 2.5em auto;
    padding: 10px 28px;
    border: 1px solid var(--accent-secondary);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'Cinzel', serif;
    color: #1a0e04;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.2s;
    border-radius: 1px;
}

.btn-primary:hover {
    background: var(--accent-secondary);
}

.hint {
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 1px;
    font-style: italic;
    margin-top: 8px;
}

.terminal-btn {
    margin: 12px auto;
    padding: 8px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--accent-primary);
    color: #1a0e04;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid var(--accent-secondary);
    border-radius: 1px;
}

.terminal-btn:hover:not(:disabled) {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

.terminal-btn:disabled {
    color: var(--text-muted);
    border-color: rgba(200, 150, 90, 0.15);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Screen Wipe */
#wipe-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    z-index: 9000;
    pointer-events: none;
    transform: translateX(-100%);
}

#wipe-overlay.active {
    animation: wipeIn 2s ease-in-out forwards;
    /* Wipes across screen: 0-1s covers, 1-2s reveals */
}

@keyframes wipeIn {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ==========================================================================
   MOBILE NAVIGATION (REFACTORED)
   ========================================================================== */

#bottom-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    pointer-events: none;
}

.footer-nav-menu {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;

    background: rgba(1, 1, 5, 0.95);
    backdrop-filter: blur(15px);
    padding: 24px 0 10px 0;
    border-top: 1px solid rgba(0, 242, 255, 0.2);
    pointer-events: auto;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

@media (min-width: 769px) {
    .footer-nav-menu {
        max-width: 500px;
        border-radius: 24px;
        padding: 24px 10px 15px 10px;
        margin: 0;
    }
}



.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 2em;

    background: rgba(200, 150, 90, 0);
    color: var(--accent-secondary);
    border: 0px none;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    padding: 8px 8px;

    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 0.72rem;
    width: auto;
    min-width: 42px;
    height: auto;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

@media (max-width: 639px) {
    .mobile-nav-btn {
        padding: 12px 2px;
        gap: 18px;
    }
}


.mobile-nav-btn i {
    font-size: 1.3rem;
}


.mobile-nav-btn span {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;

}


.mobile-nav-btn:hover {
    color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(200, 150, 90, 0.2);
}

/* Active State */
.mobile-nav-btn.active {
    color: var(--accent-secondary);
}


.minimap-panel {
    position: absolute !important;
    bottom: 150px !important;
    pointer-events: auto;
}

/* ==========================================================================
   HEADER DROPDOWN MENU (Drawer Style)
   ========================================================================== */

.header-menu-container {
    position: relative;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    /* Match the status side for centering */
}

.header-status {
    flex: 1;
    /* Match the menu side for centering */
    display: flex;
    align-items: center;
    gap: 8px;
}

.hamburger-btn {
    background: rgba(28, 18, 8, 0.6);
    border: 1px solid var(--border-accent);
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.2s;
    z-index: 5002;
    /* Stay above the sliding menu */
}

.hamburger-btn:hover {
    background: rgba(200, 150, 90, 0.15);
    border-color: var(--accent-primary);
}

.hamburger-icon {
    width: 22px;
    height: 16px;
    position: relative;
    transform: rotate(0deg);
    transition: .5s ease-in-out;
}

.hamburger-icon span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: var(--accent-secondary);
    border-radius: 9px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

.hamburger-icon span:nth-child(1) {
    top: 0px;
}

.hamburger-icon span:nth-child(2) {
    top: 7px;
}

.hamburger-icon span:nth-child(3) {
    top: 14px;
}

/* Animated transformation to X */
.header-menu-container.is-open .hamburger-icon span:nth-child(1) {
    top: 7px;
    transform: rotate(135deg);
}

.header-menu-container.is-open .hamburger-icon span:nth-child(2) {
    opacity: 0;
    left: -40px;
}

.header-menu-container.is-open .hamburger-icon span:nth-child(3) {
    top: 7px;
    transform: rotate(-135deg);
}

.header-dropdown-menu {
    position: absolute;
    top: 50px;
    /* Aligned below the header bar */
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--border-accent);
    border-top: 2px solid var(--accent-primary);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9);
    z-index: 5001;

    /* Container appears instantly, items will stagger slide */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.header-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.dropdown-item {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 12px 16px;
    text-align: left;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    width: 100%;
}

.dropdown-item:hover {
    background: rgba(200, 150, 90, 0.1);
    color: var(--accent-secondary);
}

.dropdown-item i {
    width: 20px;
    color: var(--accent-primary);
    text-align: center;
}

.dropdown-text-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.dropdown-label {
    font-weight: 600;
}

.dropdown-desc {
    font-size: 0.65rem;
    opacity: 0.7;
    font-weight: 400;
}

.dropdown-item-error {
    color: var(--accent-error);
}

/* ==========================================================================
   EVIDENCE & CODEX MODAL STYLES
   ========================================================================== */

.evidence-detail-panel {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.evidence-detail-inner {
    padding: 24px;
}

.evidence-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.evidence-detail-icon {
    font-size: 3rem;
}

.evidence-detail-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gold);
}

.evidence-detail-type {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.evidence-detail-section {
    margin-bottom: 20px;
}

.evidence-detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
}

.prophecy-section {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.read-more-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 12px;
    font-size: 0.8rem;
    margin-top: 10px;
    cursor: pointer;
}

.verse-content {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    font-style: italic;
    font-size: 0.9rem;
}

/* Codex Preview Area */
.codex-preview-panel {
    background: rgba(200, 150, 90, 0.08);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 12px;
    margin: 15px 0;
    animation: fadeIn 0.3s ease;
}

.preview-header {
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(200, 150, 90, 0.2);
    padding-bottom: 4px;
}

.preview-body {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Metrics Bar */
.metrics-bar {
    display: inline-flex;
    justify-content: center;
    gap: clamp(10px, 3vw, 24px);
    align-items: center;
    background: rgba(28, 18, 8, 0.92);
    padding: 0 20px;
    height: 34px;
    font-size: clamp(0.78rem, 1.4vw, 0.9rem);
    width: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    flex: none;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    position: fixed;
    top: 85px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: calc(var(--font-size) * 1.4);
}

.metric-icon {
    color: var(--accent-primary);
}

/* ==========================================================================
   IN-WORLD TAGS
   ========================================================================== */

.inworld-tag {
    position: absolute;
    z-index: 450;
    transform: translate(-50%, -100%);
    pointer-events: none;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    animation: tagPop 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tagPop {
    from {
        transform: translate(-50%, -80%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -100%) scale(1);
        opacity: 1;
    }
}

.inworld-btn {
    pointer-events: auto;
    background: rgba(28, 18, 8, 0.96);
    border: 1px solid var(--accent-success);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(143, 191, 106, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.05em;
    transition: all 0.15s ease;
}

.inworld-btn:hover {
    background: var(--accent-success);
    color: #1a0e04;
    transform: scale(1.04);
}

.inworld-msg {
    background: rgba(232, 197, 106, 0.95);
    border: 1px solid rgba(255, 240, 180, 0.6);
    color: #1a0e04;
    padding: 5px 12px;
    border-radius: 1px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    box-shadow: 0 3px 10px rgba(200, 150, 90, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.inworld-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid rgba(28, 18, 8, 0.96);
}

.inworld-arrow.collectable-arrow {
    border-top-color: rgba(232, 197, 106, 0.95);
}

/* ==========================================================================
   MAP TRIGGER BUTTON
   ========================================================================== */

.map-node-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-top: -7px;
    border-radius: 1px;
    z-index: 550;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 14px currentColor;
    border: 1px solid rgba(240, 230, 200, 0.5);
    transition: transform 0.2s;
    left: 50%;
    top: 50%;
}

.map-node-dot:hover {
    transform: scale(1.45);
}

.map-node-dot.locked {
    cursor: not-allowed;
    border: 1px solid #3a2a15 !important;
    background: #1c120a !important;
    box-shadow: none;
}

.map-node-dot.completed::after {
    content: '✦';
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent-secondary);
    font-size: 10px;
}

.map-node-label {
    position: absolute;
    z-index: 551;
    pointer-events: none;
    font-size: 0.7rem;
    white-space: nowrap;
    color: var(--text-main);
    background: rgba(20, 12, 4, 0.96);
    padding: 4px 8px;
    border-radius: 2px;
    border: 1px solid var(--border-subtle);
    transform: translate(-50%, -32px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.03em;
}

/* ==========================================================================
   ACT TREE (MAP MODAL SIDEBAR)
   ========================================================================== */

#modal-canvas-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.tree-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--dim);
    margin-right: 12px;
}

.tree-item.complete .tree-dot {
    background: var(--accent-secondary);
}

.tree-item.available .tree-dot {
    background: var(--accent-primary);
}

.tree-item.active-phase .tree-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 7px var(--accent-primary);
}

.tree-info {
    flex: 1;
    min-width: 0;
}

.tree-act {
    color: var(--text-muted);
    font-size: 0.52rem;
    letter-spacing: 2px;
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
}

.tree-connector {
    width: 2px;
    height: 12px;
    background: rgba(200, 150, 90, 0.12);
    margin-left: 22px;
}

/* Act tree headers */
.act-tree-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.act-tree-header:hover {
    background: rgba(200, 150, 90, 0.07);
}

.act-tree-header.active {
    border-left-color: var(--accent-primary);
}

.act-tree-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 7px var(--accent-primary);
}

.act-tree-name {
    color: var(--accent-primary);
    font-size: 0.62rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    flex: 1;
}

.act-tree-chevron {
    color: var(--accent-primary);
    font-size: 0.55rem;
}

.act-cases-list .tree-item {
    padding: 8px 16px;
    display: flex;
}

.act-cases-list .tree-item:hover {
    background: rgba(200, 150, 90, 0.07);
}

/* ==========================================================================
   MINIMAP BLIPS
   ========================================================================== */

.minimap-blip.collectable.newly-unlocked {
    animation: blipPulse 1s ease-in-out 3;
    font-weight: 900;
}

@keyframes blipPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

.minimap-blip.locked-clue {
    background: rgba(200, 150, 90, 0.15);
    border: 1px dashed rgba(200, 150, 90, 0.4);
    width: 6px;
    height: 6px;
    margin-left: -3px;
    margin-top: -3px;
    border-radius: 50%;
}

.evidence-ghost-hint {
    position: absolute;
    pointer-events: none;
    z-index: 550;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(200, 150, 90, 0.22);
    box-shadow: 0 0 12px rgba(200, 150, 90, 0.28);
    animation: ghostPulse 2.2s ease-in-out infinite;
}

@keyframes ghostPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(0.8);
    }

    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* ==========================================================================
   MAP MODAL
   ========================================================================== */

#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1500;
    background: rgba(10, 6, 2, 0.97);
    display: none;
    align-items: center;
    justify-content: center;
}

#modal-overlay.active {
    display: flex;
}

#modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.modal-body-flush {
    flex-direction: column;
    overflow: hidden;
}

#modal-canvas-wrap {
    height: 45vh;
    min-height: 280px;
    width: 100%;
    flex: none;
    position: relative;
    overflow: hidden;
}

#modal-overlay .modal-panel {
    position: relative;
    margin: auto;
    overflow: hidden;
    height: 90vh;
    max-width: 960px;
    width: 94%;
    display: flex;
    flex-direction: column;
}

#modal-overlay .modal-body {
    flex: 1;
    min-height: 0;
    position: relative;
}

.modal-body-flush {
    flex-direction: row;
    overflow: hidden;
}

#modal-canvas-wrap {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #0a0a0a 0%, #000 100%);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 0;
}

@media (max-width: 640px) {
    .modal-body-flush {
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    #modal-canvas-wrap {
        height: 40vh !important;
        min-height: 300px;
        width: 100% !important;
        order: 1;
        flex: none !important;
    }

    #map-node-info-panel {
        width: 100% !important;
        height: auto !important;
        border-left: none !important;
        padding: 20px !important;
        order: 2;
        background: transparent !important;
        min-height: 0 !important;
    }

    .map-legend {
        order: 3;
        padding: 20px !important;
        border-top: 1px solid var(--border-subtle);
    }

    #header-dropdown {
        width: calc(100% - 20px) !important;
        left: 10px !important;
        right: 10px !important;
    }

    #lsm-tree {
        position: relative !important;
        width: 100% !important;
        height: 300px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        order: 2;
    }

    .map-modal-panel {
        flex-direction: column !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow-y: visible !important;
    }
}

#modal-overlay.active {
    display: flex;
}


.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 25;
}

.modal-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.07em;
    color: var(--accent-secondary);
}


/* Modal header styles */
.modal-header .modal-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent-primary);
    font-weight: 700;
}

.modal-header .modal-subtitle {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

#modal-canvas-wrap {
    position: absolute;
    inset: 0;
}

#modal-overlay .modal-panel {
    position: relative;
    margin: auto;
    overflow: hidden;
    height: 90vh;
}



.close-modal-btn {
    background: transparent;
    border: 1px solid var(--accent-error);
    color: var(--accent-error);
    padding: 7px 18px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    background: var(--accent-error);
    color: #fff;
}


#modal-overlay .modal-panel {
    position: relative;
    margin: auto;
    overflow: hidden;
    height: 90vh;
    max-width: 960px;
    width: 94%;
}

.modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-panel {
    background: rgba(22, 13, 5, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(200, 150, 90, 0.3);
    border-top: 2px solid var(--accent-primary);
    border-radius: 2px;
    padding: 10px;
    width: auto;
    max-width: 540px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 24px 50px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(200, 150, 90, 0.05),
        inset 0 1px 0 rgba(240, 230, 206, 0.1);
    animation: modalSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}



.overlay-mask {
    opacity: 0;
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(3px);
    z-index: 2500;
    align-items: center;
    justify-content: center;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.overlay-mask.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.overlay-mask.fade-in-complete {
    opacity: 1;
    pointer-events: auto;
}


#inv-board-overlay .modal-panel {
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--panel-bg);
    border: 2px solid var(--border-accent);
    outline: 1px solid rgba(200, 150, 90, 0.15);
    outline-offset: 4px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(16px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}


.badge {
    background: rgba(200, 150, 90, 0.12);
    color: var(--accent-primary);
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 1px;
    font-weight: 700;
    margin-left: 8px;
    border: 1px solid var(--border-subtle);
    font-family: 'Cinzel', serif;
}

.close-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;

    transition: all 0.2s;
}

.close-icon-btn:hover {
    color: var(--accent-error);
    transform: scale(1.1);
}


.current-v {
    font-size: 1rem;
    line-height: 1.65;
    margin: 0 0 16px;
    color: var(--accent-success);
    font-style: italic;
}

.context-v {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
    border-left: 2px solid var(--accent-primary);
    padding-left: 12px;
    margin: 0 0 12px;
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==========================================================================
   SETTINGS OVERLAY
   ========================================================================== */

#settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(3px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

#settings-overlay.active {
    display: flex;
}

.settings-panel {
    background: rgba(22, 13, 5, 0.98);
    border: 1px solid var(--border-accent);
    border-top: 2px solid var(--accent-primary);
    width: 90%;
    max-width: 460px;
    border-radius: 2px;
    padding: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    animation: modalSlideUp 0.28s ease forwards;

    position: relative;
    margin: 20vh auto;
    overflow: hidden;
    height: 60vh;
    display: flex;
    flex-direction: column;
}


#settings-overlay .modal-panel {
    margin: auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 0.88rem;
    letter-spacing: 0.1em;
    color: var(--accent-secondary);
    margin: 0;
}

.settings-body {
    padding: 20px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 14px;
}

.settings-row label {
    font-size: 0.78rem;
    color: var(--text-main);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex: 1;
}

.settings-row select,
.settings-row input[type="range"] {
    background: rgba(200, 150, 90, 0.07);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: 2px;
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    min-width: 140px;
}

.settings-row select:focus,
.settings-row input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
}

.clickable-reference {

    margin: 8px auto;
    padding: 3px 6px;
    border: 1px solid var(--accent-primary);
    background: rgba(200, 150, 90, 0.1);
    color: var(--accent-primary);
    font-size: 0.72rem;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    border-radius: 1px;
    transition: all 0.15s ease;
    align-items: center;
}

.clickable-reference:hover {
    background: var(--accent-primary);
    color: #1a0e04;
    transform: scale(1.05);
}

/* ==========================================================================
   DIALOGUE / VN OVERLAY
   ========================================================================== */

#local-dialogue-box,
#vn-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#local-dialogue-box[style*="flex"],
#vn-overlay.active {
    opacity: 1;
    pointer-events: all;
}

#vn-container,
.dialogue-container {
    width: min(580px, 94vw);
    height: min(72vh, 660px);
    background: rgba(18, 10, 3, 0.98);
    border: 1px solid var(--border-accent);
    border-top: 2px solid var(--accent-primary);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(200, 150, 90, 0.06);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.28s ease;
    /* Parchment texture */
    background-image:
        linear-gradient(rgba(200, 150, 90, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 150, 90, 0.02) 1px, transparent 1px);
    background-size: 22px 22px;
    background-color: rgba(18, 10, 3, 0.98);
}

#vn-overlay.active #vn-container,
#local-dialogue-box[style*="flex"] .dialogue-container {
    transform: translateY(0) scale(1);
}

/* === VN / CHAT HEADER === */
.vn-chat-hdr,
.chat-hdr {
    background: rgba(200, 150, 90, 0.06);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.vn-hdr-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vn-avatar-bubble {
    width: 40px;
    height: 40px;
    background: rgba(200, 150, 90, 0.15);
    border-radius: 50%;
    border: 1px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.vn-chr,
#npc-name-display {
    color: var(--accent-secondary);
    font-size: 0.88rem;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.vn-st,
.st {
    color: var(--accent-success);
    font-size: 0.65rem;
    margin-top: 2px;
    letter-spacing: 0.05em;
}

.vn-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 2px;
    transition: color 0.2s, background 0.2s;
}

.vn-close-btn:hover {
    color: var(--text-main);
    background: rgba(200, 150, 90, 0.1);
}

/* === BUBBLE SCROLL === */
#bub-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: transparent;
    background-image: radial-gradient(rgba(200, 150, 90, 0.03) 1px, transparent 0);
    background-size: 20px 20px;
}

#bub-scroll::-webkit-scrollbar {
    width: 4px;
}

#bub-scroll::-webkit-scrollbar-thumb {
    background: rgba(200, 150, 90, 0.2);
    border-radius: 2px;
}

/* === MESSAGE BUBBLES === */
.msg {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 2px;
    font-size: 0.86rem;
    line-height: 1.55;
    word-wrap: break-word;
    animation: msgIn 0.22s ease-out both;
    font-family: var(--font-body);
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.msg.npc {
    align-self: flex-start;
    background: rgba(200, 150, 90, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-left: 2px solid var(--accent-primary);
}

.msg.player {
    align-self: flex-end;
    background: rgba(143, 191, 106, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(143, 191, 106, 0.25);
    border-right: 2px solid var(--accent-success);
}

.msg.system {
    align-self: center;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
    font-size: 0.68rem;
    text-align: center;
    padding: 5px 14px;
    border-radius: 2px;
    border: 1px solid var(--border-subtle);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.msg.breakthrough {
    align-self: flex-start;
    background: rgba(232, 197, 106, 0.15);
    border: 1px solid var(--accent-secondary);
    border-left: 2px solid var(--accent-secondary);
    color: var(--accent-secondary);
}

.msg.evidence-unlock {
    align-self: center;
    background: rgba(143, 191, 106, 0.1);
    border: 1px solid rgba(143, 191, 106, 0.3);
    color: var(--accent-success);
    font-size: 0.76rem;
    text-align: center;
    padding: 6px 16px;
    letter-spacing: 0.03em;
}

.msg.npc-filler {
    align-self: flex-start;
    background: rgba(100, 80, 50, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(200, 150, 90, 0.1);
    font-size: 0.72rem;
    font-style: italic;
}

/* Chat bubbles (legacy .chat-bubble) */
.chat-bubble {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 2px;
    font-size: 0.86rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    border: 1px solid var(--border-subtle);
}

.chat-bubble.incoming {
    background: rgba(200, 150, 90, 0.08);
    color: var(--text-main);
    align-self: flex-start;
    border-left: 2px solid var(--accent-primary);
}

.chat-bubble.outgoing {
    background: rgba(143, 191, 106, 0.1);
    color: var(--text-main);
    align-self: flex-end;
    border-right: 2px solid var(--accent-success);
}

/* === TYPING INDICATOR === */
.typing-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 9px 13px;
    background: rgba(200, 150, 90, 0.07);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    border-left: 2px solid var(--accent-primary);
    align-self: flex-start;
    animation: msgIn 0.2s ease-out;
}

.dot {
    width: 5px;
    height: 5px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {

    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.typing-lbl {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: 4px;
    font-style: italic;
}

/* === CHOICES BAR === */
#bar-choices,
.vn-bar-choices {
    border-top: 1px solid var(--border-subtle);
    background: rgba(200, 150, 90, 0.04);
    padding: 13px 17px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    min-height: 64px;
    flex-shrink: 0;
}

#bar-choices.hide,
.vn-bar-choices.hide {
    display: none;
}

.choice-btn {
    background: rgba(200, 150, 90, 0.08);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 7px 17px;
    border-radius: 2px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.82rem;
    transition: all 0.18s ease;
    letter-spacing: 0.01em;
}

.choice-btn:hover {
    background: rgba(200, 150, 90, 0.18);
    color: var(--accent-secondary);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

/* In old #bar-choices */
#bar-choices .choice-btn {
    background: rgba(200, 150, 90, 0.07);
    border: 1px solid var(--border-subtle);
    color: var(--accent-primary);
    padding: 9px 16px;
    border-radius: 2px;
    cursor: pointer;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#bar-choices .choice-btn:hover {
    background: rgba(200, 150, 90, 0.18);
    color: var(--accent-secondary);
    padding-left: 22px;
}

#bar-choices .choice-btn small {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.choice-btn .evidence-hint {
    display: block;
    font-size: 0.66rem;
    color: var(--accent-primary);
    margin-top: 3px;
    opacity: 0.8;
}

/* ==========================================================================
   INVESTIGATION BOARD (LAB UI)
   ========================================================================== */

#inv-board-content {
    display: flex;
    flex-direction: column;
    padding: 18px 20px;
    gap: 18px;
}

.lab-slots {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
}

.lab-slot {
    flex: 1;
    max-width: 310px;
    min-height: 66px;
    background: rgba(200, 150, 90, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 10px 14px;
}

.lab-slot:hover {
    background: rgba(200, 150, 90, 0.1);
    border-color: var(--accent-primary);
}

.slot-icon {
    font-size: 1.7rem;
    opacity: 0.9;
}

.slot-name {
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
}

.slot-empty {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
}

.lab-slot-divider {
    color: var(--accent-primary);
    font-size: 1.3rem;
    font-weight: bold;
    opacity: 0.5;
}

.lab-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 0;
}

.lab-btn {
    background: rgba(200, 150, 90, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 9px 16px;
    border-radius: 2px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 100px;
    transition: all 0.2s;
    letter-spacing: 0.04em;
}

.lab-btn:hover:not([aria-disabled='true']) {
    background: rgba(200, 150, 90, 0.16);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
    transform: translateY(-1px);
}

.lab-btn[aria-disabled='true'] {
    opacity: 0.38;
    cursor: not-allowed;
}

.lab-btn-icon {
    font-size: 1.1rem;
}

.lab-btn-label {
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.65rem;
}

.lab-result {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    padding: 13px;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.result-placeholder {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
}

.result-content {
    color: var(--text-main);
}

.result-text {
    margin: 0 0 6px;
    font-size: 0.84rem;
    line-height: 1.45;
}

.result-insight {
    color: var(--accent-success);
    font-size: 0.78rem;
    margin: 0;
    font-style: italic;
}

.result-key {
    color: var(--accent-primary);
}

.result-key-badge {
    color: var(--accent-secondary);
    font-weight: 700;
    font-size: 0.74rem;
    margin-top: 4px;
    font-family: 'Cinzel', serif;
}

.result-error {
    color: var(--accent-error);
    font-size: 0.82rem;
}

.lab-evidence-picker {
    margin-top: 10px;
}

.picker-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 0 0 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Cinzel', serif;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 9px;
    max-height: 290px;
    overflow-y: auto;
}

.picker-card {
    font-family: var(--font-body);
    background: rgba(200, 150, 90, 0.04);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    padding: 11px 8px;
    cursor: pointer;
    text-align: center;
    position: relative;
    transition: all 0.2s;
}

.picker-card:hover {
    background: rgba(200, 150, 90, 0.1);
    border-color: var(--accent-primary);
}

.picker-card.selected-a,
.picker-card.selected-b {
    color: var(--text-main);
    background: rgba(200, 150, 90, 0.14);
    border-color: var(--accent-primary);
}

.picker-card.selected-a {
    border-left: 3px solid var(--accent-primary);
}

.picker-card.selected-b {
    border-left: 3px solid var(--accent-secondary);
}

.picker-icon {
    font-size: 1.4rem;
    display: block;
    margin-bottom: 5px;
}

.picker-name {
    font-size: 0.72rem;
    display: block;
}

.sel-badge {
    position: absolute;
    top: 3px;
    right: 5px;
    background: var(--accent-primary);
    color: #1a0e04;
    font-size: 0.58rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
}

.picker-card.selected-b .sel-badge {
    background: var(--accent-secondary);
}

.picker-empty {
    grid-column: 1/-1;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
    padding: 18px;
    font-style: italic;
}

/* Deduction history */
.lab-history {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.lab-history-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Cinzel', serif;
}

.lab-empty {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin: 0;
    font-style: italic;
}

.deduction-entry {
    background: rgba(200, 150, 90, 0.04);
    border-radius: 2px;
    border: 1px solid var(--border-subtle);
    padding: 8px 11px;
    margin-bottom: 7px;
    font-size: 0.78rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.deduction-entry.key {
    border-left: 2px solid var(--accent-secondary);
    background: rgba(232, 197, 106, 0.07);
}

.deduction-op {
    font-size: 0.95rem;
}

.deduction-text {
    color: var(--text-main);
    flex: 1;
    line-height: 1.4;
}

.key-badge {
    color: var(--accent-secondary);
    font-weight: 700;
    margin-left: auto;
}

/* ==========================================================================
    SCREEN ALERT NOTIFICATION
    ========================================================================== */

#screen-alert {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    display: none;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    background: rgba(22, 13, 5, 0.97);
    border: 1px solid var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
    color: var(--text-main);
    padding: 10px 20px;
    font-size: 0.78rem;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    animation: alertIn 0.25s ease-out;
    white-space: nowrap;
    border-radius: 2px;
}

#screen-alert.active {
    display: flex;
    opacity: 1;
}

/* Screen alert for case title - centered */
#screen-alert.case-title-alert {
    top: 50%;
    left: 50%;
    width: auto;
    max-width: 90%;
    transform: translate(-50%, -50%);
    background: rgba(30, 18, 8, 0.98);
    border: 2px solid var(--accent-secondary);
    border-left: 4px solid var(--accent-primary);
    color: var(--accent-secondary);
    font-size: 1.2rem;
    padding: 20px 40px;
    animation: caseTitleFade 3s ease-out;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    border-radius: 2px;
}

@keyframes caseTitleFade {
    0% {
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    85% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   ACCESSIBILITY BAR
   ========================================================================== */

.a11y-bar {
    display: flex;
    gap: 6px;
    align-items: center;
}

.a11y-bar button {
    background: rgba(200, 150, 90, 0.07);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    width: 34px;
    height: 34px;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.a11y-bar button:hover {
    background: rgba(200, 150, 90, 0.16);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

.a11y-bar button[aria-pressed="true"] {
    background: rgba(200, 150, 90, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-primary);
    color: #1a0e04;
    padding: 8px 16px;
    border-radius: 0 0 4px 0;
    font-weight: 700;
    z-index: 9999;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   HIGH CONTRAST / SIMPLE MODE OVERRIDES
   ========================================================================== */

body.high-contrast {
    --panel-bg: rgba(0, 0, 0, 0.98);
    --text-main: #ffffff;
    --text-muted: #cccccc;
    --border-subtle: rgba(255, 255, 255, 0.35);
    --accent-primary: #ffd700;
    --accent-secondary: #ffffff;
}

body.simple-mode {
    font-family: Georgia, serif;
}

body.simple-mode .panel-header,
body.simple-mode .loc-tag,
body.simple-mode .quest-title {
    font-family: Georgia, serif;
    letter-spacing: 0;
}

/* ==========================================================================
   SETTINGS / ACCESSIBILITY LIST CONTROLS
   ========================================================================== */

.toggle-btn {
    background: rgba(200, 150, 90, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    min-width: 48px;
    height: 26px;
    position: relative;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn[aria-checked='true'],
.toggle-btn[aria-pressed='true'] {
    color: var(--accent-secondary);
    border-color: rgba(200, 150, 90, 0.55);
    background: rgba(200, 150, 90, 0.18);
}

.toggle-btn::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-btn[aria-checked='true']::after,
.toggle-btn[aria-pressed='true']::after {
    transform: translateX(22px);
    background: var(--accent-secondary);
}

/* Reduce motion */
body.reduce-motion * {
    animation: none !important;
    transition: none !important;
}

/* ==========================================================================
   MISC TWEAKS
   ========================================================================== */

/* Bible reader passage display */
.passage-line {
    padding: 6px 0;
    font-size: 0.9rem;
    line-height: 1.65;
    border-bottom: 1px solid rgba(200, 150, 90, 0.08);
    color: var(--text-main);
}

.passage-line:last-child {
    border-bottom: none;
}

.verse-num {
    font-size: 0.65rem;
    color: var(--accent-primary);
    font-weight: 700;
    font-family: 'Cinzel', serif;
    margin-right: 5px;
    vertical-align: super;
}

/* NPC panel (chatUI) */
.npc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.npc-card {
    background: rgba(200, 150, 90, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    padding: 12px 14px;
}

.npc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.npc-avatar {
    font-size: 1.5rem;
}

.npc-info {
    flex: 1;
}

.npc-name {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.04em;
}

.npc-role {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.npc-mood {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
}

.npc-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.npc-btn {
    background: rgba(200, 150, 90, 0.07);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 5px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-body);
    transition: all 0.2s;
}

.npc-btn:hover {
    background: rgba(200, 150, 90, 0.16);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

.npc-btn-challenge {
    border-color: rgba(201, 64, 64, 0.35);
}

.npc-btn-challenge:hover {
    background: rgba(201, 64, 64, 0.12);
    border-color: var(--accent-error);
    color: var(--accent-error);
}

.pressure-bar {
    height: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1px;
    margin-top: 9px;
    overflow: hidden;
}

.pressure-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-error));
    transition: width 0.4s ease;
}

/* Chat feed */
.msg-speaker {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 3px;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.msg-text {
    font-size: 0.82rem;
    line-height: 1.5;
}

.breakthrough-badge {
    display: inline-block;
    background: rgba(232, 197, 106, 0.15);
    border: 1px solid var(--accent-secondary);
    color: var(--accent-secondary);
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 1px;
    margin-left: 6px;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
}

.clue-badge {
    display: inline-block;
    background: rgba(143, 191, 106, 0.12);
    border: 1px solid var(--accent-success);
    color: var(--accent-success);
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 1px;
    margin-left: 6px;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
}

.chat-empty {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.show-evidence-picker {
    margin-top: 14px;
}

.evidence-pick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 10px 0;
}

.evidence-pick-btn {
    background: rgba(200, 150, 90, 0.07);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font-body);
    transition: all 0.2s;
}

.evidence-pick-btn:hover {
    background: rgba(200, 150, 90, 0.16);
    border-color: var(--accent-primary);
}

.evidence-pick-btn.selected {
    background: rgba(200, 150, 90, 0.14);
    border-color: var(--accent-primary);
}

.cancel-btn {
    background: transparent;
    border: 1px solid rgba(201, 64, 64, 0.4);
    color: var(--accent-error);
    padding: 5px 14px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Cinzel', serif;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: rgba(201, 64, 64, 0.1);
}

/* Challenge picker modal (inside VN overlay) */
.challenge-picker-modal {
    position: absolute;
    bottom: 70px;
    left: 20px;
    right: 20px;
    background: rgba(20, 12, 4, 0.96);
    border: 1px solid var(--border-accent);
    border-top: 2px solid var(--accent-error);
    border-radius: 2px;
    padding: 12px;
    z-index: 100;
    max-height: 200px;
}

.challenge-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.challenge-picker-header span {
    color: var(--accent-error);
    font-size: 0.8rem;
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

.challenge-picker-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.confirm-challenge-btn {
    background: var(--accent-error);
    color: #fff;
    border: 1px solid var(--accent-error);
    padding: 6px 12px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: 'Cinzel', serif;
    transition: all 0.2s;
}

.confirm-challenge-btn:hover:not(:disabled) {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

.confirm-challenge-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Investigation panel (right sidebar) */
.lab-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================================================
   PASSAGE HINT
   ========================================================================== */
.passage-hint {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    color: var(--sepia);
    font-size: 0.82rem;
    opacity: 0.5;
}

/* ==========================================================================
   ACT TREE - Map Modal
   ========================================================================== */
.act-tree-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.act-tree-icon {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-secondary);
}

.act-tree-name {
    color: var(--accent-secondary);
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    flex: 1;
}

.act-tree-chevron {
    color: var(--accent-secondary);
    font-size: 0.6rem;
}

.tree-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tree-dot.available {
    background: var(--accent-secondary);
}

.tree-dot.solved {
    background: var(--gold);
}

.tree-item.locked .tree-dot {
    background: var(--dim);
}

.tree-title {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main);
    font-family: var(--font-body);
    background: rgba(200, 150, 90, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 2px;
    padding: 4px 8px;
}

.tree-item.locked .tree-title {
    color: var(--text-muted);
}

/* Loading screen header text */
.loading-screen .loading-title {
    color: #fff;
    font-size: 3rem;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

/* Loading screen text */
.loading-screen .loading-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* End screen styles */
.end-screen {
    display: none;
    opacity: 0;
}

.end-screen .end-icon {
    color: var(--accent-success);
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.end-screen .end-title {
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.end-screen .end-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

/* Level title in top bar */
#level-title {
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(200, 150, 90, 0.12);
    border: 1px solid var(--border-gold);
    padding: 6px 14px;
    border-radius: 2px;
    font-size: 0.82rem;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 0 15px rgba(200, 150, 90, 0.2);
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
    margin: 0 20px;
}

#level-title.case-loading {
    animation: caseTitlePulse 2s ease-in-out infinite;
}

@keyframes caseTitlePulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(200, 150, 90, 0.2);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 25px rgba(200, 150, 90, 0.4);
        transform: scale(1.02);
    }
}



/* Settings modal */
#settings-overlay {
    display: none;
    z-index: 1000;
}

.settings-modal {
    max-width: 420px;
    margin: auto;
    top: 15%;
}

.settings-body {
    padding: 20px 0;
}

.settings-field {
    margin-bottom: 18px;
}

.settings-label {
    color: var(--accent-primary);
    display: block;
    margin-bottom: 8px;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Cinzel', serif;
}

.settings-select {
    width: 100%;
    background: #0b141a;
    color: var(--text-main);
    border: 1px solid rgba(100, 255, 218, 0.2);
    padding: 10px 14px;
    border-radius: 3px;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.9rem;
    appearance: none;
    cursor: pointer;
}

.settings-help {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-top: 6px;
    font-style: italic;
}

.settings-saved {
    height: 1rem;
    color: var(--accent-success);
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.settings-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding: 0 4px;
}

.btn-save-settings {
    background: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
}

/* Investigation board modal */
#inv-board-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(20, 12, 4, 0.96);
    z-index: 4000;
    /* Lab stays on top */
    display: none;
    justify-content: center;
    align-items: center;
    padding: 30px;
    opacity: 0;
    transition: opacity 0.35s ease;
}

#inv-board-overlay.active {
    display: flex !important;
}

#inv-board-overlay.fade-in-complete {
    opacity: 1;
}

#inv-board-overlay .modal-panel {
    width: 98vw;
    max-width: none;
    height: 95vh;
    max-height: none;
    overflow-y: auto;
    background: #1a0e04;
    border: 2px solid var(--border-accent);
    outline: 1px solid rgba(200, 150, 90, 0.15);
    outline-offset: 4px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

/* Evidence popup title icon */
.popup-evidence-icon {
    color: var(--accent-success);
}

/* Suspect button role text */
.suspect-role {
    display: block;
    font-size: 0.7rem;
    color: #8696a0;
    margin-top: 2px;
}

/* Action button icon margin */
.action-icon {
    margin-right: 6px;
}

/* Settings header icon margin */
.settings-header-icon {
    margin-right: 8px;
}

/* Dynamically positioned blip (NEW label) */
.minimap-blip.new-unlocked {
    position: absolute;
    width: 28px;
    height: 14px;
    background: #00ffaa;
    color: #000;
    font-size: 9px;
    font-weight: 900;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 552;
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px var(--gold);
    ;
}


/* Action/prophecy containers */
.actions-container,
.prophecies-container {
    flex: 1;
    overflow-y: auto;
}

/* Minimap grid circles */
.minimap-grid-circle.grid-small {
    width: 30px;
    height: 30px;
}

.minimap-grid-circle.grid-large {
    width: 65px;
    height: 65px;
}

/* ==========================================================================
   REFACTORED INTERFACE STYLES (FROM INLINE)
   ========================================================================== */

/* Modal and Panel Specific Layouts */
.settings-panel {
    max-width: 420px;
}

.map-modal-panel {
    max-width: 960px;
    width: 94%;
    max-height: 86vh;
}

.inv-board-panel {
    /* Consolidated into #inv-board-overlay .modal-panel */
}

#settings-overlay {
    z-index: 1000;
}

#inv-board-overlay {
    z-index: 1500;
}

.modal-body-flush {
    padding: 0;
    display: flex;
    flex-direction: row;
    gap: 0;
    flex-direction: column !important;
    overflow-y: visible !important;
    flex: none !important;
    height: auto !important;
    order: 1;
}


.settings-modal-body {
    padding: 20px 10px;
}

/* Header Text Components */
.modal-title-settings {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent-primary);
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
}

.modal-title-settings img {
    width: 2rem;
    height: 2rem;

}

.modal-title-map {
    margin: 0;
    font-size: 1.05rem;
    color: var(--accent-primary);
    font-weight: 700;
}

h4.modal-subtitle-custom {
    font-size: 1rem;
    text-transform: uppercase;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

.modal-subtitle-custom {
    margin: 2px 0 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);

}

.header-icon-spacer {
    margin-right: 8px;
}

/* Settings Elements */
.settings-group {
    margin-bottom: 18px;
}

.settings-label-custom {
    color: var(--accent-primary);
    display: block;
    margin-bottom: 8px;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Cinzel', serif;
}

.settings-a11y-label {
    color: var(--accent-primary);
    display: block;
    margin-bottom: 12px;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

.settings-select-custom {
    width: auto;
    background: #0b141a;
    color: var(--text-main);
    border: 1px solid rgba(100, 255, 218, 0.2);
    margin: 10px;
    padding: 10px 14px;
    border-radius: 3px;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.9rem;
    appearance: none;
    cursor: pointer;
}

.settings-hint-custom {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-top: 6px;
    font-style: italic;
}

.settings-divider-custom {
    border-top: 1px solid var(--border-subtle);
    margin: 18px 0;
}

.settings-divider-small {
    border-top: 1px solid var(--border-subtle);
    margin: 5px 0;
}

.settings-saved-label {
    height: 1rem;
    color: var(--accent-success);
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.settings-a11y-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Settings Footer & Buttons */
.settings-footer-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    padding: 0 4px;
}

.persistence-btn-row {
    display: flex;
    gap: 10px;
}

.modal-action-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.btn-flex {
    flex: 1;
}

.settings-footer-layout .terminal-btn {
    margin: 0;
    background: var(--accent-primary);
    color: #1a0e04;
    border-color: var(--accent-secondary);
}

.settings-footer-layout .terminal-btn:hover:not(:disabled) {
    background: var(--accent-secondary);
}

/* JS Generated A11y Rows */
.a11y-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(200, 150, 90, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    cursor: pointer;
}

.a11y-label-main {
    font-weight: 700;
    font-size: 0.95rem;
}

.a11y-label-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.a11y-btn-spacer {
    margin-left: 12px;
}

/* ==========================================================================
   CODEX MATCHING SYSTEM
   ========================================================================== */

.codex-selection-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.selection-slot {
    min-width: 140px;
    min-height: 48px;
    padding: 8px 14px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.selection-slot:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.06);
}

.selection-slot.active {
    border-color: var(--accent-primary);
    border-style: solid;
    background: rgba(0, 242, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 0 16px rgba(0, 242, 255, 0.18);
}

.selection-arrow {
    font-size: 1.4rem;
    color: var(--accent-primary);
}

.slot-icon {
    font-size: 1.3rem;
}

.slot-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.codex-feedback {
    margin-bottom: 16px;
    min-height: 44px;
}

.codex-feedback-msg {
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    animation: fadeSlide 0.2s ease-out;
}

.codex-feedback-msg.success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--green);
    border: 1px solid var(--green);
}

.codex-feedback-msg.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.evidence-detail-confirm {
    padding: 8px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--accent-primary);
    background: var(--accent-primary);
    color: #1a0e04;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.evidence-detail-confirm:hover:not(:disabled) {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.25);
}

.evidence-detail-confirm.is-disabled,
.evidence-detail-confirm:disabled {
    background: transparent;
    color: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.18);
    cursor: not-allowed;
    box-shadow: none;
}

.codex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.codex-matching-columns .picker-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

.codex-matching-columns .picker-card img.icon-svg {
    width: 2rem;
    height: 2rem;
}

.codex-match-column .lab-slot {
    width: 100%;
    max-width: none;
}

.prophecy-people-intro,
.prophecy-accuse-intro {
    margin-bottom: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.codex-matching-columns .picker-card:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.06);
}

.codex-matching-columns .picker-card.selected-a {
    border-color: var(--accent-primary);
    background: rgba(0, 242, 255, 0.12);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.18);
}

.codex-matching-columns .picker-card.selected-b {
    border-color: var(--accent-secondary);
    background: rgba(200, 150, 90, 0.12);
    box-shadow: 0 0 10px rgba(200, 150, 90, 0.18);
}

.prophecy-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

.prophecy-card:hover {
    border-color: var(--accent-secondary);
    background: rgba(200, 150, 90, 0.06);
}

.prophecy-card.discovered {
    border-color: var(--accent-secondary);
    background: rgba(200, 150, 90, 0.1);
}

.prophecy-card-icon {
    font-size: 1.4rem;
}

.prophecy-card-reference {
    font-weight: 700;
    font-size: 0.75rem;
    text-align: center;
    color: var(--accent-secondary);
}

.prophecy-card-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

.sel-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-primary);
    color: #1a0e04;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   MOBILE NAVIGATION OVERRIDES
   ========================================================================== */

#bottom-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    pointer-events: none;
}



/* ==========================================================================
   CODEX PREVIEW PANEL
   ========================================================================== */

.codex-preview-panel {
    background: rgba(200, 150, 90, 0.08);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 12px;
    margin: 15px 0;
    animation: fadeIn 0.3s ease;
}

.preview-header {
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(200, 150, 90, 0.2);
    padding-bottom: 4px;
    font-family: 'Cinzel', serif;
}

.preview-body {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    font-style: italic;
}

/* ==========================================================================
   EVIDENCE DETAIL ENHANCEMENTS
   ========================================================================== */

.evidence-detail-panel {
    border-top: 3px solid var(--accent-primary);
}

.evidence-detail-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--accent-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prophecy-section {
    background: rgba(0, 242, 255, 0.03);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}

.read-more-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--accent-primary);
    font-size: 0.7rem;
    padding: 4px 10px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.read-more-btn:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-primary);
}

.bible-read-more-container,
.prophecy-read-more-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.bible-read-more-container .read-more-btn,
.prophecy-read-more-container .read-more-btn {
    margin-top: 0;
    text-align: left;
}

.verse-content {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.6;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.sidebar-chat-entry {
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    border-left: 2px solid var(--accent-secondary);
}

.sidebar-chat-entry small {
    color: var(--accent-primary);
    font-weight: 700;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
}

.sidebar-chat-entry p {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-muted);
}

/* ==========================================================================
   PEOPLE MODAL STYLES
   ========================================================================== */

.people-modal-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    height: 65vh;
}

.people-list-sidebar {
    border-right: 1px solid var(--border-subtle);
    padding-right: 15px;
    overflow-y: auto;
}

.person-nav-btn {
    width: 100%;
    text-align: left;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
}

.person-nav-btn img {
    width: 3rem;
    height: 3rem;
}


.person-nav-btn.active {
    border-color: var(--accent-primary);
    background: rgba(200, 150, 90, 0.1);
}

.person-detail-view {
    overflow-y: auto;
    padding-right: 10px;
}

.person-detail-view h3 img {
    width: 5rem;
    height: 5rem;
}


.convo-history-feed {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
}

.ui-visibility-hidden {
    display: none !important;
}

/* ==========================================================================
   MAP MODAL — SATELLITE VIEW
   ========================================================================== */

.map-modal-panel {
    width: 96vw;
    height: 92vh;
    max-width: 1500px;
    display: flex;
    flex-direction: column;
    background: #080808;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

.modal-header-map-custom {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(to right, #111, #080808);
}

.modal-title-map {
    font-size: 1.25rem;
    letter-spacing: 4px;
    color: var(--accent-primary);
    font-family: 'Source Code Pro', monospace;
}

.modal-subtitle-custom {
    font-size: 0.9rem;
    opacity: 0.8;
    letter-spacing: 1px;
}

#lsm-tree {
    position: absolute;
    left: 0;
    top: 100px;
    width: 260px;
    flex-shrink: 0;
    background: rgba(12, 7, 2, 0.85);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    padding: 14px;
    z-index: 10;
    justify-content: center;
}

#modal-canvas-wrap {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #0a0a0a 0%, #000 100%);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.satellite-overlay-top {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: none;
    opacity: 0.7;
}

.satellite-overlay-bottom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    pointer-events: none;
    text-align: right;
    opacity: 0.5;
}

.satellite-grid-ver {
    font-size: 0.6rem;
    color: var(--accent-primary);
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.satellite-scan-text {
    font-size: 0.8rem;
    font-family: 'Source Code Pro';
    color: #fff;
}

.satellite-coord {
    font-size: 0.55rem;
    font-family: 'Source Code Pro';
}

#map-node-info-panel {
    width: 420px;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 200;
    background: #0c0c0c;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-subtle);
    overflow-y: auto;
    min-height: 0;
    flex-shrink: 0;
}

.map-node-intel-header {
    padding: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}


.map-node-header-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

#map-node-emoji {
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

#map-node-title {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--text-main);
    letter-spacing: 1px;
}

#map-node-location {
    font-size: 0.7rem;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

.map-node-dossier {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.dossier-section-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 600;
}

#map-node-description {
    font-size: 0.85rem;
    line-height: 1.7;
    margin: 0;
    font-family: 'Source Code Pro', monospace;
    color: var(--text-main);
    opacity: 0.8;
}

#map-act-description {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--accent-secondary);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
}

#map-node-action-container {
    padding: 0 30px 30px 30px;
}

#btn-load-node-scene {
    width: 100%;
    justify-content: center;
    padding: 15px;
    margin: 0;
}

#btn-load-node-scene i {
    margin-right: 10px;
}

#completed-cases-section-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

#completed-cases-list {
    font-size: 0.75rem;
    color: #e2b13c;
    font-family: 'Source Code Pro';
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.map-legend {
    padding: 25px 30px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.map-legend-item {
    color: var(--accent-primary);
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.map-legend-item.completed {
    color: #e2b13c;
}

.map-legend-item.locked {
    opacity: 0.3;
}

.modal-header-map-custom {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(to right, #111, #080808);
    padding: 15px 20px;
}

.modal-title-map {
    font-size: 1.25rem;
    letter-spacing: 4px;
    color: var(--accent-primary);
    font-family: 'Source Code Pro', monospace;
}

.modal-subtitle-custom {
    font-size: 0.9rem;
    opacity: 0.8;
    letter-spacing: 1px;
}


#modal-canvas-wrap {
    flex: 1;
    position: relative;
    background: radial-gradient(circle at center, #0a0a0a 0%, #000 100%);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.satellite-overlay {
    position: absolute;
    pointer-events: none;
}

.satellite-overlay-top {
    top: 20px;
    left: 20px;
    opacity: 0.7;
}

.satellite-overlay-bottom {
    bottom: 20px;
    right: 20px;
    text-align: right;
    opacity: 0.5;
}

.satellite-grid-ver {
    font-size: 0.6rem;
    color: var(--accent-primary);
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.satellite-scan-text {
    font-size: 0.8rem;
    font-family: 'Source Code Pro';
    color: #fff;
}

.satellite-coord {
    font-size: 0.55rem;
    font-family: 'Source Code Pro';
}

#map-node-info-panel {
    width: 420px;
    background: #0c0c0c;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-subtle);
    overflow-y: auto;
    min-height: 0;
    flex-shrink: 0;
}

.map-node-intel-header {
    padding: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}


.map-node-header-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

#map-node-emoji {
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

#map-node-title {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--text-main);
    letter-spacing: 1px;
}

#map-node-location {
    font-size: 0.7rem;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

.map-node-dossier {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.dossier-section-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 600;
}

#map-node-description {
    font-size: 0.85rem;
    line-height: 1.7;
    margin: 0;
    font-family: 'Source Code Pro', monospace;
    color: var(--text-main);
    opacity: 0.8;
}

#map-act-description {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--accent-secondary);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
}

#btn-load-node-scene {
    width: 100%;
    justify-content: center;
    padding: 15px;
    margin: 0;
}

#btn-load-node-scene i {
    margin-right: 10px;
}

#completed-cases-section-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

#completed-cases-list {
    font-size: 0.75rem;
    color: #e2b13c;
    font-family: 'Source Code Pro';
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.map-legend {
    padding: 25px 30px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.map-legend-item {
    color: var(--accent-primary);
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.map-legend-item.completed {
    color: #e2b13c;
}

.map-legend-item.locked {
    opacity: 0.3;
}

.map-legend-icon-sm {
    font-size: 8px;
}

.map-legend-icon-md {
    font-size: 9px;
}

.completed-cases-placeholder {
    opacity: 0.5;
    font-style: italic;
}

/* ==========================================================================
   SETTINGS MODAL
   ========================================================================== */

#settings-overlay .modal-panel {
    max-width: 500px;
    width: 90%;
}

.settings-section {
    margin-top: 20px;
}

.settings-section:first-of-type {
    margin-top: 0;
}

.settings-section-scripture {
    margin-top: 20px;
}

.settings-section-a11y {
    margin-top: 20px;
}

.a11y-setting-row-audio {
    margin-top: 8px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
}

/* Instructions Modal */
#instructions-modal .modal-panel {
    max-width: 420px;
}

.instructions-logo {
    text-align: center;
    margin-bottom: 24px;
}

.instructions-title {
    font-size: 1.1rem;
    color: var(--accent-primary);
}

.instructions-subtitle {
    font-weight: 700;
    margin-bottom: 12px;
}

.instructions-body {
    line-height: 1.6;
}

.instructions-actions {
    margin-top: 18px;
}

/* Reset Modal */
#reset-modal .modal-panel {
    max-width: 340px;
}

.reset-modal-body {
    text-align: center;
}

.reset-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.reset-subtitle {
    margin: 10px 0 18px;
}

/* Codex Modal */
#codex-modal .modal-panel {
    max-width: 800px;
    width: 95%;
}

#codex-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 70vh;
}

.prophecy-lab-intro {
    margin-bottom: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

#codex-evidence-grid {
    margin-bottom: 24px;
}

.picker-title-margin-top {
    margin-top: 24px;
}

/* Evidence Detail Modal */
.evidence-detail-panel {
    max-width: 600px;
    width: 95%;
}

.evidence-detail-inner {
    overflow-y: auto;
    max-height: 70vh;
}

.prophecy-section-spacer {
    margin-top: 20px;
}

.btn-full-width {
    width: 100%;
    margin-top: 12px;
}

/* People Modal */
#people-modal .modal-panel {
    max-width: 850px;
    width: 95%;
}

/* Accuse Modal */
#accuse-modal .modal-panel {
    max-width: 540px;
    width: 95%;
}

#accuse-suspect-list {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow-y: auto;
    max-height: 60vh;
}

.settings-section {
    margin-top: 20px;
}

.settings-section:first-of-type {
    margin-top: 0;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   PASSAGE OVERLAY
   ========================================================================== */

.passage-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================================
   ACCUSE MODAL
   ========================================================================== */

#accuse-modal .modal-panel {
    max-width: 540px;
    width: 95%;
}

#accuse-suspect-list {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow-y: auto;
    max-height: 60vh;
}

/* ==========================================================================
   PEOPLE MODAL
   ========================================================================== */

#people-modal .modal-panel {
    max-width: 850px;
    width: 95%;
}

/* ==========================================================================
   EVIDENCE DETAIL MODAL
   ========================================================================== */

.evidence-detail-panel {
    max-width: 600px;
    width: 95%;
}

.evidence-detail-inner {
    overflow-y: auto;
    max-height: 70vh;
}

.prophecy-section-spacer {
    margin-top: 20px;
}

.btn-full-width {
    width: 100%;
    margin-top: 12px;
}

/* ==========================================================================
   CODEX MODAL
   ========================================================================== */

#codex-modal .modal-panel {
    max-width: 800px;
    width: 95%;
}

#codex-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 70vh;
}

.prophecy-lab-intro {
    margin-bottom: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

#codex-evidence-grid {
    margin-bottom: 24px;
}

.picker-title-margin-top {
    margin-top: 24px;
}

/* ==========================================================================
   INSTRUCTIONS MODAL
   ========================================================================== */

#instructions-modal .modal-panel {
    max-width: 420px;
}

.instructions-logo {
    text-align: center;
    margin-bottom: 24px;
}

.instructions-title {
    font-size: 1.4rem;
    color: var(--accent-primary);
}

.instructions-subtitle {
    font-weight: 700;
    margin-bottom: 12px;
}

.instructions-body {
    line-height: 1.6;
}

.instructions-action-row {
    margin-top: 18px;
}

/* ==========================================================================
   RESET MODAL
   ========================================================================== */

#reset-modal .modal-panel {
    max-width: 340px;
}

.reset-modal-body {
    text-align: center;
}

.reset-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.reset-subtitle {
    margin: 10px 0 18px;
}

/* ==========================================================================
   RESPONSIVE FIXES
   ========================================================================== */

@media (max-width: 768px) {
    #map-node-info-panel {
        min-height: 0 !important;
    }

    .modal-top-row {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .modal-header-map-custom {
        padding: 15px 20px !important;
    }

    .modal-body-flush {
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    #modal-canvas-wrap {
        height: 40vh !important;
        min-height: 300px;
        width: 100% !important;
        order: 1;
        flex: none !important;
    }

    #map-node-info-panel {
        width: 100% !important;
        height: auto !important;
        border-left: none !important;
        padding: 20px !important;
        order: 2;
        background: transparent !important;
        min-height: 0 !important;
    }

    .map-legend {
        order: 3;
        padding: 20px !important;
        border-top: 1px solid var(--border-subtle);
    }

    #header-dropdown {
        width: calc(100% - 20px) !important;
        left: 10px !important;
        right: 10px !important;
    }

    #lsm-tree {
        position: relative !important;
        width: 100% !important;
        height: 300px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        order: 4;
    }

    .map-modal-panel {
        flex-direction: column !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow-y: visible !important;
    }
}

/* ==========================================================================
   MAP NODE STYLES
   ========================================================================== */

.map-node-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-primary);
    cursor: pointer;
    z-index: 100;
    pointer-events: auto;
    border: 2px solid #fff;
    transition: transform 0.2s, background-color 0.2s;
    display: block;
    transform: translate(-50%, -50%);
}

@keyframes nodePulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 15px var(--accent-primary);
        opacity: 0.8;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        box-shadow: 0 0 25px var(--accent-primary);
        opacity: 1;
    }
}

.map-node-dot.pulse {
    animation: nodePulse 2s ease-in-out infinite;
}

.map-node-dot:hover {
    background-color: #fff !important;
    transform: translate(-50%, -50%) scale(1.4) !important;
    z-index: 120;
}

.map-node-dot.locked {
    background: #444 !important;
    box-shadow: none !important;
    border-color: #666;
    cursor: not-allowed;
}

.codex-matching-columns {
    grid-template-columns: 1fr !important;
}


.map-node-label {
    position: absolute;
    pointer-events: none;
    z-index: 110;
    color: #fff;
    font-family: 'Source Code Pro', monospace;
    text-transform: uppercase;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.85);
    padding: 6px 12px;
    border-left: 3px solid var(--accent-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 2px;
    transform: translate(-50%, -100%);
}

.map-node-loc {
    font-size: 0.55rem;
    color: var(--accent-primary);
    opacity: 0.9;
    font-weight: 700;
    letter-spacing: 1px;
}

.map-node-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ==========================================================================
   CODE/TERMINAL TEXT
   ========================================================================== */

.terminal-code-text {
    font-family: 'Source Code Pro', monospace;
}