:root {
    --space-black: #0a0e27;
    --cosmic-blue: #1e3a8a;
    --star-white: #ffffff;
    --china-red: #de2910;
    --nebula-purple: #7c3aed;
    --galaxy-gold: #fbbf24;

    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.3);

    --font-family: "Noto Serif SC", "Outfit", serif;
    --font-mono: "JetBrains Mono", monospace;
    --font-title: "Ma Shan Zheng", cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: radial-gradient(ellipse at center, #1a1f3a 0%, #0a0e27 100%);
    color: var(--star-white);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 96vw;
    height: 92vh;
    max-width: 1900px;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid rgba(124, 58, 237, 0.3);
}

/* Header */
.main-header {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--cosmic-blue) 0%, var(--space-black) 100%);
    border-bottom: 2px solid rgba(124, 58, 237, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.6rem;
    color: var(--star-white);
    margin-bottom: 4px;
}

.china-space {
    font-family: var(--font-title);
    font-size: 2rem;
    color: var(--china-red);
    text-shadow: 0 0 10px rgba(222, 41, 16, 0.5);
}

.highlight {
    color: var(--galaxy-gold);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.mission-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(222, 41, 16, 0.2);
    border: 2px solid var(--china-red);
    border-radius: 20px;
    color: var(--star-white);
    font-weight: 600;
    box-shadow: 0 0 15px rgba(222, 41, 16, 0.3);
}

.badge-icon {
    font-size: 1.4rem;
}

/* Main Stage */
.main-stage {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    overflow: hidden;
}

.universe-container {
    position: relative;
    background: radial-gradient(ellipse at center, #1a1f3a 0%, #0a0e27 100%);
    overflow: hidden;
}

#universeCanvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#universeCanvas:active {
    cursor: grabbing;
}

.universe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.info-panel {
    position: absolute;
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(124, 58, 237, 0.5);
    pointer-events: auto;
}

.top-left {
    top: 20px;
    left: 20px;
    min-width: 200px;
}

.info-panel h3 {
    font-size: 1.1rem;
    color: var(--galaxy-gold);
    margin-bottom: 4px;
}

.info-panel p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
}

.info-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--star-white);
}

.legend-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(10px);
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(124, 58, 237, 0.5);
    pointer-events: auto;
}

.legend-panel h4 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--galaxy-gold);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    font-size: 0.85rem;
}

.legend-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-icon.star {
    background: radial-gradient(circle, white, rgba(255, 255, 255, 0.5));
    box-shadow: 0 0 8px white;
}

.legend-icon.mission {
    background: var(--china-red);
    box-shadow: 0 0 8px var(--china-red);
}

.legend-icon.boundary {
    background: transparent;
    border: 2px dashed var(--nebula-purple);
}

.zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(124, 58, 237, 0.5);
    background: rgba(10, 14, 39, 0.85);
    color: var(--star-white);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.zoom-btn:hover {
    background: rgba(124, 58, 237, 0.3);
    border-color: var(--nebula-purple);
    transform: scale(1.1);
}

/* Sidebar */
.sidebar {
    background: rgba(10, 14, 39, 0.8);
    border-left: 2px solid rgba(124, 58, 237, 0.3);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.panel-section {
    background: rgba(30, 58, 138, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.3);
    padding: 16px;
    border-radius: 12px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}

.panel-icon {
    font-size: 1.2rem;
}

.panel-header h3 {
    font-size: 1rem;
    color: var(--galaxy-gold);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    background: rgba(10, 14, 39, 0.6);
    padding: 14px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.stat-card.highlight {
    grid-column: span 2;
    border-color: var(--nebula-purple);
    background: rgba(124, 58, 237, 0.1);
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--star-white);
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.missions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 180px;
    overflow-y: auto;
}

.mission-item {
    padding: 10px 12px;
    background: rgba(222, 41, 16, 0.1);
    border-left: 3px solid var(--china-red);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.mission-item:hover {
    background: rgba(222, 41, 16, 0.2);
    transform: translateX(4px);
}

.mission-item strong {
    display: block;
    color: var(--china-red);
    margin-bottom: 3px;
}

.mission-item span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.math-content {
    font-size: 0.9rem;
    line-height: 1.8;
}

.math-content h4 {
    color: var(--nebula-purple);
    margin: 12px 0 6px 0;
    font-size: 0.95rem;
}

.math-content h4:first-child {
    margin-top: 0;
}

.math-formula {
    background: rgba(10, 14, 39, 0.6);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 6px 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.formula-note {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 12px;
    font-style: italic;
}

.insight-panel {
    border-color: var(--china-red);
    background: rgba(222, 41, 16, 0.05);
}

.insight-content {
    font-size: 0.85rem;
    line-height: 1.7;
}

.insight-content h4 {
    color: var(--china-red);
    margin: 12px 0 6px 0;
    font-size: 0.9rem;
}

.insight-content h4:first-child {
    margin-top: 0;
}

.insight-content p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar,
.missions-list::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.missions-list::-webkit-scrollbar-track {
    background: rgba(10, 14, 39, 0.5);
}

.sidebar::-webkit-scrollbar-thumb,
.missions-list::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.5);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.missions-list::-webkit-scrollbar-thumb:hover {
    background: var(--nebula-purple);
}