/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --deep-void: #08080f;
    --terminal-dark: #0f1118;
    --phosphor-green: #00ff88;
    --anomaly-cyan: #00e5ff;
    --warning-amber: #ffb300;
    --signal-magenta: #ff2d7b;
    --ghost-white: #e8e0f0;
    --bokeh-soft: #1a2040;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-void);
    color: var(--ghost-white);
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.05em;
    overflow-x: hidden;
    background: radial-gradient(ellipse at center, var(--terminal-dark) 0%, var(--deep-void) 70%);
}

/* === BOKEH LAYERS === */
.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.bokeh-far { z-index: -3; }
.bokeh-mid { z-index: -2; }
.bokeh-near { z-index: -1; }

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.bokeh-far .bokeh-circle {
    filter: blur(60px);
    opacity: 0.08;
    animation: bokeh-drift-far 30s ease-in-out infinite alternate;
}

.bokeh-mid .bokeh-circle {
    filter: blur(35px);
    opacity: 0.12;
    animation: bokeh-drift-mid 22s ease-in-out infinite alternate;
}

.bokeh-near .bokeh-circle {
    filter: blur(15px);
    opacity: 0.18;
    animation: bokeh-drift-near 15s ease-in-out infinite alternate;
}

@keyframes bokeh-drift-far {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, -20px); }
}

@keyframes bokeh-drift-mid {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-40px, 25px); }
}

@keyframes bokeh-drift-near {
    0% { transform: translate(0, 0); }
    100% { transform: translate(20px, -35px); }
}

/* === SCANLINE OVERLAY === */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        transparent, transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    animation: scanline-scroll 8s linear infinite;
}

@keyframes scanline-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* === BUBBLE ANOMALIES === */
.bubble-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(0, 229, 255, 0.4);
    background: radial-gradient(circle at 30% 30%, transparent 60%, rgba(0, 229, 255, 0.1));
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
    animation: bubble-rise linear forwards;
    will-change: transform, opacity;
}

@keyframes bubble-rise {
    0% {
        transform: translateY(100vh) translateX(0) scale(1);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100px) translateX(var(--wobble, 30px)) scale(0.6);
        opacity: 0;
    }
}

/* === LEVELS / SECTIONS === */
.level {
    min-height: 100vh;
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

/* === BOOT SEQUENCE === */
.level-boot {
    background: var(--deep-void);
    justify-content: center;
    align-items: flex-start;
    padding-left: 10vw;
}

.terminal-boot {
    max-width: 700px;
}

.boot-line {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--phosphor-green);
    letter-spacing: 0.1em;
    white-space: nowrap;
    overflow: hidden;
    border-right: 2px solid var(--phosphor-green);
    width: 0;
    animation: typing 1.5s steps(40) forwards, blink-caret 0.8s step-end infinite alternate;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.boot-line[data-delay="0"] { animation-delay: 0s, 0s; }
.boot-line[data-delay="1"] { animation-delay: 1.6s, 1.6s; }
.boot-line[data-delay="2"] { animation-delay: 3.2s, 3.2s; }
.boot-line[data-delay="3"] { animation-delay: 4.8s, 4.8s; }
.boot-line[data-delay="4"] { animation-delay: 6.4s, 6.4s; }

@keyframes typing {
    0% { width: 0; }
    100% { width: 100%; }
}

@keyframes blink-caret {
    50% { border-color: transparent; }
}

/* === LEVEL HEADERS === */
.level-header {
    width: 100%;
    max-width: 1400px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-label {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--phosphor-green);
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.level-tag {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--phosphor-green);
    padding: 0.3em 1em;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.level-tag.warning {
    color: var(--warning-amber);
    border-color: rgba(255, 179, 0, 0.3);
    text-shadow: 0 0 8px rgba(255, 179, 0, 0.4);
}

.level-tag.critical {
    color: var(--signal-magenta);
    border-color: rgba(255, 45, 123, 0.3);
    text-shadow: 0 0 8px rgba(255, 45, 123, 0.4);
}

/* === GRID WALL === */
.grid-wall {
    display: grid;
    gap: 3px;
    width: 100%;
    max-width: 1400px;
    position: relative;
}

.grid-3 {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(5, 1fr);
    min-height: 70vh;
}

.grid-3 .hero {
    grid-column: 1 / 8;
    grid-row: 1 / 6;
}

.grid-3 .thumb:nth-child(2) {
    grid-column: 8 / 13;
    grid-row: 1 / 3;
}

.grid-3 .thumb:nth-child(3) {
    grid-column: 8 / 13;
    grid-row: 3 / 6;
}

.grid-6 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    min-height: 70vh;
}

.grid-8 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    min-height: 70vh;
}

