body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #111;
    color: #eee;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

h1 {
    margin: 0 0 10px 0;
    font-size: 2.2rem;
    font-weight: 500;
    background: linear-gradient(45deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.subtitle {
    margin: 0 0 25px 0;
    font-size: 0.95rem;
    color: #9ca3af;
    text-align: center;
    line-height: 1.5;
}

.container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    background: #000;
    line-height: 0;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 4/3; 
}

video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#fps {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #4ade80;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1;
    z-index: 10;
    pointer-events: none;
    min-width: 75px;
    text-align: center;
}

#status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
    z-index: 20;
    backdrop-filter: blur(8px);
    flex-direction: column;
    gap: 24px;
    transition: opacity 0.3s ease;
}

#status-content {
    text-align: center;
}

#status-text {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 24px;
}

#status-sub {
    font-size: 0.9em;
    color: #aaa;
}

.controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    align-items: center;
    background: #222;
    padding: 12px 24px;
    border-radius: 50px;
    border: 1px solid #333;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

input[type=range] {
    accent-color: #3b82f6;
    cursor: pointer;
}

#thresh-val {
    font-family: monospace;
    width: 3ch;
}

footer {
    margin-top: 30px;
    font-size: 0.8rem;
    color: #666;
}

footer a {
    color: #888;
    text-decoration: none;
    border-bottom: 1px dotted #888;
    transition: color 0.2s;
}

footer a:hover {
    color: #eee;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
