* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    font-family: 'Courier New', monospace;
    color: #fff;
    overflow: hidden;
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 0, 0.3); /* Debug border to see canvas position */
}

#controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #ff0000;
    width: 250px; /* Fixed width to prevent growing */
    max-width: 250px; /* Enforce maximum width */
}

#controls button {
    background: #ff0000;
    color: #fff;
    border: none;
    padding: 10px 15px;
    margin: 5px;
    cursor: pointer;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

#controls button:hover {
    background: #cc0000;
}

#controls button:disabled {
    background: #666;
    cursor: not-allowed;
}

#controls button.stop-mode {
    background: #cc0000;
    border: 2px solid #ff0000;
}

#controls button.stop-mode:hover {
    background: #990000;
}

#status {
    margin-top: 10px;
    font-size: 12px;
    color: #ff0000;
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide overflow text */
    text-overflow: ellipsis; /* Add ... for truncated text */
    max-width: 220px; /* Fit within controls width minus padding */
}

#cost-counter {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.cost-label {
    font-size: 10px;
    color: #ccc;
    margin-bottom: 3px;
}

.cost-amount {
    font-size: 16px;
    color: #ff0000;
    font-weight: bold;
    margin-bottom: 2px;
}

.cost-details {
    font-size: 9px;
    color: #999;
    line-height: 1.2;
    min-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

#judgments {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #ff0000;
    max-width: 300px;
    max-height: 70vh;
    overflow-y: auto;
}

.judgment {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #333;
    border-radius: 3px;
    font-size: 11px;
    line-height: 1.4;
}

.judgment .header {
    color: #ff0000;
    font-weight: bold;
    margin-bottom: 5px;
}

.judgment .content {
    color: #ccc;
}

/* Face detection circles */
.face-circle {
    border: 2px solid rgba(255, 0, 0, 0.7);
    border-radius: 50%;
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.face-label {
    position: absolute;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    border-radius: 2px;
    pointer-events: none;
    z-index: 2;
}

/* Cost warning animation */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

/* Scrolling judgment ticker */
#judgment-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: #ff0000;
    overflow: hidden;
    z-index: 15;
    display: flex;
    align-items: center;
}

#ticker-content {
    color: white;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: nowrap;
    animation: scroll-left 43.5s linear infinite;
    padding-left: 100%;
}

@keyframes scroll-left {
    0% {
        transform: translate3d(100%, 0, 0);
    }
    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

/* Big Brother decal */
#decal1 {
    position: fixed;
    bottom: 50px;
    left: -40px; /* Slightly off-screen */
    width: calc(100vh / 6 * 2.5);
    height: calc(100vh / 6 * 2.5);
    z-index: 20;
    margin: 0;
    padding: 0;
}

.decal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.5));
}