/* xanadu.science - Sci-Fi Laboratory Interface */
/* Colors: #0a0e17 #121a2b #ff006e #00e5ff #76ff03 #e0f7fa #37474f #ff6d00 #455a64 #b0bec5 */
/* Fonts: Cormorant Garamond, Space Grotesk, IBM Plex Mono */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0e17;
    color: #b0bec5;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 400;
    cursor: url('data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22><line x1=%2212%22 y1=%220%22 x2=%2212%22 y2=%2224%22 stroke=%22%2300e5ff%22 stroke-width=%221%22 opacity=%220.8%22/><line x1=%220%22 y1=%2212%22 x2=%2224%22 y2=%2212%22 stroke=%22%2300e5ff%22 stroke-width=%221%22 opacity=%220.8%22/><circle cx=%2212%22 cy=%2212%22 r=%223%22 fill=%22none%22 stroke=%22%2300e5ff%22 stroke-width=%221%22 opacity=%220.6%22/></svg>') 12 12, crosshair;
}

/* Particle Canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Scroll Wrapper */
#scroll-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    z-index: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#scroll-wrapper::-webkit-scrollbar {
    display: none;
}

#chambers-track {
    display: inline-flex;
    height: 100vh;
    will-change: transform;
}

/* Chamber */
.chamber {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
}

.chamber-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #0a0e17 0%, #121a2b 100%);
    z-index: 0;
}

.chamber-content {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    height: 100%;
}

/* Chamber Main (60%) */
.chamber-main {
    width: 60%;
    height: 100%;
    position: relative;
    padding: 60px 50px 60px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* HUD Corner Brackets */
.hud-corner-bracket {
    position: absolute;
    width: 30px;
    height: 30px;
    z-index: 2;
}

.hud-corner-bracket::before,
.hud-corner-bracket::after {
    content: '';
    position: absolute;
    background: #455a64;
}

.hud-corner-bracket.top-left {
    top: 30px;
    left: 30px;
}
.hud-corner-bracket.top-left::before {
    top: 0; left: 0; width: 20px; height: 1px;
}
.hud-corner-bracket.top-left::after {
    top: 0; left: 0; width: 1px; height: 20px;
}

.hud-corner-bracket.top-right {
    top: 30px;
    right: 30px;
}
.hud-corner-bracket.top-right::before {
    top: 0; right: 0; width: 20px; height: 1px;
}
.hud-corner-bracket.top-right::after {
    top: 0; right: 0; width: 1px; height: 20px;
}

.hud-corner-bracket.bottom-left {
    bottom: 30px;
    left: 30px;
}
.hud-corner-bracket.bottom-left::before {
    bottom: 0; left: 0; width: 20px; height: 1px;
}
.hud-corner-bracket.bottom-left::after {
    bottom: 0; left: 0; width: 1px; height: 20px;
}

.hud-corner-bracket.bottom-right {
    bottom: 30px;
    right: 30px;
}
.hud-corner-bracket.bottom-right::before {
    bottom: 0; right: 0; width: 20px; height: 1px;
}
.hud-corner-bracket.bottom-right::after {
    bottom: 0; right: 0; width: 1px; height: 20px;
}

/* Chamber Label */
.chamber-label {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.label-mono {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    color: #455a64;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.label-coord {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    color: #76ff03;
    letter-spacing: 0.1em;
}

/* Chamber Title */
.chamber-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 64px;
    font-weight: 400;
    font-style: italic;
    color: #e0f7fa;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 30px;
    transform: rotate(-2deg);
    transform-origin: left center;
}

/* Text Pod */
.text-pod {
    max-width: 520px;
    padding: 24px 28px;
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 24px;
    background: rgba(18, 26, 43, 0.6);
    margin-bottom: 30px;
}

.text-pod p {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.7;
    color: #b0bec5;
}

/* Chamber SVG */
.chamber-svg {
    width: 100%;
    max-width: 420px;
    height: auto;
    max-height: 280px;
}

.draw-path {
    transition: stroke-width 0.2s ease, stroke 0.2s ease;
}

.draw-path:hover {
    stroke-width: 3;
    stroke: #ff006e;
}

.svg-node {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.svg-node.visible {
    opacity: 1;
}

.svg-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    fill: #76ff03;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.svg-label.visible {
    opacity: 1;
}

.star-pulse {
    animation: starPulse 2s ease-in-out infinite alternate;
}

@keyframes starPulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.electron {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.electron.visible {
    opacity: 1;
    animation: electronOrbit 3s linear infinite;
}

@keyframes electronOrbit {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Instrument Panel (40%) */
.instrument-panel {
    width: 40%;
    height: 100%;
    background: rgba(18, 26, 43, 0.85);
    border-left: 1px solid rgba(55, 71, 79, 0.5);
    padding: 50px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    overflow: hidden;
}

.panel-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #37474f;
}

.panel-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    color: #455a64;
    letter-spacing: 0.2em;
}

.panel-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    color: #37474f;
    padding: 3px 10px;
    border: 1px solid #37474f;
    border-radius: 12px;
}

