:root {
    --bg-color: #f8fafc;
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(0, 0, 0, 0.08);
    --text-main: #1e293b;
    --text-muted: #475569;
    --accent-1: #0ea5e9;
    --accent-2: #6366f1;
    --accent-glow: rgba(14, 165, 233, 0.3);
    
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Noto Sans Thai', 'Inter', sans-serif;
}

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

body {
    background: radial-gradient(circle at top right, #e0f2fe, #f0fdfa, #f8fafc);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
    overflow-x: hidden;
}

/* Background animated glow */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
    animation: rotateGlow 20s linear infinite;
    z-index: -1;
}

@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.app-container {
    max-width: 1400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.glass-header {
    text-align: center;
    padding: 2rem;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.glass-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.glass-header h1 span {
    font-size: 1.5rem;
    font-weight: 400;
}

.glass-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

/* Theory Panel */
.theory-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent-1);
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.5rem;
}

.equation-box {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.equation-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-color: rgba(14, 165, 233, 0.3);
}

.equation-box h3 {
    font-size: 1.1rem;
    color: var(--accent-2);
    margin-bottom: 0.5rem;
}

.equation-box p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.equation-box ul {
    list-style-position: inside;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.equation-box ul li {
    margin-bottom: 0.3rem;
}

.math-formula {
    background: rgba(255, 255, 255, 1);
    padding: 0.5rem;
    border-radius: 8px;
    text-align: center;
    overflow-x: auto;
    font-size: 1.1em;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Simulation Panel */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.tab-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.tab-btn.active {
    background: var(--accent-1);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 15px var(--accent-glow);
    border-color: var(--accent-1);
}

.canvas-container {
    width: 100%;
    display: flex;
    justify-content: center;
    background: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
    margin-bottom: 1.5rem;
}

canvas {
    max-width: 100%;
    border-radius: 8px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.95rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.control-group label span {
    color: var(--accent-1);
    font-weight: bold;
}

/* Custom Range Slider */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}
input[type=range]:focus {
    outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent-1);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -5px;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.1s;
}
input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.data-display {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.data-item {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.data-item span {
    font-family: monospace;
    font-size: 1.3rem;
    color: var(--accent-2);
    font-weight: bold;
}
