:root {
    /* Red Culture Theme */
    --app-bg: #fdfbf7;
    --sidebar-bg: rgba(255, 248, 240, 0.8);
    --glass-border: rgba(214, 59, 29, 0.2);
    --text-primary: #8b0000;
    --text-secondary: #a05a5a;
    --accent-red: #d63b1d;
    --accent-gold: #ffb400;
    --accent-moon: #e0e0e0;
    /* Silver for Moon */
    --accent-lantern: #ff9500;
    /* Orange for Lantern */

    --shadow-sm: 0 2px 8px rgba(139, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(139, 0, 0, 0.12);
    --shadow-lg: 0 20px 40px rgba(139, 0, 0, 0.15);

    --font-family: "Noto Serif SC", "Outfit", serif;
    --font-title: "Ma Shan Zheng", cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--app-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('https://images.unsplash.com/photo-1533038590840-1cde6e668a91?q=80&w=2574&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
}

.app-container {
    width: 90vw;
    height: 85vh;
    max-width: 1400px;
    background: rgba(255, 252, 245, 0.85);
    backdrop-filter: blur(20px) saturate(120%);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 380px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
    border: 1px solid #e0443e;
}

.dot.yellow {
    background: #ffbd2e;
    border: 1px solid #dea123;
}

.dot.green {
    background: #27c93f;
    border: 1px solid #1aab29;
}

h1 {
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-primary);
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: -5px;
}

.highlight {
    color: var(--accent-red);
}

.controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-grow: 1;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Legend */
.legend-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.legend-item:hover {
    background: #fff;
    border-color: var(--accent-gold);
    transform: translateX(2px);
}

.icon {
    font-size: 1.5rem;
}

.legend-info {
    display: flex;
    flex-direction: column;
}

.legend-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.legend-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Mission Buttons */
.mission-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mission-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid rgba(139, 0, 0, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mission-btn:hover {
    background: rgba(255, 189, 46, 0.1);
    border-color: var(--accent-gold);
    transform: translateY(-1px);
}

.mission-btn.active {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

.mission-btn.active .btn-sub {
    color: rgba(255, 255, 255, 0.8);
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    display: flex;
    flex-direction: column;
}

.btn-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Insight Card */
.insight-card {
    background: rgba(255, 255, 255, 0.5);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(139, 0, 0, 0.1);
    box-shadow: var(--shadow-sm);
    min-height: 100px;
}

.insight-card h3 {
    font-size: 1.1rem;
    color: var(--accent-red);
    margin-bottom: 8px;
    font-family: var(--font-title);
}

.insight-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Footer */
.actions-footer {
    margin-top: auto;
}

.secondary-btn {
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 1px solid rgba(139, 0, 0, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn:hover {
    background: #f5f5f5;
}

/* Main Stage */
.visualizer-stage {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-pane {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.stage-header {
    text-align: center;
    margin-bottom: 1rem;
}

.stage-header h2 {
    font-size: 2rem;
    color: var(--accent-red);
    font-family: var(--font-title);
}

.stage-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

/* Venn Diagram */
.venn-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.venn-stage {
    width: 500px;
    height: 400px;
    position: relative;
}

.venn-circle {
    fill: rgba(255, 255, 255, 0.3);
    stroke: rgba(139, 0, 0, 0.2);
    stroke-width: 2;
    transition: all 0.4s ease;
    cursor: pointer;
}

.venn-circle:hover {
    stroke: var(--accent-gold);
    stroke-width: 3;
}

.venn-label {
    font-family: var(--font-title);
    font-size: 1.2rem;
    fill: var(--text-primary);
    text-anchor: middle;
    pointer-events: none;
}

/* Highlight Classes */
.highlight-a {
    fill: rgba(255, 95, 86, 0.2);
    stroke: #ff5f56;
}

.highlight-b {
    fill: rgba(255, 189, 46, 0.2);
    stroke: #ffbd2e;
}

.highlight-c {
    fill: rgba(255, 149, 0, 0.2);
    stroke: #ff9500;
}

/* Dynamic Highlights for Intersections */
/* Note: Complex intersection highlighting requires more advanced SVG manipulation or masking in JS. 
   For this CSS, we'll rely on JS to add classes or modify fill/opacity. */