.panel-status.active {
    color: #76ff03;
    border-color: #76ff03;
    box-shadow: 0 0 8px rgba(118, 255, 3, 0.2);
}

/* Gauge */
.gauge-container {
    width: 120px;
    height: 120px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
}

.gauge-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    fill: #e0f7fa;
    font-weight: 500;
}

.gauge-fill {
    transition: stroke-dashoffset 0.3s ease;
}

/* Readout Group */
.readout-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.readout {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(55, 71, 79, 0.4);
    border-radius: 8px;
    background: rgba(10, 14, 23, 0.5);
    transition: border-color 0.2s ease;
}

.readout:hover {
    border-color: #00e5ff;
}

.readout-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    color: #455a64;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.readout-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 20px;
    font-weight: 500;
    color: #76ff03;
    flex: 1;
    text-align: right;
    transition: color 0.15s ease;
}

.readout-value.glitching {
    color: #ff006e;
}

.readout-unit {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    color: #455a64;
}

/* Waveform Canvas */
.waveform-canvas {
    width: 100%;
    max-width: 200px;
    height: 60px;
    border: 1px solid rgba(55, 71, 79, 0.3);
    border-radius: 8px;
    background: rgba(10, 14, 23, 0.4);
}

/* Progress Bar */
#progress-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 300px;
    height: 20px;
}

#progress-svg {
    width: 100%;
    height: 100%;
}

.progress-dot {
    fill: #37474f;
    transition: fill 0.3s ease, r 0.3s ease;
}

.progress-dot.active {
    fill: #ff006e;
    r: 5;
}

.progress-dot.visited {
    fill: #00e5ff;
}

#progress-line {
    transition: stroke-dashoffset 0.4s ease;
}

/* Scan Line Effect */
#scan-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(255, 0, 110, 0.6);
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-100%);
}

#scan-line.active {
    animation: scanSweep 0.3s ease-out forwards;
}

@keyframes scanSweep {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh);
    }
}

/* Concentric circle HUD overlays */
.chamber::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 30%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    border: 1px solid rgba(55, 71, 79, 0.12);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.chamber::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 30%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    border: 1px solid rgba(55, 71, 79, 0.08);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .chamber-content {
        flex-direction: column;
    }

    .chamber-main {
        width: 100%;
        height: 60%;
        padding: 30px;
    }

    .instrument-panel {
        width: 100%;
        height: 40%;
        border-left: none;
        border-top: 1px solid rgba(55, 71, 79, 0.5);
        padding: 20px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .chamber-title {
        font-size: 40px;
    }

    .text-pod {
        max-width: 100%;
    }

    .chamber-svg {
        max-width: 280px;
        max-height: 180px;
    }
}
