:root {
    --bg-color: #050608;
    --accent-color: #00f2ff;
    --accent-secondary: #ff00c8;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --glass-bg: rgba(20, 22, 30, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --panel-width: 320px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
}

/* Loader */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--glass-border);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Canvas background */
#canvas-webgl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(circle at center, #10121a 0%, #050608 100%);
}

.overlay {
    position: relative;
    z-index: 10;
    pointer-events: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 30px;
}

.overlay > *, 
.overlay main > *, 
.overlay footer > * {
    pointer-events: auto;
}

/* Header styling */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.glyph {
    font-size: 32px;
    color: var(--accent-color);
    font-weight: 800;
    text-shadow: 0 0 15px rgba(0, 242, 255, 0.5);
}

.logo h1 {
    font-size: 24px;
    letter-spacing: -0.5px;
}

.highlight {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphism Class */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* Controls */
#gui-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: var(--panel-width);
    margin-bottom: auto;
}

.control-panel {
    padding: 24px;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.control-group {
    margin-bottom: 18px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

select, input[type="range"] {
    width: 100%;
}

select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px;
    color: white;
    cursor: pointer;
    font-family: inherit;
    transition: border 0.3s ease;
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
}

input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

.param-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.param-val {
    font-family: 'Space Grotesk', monospace;
    font-size: 12px;
    color: var(--accent-color);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

button {
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button.primary {
    background: linear-gradient(135deg, var(--accent-color), #00a2ff);
    color: #050608;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
}

button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 255, 0.5);
}

button.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
}

button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
}

/* Stats */
.info-card {
    padding: 16px;
}

.stat {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.stat:last-child { margin-bottom: 0; }

.stat .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat .value {
    font-family: 'Space Grotesk', monospace;
    font-size: 14px;
    color: var(--accent-color);
}

/* Footer */
footer {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-top: auto;
}

.butterfly-note {
    font-size: 14px;
    color: var(--text-secondary);
}

.butterfly-note strong {
    color: var(--accent-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

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

.modal-content {
    width: 95%;
    max-width: 700px;
    max-height: 85vh;
    padding: 30px;
    position: relative;
    pointer-events: auto;
}

.scroll-area {
    overflow-y: auto;
    max-height: calc(85vh - 100px);
    margin-top: 15px;
    padding-right: 15px;
}

.scroll-area section {
    margin-bottom: 30px;
}

.scroll-area h3 {
    margin: 0 0 15px 0;
    color: var(--accent-color);
    font-size: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.guide-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.guide-item strong {
    display: block;
    color: var(--accent-secondary);
    margin-bottom: 8px;
    font-size: 14px;
}

.guide-item p {
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
}

/* Tabs System */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-color);
    box-shadow: inset 0 0 10px rgba(0, 242, 255, 0.1);
}

.modal-content .tab-content {
    display: none;
}

.modal-content .tab-content.active {
    display: block !important;
}

/* Experiment items inside modal */
.exp-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
}

.exp-item h4 {
    color: var(--accent-secondary);
    margin-bottom: 10px;
    font-size: 16px;
}

.step-box {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--glass-border);
}

.step {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.step-n {
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    color: var(--bg-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
}


@media (max-width: 600px) {
    .guide-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .overlay {
        padding: 15px;
    }
    
    #gui-container {
        max-width: 100%;
        width: 100%;
    }
    
    .butterfly-note {
        font-size: 12px;
    }
}
