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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f4c75 100%);
    color: #ffffff;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    position: relative;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    padding: 2rem;
    border-radius: 20px;
    max-width: 500px;
    margin: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(42, 42, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(45deg, #00ff88, #0088ff, #ff0080);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

/* Main Content */
.main-content {
    display: flex;
    padding: 1rem;
    gap: 1rem;
    min-height: calc(100vh - 80px);
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#main-canvas {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.3);
    animation: canvasGlow 3s ease-in-out infinite alternate;
}

@keyframes canvasGlow {
    from { box-shadow: 0 0 30px rgba(0, 255, 136, 0.3); }
    to { box-shadow: 0 0 60px rgba(0, 255, 136, 0.5); }
}

/* Breathing Guide */
.breathing-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.breathing-circle {
    width: 100px;
    height: 100px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: breathe 4s ease-in-out infinite;
}

.breathing-text {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* Control Panels */
.control-panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 320px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.control-panel {
    padding: 1.5rem;
    border-radius: 15px;
}

.glass-panel {
    background: rgba(42, 42, 42, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.control-panel h3 {
    margin-bottom: 1rem;
    color: #00ff88;
    font-weight: 600;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    outline: none;
    margin-bottom: 0.5rem;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #00ff88, #0088ff);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.4);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #00ff88, #0088ff);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.control-group span {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.control-group select {
    width: 100%;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
}

.control-group input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: #00ff88;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(45deg, #00ff88, #0088ff);
    border: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: linear-gradient(45deg, #ff0080, #ff4040);
    border: none;
}

.btn-icon {
    padding: 0.5rem;
    font-size: 1.2rem;
    min-width: 40px;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.button-group .btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.6rem;
}

/* Preset Grid */
.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.preset-btn {
    padding: 0.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    transform: translateY(-1px);
}

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.color-btn {
    padding: 0.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.color-btn.active {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.2);
}

.color-btn:hover {
    transform: translateY(-1px);
}

/* Mindfulness Mode */
.mindfulness-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timer-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.timer-btn {
    padding: 1rem 2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timer-btn:hover {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.2);
    transform: translateY(-2px);
}

.timer-display {
    font-size: 3rem;
    font-weight: 700;
    color: #00ff88;
    text-align: center;
    margin-bottom: 2rem;
    font-family: monospace;
}

/* Formula Display */
.formula {
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    text-align: center;
    margin: 1rem 0;
    border-left: 4px solid #00ff88;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .control-panels {
        width: 100%;
        max-height: none;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .header-controls {
        gap: 0.25rem;
    }
    
    .btn-icon {
        padding: 0.4rem;
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0.75rem 1rem;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .control-panels {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 0.5rem;
        padding: 1.5rem;
    }
    
    .timer-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .timer-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .timer-display {
        font-size: 2rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
.preset-btn:focus,
.color-btn:focus,
.timer-btn:focus,
input:focus,
select:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

/* Custom scrollbar */
.control-panels::-webkit-scrollbar {
    width: 8px;
}

.control-panels::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.control-panels::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #00ff88, #0088ff);
    border-radius: 4px;
}

.control-panels::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #00cc77, #0066dd);
}

/* Loading animation for canvas */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.canvas-container::before {
    content: "Initializing HypnoViz...";
    position: absolute;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    font-weight: 500;
    animation: pulse 2s infinite;
    z-index: -1;
}