:root {
    --bg-dark: #000000;
    --bg-card: rgba(255, 255, 255, 0.02);
    --accent-primary: #00aaff;
    --accent-secondary: #00f2ff;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --glass-border: rgba(0, 170, 255, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --critical: #ff5050;
    --warning: #ffaa00;
    --success: #35ffb6;
    --font-heading: 'Cinzel', serif;
    --font-ethereal: 'Cormorant Garamond', serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 30% 20%, rgba(0, 170, 255, 0.11), transparent 35%), radial-gradient(circle at 70% 75%, rgba(0, 242, 255, 0.08), transparent 40%);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url('../../lux convergence page/lux_main.jpg');
    background-size: 68vmin;
    background-repeat: no-repeat;
    background-position: center center;
    opacity: 0.055;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: lighten;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

#earth-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#earth-fallback {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    background:
      radial-gradient(circle at 4% 54%, rgba(255, 166, 46, 0.45), rgba(255, 166, 46, 0) 15%),
      radial-gradient(circle at 50% 45%, rgba(2, 18, 36, 0.2), rgba(0, 0, 0, 0) 40%);
}

body.webgl-ready #earth-fallback {
    display: none;
}

.fallback-sun {
    position: absolute;
    left: -6%;
    top: 45%;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.96) 0%, rgba(255,233,168,0.88) 28%, rgba(255,164,35,0.62) 52%, rgba(255,120,10,0.08) 80%, rgba(255,120,10,0) 100%);
    filter: blur(1px);
}

.fallback-particles {
    position: absolute;
    inset: 0;
    background-image:
      radial-gradient(circle, rgba(255, 153, 45, 0.9) 0 2px, transparent 3px),
      radial-gradient(circle, rgba(255, 153, 45, 0.7) 0 1.4px, transparent 2px),
      radial-gradient(circle, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.6px);
    background-size: 220px 220px, 150px 150px, 280px 280px;
    background-position: 0 0, 40px 90px, 120px 60px;
    opacity: 0.68;
    animation: driftStars 24s linear infinite;
}

.fallback-earth {
    position: absolute;
    left: 52%;
    top: 56%;
    width: min(43vw, 560px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background:
      radial-gradient(circle at 72% 24%, rgba(209, 239, 255, 0.35), rgba(209, 239, 255, 0) 23%),
      radial-gradient(circle at 36% 62%, rgba(97, 215, 255, 0.45), rgba(97, 215, 255, 0) 48%),
      linear-gradient(160deg, rgba(0, 87, 145, 0.92), rgba(35, 154, 212, 0.95) 45%, rgba(16, 101, 162, 0.96));
    box-shadow:
      -65px 0 90px rgba(21, 91, 255, 0.58),
      inset -48px -28px 78px rgba(0, 35, 73, 0.75),
      inset 28px 8px 60px rgba(162, 235, 255, 0.2);
}

.fallback-magnetosphere {
    position: absolute;
    left: 52%;
    top: 56%;
    width: min(74vw, 980px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(0, 230, 255, 0.33);
    box-shadow:
      0 0 45px rgba(0, 229, 255, 0.38),
      inset 0 0 95px rgba(0, 193, 255, 0.25);
    opacity: 0.72;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    pointer-events: none;
}

.overlay > * {
    pointer-events: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.brand {
    display: flex;
    flex-direction: column;
}

.glitch {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.35rem;
    color: var(--accent-primary);
    text-shadow: 0 0 18px rgba(0, 170, 255, 0.45);
    white-space: nowrap;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), #ffffff);
    background-size: 220% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shineText 7s linear infinite;
}

.status-indicator {
    font-size: 0.7rem;
    letter-spacing: 0.22rem;
    color: var(--accent-secondary);
    margin-top: 0.5rem;
    white-space: nowrap;
    text-transform: uppercase;
}

.clock {
    font-family: var(--font-ethereal);
    font-size: 1.2rem;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.home-link {
    text-decoration: none;
    color: #ffffff;
    border: 1px solid var(--glass-border);
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    padding: 0.42rem 1rem;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.14rem;
    text-transform: uppercase;
    font-weight: 700;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.home-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 170, 255, 0.34);
}

main {
    flex: 1;
    display: grid;
    grid-template-columns: 290px 1fr 290px;
    grid-template-rows: 1fr 120px;
    gap: 1.5rem;
}

.panel.left { grid-column: 1; grid-row: 1; }
.panel.right { grid-column: 3; grid-row: 1; }
.panel.bottom { grid-column: 1 / 4; }

.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
    height: fit-content;
}

.panel-header {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22rem;
    color: var(--accent-secondary);
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.45rem;
    text-transform: uppercase;
}

.metric {
    margin-bottom: 1.5rem;
}

.metric label {
    display: block;
    font-size: 0.64rem;
    letter-spacing: 0.14rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.metric .value {
    font-family: var(--font-ethereal);
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-main);
}

.metric .value small {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-body);
}

.gauge-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    width: 100%;
}

.gauge-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 1s ease-out;
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.6);
}

.oscilloscope {
    height: 80px;
    width: 100%;
    background: rgba(0, 20, 40, 0.35);
    margin-top: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.oscilloscope::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(0,170,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(0,170,255,0.08) 1px, transparent 1px);
    background-size: 20px 20px;
}

#schumann-wave { width: 100%; height: 100%; position: relative; z-index: 2; }

.status-msg { color: var(--accent-secondary); letter-spacing: 1px; font-size: 0.78rem; text-transform: uppercase; }

.terminal-output {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-line;
}

footer {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.12rem;
    text-transform: uppercase;
}

.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 62%, rgba(0,0,0,0.6) 100%);
    pointer-events: none;
    z-index: 2;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.06) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 21;
    opacity: 0.25;
}

@keyframes driftStars {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-140px, 120px, 0); }
}

@keyframes shineText {
    0% { background-position: 0% center; }
    100% { background-position: 220% center; }
}

@media (max-width: 1100px) {
    main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .panel.left, .panel.right, .panel.bottom {
        grid-column: 1;
        grid-row: auto;
    }
    .overlay {
        overflow-y: auto;
        padding-bottom: 3rem;
    }
    body { overflow: auto; }
    #app { min-height: 100vh; height: auto; }
    #earth-canvas { position: fixed; }
}
