:root {
    /* --- Palette: Royal Persian (Ultrathink Refined) --- */
    --c-surface-solid: #050404; /* Deepest Void */
    --c-surface-glass: rgba(5, 4, 4, 0.8); /* Translucent Obsidian */
    --c-surface-glass-border: rgba(255, 255, 255, 0.08);

    --c-text-primary: #E6DCCD; /* Antique Parchment */
    --c-text-secondary: #9C9488; /* Weathered Stone */
    --c-text-tertiary: #5D564E; /* Shadow Earth */

    --c-accent: #D94E28; /* Persian Vermilion */

    /* Metallic Gold Gradients - Photorealistic */
    --c-gold: #D4AF37;
    --c-gold-bright: #F2DFA8;
    --c-gold-dim: #6B5226;

    /* A rich, multi-stop gold gradient for text and borders */
    --g-gold-premium: linear-gradient(135deg,
        #BF953F 0%,
        #FCF6BA 20%,
        #B38728 40%,
        #FBF5B7 60%,
        #AA771C 80%,
        #BF953F 100%
    );

    --g-gold-subtle: linear-gradient(135deg, rgba(197, 160, 89, 0.4), rgba(122, 96, 40, 0.1));

    --g-surface-glass: linear-gradient(160deg, rgba(20, 18, 16, 0.7), rgba(5, 4, 3, 0.85));

    /* --- Typography --- */
    --font-display: 'Cinzel', serif;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;

    /* --- Metrics --- */
    --radius-lg: 32px;
    --radius-md: 20px;
    --radius-sm: 12px;

    /* --- Effects --- */
    --shadow-soft: 0 24px 48px -12px rgba(0, 0, 0, 0.8);
    --shadow-sharp: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 80px rgba(197, 160, 89, 0.15);
    --shadow-glass-inset: inset 0 1px 1px rgba(255, 255, 255, 0.1), inset 0 0 20px rgba(0, 0, 0, 0.5);
    --blur-glass: 40px;

    --z-map: 1;
    --z-ui: 100;
    --z-panel: 200;
    --z-overlay: 300;

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-elastic: cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* --- Global Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    background-color: var(--c-surface-solid);
    font-family: var(--font-body);
    color: var(--c-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
}

::selection {
    background: rgba(197, 160, 89, 0.3);
    color: var(--c-gold-bright);
    text-shadow: 0 0 8px var(--c-gold);
}

/* Global Grain Texture */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 0.07;
    mix-blend-mode: overlay;
}

/* --- Map Layer --- */
#map {
    position: absolute; inset: 0;
    z-index: var(--z-map);
    background: #080605;
    transition: filter 0.8s ease;
}

/* The obsidian-and-gold invert filter was retired with the Carto tiles:
   the warm-paper vector basemap carries its own palette natively. */

.leaflet-control-attribution {
    background: transparent !important;
    font-family: var(--font-body);
    font-size: 10px;
    opacity: 0.3;
    text-shadow: 0 1px 2px black;
    transition: opacity 0.3s ease;
}
.leaflet-control-attribution:hover { opacity: 0.8; }
.leaflet-control-attribution a { color: var(--c-text-secondary); text-decoration: none; }

/* --- UI Layer --- */
#ui-layer {
    position: absolute; inset: 0;
    z-index: var(--z-ui);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    padding: 40px;
    justify-content: space-between;
}

/* --- Header --- */
.app-header {
    pointer-events: auto;
    text-align: center;
    width: fit-content;
    margin: 0 auto;
    padding-top: 2vh;
    animation: fadeInDown 1.2s var(--ease-out-expo);
    position: relative;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-40px); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.header-content h1 {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 5vw, 6rem);
    font-weight: 400;
    margin: 0;
    letter-spacing: 0.2em; /* Increased spacing */
    line-height: 1.1;
    background: var(--g-gold-premium);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 30px rgba(197, 160, 89, 0.2));
    position: relative;
    animation: textShimmer 8s linear infinite;
}

