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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    background: #000;
    color: #fff;
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

#video {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 160px;
    height: 120px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    opacity: 0.7;
    transition: opacity 0.3s;
    z-index: 10;
}

#video:hover {
    opacity: 1;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s;
}

#overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#welcome {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

#welcome h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#welcome p {
    font-size: 1.1em;
    margin-bottom: 30px;
    color: #aaa;
    line-height: 1.6;
}

#welcome .hint {
    font-size: 0.9em;
    color: #666;
    margin-top: 15px;
}

#startButton {
    padding: 15px 40px;
    font-size: 1.2em;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#startButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#startButton:active {
    transform: translateY(0);
}

#controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.mode-switcher {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.mode-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1.6em;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

.control-buttons {
    display: flex;
    gap: 15px;
}

.control-buttons button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
}

.control-buttons button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.control-buttons button.inactive {
    opacity: 0.4;
    border-color: rgba(255, 100, 100, 0.5);
}

.control-buttons button.inactive:hover {
    border-color: rgba(255, 150, 150, 0.7);
}

#info {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: opacity 0.3s;
}

#info.hidden {
    opacity: 0;
    pointer-events: none;
}

.info-content {
    max-width: 600px;
    max-height: 80vh;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
}

.info-content h2 {
    margin-bottom: 10px;
    color: #667eea;
}

.info-content h3 {
    margin-bottom: 20px;
    color: #888;
    font-size: 1.2em;
    font-weight: normal;
}

.info-content h4 {
    margin-top: 25px;
    margin-bottom: 10px;
    color: #aaa;
    font-size: 1.1em;
}

.info-content ul {
    list-style: none;
    margin-bottom: 20px;
}

.info-content li {
    padding: 10px 0;
    padding-left: 25px;
    position: relative;
    color: #ccc;
}

.info-content li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
}

.privacy {
    text-align: center;
    color: #888;
    font-size: 0.9em;
    margin: 20px 0;
}

#closeInfo {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.2);
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

#closeInfo:hover {
    background: rgba(102, 126, 234, 0.3);
}

#status {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 5px;
    font-size: 0.9em;
    color: #aaa;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
}

#status.visible {
    opacity: 1;
}

/* Debug panel */
#debug {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 15;
    transition: opacity 0.3s;
}

#debug.hidden {
    opacity: 0;
    pointer-events: none;
}

.debug-panel {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.debug-panel h3 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 1em;
}

.debug-panel p {
    margin: 5px 0;
    color: #aaa;
}

/* Pad Debug Panel */
#padDebugPanel {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 20;
    transition: opacity 0.3s;
    max-width: 350px;
}

#padDebugPanel.hidden {
    opacity: 0;
    pointer-events: none;
}

.pad-debug-content {
    padding: 20px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.4);
    font-family: 'Courier New', monospace;
}

.pad-debug-content h3 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    color: #aaa;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.control-group select {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.control-group input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.pad-debug-content button {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 6px;
    color: white;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: background 0.2s;
}

.pad-debug-content button:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* Visualization Debug Panel */
#vizDebugPanel {
    position: absolute;
    top: 80px;
    left: 20px;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.3s;
    max-width: 350px;
}

#vizDebugPanel.hidden {
    opacity: 0;
    pointer-events: none;
}

.viz-debug-content {
    padding: 20px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 2px solid rgba(234, 102, 166, 0.4);
    font-family: 'Courier New', monospace;
    max-height: 85vh;
    overflow-y: auto;
}

.viz-debug-content h3 {
    margin: 0 0 10px 0;
    color: #ea66a6;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.viz-mode-indicator {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 15px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.viz-mode-indicator span {
    color: #ea66a6;
    font-weight: bold;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.viz-debug-content button {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: rgba(234, 102, 166, 0.3);
    border: 1px solid rgba(234, 102, 166, 0.5);
    border-radius: 6px;
    color: white;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: background 0.2s;
}

.viz-debug-content button:hover {
    background: rgba(234, 102, 166, 0.5);
}

.viz-debug-content .control-group p {
    margin: 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 0.9em;
}

.viz-debug-content .control-group p span {
    color: #ea66a6;
    font-weight: bold;
}

.debug-panel span {
    color: #fff;
    font-weight: bold;
}

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

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}
