/* Quantum Signals - Custom Styles */

:root {
    --cyan: #00ffff;
    --orange: #ff6600;
    --dark: #0a0a0a;
}

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

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--dark);
    color: var(--cyan);
    overflow: hidden;
    cursor: crosshair;
}

/* Module transitions */
.module {
    transition: opacity 0.5s ease;
}

.module.hidden {
    display: none;
    opacity: 0;
}

.module.active {
    display: block;
    opacity: 1;
}

/* Navigation */
.nav-btn {
    letter-spacing: 0.1em;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.nav-btn.active {
    opacity: 1 !important;
    border-bottom-color: var(--cyan);
}

.nav-btn.locked {
    opacity: 0.3;
    color: rgba(255, 255, 255, 0.2);
}

.nav-btn.unlocked {
    opacity: 0.7;
    color: var(--cyan);
    text-shadow: 0 0 5px var(--cyan);
}

.nav-btn.completed {
    opacity: 1;
    color: var(--orange);
    text-shadow: 0 0 8px var(--orange);
}

/* CRT Glow Effects */
.glitch-text {
    text-shadow:
        0 0 10px var(--orange),
        0 0 20px var(--orange),
        0 0 30px var(--orange);
    animation: flicker 3s infinite alternate;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
    75% { opacity: 0.98; }
}

/* Grid Styles */
.grid-container {
    display: inline-block;
    position: relative;
}

.quantum-grid {
    display: grid;
    gap: 1px;
    background: rgba(0, 255, 255, 0.1);
    padding: 2px;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.grid-tile {
    width: 12px;
    height: 12px;
    background: var(--dark);
    border: 1px solid rgba(0, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    user-select: none;
}

.grid-tile:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 5px var(--cyan);
}

.grid-tile.state-0 {
    background: var(--dark);
    color: rgba(0, 255, 255, 0.3);
}

.grid-tile.state-1 {
    background: rgba(0, 255, 255, 0.2);
    color: var(--cyan);
    box-shadow: 0 0 3px var(--cyan);
}

.grid-tile.superposition {
    animation: shimmer 0.3s infinite;
    background: linear-gradient(45deg, var(--dark) 25%, rgba(0, 255, 255, 0.2) 50%, var(--dark) 75%);
    background-size: 200% 200%;
    color: var(--orange);
    box-shadow: 0 0 8px var(--orange);
}

@keyframes shimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

.grid-tile.frozen {
    pointer-events: none;
    opacity: 0.7;
}

.grid-tile.entangled {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 3px var(--cyan);
    }
    50% {
        box-shadow: 0 0 10px var(--orange), 0 0 15px var(--orange);
    }
}

/* Buttons */
.btn-primary {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.15em;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-primary:hover {
    box-shadow: 0 0 10px currentColor;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Formula overlay */
.formula-overlay {
    font-size: 1.25rem;
    font-style: italic;
    letter-spacing: 0.05em;
}

/* Hash display */
#signal-hash {
    font-weight: 700;
}

/* Entanglement lines */
.entangle-line {
    animation: flow 2s infinite;
}

@keyframes flow {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

/* Canvas styles */
canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Scanlines effect */
#scanlines {
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 3px
    );
    animation: scan 8s linear infinite;
}

@keyframes scan {
    0% { transform: translateY(0); }
    100% { transform: translateY(100%); }
}

/* Typewriter effect */
#typewriter-text {
    border-right: 2px solid var(--cyan);
    white-space: nowrap;
    overflow: hidden;
    animation: blink 1s step-end infinite;
}

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

/* Fade transitions */
.fade-in {
    animation: fadeIn 2s ease-in forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-out {
    animation: fadeOut 2s ease-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* CRT screen effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    z-index: 1000;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    background: rgba(0, 255, 255, 0.02);
    animation: crtFlicker 0.15s infinite;
    z-index: 999;
}

@keyframes crtFlicker {
    0% { opacity: 0.97; }
    50% { opacity: 1; }
    100% { opacity: 0.97; }
}

/* Performance optimization */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .grid-tile {
        width: 8px;
        height: 8px;
        font-size: 6px;
    }

    #module-nav {
        font-size: 0.6rem;
        gap: 0.5rem;
    }

    .formula-overlay {
        font-size: 1rem;
    }
}

/* Selection disable for cleaner UX */
::selection {
    background: rgba(0, 255, 255, 0.3);
    color: var(--cyan);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
}

::-webkit-scrollbar-thumb {
    background: var(--cyan);
    border: 1px solid var(--dark);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--orange);
}

/* Gallery Styles */
.signal-card {
    background: rgba(0, 255, 255, 0.02);
    transition: all 0.3s ease;
    position: relative;
}

.signal-card:hover {
    background: rgba(0, 255, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.2);
}

.mini-grid {
    margin-bottom: 0.5rem;
}

#gallery-grid {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 1rem;
}

/* Info Panel */
.info-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.info-panel.visible {
    opacity: 1;
    pointer-events: all;
}

.info-panel.hidden {
    display: none;
}

.info-content {
    max-width: 600px;
    width: 90%;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 2rem;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.info-body {
    line-height: 1.6;
}

.info-section {
    margin-bottom: 1rem;
}

.info-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.2s;
    cursor: pointer;
    background: none;
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--cyan);
    padding: 0.25rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
}

.info-btn:hover {
    opacity: 1;
    box-shadow: 0 0 10px var(--cyan);
}
