:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --accent-color: #38bdf8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --button-bg: rgba(56, 189, 248, 0.1);
    --button-hover: rgba(56, 189, 248, 0.3);
    --button-active: #38bdf8;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scroll-behavior: smooth;
}



.app-header {
    height: auto;
    min-height: 25vh;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(23, 37, 84, 0.95));
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(10px);
    padding: 2rem 1rem;
}

.header-content {
    max-width: 1000px;
    width: 100%;
}

.app-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-description {
    font-size: 1rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.fractal-definition {
    max-width: 800px;
    margin: 1.5rem auto;
    background: rgba(56, 189, 248, 0.1);
    border-left: 4px solid var(--accent-color);
    padding: 1.2rem;
    border-radius: 0 12px 12px 0;
    text-align: left;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.fractal-definition p {
    margin: 0;
    color: #e2e8f0;
    font-size: 1.1rem;
    line-height: 1.6;
}

.fractal-nav {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.fractal-btn {
    background: var(--button-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.fractal-btn:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.fractal-btn.active {
    background: var(--button-active);
    color: #0f172a;
    font-weight: 700;
}

.viewport {
    height: 85vh;
    min-height: 700px;
    position: relative;
    width: 100%;
    background-color: #000;
}

#fractal-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.controls-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    pointer-events: none;
}

.status-indicator {
    background: var(--glass-bg);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#fractal-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent-color);
}

#zoom-level {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-top: 0.2rem;
    margin-bottom: 0.5rem;
}

.control-btn {
    background: var(--button-bg);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.control-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    transform: scale(1.1);
}

.hidden {
    display: none !important;
}

#flash-overlay {
    position: absolute;
    inset: 0;
    background-color: white;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.1s ease-out;
}

#flash-overlay.flashing {
    opacity: 1;
}

#loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    backdrop-filter: blur(5px);
    opacity: 1;
    transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Info Toggle Button */
.info-toggle-btn {
    background: var(--button-bg);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.info-toggle-btn:hover {
    background: var(--accent-color);
    color: #0f172a;
    transform: scale(1.1) rotate(5deg);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}

/* Modal Content */
.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    border-radius: 24px;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #ef4444; /* Brighter red for visibility */
    border: 2px solid white;
    color: white;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 9999; /* Much higher z-index */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.close-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.modal-body {
    padding: 3rem;
}

.modal-body h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.info-section.specific-info {
    background: rgba(56, 189, 248, 0.05);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.2);
    margin-bottom: 3rem;
}

.info-section.specific-info h3 {
    font-size: 1.8rem;
    background: linear-gradient(to right, #fff, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.info-section.specific-info p {
    font-size: 1.15rem;
    color: #f1f5f9;
}

.info-section h3 {
    font-family: var(--font-heading);
    color: var(--accent-color);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-section p,
.info-section li {
    line-height: 1.7;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.info-section ul {
    list-style-type: none;
    padding-left: 0.5rem;
}

.info-section li {
    position: relative;
    padding-left: 1.5rem;
}

.info-section li::before {
    content: "•";
    color: var(--accent-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Example Grid */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.example-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.example-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

.example-item strong {
    display: block;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
}

/* Custom Scrollbar */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}



.laboratory-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white !important;
    border: none;
    font-weight: 700;
}

.laboratory-btn:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .modal-body {
        padding: 2rem 1.5rem;
    }

    .modal-body h2 {
        font-size: 1.8rem;
    }

    .example-grid {
        grid-template-columns: 1fr;
    }
}