* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Courier New', monospace;
}

body {
    background-color: #000;
    color: #fff;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.main-display {
    flex: 7;
    position: relative;
    background-color: #0a0a0a;
    overflow: hidden;
}

.side-panel {
    flex: 3;
    background-color: rgba(17, 17, 17, 0.9);
    padding: 10px;
    display: flex;
    flex-direction: column;
    border-left: 2px solid rgba(0, 180, 255, 0.8);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
}

.settings-panel {
    padding: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0, 180, 255, 0.6);
}

#camera-select {
    background-color: rgba(20, 20, 20, 0.8);
    color: #fff;
    border: 1px solid rgba(0, 180, 255, 0.6);
    padding: 5px;
    margin-top: 5px;
    width: 100%;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 5px rgba(0, 180, 255, 0.3);
    margin-bottom: 5px;
}

.restart-button {
    background-color: rgba(20, 20, 20, 0.8);
    color: rgba(0, 180, 255, 0.9);
    border: 1px solid rgba(0, 180, 255, 0.6);
    padding: 5px;
    width: 100%;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 180, 255, 0.3);
    transition: all 0.2s ease;
    margin-bottom: 5px;
}

.restart-button:hover {
    background-color: rgba(0, 180, 255, 0.2);
}

.enhance-button {
    background-color: rgba(20, 30, 25, 0.8);
    color: rgba(0, 255, 170, 0.9);
    border: 1px solid rgba(0, 255, 170, 0.6);
    box-shadow: 0 0 8px rgba(0, 255, 170, 0.4);
    font-weight: bold;
    animation: pulse-enhance 2s infinite;
}

.enhance-button:hover {
    background-color: rgba(0, 255, 170, 0.2);
    transform: scale(1.02);
}

@keyframes pulse-enhance {
    0% { box-shadow: 0 0 5px rgba(0, 255, 170, 0.3); }
    50% { box-shadow: 0 0 15px rgba(0, 255, 170, 0.7); }
    100% { box-shadow: 0 0 5px rgba(0, 255, 170, 0.3); }
}

.camera-debug {
    position: absolute;
    bottom: 60px;
    left: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 255, 0, 0.5);
    padding: 5px 10px;
    font-size: 12px;
    color: rgba(0, 255, 0, 0.9);
    z-index: 50;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    font-family: 'Courier New', monospace;
    pointer-events: none;
}

.camera-debug .camera-name {
    display: flex;
    align-items: center;
}

.camera-debug #current-camera {
    display: inline-block;
    margin-left: 5px;
    font-weight: bold;
    color: rgba(0, 255, 200, 1);
}

.camera-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.error-message {
    background-color: rgba(20, 20, 20, 0.9);
    border: 2px solid rgba(255, 50, 50, 0.8);
    padding: 20px;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.5);
    z-index: 9999;
}

.error-message h3 {
    color: rgba(255, 50, 50, 0.9);
    margin-bottom: 10px;
    animation: pulse-text 1.5s infinite;
}

.error-message p {
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
}

#retry-camera {
    background-color: rgba(20, 20, 20, 0.8);
    color: rgba(0, 180, 255, 0.9);
    border: 1px solid rgba(0, 180, 255, 0.6);
    padding: 8px 15px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 180, 255, 0.3);
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: bold;
    animation: pulse-button 2s infinite;
}

#retry-camera:hover {
    background-color: rgba(0, 180, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.6);
}

.help-message {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes pulse-text {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

@keyframes pulse-button {
    0% { box-shadow: 0 0 5px rgba(0, 180, 255, 0.3); }
    50% { box-shadow: 0 0 15px rgba(0, 180, 255, 0.7); }
    100% { box-shadow: 0 0 5px rgba(0, 180, 255, 0.3); }
}

.camera-feed {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.camera-debug {
    display: none; /* Hide camera debug info */
}

video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) brightness(90%) contrast(130%) sepia(0%) hue-rotate(200deg);
    mix-blend-mode: screen;
    opacity: 0.85;
}

/* Anon-style grid overlay */
.camera-feed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(transparent 98%, rgba(0, 180, 255, 0.3) 100%),
        linear-gradient(90deg, transparent 98%, rgba(0, 180, 255, 0.3) 100%),
        linear-gradient(45deg, transparent 98.5%, rgba(0, 220, 255, 0.15) 100%),
        linear-gradient(135deg, transparent 98.5%, rgba(0, 220, 255, 0.15) 100%);
    background-size: 40px 40px, 40px 40px, 100px 100px, 100px 100px;
    z-index: 1;
    pointer-events: none;
}

