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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #fff;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 30px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #4CAF50;
}

h1 i {
    margin-right: 10px;
    color: #4CAF50;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

select, button {
    padding: 0.6rem 0.8rem;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

select {
    background: #333;
    color: #fff;
}

button {
    background: #4CAF50;
    color: white;
    min-width: 120px;
}

#settingsToggle {
    background: rgba(102, 102, 102, 0.9);
    color: white;
    min-width: 100px;
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 10;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#settingsToggle:hover:not(:disabled) {
    background: rgba(119, 119, 119, 0.95);
    transform: translateY(-2px);
}

button:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.video-container {
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
}

#videoElement {
    width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: border 0.3s ease;
    display: block;
}

#videoElement.recording {
    border: 4px solid #ff0000;
    box-shadow: 0 8px 32px rgba(255, 0, 0, 0.5), 0 0 20px rgba(255, 0, 0, 0.3);
}

.frames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.frame-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #333;
    aspect-ratio: 16/9;
}

.frame-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-timestamp {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 4px;
}

.status {
    text-align: center;
    padding: 20px;
    background: #333;
    border-radius: 8px;
    margin-top: 20px;
}

.status.recording {
    background: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .frames-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
}

.fullscreen-image {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.1);
}

.settings-panel {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #2a2a2a;
    border-radius: 8px;
    margin-top: 15px;
}

.settings-panel.collapsed {
    display: none;
}

.settings-panel:not(.collapsed) {
    max-height: 200px;
}

.settings-content {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

#toggleBtn {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 10;
    background: rgba(76, 175, 80, 0.9);
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#toggleBtn:hover:not(:disabled) {
    background: rgba(69, 160, 73, 0.95);
    transform: translateY(-2px);
}
