:root {
    --primary-red: #de2910;
    --primary-gold: #ffde00;
    --network-blue: #1890ff;
    --network-purple: #722ed1;
    --bg-color: #fdfbf7;
    --text-dark: #2c3e50;
    --text-light: #596b7e;
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --shadow-lg: 0 12px 48px 0 rgba(31, 38, 135, 0.25);
    --font-title: 'Ma Shan Zheng', cursive;
    --font-body: 'Outfit', sans-serif;
    --font-serif: 'Noto Serif SC', serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 25%, rgba(24, 144, 255, 0.04) 0%, transparent 25%),
        radial-gradient(circle at 85% 75%, rgba(114, 46, 209, 0.04) 0%, transparent 25%);
    color: var(--text-dark);
    font-family: var(--font-body);
    min-height: 100vh;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 35px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
}

.header-content h1 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.header-content .highlight {
    color: var(--primary-red);
    font-family: var(--font-title);
    font-size: 2rem;
    margin-left: 10px;
}

.subtitle {
    font-family: var(--font-body);
    color: var(--text-light);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.connection-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--network-blue), var(--network-purple));
    color: white;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.badge-icon {
    font-size: 1.3rem;
}

/* ===== Main Stage ===== */
.main-stage {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 20px;
}

.left-panel,
.right-panel,
.center-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    padding: 20px;
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ===== Panel Sections ===== */
.panel-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 18px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-gold);
}

.panel-icon {
    font-size: 1.4rem;
}

.panel-header h3 {
    font-size: 1.05rem;
    color: var(--primary-red);
    font-weight: 700;
}

/* ===== Graph Types ===== */
.graph-types {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.type-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: var(--font-body);
}

.type-btn:hover {
    border-color: var(--network-blue);
    transform: translateX(5px);
}

.type-btn.active {
    background: linear-gradient(135deg, #e6f7ff, #f9f0ff);
    border-color: var(--network-blue);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.2);
}

.type-icon {
    font-size: 1.3rem;
}

.type-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
}

/* ===== Ideology Content ===== */
.ideology-content h4 {
    color: var(--primary-red);
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.ideology-content p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 10px;
}

/* ===== Controls ===== */
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.control-btn {
    padding: 10px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    color: var(--text-dark);
}

.control-btn:hover {
    border-color: var(--network-blue);
    background: #f0f8ff;
}

/* ===== Canvas ===== */
.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.canvas-header h2 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    color: var(--primary-red);
}

.canvas-stats {
    display: flex;
    gap: 20px;
}

.stat {
    font-size: 0.9rem;
    color: var(--text-light);
}

.stat strong {
    color: var(--network-blue);
    font-size: 1.1rem;
}

.canvas-container {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    height: 450px;
}

#graphCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.canvas-hint {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    pointer-events: none;
}

/* ===== Definition Box ===== */
.definition-box {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #fff5f5, #ffffff);
    border: 2px solid var(--primary-red);
    border-radius: 12px;
}

.def-title {
    font-weight: 700;
    color: var(--primary-red);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.def-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-dark);
}

/* ===== Math Definition ===== */
.math-definition {
    background: white;
    padding: 15px;
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.math-formula {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 3px solid var(--network-blue);
}

/* ===== Application List ===== */
.application-list,
.properties-list {
    background: white;
    padding: 15px;
    border-radius: 10px;
}

.app-item,
.prop-item {
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--network-purple);
}

.app-item:last-child,
.prop-item:last-child {
    margin-bottom: 0;
}

.app-title,
.prop-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.app-desc,
.prop-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* ===== Responsive ===== */
@media (max-width: 1400px) {
    .main-stage {
        grid-template-columns: 1fr;
    }
}