/* Anon-style measurement lines and overlay markers */
.camera-feed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        /* Corner brackets */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100' fill='none'%3E%3Cpath d='M0 20L0 0L20 0M80 0L100 0L100 20M100 80L100 100L80 100M20 100L0 100L0 80' stroke='rgba(0,180,255,0.8)' stroke-width='1'/%3E%3C/svg%3E"),
        /* Horizontal measurement line */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='20' viewBox='0 0 200 20' fill='none'%3E%3Cpath d='M0 10L200 10' stroke='rgba(0,220,255,0.5)' stroke-width='1' stroke-dasharray='5,5'/%3E%3Cpath d='M0 10L0 5M20 10L20 7M40 10L40 7M60 10L60 7M80 10L80 7M100 10L100 5M120 10L120 7M140 10L140 7M160 10L160 7M180 10L180 7M200 10L200 5' stroke='rgba(0,220,255,0.5)' stroke-width='1'/%3E%3C/svg%3E"),
        /* Vertical measurement line */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='200' viewBox='0 0 20 200' fill='none'%3E%3Cpath d='M10 0L10 200' stroke='rgba(0,220,255,0.5)' stroke-width='1' stroke-dasharray='5,5'/%3E%3Cpath d='M10 0L5 0M10 20L7 20M10 40L7 40M10 60L7 60M10 80L7 80M10 100L5 100M10 120L7 120M10 140L7 140M10 160L7 160M10 180L7 180M10 200L5 200' stroke='rgba(0,220,255,0.5)' stroke-width='1'/%3E%3C/svg%3E");
    background-position: 
        center center,
        center 20%, 
        80% center;
    background-repeat: no-repeat;
    opacity: 0.7;
    z-index: 3;
    pointer-events: none;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* Scanning line effects */
.scan-line-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    overflow: hidden;
    pointer-events: none;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(0, 180, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.9);
    z-index: 20;
    transform-origin: center;
    animation: scan-top-bottom 12s linear infinite; /* 4x slower (was 3s) */
}

.scan-line-horizontal {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background-color: rgba(0, 180, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 180, 255, 0.9);
    z-index: 20;
    transform-origin: center;
    animation: scan-left-right 12s linear infinite; /* 4x slower (was 3s) */
}

.scan-trail {
    position: absolute;
    background: linear-gradient(to bottom, rgba(0, 180, 255, 0), rgba(0, 180, 255, 0.2), rgba(0, 180, 255, 0));
    opacity: 0.3;
    z-index: 15;
}

.horizontal-trail {
    background: linear-gradient(to right, rgba(0, 180, 255, 0), rgba(0, 180, 255, 0.2), rgba(0, 180, 255, 0));
}

.scan-intersection {
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, rgba(0, 220, 255, 0.8) 0%, rgba(0, 180, 255, 0.5) 40%, rgba(0, 180, 255, 0) 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    pointer-events: none;
}

/* Slow down the scanning animations by 75% */
@keyframes scan-top-bottom {
    0% { top: 0; }
    50% { top: 100%; }
    50.1% { top: 100%; }
    100% { top: 0; }
    animation-duration: 12s; /* 4x slower */
}

@keyframes scan-left-right {
    0% { left: 0; }
    50% { left: 100%; }
    50.1% { left: 100%; }
    100% { left: 0; }
    animation-duration: 12s; /* 4x slower */
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    z-index: 30;
}

.top-left {
    top: 15px;
    left: 15px;
    border-right: none;
    border-bottom: none;
}

.top-right {
    top: 15px;
    right: 15px;
    border-left: none;
    border-bottom: none;
}

.bottom-left {
    bottom: 15px;
    left: 15px;
    border-right: none;
    border-top: none;
}

.bottom-right {
    bottom: 15px;
    right: 15px;
    border-left: none;
    border-top: none;
}

/* Anon-style identity frame and markers */
.identity-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25;
}

.identity-frame-top, .identity-frame-bottom, .identity-frame-left, .identity-frame-right {
    position: absolute;
    background-color: rgba(0, 220, 255, 0.1);
    border: 1px solid rgba(0, 220, 255, 0.3);
}