@keyframes textShimmer {
    to { background-position: 200% center; }
}

.subtitle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    opacity: 0;
    animation: fadeIn 1s ease 0.5s forwards;
}

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

.subtitle-wrapper p {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-style: italic;
    margin: 0;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--c-text-secondary);
}

.separator {
    height: 1px;
    width: 40px;
    background: linear-gradient(90deg, transparent, var(--c-gold-dim), transparent);
}

/* --- Timeline Navigation --- */
#timeline {
    pointer-events: auto;
    background: rgba(10, 8, 7, 0.6);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-soft), var(--shadow-glow);
    border-radius: 100px;
    padding: 6px;
    display: flex;
    gap: 0;
    align-self: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 1s var(--ease-out-expo) 0.2s backwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); filter: blur(5px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.era-button {
    background: transparent;
    border: none;
    padding: 16px 40px;
    border-radius: 100px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-text-secondary);
    cursor: pointer;
    transition: all 0.4s var(--ease-out-expo);
    position: relative;
    z-index: 1;
}

.era-button::after {
    content: "";
    position: absolute; inset: 4px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.03);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
    z-index: -1;
}

.era-button:hover {
    color: var(--c-text-primary);
    background: rgba(255, 255, 255, 0.03);
    text-shadow: 0 0 8px rgba(197, 160, 89, 0.4);
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.1), inset 0 0 10px rgba(197, 160, 89, 0.05);
}
.era-button:hover::after { opacity: 1; transform: scale(1); }

.era-button.active {
    color: #000;
    font-weight: 600;
    text-shadow: none;
}

/* The active indicator blob */
#timeline-indicator {
    position: absolute;
    top: 6px; bottom: 6px; left: 0;
    width: 0; /* JS will set */
    border-radius: 100px;
    background: var(--g-gold-premium);
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.4);
    pointer-events: none;
    transition: transform 0.5s var(--ease-elastic), width 0.4s ease;
    z-index: 0;
}

/* --- Info Panel (Desktop: Floating Glass Shard) --- */
#info-panel {
    position: fixed;
    z-index: var(--z-panel);
    background: var(--g-surface-glass);
    backdrop-filter: blur(50px) saturate(120%);
    -webkit-backdrop-filter: blur(50px) saturate(120%);
    border: 1px solid var(--c-surface-glass-border);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.8s var(--ease-out-expo);
}

/* Subtle inner glow */
#info-panel::before {
    content: "";
    position: absolute; inset: 0;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 1;
}

/* Jewel border & Shine */
#info-panel::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(160deg, rgba(255,255,255,0.15), transparent 40%, rgba(197, 160, 89, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 10;
}

/* Moving sheen on border */
.border-shine {
    position: absolute; inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 11;
    overflow: hidden;
}
.border-shine::before {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-25deg);
    animation: shinePass 6s infinite;
}

@keyframes shinePass {
    0%, 80% { left: -100%; }
    100% { left: 200%; }
}

@keyframes borderRotate { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

.border-light {
    position: absolute; inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 12;
    padding: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.5), transparent);
    background-size: 200% 100%;
    animation: borderRotate 3s infinite linear;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

#info-panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, 0);
}

.panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none; /* Hide standard scrollbars */
    z-index: 2;
}

.image-wrapper {
    width: 100%;
    height: 42vh;
    position: relative;
    flex-shrink: 0;
    background: #000;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.panel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform-origin: center center;
}
#info-panel.visible .panel-image {
    animation: kenBurns 20s ease-out infinite alternate;
}

@keyframes kenBurns {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.15); }
}

.panel-text {
    padding: 24px 48px 64px;
    color: var(--c-text-primary);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.6s ease 0.2s;
}

#info-panel.visible .panel-text {
    transform: translateY(0);
    opacity: 1;
}

