:root {
    --primary-color: #0a192f;
    --secondary-color: #64ffda;
    --highlight-color: #f97316;
    --text-color: #e6f1ff;
    --glow-color: rgba(100, 255, 218, 0.3);
    --panel-bg: rgba(10, 25, 47, 0.4);
    --panel-border: rgba(100, 255, 218, 0.2);
    --panel-shadow: rgba(100, 255, 218, 0.1);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background: var(--primary-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
}

.container {
    width: 100%;
    height: 100%;
    position: relative;
}

h1 {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--secondary-color);
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 0 0 15px var(--glow-color);
    z-index: 100;
}

.visualization-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Unified Quantum Control Panels */
.quantum-panel {
    position: absolute;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--panel-border);
    box-shadow: 0 0 30px var(--panel-shadow);
    padding: 15px;
    z-index: 10;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quantum-panel:hover {
    box-shadow: 0 0 40px rgba(100, 255, 218, 0.2);
    transform: scale(1.02);
}

/* Panel Positioning */
.left-panel {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 100px;
    height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.right-panel {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 100px;
    height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.top-panel {
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    max-width: 800px;
    height: 90px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-panel {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    max-width: 800px;
    height: 100px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

/* Quantum Control Elements */
.control-group {
    margin: 10px 0;
    padding: 10px 0;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.control-title {
    font-size: 0.7rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    text-shadow: 0 0 5px var(--glow-color);
    flex-shrink: 0;
}


.quantum-slider-horizontal {
    -webkit-appearance: none;
    width: 120px;
    height: 8px;
    background: linear-gradient(to right,
        rgba(10, 25, 47, 0.8),
        rgba(100, 255, 218, 0.5) 50%,
        rgba(10, 25, 47, 0.8));
    border-radius: 4px;
    outline: none;
    margin: auto 10px;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.2);
}

.quantum-slider-horizontal::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--highlight-color);
    cursor: pointer;
    box-shadow: 0 0 15px var(--highlight-color);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* Quantum Toggle Switch */
.quantum-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.quantum-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.quantum-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(100, 255, 218, 0.1);
    transition: .4s;
    border: 1px solid var(--secondary-color);
    border-radius: 24px;
}

.quantum-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: var(--highlight-color);
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 0 10px var(--highlight-color);
}

input:checked + .quantum-slider {
    background-color: rgba(100, 255, 218, 0.3);
}

input:checked + .quantum-slider:before {
    transform: translateX(26px);
    background-color: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
}

/* Quantum Mode Selector */
.quantum-mode-container {
    position: absolute;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 8px;
    border: 1px solid var(--panel-border);
    box-shadow: 0 0 30px var(--panel-shadow);
    z-index: 20;
}

.quantum-mode-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--secondary-color);
    font-size: 0.8rem;
    position: relative;
    overflow: hidden;
}

.quantum-mode-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(100, 255, 218, 0.2) 0%, transparent 70%);
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quantum-mode-btn:hover::after {
    opacity: 1;
}

.quantum-mode-btn.active {
    background: var(--secondary-color);
    color: var(--primary-color);
    box-shadow: 0 0 15px var(--glow-color);
}

/* Quantum Preset Panel */
.quantum-preset-panel {
    position: absolute;
    bottom: 185px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 10px;
    border: 1px solid var(--panel-border);
    box-shadow: 0 0 30px var(--panel-shadow);
    z-index: 15;
}

.quantum-preset-btn {
    background: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 15px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.quantum-preset-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(100, 255, 218, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.quantum-preset-btn:hover::before {
    left: 100%;
}

.quantum-preset-btn:hover {
    background: rgba(100, 255, 218, 0.1);
    box-shadow: 0 0 10px var(--glow-color);
}

.quantum-preset-btn:active {
    background: rgba(100, 255, 218, 0.2);
    transform: scale(0.95);
}

/* Quantum Color Picker */
.quantum-color-picker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 15px auto;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.primary-color-init {
    background-color: #64ffda;
}

.secondary-color-init {
    background-color: #f97316;
}

.quantum-color-picker::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.5) 0%, transparent 70%);
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quantum-color-picker:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.quantum-color-picker:hover::after {
    opacity: 1;
}

/* Quantum Value Display */
.quantum-value {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-align: center;
    margin-top: 10px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px var(--glow-color);
    background: rgba(10, 25, 47, 0.5);
    border-radius: 10px;
    padding: 2px 6px;
    min-width: 30px;
    flex-shrink: 0;
}