.identity-frame-top, .identity-frame-bottom {
    height: 40px;
    width: 60%;
    left: 20%;
}

.identity-frame-top {
    top: 40px;
    border-bottom: none;
}

.identity-frame-bottom {
    bottom: 40px;
    border-top: none;
}

.identity-frame-left, .identity-frame-right {
    width: 40px;
    height: 60%;
    top: 20%;
}

.identity-frame-left {
    left: 40px;
    border-right: none;
}

.identity-frame-right {
    right: 40px;
    border-left: none;
}

.identity-marker {
    position: absolute;
    font-size: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: rgba(0, 220, 255, 0.9);
    padding: 3px 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    z-index: 26;
}

.top-marker {
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    border-top: 1px solid rgba(0, 220, 255, 0.5);
    border-left: 1px solid rgba(0, 220, 255, 0.5);
    border-right: 1px solid rgba(0, 220, 255, 0.5);
}

.bottom-marker {
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom: 1px solid rgba(0, 220, 255, 0.5);
    border-left: 1px solid rgba(0, 220, 255, 0.5);
    border-right: 1px solid rgba(0, 220, 255, 0.5);
}

.hud-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
    padding: 20px;
}

.hud {
    position: absolute;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 0 5px rgba(0, 180, 255, 0.9);
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border: 1px solid rgba(0, 180, 255, 0.6);
    max-width: 300px;
    backdrop-filter: blur(2px);
    box-shadow: 0 0 10px rgba(0, 180, 255, 0.3);
}

.top-left {
    top: 20px;
    left: 20px;
}

.top-right {
    top: 20px;
    right: 20px;
    text-align: right;
}

.bottom-left {
    bottom: 20px;
    left: 20px;
}

.bottom-right {
    bottom: 20px;
    right: 20px;
    width: 35%;
    max-height: 350px;
    overflow: hidden;
}

.agency {
    text-align: right;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 180, 255, 0.7);
    font-weight: bold;
    font-size: 16px;
}

.unit {
    text-align: right;
    letter-spacing: 1px;
    font-size: 12px;
    color: rgba(255, 160, 0, 0.9);
    text-shadow: 0 0 5px rgba(255, 120, 0, 0.7);
}

.code-terminal {
    font-size: 10px;
    line-height: 1.2;
    height: 100%;
    overflow: hidden;
    color: rgba(0, 180, 255, 0.9);
    text-shadow: 0 0 5px rgba(0, 180, 255, 0.5);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 180, 255, 0.3);
    padding: 8px;
}

.cobol-terminal-container {
    position: absolute;
    top: 150px;
    right: 20px;
    width: 300px;
    height: 250px; /* Increased from 150px to 250px for more vertical content */
    text-align: left;
    padding: 0;
    overflow: hidden;
}

.cobol-header {
    background-color: rgba(30, 30, 30, 0.8);
    color: #ffcc00;
    text-shadow: 0 0 5px rgba(255, 160, 0, 0.7);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 160, 0, 0.5);
    letter-spacing: 1px;
}

.cobol-terminal {
    font-size: 10px;
    line-height: 1.2;
    height: calc(100% - 25px);
    overflow: hidden;
    color: #ffcc00;
    background-color: rgba(0, 0, 0, 0.3);
    text-shadow: 0 0 5px rgba(255, 160, 0, 0.7);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    padding: 5px;
}

.lowlevel-terminal-container {
    position: absolute;
    top: 420px; /* Adjusted to not overlap with COBOL terminal */
    right: 20px;
    width: 300px;
    height: 250px; /* Increased from 150px to 250px for more vertical content */
    text-align: left;
    padding: 0;
    overflow: hidden;
    z-index: 45;
}

.lowlevel-header {
    background-color: rgba(20, 20, 20, 0.9);
    color: #ff3300;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.7);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 0, 0, 0.5);
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.lowlevel-terminal {
    font-size: 9px;
    line-height: 1.2;
    height: calc(100% - 25px);
    overflow: hidden;
    color: #ff5500;
    background-color: rgba(10, 10, 10, 0.8);
    text-shadow: 0 0 5px rgba(255, 51, 0, 0.5);
    font-family: 'Consolas', 'Courier New', monospace;
    letter-spacing: 0.5px;
    padding: 5px;
    border-left: 1px solid rgba(255, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 0, 0, 0.3);
}

.database-header {
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 180, 255, 0.8);
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(0, 180, 255, 0.7);
}

