:root {
    --color-bg: #1a1510;
    --color-parchment: #f4e1c1;
    --color-parchment-dark: #e8d1a7;
    --color-gold: #d4af37;
    --color-gold-bright: #f1d37c;
    --color-crimson: #8b0000;
    --color-text: #2c1e12;
    --color-text-dim: #5d4632;
    --font-title: 'Nanum Myeongjo', serif;
    --font-body: 'Nanum Gothic', sans-serif;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Sidebar Styling */
#sidebar {
    width: 400px;
    height: 100%;
    background: linear-gradient(rgba(244, 225, 193, 0.95), rgba(232, 209, 167, 0.95)),
                url('https://www.transparenttextures.com/patterns/old-map.png');
    border-right: 2px solid var(--color-gold);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: auto;
}

header {
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(139, 0, 0, 0.2);
    padding-bottom: 1.5rem;
}

header h1 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    color: var(--color-crimson);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-style: italic;
    color: var(--color-text-dim);
    font-size: 0.9rem;
}

/* Episode List Styling */
#episode-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.episode-card {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.episode-card:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: translateX(5px);
    border-color: var(--color-gold);
}

.episode-card.active {
    background: var(--color-crimson);
    color: white;
    border-color: var(--color-gold);
    box-shadow: var(--shadow);
}

.episode-number {
    font-family: var(--font-title);
    font-weight: bold;
    font-size: 0.8rem;
    display: block;
    margin-bottom: 0.3rem;
    color: var(--color-gold);
}

.episode-card.active .episode-number {
    color: var(--color-gold-bright);
}

.episode-title {
    font-size: 1rem;
    font-weight: 700;
}

/* Info Panel Styling */
#info-panel {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--color-gold);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: auto;
    animation: fadeIn 0.5s ease;
}

#info-panel.hidden {
    display: none;
}

#info-title {
    font-family: var(--font-title);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--color-crimson);
}

.info-meta {
    font-size: 0.8rem;
    color: var(--color-text-dim);
    margin-bottom: 1rem;
    font-weight: bold;
}

.info-body h3 {
    font-size: 0.9rem;
    color: var(--color-crimson);
    margin-top: 1rem;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(139, 0, 0, 0.1);
}

.info-body p {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Map Container */
#map-container {
    flex: 1;
    position: relative;
    background-color: #0b141a;
}

#map {
    width: 100%;
    height: 100%;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
    background: radial-gradient(circle, transparent 50%, rgba(0,0,0,0.4) 100%);
    z-index: 1001;
}

/* Legend Styling */
#legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(244, 225, 193, 0.9);
    border: 2px solid var(--color-gold);
    padding: 1rem;
    border-radius: 8px;
    z-index: 1002;
    box-shadow: var(--shadow);
    width: 200px;
    font-size: 0.85rem;
}

#legend h3 {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    color: var(--color-crimson);
    border-bottom: 1px solid var(--color-gold);
    padding-bottom: 0.3rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.2);
}

.catholic { background-color: #a8d5a2; } /* 연한 녹색 */
.orthodox { background-color: #f5b085; } /* 연한 주황 */
.islamic { background-color: #fff9c4; }  /* 연한 노랑 */

.route-line {
    width: 24px;
    height: 4px;
    border-radius: 2px;
}

.r1 { background-color: #ff00ff; }
.r2 { background-color: #00ffff; }
.r3 { background-color: #2e7d32; }
.r4 { background-color: #6a1b9a; }
.r5 { background-color: #795548; border-top: 2px dashed white; height: 1px; }

#legend hr {
    margin: 0.8rem 0;
    border: none;
    border-top: 1px solid rgba(0,0,0,0.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 900px) {
    #app {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
        height: 350px;
        border-right: none;
        border-bottom: 2px solid var(--color-gold);
    }
}