.panel-overline {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.35em; /* Increased spacing */
    color: var(--c-gold);
    margin-bottom: 24px;
    font-weight: 600;
}
.panel-overline::before {
    content: '';
    width: 40px; height: 1px;
    background: var(--c-gold);
    box-shadow: 0 0 10px var(--c-gold);
}

#panel-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 400;
    margin: 0 0 8px 0;
    line-height: 1;
    color: #fff;
    letter-spacing: -0.02em;
}

#panel-subtitle {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--c-gold-bright);
    margin: 0 0 32px 0;
    letter-spacing: 0.1em;
    font-style: italic;
    opacity: 0.8;
}

.panel-divider {
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, var(--c-gold-dim), transparent);
    margin: 32px 0;
    opacity: 0.3;
}

#panel-desc {
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.8; /* Improved readability */
    color: var(--c-text-secondary);
    margin: 0;
    font-weight: 300;
}

/* Close Button (Premium) */
#close-panel {
    position: absolute;
    top: 32px; right: 32px;
    z-index: 20;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--c-text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.4s var(--ease-out-expo);
}
#close-panel:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    transform: rotate(90deg);
    border-color: rgba(255,255,255,0.3);
}

.panel-handle-mobile { display: none; }

/* --- Markers (Pulsing Orbs) --- */
.location-marker {
    background: transparent;
    border: none;
    cursor: pointer;
}

.marker-inner {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 14px; height: 14px;
    background: radial-gradient(circle at 30% 30%, var(--c-gold-bright), var(--c-gold) 60%, var(--c-gold-dim)); /* 3D Jewel */
    border-radius: 50%;
    box-shadow:
        0 0 10px rgba(197, 160, 89, 0.8),
        0 0 20px rgba(255, 255, 255, 0.4);
    z-index: 3;
    transition: all 0.5s var(--ease-out-expo);
}

.marker-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    border: 1px solid var(--c-gold);
    border-radius: 50%;
    opacity: 0.5;
    transition: all 0.5s var(--ease-out-expo);
    z-index: 2;
    box-shadow: 0 0 15px rgba(197, 160, 89, 0.2) inset, 0 0 5px var(--c-gold); /* Enhanced glow */
}

.marker-pulse {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100px; height: 100px;
    border: 1px solid var(--c-gold-dim);
    border-radius: 50%;
    opacity: 0;
    animation: pulse-ring 3s infinite cubic-bezier(0.2, 0.6, 0.35, 1);
    z-index: 1;
}

.location-marker:hover .marker-inner {
    transform: translate(-50%, -50%) scale(1.4);
    box-shadow:
        0 0 20px var(--c-gold-bright),
        0 0 40px rgba(197, 160, 89, 0.6);
}
.location-marker:hover .marker-ring {
    width: 60px; height: 60px;
    border-color: var(--c-gold-bright);
    opacity: 0.6;
    background: rgba(197, 160, 89, 0.05);
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.3) inset;
}

@keyframes pulse-ring {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; border-width: 3px;}
    50% { opacity: 0.3; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; border-width: 0px;}
}

