* {
    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;
    touch-action: none;
}

.container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#video {
    display: none;
}

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

.settings-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.controls-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    width: 200px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.controls-panel.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

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

.control-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    color: #fff;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #f0f0f0;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    vertical-align: middle;
}

.button {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.button:active {
    transform: translateY(0);
}

.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 38, 38, 0.95);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    display: none;
    z-index: 2000;
    max-width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 16px;
    z-index: 2000;
    display: none;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.bottom-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 900;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

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

#videoBtn.recording {
    background: rgba(220, 38, 38, 0.9);
    animation: pulse 1s infinite;
}

.install-prompt {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: none;
}

.install-prompt.visible {
    display: block;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.install-content span {
    font-size: 14px;
    font-weight: 500;
}

.install-buttons {
    display: flex;
    gap: 10px;
}

.install-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#installBtn {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
}

#installBtn:hover {
    background: #fff;
    transform: translateY(-2px);
}

#dismissInstall {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 32px;
    padding: 8px;
}

#dismissInstall:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Scrollbar styling for controls panel */
.controls-panel::-webkit-scrollbar {
    width: 8px;
}

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

.controls-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .controls {
        top: 10px;
        right: 10px;
    }

    .controls-panel {
        right: -10px;
        min-width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
    }

    .toggle-controls {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}
