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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2rem;
    color: #666;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e53e3e;
    color: white;
}

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

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

.sound-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.sound-toggle input {
    cursor: pointer;
}

.sound-select {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.sound-select:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.session-log {
    background: #f7fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.log-header h3 {
    color: #667eea;
    margin: 0;
}

.log-reset-info {
    font-size: 0.8rem;
    color: #718096;
}

.log-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.stat {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #e53e3e;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #718096;
    margin-top: 4px;
}

.log-entries {
    max-height: 120px;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    padding: 10px;
}

.log-entry {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #4a5568;
}

.log-entry:nth-child(odd) {
    background: #f7fafc;
}

.log-entry-time {
    color: #718096;
    font-family: monospace;
}

.log-entry-duration {
    font-weight: 600;
    color: #e53e3e;
}

.log-empty {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 10px;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 30px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

#webcam, #canvas {
    width: 100%;
    height: auto;
    display: block;
}

#webcam {
    transform: scaleX(-1); /* Mirror effect */
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform: scaleX(-1); /* Mirror effect */
}

.alert-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(229, 62, 62, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: pulse 1s infinite;
}

.alert-overlay.active {
    display: flex;
}

@keyframes pulse {
    0%, 100% {
        background: rgba(229, 62, 62, 0.6);
    }
    50% {
        background: rgba(229, 62, 62, 0.8);
    }
}

.alert-text {
    font-size: 3rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

.duration-text {
    font-size: 1.5rem;
    color: white;
    margin-top: 10px;
    font-weight: 600;
}

.status-indicator {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #48bb78;
}

.status-dot.touching {
    background: #f56565;
    animation: blink 0.5s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.settings {
    background: #f7fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.settings h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
}

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

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

.info {
    background: #edf2f7;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.info h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.info ol {
    margin-left: 20px;
    margin-bottom: 15px;
    line-height: 1.8;
}

.info ol li {
    margin-bottom: 8px;
}

.privacy-note {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #48bb78;
    font-size: 0.9rem;
    color: #2d3748;
}

footer {
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

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

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .alert-text {
        font-size: 2rem;
    }

    .container {
        padding: 20px;
    }
}
