* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0a;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    user-select: none;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
}

/* Header */
#header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

#header h1 {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-shadow: 0 0 20px #ff0080, 0 0 40px #00ffff;
    background: linear-gradient(90deg, #ff0080, #00ffff, #8b00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#audio-icon {
    font-size: 1.5rem;
    transition: transform 0.1s ease-out;
    filter: drop-shadow(0 0 10px #00ffff);
}

/* Canvas area */
#canvas-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #0a0a0a;
}

#freq-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, #ff0080, #00ffff, #8b00ff);
    transition: width 0.05s ease-out;
    border-radius: 0 2px 2px 0;
}

#tilt-toast {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ffff;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    transition: opacity 0.5s ease;
    cursor: pointer;
}

/* Controls */
#controls {
    background: rgba(26, 26, 26, 0.95);
    padding: 15px;
    border-top: 1px solid #333;
    flex-shrink: 0;
}

#primary-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 80px;
    height: 70px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #444;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn .btn-icon {
    font-size: 1.5rem;
}

.control-btn .btn-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #888;
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5), inset 0 0 10px rgba(0, 255, 0, 0.2);
}

.control-btn.active .btn-label {
    color: #00ff00;
}

.control-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#strobe-btn:active {
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    background: linear-gradient(180deg, #fff 0%, #ccc 100%);
}

#strobe-btn:active .btn-icon,
#strobe-btn:active .btn-label {
    color: #000;
}

/* Pattern selector */
#pattern-selector {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 0;
    margin-bottom: 15px;
    scrollbar-width: none;
}

#pattern-selector::-webkit-scrollbar {
    display: none;
}

.pattern-btn {
    flex-shrink: 0;
    padding: 10px 15px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #333;
    border-radius: 20px;
    color: #888;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pattern-btn.active {
    border-color: #ff0080;
    color: #ff0080;
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.5);
    text-shadow: 0 0 10px #ff0080;
}

.pattern-btn:active {
    transform: scale(0.95);
}

/* Sensitivity slider */
#sensitivity-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #666;
    text-align: center;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-indicator {
    font-size: 0.55rem;
    color: #555;
    letter-spacing: 1px;
}

#sensitivity-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(90deg, #333 0%, #00ffff 100%);
    border-radius: 4px;
    outline: none;
}

#sensitivity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(180deg, #00ffff 0%, #0088aa 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#sensitivity-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(180deg, #00ffff 0%, #0088aa 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Ad slot */
#ad-slot {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    border: 1px dashed #333;
    color: #555;
    font-size: 0.7rem;
    letter-spacing: 1px;
    flex-shrink: 0;
}

/* Footer */
#footer {
    padding: 8px;
    text-align: center;
    font-size: 0.6rem;
    color: #444;
    background: #0a0a0a;
    flex-shrink: 0;
}

#footer a {
    color: #ff6b6b;
    text-decoration: none;
}

#footer a:hover {
    text-shadow: 0 0 10px #ff6b6b;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px currentColor; }
    50% { box-shadow: 0 0 25px currentColor; }
}

/* Responsive adjustments */
@media (min-width: 768px) {
    #header h1 {
        font-size: 1.5rem;
    }
    
    .control-btn {
        width: 100px;
        height: 80px;
    }
    
    .control-btn .btn-icon {
        font-size: 2rem;
    }
    
    .pattern-btn {
        font-size: 0.75rem;
        padding: 12px 20px;
    }
}

@media (max-height: 600px) {
    #header {
        padding: 8px;
    }
    
    #header h1 {
        font-size: 1rem;
    }
    
    #controls {
        padding: 10px;
    }
    
    .control-btn {
        width: 65px;
        height: 55px;
    }
    
    .control-btn .btn-icon {
        font-size: 1.2rem;
    }
    
    #ad-slot {
        height: 40px;
    }
}