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

body {
    font-family: 'Courier New', monospace;
    background-color: #000;
    color: #fff;
    overflow: hidden;
    line-height: 1.6;
}

.container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 30px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: opacity 0.5s ease;
}

header h1 {
    font-size: 2em;
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 0.9em;
    color: #888;
}

#ascii-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

#ascii-container pre {
    margin: 0;
    line-height: 1;
    letter-spacing: 0;
    position: relative;
    z-index: 2;
    background-color: transparent !important;
}

/* Video overlay */
#video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    z-index: 1;
    display: none;
}

#video.overlay-active {
    display: block;
}

/* Toggle button for controls */
.toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 150;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 255, 0, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.4);
    transition: all 0.3s ease;
    color: #000;
}

.toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 255, 0, 0.6);
}

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

/* Controls panel slideout */
.controls-panel {
    position: fixed;
    right: -100%;
    top: 0;
    height: 100vh;
    width: 350px;
    max-width: 85vw;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.controls-panel.active {
    right: 0;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #0f0;
}

.controls-header h3 {
    margin: 0;
    font-size: 1.5em;
    color: #0f0;
    font-family: 'Courier New', monospace;
}

.close-btn {
    background: none;
    border: none;
    color: #0f0;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.close-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    transform: rotate(90deg);
}

.controls-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.button-group .btn {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.camera-indicator {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid rgba(0, 255, 0, 0.4);
    border-radius: 12px;
    font-size: 0.85em;
    color: #0f0;
    font-weight: bold;
}

/* Overlay */
.controls-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 190;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.controls-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.btn {
    padding: 12px 24px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-primary {
    background-color: #0f0;
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    background-color: #00cc00;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #333;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #555;
    transform: translateY(-2px);
}

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

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.control-group label {
    font-size: 14px;
    white-space: nowrap;
}

.control-group input[type="range"] {
    width: 100px;
}

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

.control-group select {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 5px 10px;
    background-color: #222;
    color: #0f0;
    border: 1px solid #0f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group select:hover {
    background-color: #333;
    border-color: #00ff00;
}

.control-group select:focus {
    outline: none;
    box-shadow: 0 0 5px #0f0;
}

#resolutionValue {
    font-weight: bold;
    color: #0f0;
    min-width: 40px;
}

.error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 0, 0, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 8px;
    font-size: 16px;
    max-width: 80%;
    text-align: center;
    z-index: 200;
}

.error.hidden {
    display: none;
}

footer {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    text-align: center;
    font-size: 12px;
    color: #666;
}

footer p {
    margin: 5px 0;
}

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

footer a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    header {
        top: 10px;
        padding: 10px 20px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.8em;
    }

    /* Slide from bottom on mobile */
    .controls-panel {
        right: auto;
        left: 0;
        top: auto;
        bottom: -100%;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 80vh;
        transition: bottom 0.3s ease;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    .controls-panel.active {
        bottom: 0;
        right: auto;
    }

    .toggle-btn {
        bottom: 20px;
        right: 20px;
    }

    footer {
        bottom: 100px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.2em;
    }

    .toggle-btn {
        width: 48px;
        height: 48px;
    }

    footer {
        display: none;
    }
}

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

.btn-primary:not(:disabled) {
    animation: pulse 2s infinite;
}

.btn-primary:hover:not(:disabled) {
    animation: none;
}