/* Quantum Dimensional Selector */
.quantum-dimension-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quantum-dimension-btn {
    background: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    padding: 5px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.7rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quantum-dimension-btn::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent,
        rgba(100, 255, 218, 0.2),
        transparent
    );
    transition: top 0.5s ease;
}

.quantum-dimension-btn:hover::before {
    top: 100%;
}

.quantum-dimension-btn.active {
    background: var(--secondary-color);
    color: var(--primary-color);
    box-shadow: 0 0 10px var(--glow-color);
}

/* Quantum Reset Button */
.quantum-reset-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 15px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    z-index: 30;
}

.quantum-reset-btn:hover {
    background: rgba(100, 255, 218, 0.1);
    box-shadow: 0 0 15px var(--glow-color);
}

.quantum-reset-btn:active {
    background: rgba(100, 255, 218, 0.2);
    transform: scale(0.95);
}

/* Quantum Export Button */
.quantum-export-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: transparent;
    color: var(--highlight-color);
    border: 1px solid var(--highlight-color);
    border-radius: 15px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    z-index: 30;
}

.quantum-export-btn:hover {
    background: rgba(249, 115, 22, 0.1);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.3);
}

.quantum-export-btn:active {
    background: rgba(249, 115, 22, 0.2);
    transform: scale(0.95);
}

/* Quantum Floating Animations */
@keyframes quantum-float-left {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(-8px); }
}

@keyframes quantum-float-right {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(8px); }
}

@keyframes quantum-float-top {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

@keyframes quantum-float-bottom {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

.left-panel {
    animation: quantum-float-left 8s ease-in-out infinite;
}

.right-panel {
    animation: quantum-float-right 8s ease-in-out infinite;
}

.top-panel {
    animation: quantum-float-top 7s ease-in-out infinite;
}

.bottom-panel {
    animation: quantum-float-bottom 9s ease-in-out infinite;
}

.quantum-mode-container {
    animation: quantum-float-bottom 6s ease-in-out infinite;
}

.quantum-preset-panel {
    animation: quantum-float-top 10s ease-in-out infinite;
}

/* 3D Quantum Tooltips - Fixed positioning above canvas */
[data-tooltip] {
    position: relative;
}

/* Preserve absolute positioning for action buttons */
.quantum-reset-btn[data-tooltip],
.quantum-export-btn[data-tooltip] {
    position: absolute;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: fixed;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10000;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.95) 0%, rgba(10, 25, 47, 0.95) 100%);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow:
        0 0 20px rgba(100, 255, 218, 0.4),
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(100, 255, 218, 0.3);
    backdrop-filter: blur(10px);
    font-weight: 500;
    letter-spacing: 0.5px;
    left: var(--tooltip-left, -9999px);
    top: var(--tooltip-top, -9999px);
    transform: translateX(-50%);
}

[data-tooltip]::after {
    content: '';
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-top-color: rgba(100, 255, 218, 0.95);
    filter: drop-shadow(0 2px 4px rgba(100, 255, 218, 0.3));
    left: var(--tooltip-arrow-left, -9999px);
    top: var(--tooltip-arrow-top, -9999px);
    transform: translateX(-50%);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
}

[data-tooltip]:hover::before {
    animation: tooltip-pulse 2s ease-in-out infinite;
}

@keyframes tooltip-pulse {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(100, 255, 218, 0.4),
            0 4px 15px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow:
            0 0 30px rgba(100, 255, 218, 0.6),
            0 6px 20px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .top-panel, .bottom-panel {
        width: 80vw;
    }

    [data-tooltip]::before {
        font-size: 0.7rem;
        padding: 6px 10px;
    }
}

@media (max-width: 768px) {
    .left-panel, .right-panel {
        width: 60px;
        height: 55vh;
        padding: 10px;
    }

    .top-panel, .bottom-panel {
        width: 90vw;
        height: 70px;
        padding: 10px;
    }

    h1 {
        font-size: 1.3rem;
        top: 5px;
    }

    .quantum-preset-panel {
        flex-wrap: wrap;
        justify-content: center;
        bottom: 175px;
        max-width: 90vw;
    }

    .quantum-mode-container {
        bottom: 120px;
    }

    .control-title {
        font-size: 0.6rem;
    }

    .quantum-value {
        font-size: 0.7rem;
    }
}
