/* --- CORE THEME --- */
:root {
    --bg-color: #050510;
    --panel-color: #0f172a;
    --accent-cyan: #00f3ff;
    --accent-pink: #ff0055;
    --accent-gold: #ffd700;
    --accent-purple: #bd00ff;
    --accent-math: #ffffff;
    --text-color: #e2e8f0;
    --grid-color: #1e293b;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Roboto, sans-serif;
    display: flex;
    height: 100vh;
}

/* SIDEBAR */
#sidebar {
    width: 340px;
    background-color: var(--panel-color);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--grid-color);
    z-index: 20;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
}

.logo-area {
    padding: 20px;
    background: linear-gradient(90deg, #0f172a, #1e293b);
    border-bottom: 1px solid var(--accent-cyan);
    margin-bottom: 10px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
}

/* TABS */
.subject-tabs {
    display: flex;
    background: #020617;
    border-bottom: 1px solid #334155;
}

.subject-btn {
    flex: 1;
    padding: 15px 5px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-weight: 900;
    font-size: 0.75rem;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.subject-btn:hover {
    color: #fff;
    background: #1e293b;
}

.subject-btn.active {
    color: #fff;
    background: var(--panel-color);
}

/* SUB-NAV */
.exp-tabs {
    padding: 10px;
    display: flex;
    gap: 5px;
    display: none;
}

.exp-tabs.active {
    display: flex;
}

.exp-btn {
    flex: 1;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #334155;
    color: #94a3b8;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.exp-btn:hover {
    color: #fff;
    border-color: #fff;
}

.tab-phy.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

.tab-chem.active {
    background: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.4);
}

.tab-math.active {
    background: var(--accent-math);
    color: #000;
    border-color: var(--accent-math);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

/* CONTROLS */
.controls-container {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    display: none;
    animation: slideIn 0.4s ease;
}

.controls-container.active {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

h2 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.color-purple {
    color: var(--accent-purple) !important;
}

.color-math {
    color: var(--accent-math) !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.subtitle {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 15px;
    border-left: 2px solid var(--accent-pink);
    padding-left: 10px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #334155;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #cbd5e1;
}

/* SLIDERS */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #334155;
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: #fff;
    margin-top: -5px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* BUTTONS */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), #2563eb);
    color: #000;
    padding: 15px;
    border: none;
    border-radius: 4px;
    font-weight: 900;
    cursor: pointer;
    margin-top: auto;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 243, 255, 0.3);
    text-transform: uppercase;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-chem {
    background: linear-gradient(135deg, var(--accent-purple), #7000ff);
    color: white;
    box-shadow: 0 4px 15px rgba(189, 0, 255, 0.3);
}

.btn-math {
    background: linear-gradient(135deg, #ffffff, #aaaaaa);
    color: black;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.btn-charge {
    flex: 1;
    padding: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #64748b;
    cursor: pointer;
    font-weight: bold;
}

.btn-charge.active-pos {
    background: var(--accent-pink);
    color: white;
    border-color: var(--accent-pink);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.btn-charge.active-neg {
    background: var(--accent-cyan);
    color: black;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

.btn-slow {
    width: 100%;
    padding: 8px;
    border: 1px solid #334155;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    margin-top: 5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-slow:hover {
    color: #fff;
    border-color: #fff;
}

.btn-slow.active {
    background: #fff;
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.btn-slow::before {
    content: '⏱';
}

.btn-analyze {
    width: 100%;
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    margin-top: 5px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-analyze:hover {
    background: var(--accent-gold);
    color: #000;
    box-shadow: 0 0 15px var(--accent-gold);
}

.btn-analyze::before {
    content: '📊';
}

/* VIEWPORT */
#viewport {
    flex-grow: 1;
    position: relative;
    background: #000;
    overflow: hidden;
}

canvas {
    display: none;
    width: 100%;
    height: 100%;
}

canvas.active {
    display: block;
}

/* MODALS */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-content {
    background: #0f172a;
    border: 1px solid var(--accent-cyan);
    width: 85%;
    max-width: 1000px;
    height: 85%;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.2);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    color: var(--accent-cyan);
    font-weight: 800;
    text-transform: uppercase;
}

.modal-body {
    flex: 1;
    display: flex;
    padding: 25px;
    gap: 30px;
    overflow-y: auto;
}

.calc-panel {
    flex: 1;
    border-right: 1px solid #334155;
    padding-right: 25px;
    overflow-y: auto;
}

.graph-panel {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.calc-step {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid var(--accent-gold);
}

.calc-label {
    color: #94a3b8;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.calc-formula {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #fff;
    line-height: 1.5;
}

.calc-result {
    color: var(--accent-gold);
    font-weight: 900;
    font-size: 1.4rem;
    margin-top: 8px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.close-btn {
    background: transparent;
    color: #fff;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--accent-pink);
}

/* Theory Modal */
#theory-modal .modal-content {
    width: 550px;
    height: auto;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#theory-body {
    padding: 25px;
    overflow-y: auto;
    line-height: 1.6;
}

.formula-box {
    background: #000;
    padding: 15px;
    border-left: 4px solid var(--accent-pink);
    font-family: 'Courier New', monospace;
    margin: 20px 0;
    color: #fff;
    font-size: 1.1rem;
}

h3 {
    color: var(--accent-gold);
    border-bottom: 1px solid #334155;
    padding-bottom: 5px;
    margin-top: 0;
}

li {
    margin-bottom: 8px;
    color: #e2e8f0;
}

.help-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 50;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.help-btn:hover {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 20px var(--accent-cyan);
}

/* Video Container Styles */
.video-container {
    margin-top: 25px;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(0, 243, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s, box-shadow 0.3s;
}

.video-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 243, 255, 0.15);
    border-color: var(--accent-cyan);
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: all 0.5s;
    filter: grayscale(20%);
}

.video-container:hover .video-thumbnail {
    opacity: 0.4;
    filter: grayscale(0%);
    transform: scale(1.05);
}

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    z-index: 2;
}

.video-container:hover .play-btn {
    width: 80px;
    height: 80px;
    background: rgba(0, 243, 255, 0.2);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 40px var(--accent-cyan);
}

.play-btn svg {
    width: 35px;
    height: 35px;
    fill: #fff;
    margin-left: 5px;
    /* Optical center */
    transition: fill 0.3s;
}


/* ENTRY PAGE */
#entry-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 1.5s ease-in-out, transform 1.5s ease-in-out;
}

#entry-page.fade-out {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none;
}

.entry-content {
    text-align: center;
    position: relative;
    z-index: 10;
    animation: fadeIn 1s ease-out;
}

.entry-title {
    font-size: 6rem;
    font-weight: 900;
    margin: 0;
    color: #fff;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-shadow: 0 0 30px rgba(0, 243, 255, 0.3);
    background: linear-gradient(to bottom right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.entry-title .accent {
    color: var(--accent-gold);
    -webkit-text-fill-color: var(--accent-gold);
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
}

.entry-subtitle {
    font-size: 1.5rem;
    color: var(--accent-cyan);
    margin-top: 10px;
    margin-bottom: 20px;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.8;
}

.entry-tagline {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: var(--accent-purple);
    margin-bottom: 50px;
    letter-spacing: 2px;
    opacity: 0.7;
    animation: fadeIn 1.5s ease-out;
}

#start-btn {
    background: transparent;
    border: 2px solid var(--accent-cyan);
    color: var(--accent-cyan);
    padding: 20px 60px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.1);
    position: relative;
    overflow: hidden;
}

#start-btn:hover {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.6);
    transform: translateY(-5px);
}

#start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

#start-btn:hover::before {
    left: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.background-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0, 243, 255, 0.05) 0%, transparent 10%),
        radial-gradient(circle at 80% 70%, rgba(189, 0, 255, 0.05) 0%, transparent 10%);
    animation: pulseBG 5s infinite alternate;
}