/* --- Custom Tooltip --- */
.leaflet-tooltip.custom-tooltip {
    background: rgba(10, 8, 7, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(197, 160, 89, 0.3);
    border-radius: 4px;
    color: var(--c-text-primary);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    padding: 8px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    white-space: nowrap;
    opacity: 0 !important; /* Start hidden for animation */
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s var(--ease-out-expo);
}

.leaflet-tooltip-top.custom-tooltip::before {
    border-top-color: rgba(197, 160, 89, 0.3);
}

/* Override default leaflet tooltip visibility */
.leaflet-tooltip-pane .custom-tooltip {
    opacity: 1 !important;
    transform: translateY(0);
}

/* Remove default triangle if preferred, or style it.
   Leaflet adds a pseudo-element for the tip. */
.leaflet-tooltip-top::before {
    border-top-color: rgba(10, 8, 7, 0.85); /* Match bg */
}

/* --- Media Queries --- */

/* Desktop Ultrathink */
@media (min-width: 1025px) {
    #info-panel {
        top: 40px;
        right: 40px;
        bottom: 40px;
        width: 540px;
        border-radius: var(--radius-lg);
        transform: translateX(120%) perspective(1000px) rotateY(-10deg) scale(0.9);
        transform-origin: right center;
        /* Glass Shard Polish */
        box-shadow: var(--shadow-soft), var(--shadow-glass-inset);
    }

    #info-panel.visible {
        transform: translateX(0) perspective(1000px) rotateY(0) scale(1);
    }

    /* Hover effect for panel */
    #info-panel:hover {
        border-color: rgba(197, 160, 89, 0.4);
        box-shadow: var(--shadow-soft), var(--shadow-glass-inset), 0 0 30px rgba(197, 160, 89, 0.1);
    }

    /* Custom Minimal Scrollbar for Desktop */
    .panel-content {
        scrollbar-width: thin;
        scrollbar-color: var(--c-gold-dim) transparent;
        padding-right: 4px; /* Space for scrollbar */
    }

    .panel-content::-webkit-scrollbar {
        width: 4px;
    }
    .panel-content::-webkit-scrollbar-track {
        background: transparent;
    }
    .panel-content::-webkit-scrollbar-thumb {
        background: var(--c-gold-dim);
        border-radius: 10px;
    }
    .panel-content::-webkit-scrollbar-thumb:hover {
        background: var(--c-gold);
    }
}

/* Mobile Ultrathink */
@media (max-width: 1024px) {
    #ui-layer {
        padding: 24px 16px;
    }

    .app-header .header-content h1 {
        font-size: clamp(2rem, 10vw, 3rem);
        width: 100%;
        line-height: 0.9;
    }

    .subtitle-wrapper { margin-top: 12px; gap: 12px; }
    .subtitle-wrapper p { font-size: 0.75rem; letter-spacing: 0.2em; }
    .separator { width: 15px; }

    /* Floating Navigation Pill */
    #timeline {
        position: absolute;
        bottom: calc(20px + env(safe-area-inset-bottom));
        left: 16px; right: 16px;
        justify-content: flex-start;
        padding: 4px 4px;
        border-radius: 20px; /* Softer rect */
        margin: 0;
        overflow-x: auto;
        /* Scroll snap */
        scroll-snap-type: x mandatory;
        gap: 8px;
        -webkit-overflow-scrolling: touch;

        /* Fade masks for scroll indication */
        mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
    }

    #timeline::-webkit-scrollbar { display: none; }

    .era-button {
        scroll-snap-align: center;
        padding: 16px 24px; /* Larger touch target */
        min-height: 48px; /* Touch friendly */
        display: flex; align-items: center; justify-content: center;
        font-size: 0.7rem;
        flex-shrink: 0;
        white-space: nowrap;
        background: rgba(255,255,255,0.02);
    }

    #timeline-indicator { display: none; } /* Use simple active state for mobile */
    .era-button.active {
        background: var(--c-gold-dim); /* Solid bg for visibility */
        color: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }

    /* Bottom Sheet Physics */
    #info-panel {
        top: auto;
        bottom: 0;
        left: 0; right: 0;
        width: 100%;
        height: 85vh;
        border-radius: 32px 32px 0 0; /* Softer curve */
        transform: translateY(100%);
        transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1); /* Springy */
        border-bottom: none;
        border-left: none; border-right: none;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.8), var(--shadow-glass-inset);
        padding-bottom: env(safe-area-inset-bottom);
    }

    #info-panel.visible {
        transform: translateY(0);
    }

    .panel-handle-mobile {
        display: block;
        width: 60px; height: 6px;
        background: linear-gradient(90deg, var(--c-gold-dim), var(--c-gold), var(--c-gold-dim));
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
        border-radius: 100px;
        margin: 16px auto 0 auto;
        position: absolute;
        left: 0; right: 0;
        z-index: 20;
        transition: background-color 0.3s ease, transform 0.3s ease;
        opacity: 0.8;
    }

    .panel-handle-mobile:active {
        background-color: var(--c-gold-bright);
        transform: scaleX(1.1);
    }

    .image-wrapper { height: 30vh; }

    .panel-text { padding: 24px 20px 80px 20px; }

    #panel-title { font-size: 2rem; }

    #panel-desc { font-size: 1rem; line-height: 1.6; }

    #close-panel {
        top: 20px; right: 20px;
        width: 40px; height: 40px;
        background: rgba(0,0,0,0.6);
        border: 1px solid rgba(255,255,255,0.2);
    }
}