/* === CASE PANELS === */
.case-panel {
    background: rgba(15, 17, 24, 0.85);
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.6s ease, border-color 0.6s ease;
    will-change: box-shadow, opacity;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.6s ease;
}

.case-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.case-panel:hover {
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 0 4px var(--anomaly-cyan), 0 0 12px rgba(0, 229, 255, 0.3);
}

.case-panel.pulse {
    animation: panel-pulse 2s ease-in-out infinite;
}

@keyframes panel-pulse {
    0%, 100% { box-shadow: 0 0 2px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 12px rgba(0, 255, 136, 0.6), 0 0 30px rgba(0, 255, 136, 0.15); }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.case-id {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--warning-amber);
    text-shadow: 0 0 6px rgba(255, 179, 0, 0.3);
}

.timestamp {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.55rem, 0.7vw, 0.7rem);
    letter-spacing: 0.2em;
    color: rgba(232, 224, 240, 0.4);
}

.case-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ghost-white);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
    line-height: 1.2;
}

.thumb .case-title,
.grid-6 .case-title,
.grid-8 .case-title {
    font-size: clamp(1rem, 2vw, 1.5rem);
}

.case-body {
    color: rgba(232, 224, 240, 0.7);
    max-width: 60ch;
}

.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.meta-tag {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.55rem, 0.7vw, 0.65rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--anomaly-cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
    padding: 0.2em 0.6em;
}

.meta-coord {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.55rem, 0.7vw, 0.65rem);
    letter-spacing: 0.2em;
    color: rgba(232, 224, 240, 0.3);
}

.critical-tag {
    color: var(--signal-magenta);
    border-color: rgba(255, 45, 123, 0.5);
    text-shadow: 0 0 6px rgba(255, 45, 123, 0.3);
}

/* === WATERMARK / STAMPS === */
.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-12deg);
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 10rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255, 179, 0, 0.06);
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

.stamp {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s ease 0.5s;
}

.stamp.show {
    opacity: 1;
}

.classified-stamp {
    top: 30%;
    right: 10%;
    transform: rotate(-12deg);
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--signal-magenta);
    text-shadow: 0 0 20px rgba(255, 45, 123, 0.4), 0 0 40px rgba(255, 45, 123, 0.15);
}

.boo-stamp {
    bottom: 20%;
    left: 10%;
    transform: rotate(-12deg);
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--warning-amber);
    text-shadow: 0 0 15px rgba(255, 179, 0, 0.4);
}

/* === FINAL REVEAL === */
.level-final {
    min-height: 100vh;
    justify-content: center;
    align-items: center;
}

.final-reveal {
    max-width: 800px;
    width: 100%;
    border-color: rgba(255, 45, 123, 0.5);
    text-align: center;
    padding: 3rem;
}

.final-reveal .case-body {
    max-width: none;
}

.final-stamp {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    letter-spacing: 0.4em;
    color: var(--signal-magenta);
    text-shadow: 0 0 30px rgba(255, 45, 123, 0.5), 0 0 60px rgba(255, 45, 123, 0.2);
    margin-bottom: 0.5rem;
}

.final-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 1.2vw, 1rem);
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: var(--warning-amber);
    margin-bottom: 2rem;
}

.final-message {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--phosphor-green);
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
    margin-top: 2rem;
    animation: blink-caret 0.8s step-end infinite alternate;
    border-right: 2px solid var(--phosphor-green);
    display: inline-block;
}

.blink-text {
    animation: text-blink 1s step-end infinite;
    color: var(--signal-magenta);
    font-weight: 700;
}

@keyframes text-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === STATUS BAR === */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2.5rem;
    background: rgba(8, 8, 15, 0.95);
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 100;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
}

.status-cursor {
    color: var(--phosphor-green);
    animation: text-blink 1s step-end infinite;
    margin-right: 0.5rem;
}

.status-text {
    color: var(--phosphor-green);
    text-shadow: 0 0 6px rgba(0, 255, 136, 0.3);
    transition: opacity 0.3s ease;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .grid-3, .grid-6, .grid-8 {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .grid-3 .hero,
    .grid-3 .thumb:nth-child(2),
    .grid-3 .thumb:nth-child(3) {
        grid-column: auto;
        grid-row: auto;
    }

    .level {
        padding: 1rem;
    }

    .level-boot {
        padding-left: 1.5rem;
    }

    .watermark, .stamp {
        font-size: 2rem;
    }
}