.database-container {
    overflow-y: auto;
    flex-grow: 1;
    padding: 0;
    position: relative;
    height: calc(100vh - 170px); /* Maximum vertical space */
    max-height: none; /* Remove any max height restrictions */
    scrollbar-width: none; /* Hide scrollbar in Firefox */
    -ms-overflow-style: none; /* Hide scrollbar in IE/Edge */
    background-color: rgba(10, 10, 10, 0.8); /* Dark background */
}

/* Hide scrollbar in Chrome, Safari and Opera */
.database-container::-webkit-scrollbar {
    display: none;
}

/* Create overlay effect with scan lines */
.database-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0),
        rgba(0, 0, 0, 0) 3px,
        rgba(0, 180, 255, 0.05) 4px
    );
    pointer-events: none;
    z-index: 10;
}

/* Face grid image */
.database-grid-image {
    display: block;
    width: 100%;
    height: auto;
    position: relative;
}

/* Scrolling face panel */
.database-scroll-container {
    position: relative;
    width: 100%; 
    overflow: hidden;
}

.database-face {
    width: 100%;
    aspect-ratio: 1/1;
    background-color: rgba(30, 30, 30, 0.8);
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 180, 255, 0.4);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.database-face::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 180, 255, 0.05) 0%,
        rgba(0, 0, 0, 0) 100%
    );
    z-index: 2;
}

.database-face.highlight {
    border: 2px solid rgba(0, 220, 255, 0.9);
    box-shadow: 0 0 8px rgba(0, 180, 255, 0.8);
    transform: scale(1.05);
    z-index: 5;
}

.database-face.primary-match {
    border: 3px solid rgba(0, 255, 220, 0.9);
    box-shadow: 0 0 12px rgba(0, 255, 220, 0.7);
    transform: scale(1.08);
    z-index: 6;
}

.database-face.secondary-match {
    border: 2px solid rgba(0, 180, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 180, 255, 0.6);
    transform: scale(1.05);
    z-index: 5;
}

.analyzing {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 180, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    letter-spacing: 0.5px;
    animation: pulse 0.5s infinite;
    text-shadow: 0 0 3px rgba(0, 180, 255, 0.9);
    z-index: 3;
}

.scanning-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 10%;
    background-color: rgba(0, 220, 255, 0.2);
    animation: scan-database-face 0.5s linear infinite;
    z-index: 4;
    pointer-events: none;
}

@keyframes scan-database-face {
    0% { top: 0; }
    100% { top: 90%; }
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 0.8; }
    100% { opacity: 0.4; }
}

.match-probability {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: rgba(0, 220, 255, 0.9);
    font-size: 7px;
    padding: 2px;
    z-index: 5;
}

.criminal-label {
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(255, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.9);
    font-size: 7px;
    font-weight: bold;
    padding: 2px 4px;
    z-index: 5;
    animation: pulse-warning 1.5s infinite;
    letter-spacing: 0.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.threat-level {
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    font-size: 7px;
    font-weight: bold;
    padding: 2px 4px;
    z-index: 5;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.crime-type {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffcc33;
    font-size: 7px;
    padding: 2px 4px;
    z-index: 5;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

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

.match-info {
    padding: 10px;
    text-align: center;
    border-top: 1px solid rgba(0, 180, 255, 0.8);
    margin-top: 10px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px rgba(0, 180, 255, 0.7);
}

/* FPS meter styling */
#fps-meter {
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.7);
}

/* Enhanced scrolling animation for faces in the grid */
.scrolling {
    animation: scroll-effect 0.3s infinite; /* Slightly slower for better visibility */
    background-size: cover !important;
    box-shadow: 0 0 10px rgba(0, 180, 255, 0.5);
}

@keyframes scroll-effect {
    0% { transform: translateY(0) scale(1); filter: brightness(1); }
    25% { transform: translateY(-1px) scale(1.02); filter: brightness(1.1); }
    50% { transform: translateY(-3px) scale(1.04); filter: brightness(1.2); }
    75% { transform: translateY(-1px) scale(1.02); filter: brightness(1.1); }
    100% { transform: translateY(0) scale(1); filter: brightness(1); }
}