/* --- Tour Mode --- */

/* Utility */
.hidden { display: none !important; }

/* Hide standard UI when tour is active */
body.tour-active .app-header,
body.tour-active #timeline,
body.tour-active .leaflet-control-attribution,
body.tour-active #start-tour-btn,
body.tour-active #info-panel {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Start Tour FAB */
#start-tour-btn {
    position: absolute;
    bottom: 40px; right: 40px;
    z-index: 150; /* Above timeline */
    background: var(--g-gold-premium);
    color: #000;
    border: none;
    border-radius: 100px;
    padding: 16px 32px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(197, 160, 89, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s var(--ease-out-expo);
    pointer-events: auto;
}

#start-tour-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 48px rgba(197, 160, 89, 0.5);
}

#start-tour-btn svg {
    width: 20px; height: 20px;
}

/* Tour Overlay */
#tour-overlay {
    position: fixed; inset: 0;
    z-index: var(--z-overlay);
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 60px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#tour-overlay.visible {
    opacity: 1;
}

.tour-card {
    background: var(--g-surface-glass);
    backdrop-filter: blur(40px) saturate(120%);
    -webkit-backdrop-filter: blur(40px) saturate(120%);
    border: 1px solid var(--c-surface-glass-border);
    box-shadow: var(--shadow-soft), var(--shadow-glass-inset);
    border-radius: var(--radius-lg);
    width: 600px;
    max-width: 90vw;
    padding: 32px;
    pointer-events: auto;
    position: relative;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.8s var(--ease-out-expo), opacity 0.6s ease;
    text-align: center;
}

/* Jewel Border for Card */
.tour-card::after {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(160deg, rgba(255,255,255,0.15), transparent 40%, rgba(197, 160, 89, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

#tour-overlay.visible .tour-card {
    transform: translateY(0);
    opacity: 1;
}

/* Tour Typography */
.tour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.tour-era-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--c-gold);
}

.tour-progress {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--c-text-tertiary);
}

.tour-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.1;
}

.tour-subtitle {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--c-gold-bright);
    margin: 0 0 24px 0;
    font-style: italic;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.tour-desc {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--c-text-secondary);
    margin-bottom: 32px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Controls */
.tour-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    align-items: center;
}

.tour-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--c-text-secondary);
    border-radius: 50px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tour-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.tour-btn.icon-only {
    padding: 12px;
    border-radius: 50%;
}

.tour-btn.primary {
    background: var(--c-gold-dim);
    color: #fff;
    border-color: transparent;
    padding: 12px 32px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.tour-btn.primary:hover {
    background: var(--c-gold);
    color: #000;
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.4);
    transform: translateY(-2px);
}

.tour-btn svg {
    width: 20px; height: 20px;
}

/* Progressive Reveal Classes */
.reveal-text {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.8s ease;
}

.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile Adjustments */
@media (max-width: 1024px) {
    #start-tour-btn {
        bottom: calc(90px + env(safe-area-inset-bottom)); /* Above nav pill */
        right: 16px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    #tour-overlay {
        padding-bottom: 0;
        align-items: flex-end;
    }

    .tour-card {
        width: 100%;
        max-width: 100%;
        border-radius: 32px 32px 0 0;
        border-bottom: none;
        padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
        margin-bottom: 0;
    }

    .tour-title { font-size: 2rem; }
    .tour-desc { -webkit-line-clamp: 4; }
}