@keyframes pulseBG {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.powered-by {
    margin-top: 40px;
    font-size: 0.9rem;
    color: #cbd5e1;
    font-weight: 600;
    letter-spacing: 2px;
    opacity: 0.8;
    text-transform: uppercase;
    font-family: 'Segoe UI', sans-serif;
    position: relative;
    z-index: 20;
}

/* WARP SPEED ANIMATION */
.warp-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    perspective: 500px;
    transform-style: preserve-3d;
}

.stars,
.stars2,
.stars3 {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    opacity: 0.9;
}

/* Simulating starfield with box-shadows for performance */
.stars {
    width: 1px;
    height: 1px;
    background: transparent;
    animation: animStar 60s linear infinite;
}

.stars:after {
    content: " ";
    position: absolute;
    top: 2000px;
    width: 1px;
    height: 1px;
    background: transparent;
    box-shadow: inherit;
}

.stars2 {
    width: 2px;
    height: 2px;
    background: transparent;
    animation: animStar 100s linear infinite;
}

.stars2:after {
    content: " ";
    position: absolute;
    top: 2000px;
    width: 2px;
    height: 2px;
    background: transparent;
    box-shadow: inherit;
}

.stars3 {
    width: 3px;
    height: 3px;
    background: transparent;
    animation: animStar 150s linear infinite;
}

.stars3:after {
    content: " ";
    position: absolute;
    top: 2000px;
    width: 3px;
    height: 3px;
    background: transparent;
    box-shadow: inherit;
}

@keyframes animStar {
    from {
        transform: translateY(0px) rotate(0deg);
    }

    to {
        transform: translateY(-2000px) rotate(5deg);
    }
}

/* WARP ACTIVATION STATES */
.warping .entry-content {
    animation: zoomOutContent 0.5s ease-in forwards;
}

.warping .background-particles {
    opacity: 0;
    transition: opacity 0.5s;
}

.warping .stars,
.warping .stars2,
.warping .stars3 {
    /* Engage Warp Drive */
    animation: warpSpeed 2.5s cubic-bezier(0.7, 0, 0.3, 1) forwards;
}

@keyframes zoomOutContent {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(3);
        opacity: 0;
        filter: blur(20px);
    }
}

@keyframes warpSpeed {
    0% {
        transform: translateZ(0) scale(1);
        opacity: 1;
    }

    20% {
        transform: translateZ(200px) scale(2);
        opacity: 1;
    }

    100% {
        transform: translateZ(1000px) scale(15);
        opacity: 0;
    }
}