:root {
    --abyss: #040b14;
    --midnight: #0a1628;
    --sonar: #1a6b7a;
    --signal: #00d4ff;
    --phosphor: #c8e6f0;
    --ghost: #e8f2f6;
    --depth-marker: #3a5a6e;
    --pressure: #c44040;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--abyss);
    color: var(--phosphor);
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
}

/* Levels Container */
.levels-container {
    width: 100%;
    height: 100vh;
    will-change: transform;
    transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.level {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Coordinate Overlays */
.coord {
    position: fixed;
    z-index: 100;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--depth-marker);
    opacity: 0.4;
    line-height: 1.6;
}

.coord-tl { top: 2vh; left: 2vw; }
.coord-tr { top: 2vh; right: 2vw; text-align: right; }
.coord-bl { bottom: 2vh; left: 2vw; }
.coord-br { bottom: 2vh; right: 2vw; text-align: right; }

.coord-label {
    color: var(--sonar);
    opacity: 0.6;
}

.signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    vertical-align: middle;
    margin-left: 4px;
}

.bar {
    width: 3px;
    background: var(--sonar);
}
.bar-1 { height: 3px; }
.bar-2 { height: 5px; }
.bar-3 { height: 8px; }
.bar-4 { height: 6px; }
.bar-5 { height: 10px; }

/* Depth Gauge */
.depth-gauge {
    position: fixed;
    right: 2vw;
    top: 15vh;
    height: 70vh;
    width: 30px;
    z-index: 100;
}

#depth-gauge-svg {
    width: 100%;
    height: 100%;
}

.depth-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 8px solid var(--signal);
    transition: top 400ms ease-out;
}

/* Depth Navigation Ticks */
.depth-nav {
    position: fixed;
    right: 1vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.depth-tick {
    width: 16px;
    height: 2px;
    background: var(--depth-marker);
    opacity: 0.3;
    transition: opacity 300ms, background 300ms, width 300ms;
    cursor: pointer;
}

.depth-tick.active {
    opacity: 1;
    background: var(--signal);
    width: 24px;
}

/* Scan Lines */
.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sonar) 20%, var(--sonar) 80%, transparent);
    opacity: 0.08;
    transition: opacity 300ms;
}

.scan-line-center {
    top: 50%;
}

.scan-line-deep {
    top: 30%;
}

/* ======================== */
/* LEVEL 0: Surface Scan    */
/* ======================== */

.radar-container {
    position: absolute;
    width: clamp(280px, 35vw, 480px);
    height: clamp(280px, 35vw, 480px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid var(--sonar);
    opacity: 0.2;
}

.radar-crosshair-h,
.radar-crosshair-v {
    position: absolute;
    background: var(--sonar);
    opacity: 0.1;
}

.radar-crosshair-h {
    width: 100%;
    height: 1px;
    top: 50%;
}

.radar-crosshair-v {
    height: 100%;
    width: 1px;
    left: 50%;
}

.radar-sweep {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    /* Animated via JS */
}

.radar-dot-red {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--pressure);
    border-radius: 50%;
    top: 30%;
    left: 62%;
    box-shadow: 0 0 6px var(--pressure);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.wordmark {
    position: relative;
    z-index: 10;
    font-family: 'Bodoni Moda', serif;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ghost);
    user-select: none;
}

.wm-char {
    display: inline-block;
    animation: signal-flicker 4s ease-in-out infinite;
}

@keyframes signal-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.surface-subtitle {
    position: absolute;
    bottom: 18vh;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.6rem, 0.75vw, 0.7rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--depth-marker);
    opacity: 0.5;
}

/* ======================== */
/* LEVEL 1: Signal Array    */
/* ======================== */

.level-1 {
    background: var(--abyss);
}

.connection-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.conn-line {
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1.5s ease-out;
}

.level-1.active .conn-line {
    stroke-dashoffset: 0;
}

.node {
    position: absolute;
    padding: 20px 24px;
    cursor: pointer;
}

.node-1 { top: 22%; left: 12%; }
.node-2 { top: 38%; left: 48%; }
.node-3 { top: 18%; right: 14%; }
.node-4 { bottom: 22%; left: 28%; }

.node-dot {
    width: 4px;
    height: 4px;
    background: var(--signal);
    border-radius: 50%;
    margin-bottom: 12px;
    transition: transform 200ms;
    animation: node-pulse 3s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(0, 212, 255, 0); }
}

.node-border {
    position: absolute;
    inset: 0;
    border: 1px solid var(--sonar);
    opacity: 0.15;
    transition: opacity 200ms;
    clip-path: inset(0 100% 100% 0);
}

.level-1.active .node-border {
    clip-path: inset(0 0 0 0);
    transition: clip-path 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.node:hover .node-border {
    opacity: 0.5;
}

.node:hover .node-dot {
    transform: scale(1.5);
}

.node-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--signal);
    margin-bottom: 8px;
}

.node-desc {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.6;
    color: var(--phosphor);
    opacity: 0.7;
}

/* ======================== */
/* LEVEL 2: Deep Read       */
/* ======================== */

.level-2 {
    background: var(--abyss);
    justify-content: flex-start;
    padding-left: 10vw;
}

.deep-read-content {
    max-width: 55vw;
    padding-top: 12vh;
}

.deep-read-marker {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--sonar);
    margin-bottom: 3rem;
    opacity: 0.6;
}

.deep-line {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--phosphor);
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms, transform 400ms;
}

.level-2.active .deep-line {
    opacity: 1;
    transform: translateY(0);
}

.depth-scale {
    position: absolute;
    right: 6vw;
    top: 10vh;
    bottom: 10vh;
    width: 1px;
    background: var(--depth-marker);
    opacity: 0.15;
}

/* ======================== */
/* LEVEL 3: Contact Beacon  */
/* ======================== */

.level-3 {
    background: var(--abyss);
}

.beacon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 300px;
    height: 300px;
}

.beacon-ring {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1px solid var(--signal);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    animation: beacon-pulse 3s ease-out infinite;
}

.beacon-ring-2 {
    animation-delay: 1s;
}

.beacon-ring-3 {
    animation-delay: 2s;
}

@keyframes beacon-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(12);
        opacity: 0;
    }
}

.beacon-core {
    width: 8px;
    height: 8px;
    background: var(--signal);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--signal), 0 0 40px rgba(0, 212, 255, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.beacon-link {
    position: relative;
    z-index: 10;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    letter-spacing: 0.1em;
    color: var(--ghost);
    text-decoration: none;
    padding-top: 60px;
    transition: color 200ms;
}

.beacon-link:hover {
    color: var(--signal);
}

.floor-label {
    position: absolute;
    bottom: 8vh;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.55rem, 0.7vw, 0.65rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--depth-marker);
    opacity: 0.3;
}
