@font-face {
    font-family: 'AlimamaShuHeiTi';
    src: url('https://assets-persist.lovart.ai/agent-static-assets/AlimamaShuHeiTi-Bold.otf') format('opentype');
    font-weight: bold;
}

@font-face {
    font-family: 'MiSans';
    src: url('https://assets-persist.lovart.ai/agent-static-assets/MiSans-Regular.ttf') format('truetype');
    font-weight: normal;
}

@font-face {
    font-family: 'MiSans';
    src: url('https://assets-persist.lovart.ai/agent-static-assets/MiSans-Bold.ttf') format('truetype');
    font-weight: bold;
}

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

body {
    font-family: 'MiSans', sans-serif;
    background-color: #0a0a0a;
    color: #e0e0e0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden;
    transition: color 0.5s ease;
}

.container {
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

.title {
    font-family: 'AlimamaShuHeiTi', sans-serif;
    font-size: 32px;
    color: #ff0000;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    margin-bottom: 10px;
}

.header-left {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.system-status {
    display: flex;
    align-items: center;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border: 1px solid #333;
    border-radius: 4px;
}

.threat-level-container, .power-level-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
    max-width: 400px;
}

.threat-label {
    font-weight: bold;
    color: #fff;
    font-size: 14px;
}

.threat-bar-bg {
    flex: 1;
    height: 12px;
    background: #111;
    border: 1px solid #444;
    border-radius: 2px;
    overflow: hidden;
}

.threat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff00, #ffff00, #ff0000);
    width: 0%;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.power-bar-bg {
    flex: 1;
    height: 12px;
    background: #111;
    border: 1px solid #444;
    border-radius: 2px;
    overflow: hidden;
}

.power-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ffff00, #00ff00);
    width: 100%;
    transition: width 0.2s linear;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.threat-value {
    color: #fff;
    font-family: monospace;
    font-size: 14px;
    min-width: 40px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    background-color: #00ff00;
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 2s infinite;
}

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

.camera-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.camera-feed {
    position: relative;
    border: 2px solid #333;
    border-radius: 5px;
    overflow: hidden;
    background-color: #111;
    transition: all 0.3s ease;
}

.camera-feed.scanning {
    border-color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
}

.camera-feed:hover {
    border-color: #ff0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
    cursor: pointer;
}

.camera-feed.signal-lost {
    border-color: #555;
    animation: static-pulse 0.2s infinite;
}

.camera-feed.dark-anomaly {
    border-color: #000;
    position: relative;
}

.camera-feed.dark-anomaly .camera-image {
    filter: brightness(0%);
}

/* Night vision reveals the dark anomaly */
body.night-vision .camera-feed.dark-anomaly .camera-image {
    filter: grayscale(100%) brightness(80%) sepia(100%) hue-rotate(50deg) saturate(200%) contrast(150%);
}

.camera-feed.dark-anomaly::after {
    content: "NO SIGNAL - LIGHT SENSORS OFFLINE";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-family: monospace;
    font-size: 12px;
    pointer-events: none;
    text-align: center;
}

body.night-vision .camera-feed.dark-anomaly::after {
    display: none;
}

.camera-feed.manifestation {
    border-color: #ff0000;
    animation: terror-pulse 0.5s infinite;
    box-shadow: inset 0 0 50px #ff0000;
}

@keyframes terror-pulse {
    0% { transform: scale(1); border-color: #ff0000; }
    50% { transform: scale(1.02); border-color: #ff0000; }
    100% { transform: scale(1); border-color: #ff0000; }
}

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

.camera-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    filter: grayscale(30%) contrast(120%);
    transition: filter 0.5s ease;
}

.camera-id {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ff0000;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.camera-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 8px;
    font-size: 14px;
    text-align: center;
}

.control-panel {
    background-color: #111;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 15px;
}

.control-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.control-btn {
    background-color: #222;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px 20px;
    font-family: 'MiSans', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 23%;
    min-height: 44px;
}

.control-btn i {
    margin-right: 8px;
}

.control-btn:hover:not(.disabled) {
    background-color: #333;
    border-color: #ff0000;
}

.control-btn.active {
    background-color: #ff0000;
    color: #fff;
    border-color: #ff0000;
}

.control-btn.active:hover {
    background-color: #cc0000;
}

.control-btn.disabled {
    cursor: not-allowed;
    background-color: #1a1a1a;
    color: #555;
    border-color: #333;
}

.status-panel {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #888;
}

.time-display {
    font-family: monospace;
    letter-spacing: 1px;
}

.credits-display {
    font-family: monospace;
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    letter-spacing: 1px;
    font-weight: bold;
}

.recording-status {
    color: #ff0000;
    display: flex;
    align-items: center;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background-color: #ff0000;
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 1s infinite;
}

/* Night Vision */
body.night-vision {
    color: #00ff41;
}
body.night-vision .title,
body.night-vision .camera-id,
body.night-vision .recording-status {
    color: #00ff41;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.7);
}
body.night-vision .camera-image {
    filter: grayscale(100%) brightness(80%) sepia(100%) hue-rotate(50deg) saturate(200%) contrast(150%);
}
body.night-vision .control-btn:hover:not(.disabled) {
    border-color: #00ff41;
}
body.night-vision .control-btn.active {
    background-color: #00ff41;
    color: #000;
    border-color: #00ff41;
}
body.night-vision .control-btn.active:hover {
    background-color: #00cc34;
}

/* Alarm */
#alarm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 0, 0, 0.2);
    z-index: 9000;
    pointer-events: none;
    display: none;
    animation: alarm-flash 0.5s infinite;
}
body.alarm-active #alarm-overlay {
    display: block;
}
@keyframes alarm-flash {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Jumpscare */
#jumpscare-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
#jumpscare-overlay.active {
    display: flex;
}
#jumpscare-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Terminal Overlay */
#terminal-overlay {
    background-color: black;
    color: #ff0000;
    font-family: 'Courier New', Courier, monospace;
    padding: 20px;
    font-size: 16px;
    line-height: 1.2;
    z-index: 9998; /* Below jumpscare but above everything else */
    justify-content: flex-start !important;
    align-items: flex-start !important;
    overflow: hidden;
    text-align: left;
    white-space: pre-wrap;
}

.terminal-line {
    opacity: 0;
    animation: termFadeIn 0.05s forwards;
    text-shadow: 0 0 5px red;
}

@keyframes termFadeIn {
    to { opacity: 1; }
}

/* Screen Shake */
@keyframes shake-hard {
    0% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-10px, -10px) rotate(-1deg); }
    20% { transform: translate(10px, 10px) rotate(1deg); }
    30% { transform: translate(-10px, 10px) rotate(0deg); }
    40% { transform: translate(10px, -10px) rotate(1deg); }
    50% { transform: translate(-10px, -10px) rotate(-1deg); }
    60% { transform: translate(10px, 10px) rotate(0deg); }
    70% { transform: translate(-10px, 10px) rotate(-1deg); }
    80% { transform: translate(10px, -10px) rotate(1deg); }
    90% { transform: translate(-10px, -10px) rotate(0deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.shake-screen {
    animation: shake-hard 0.5s infinite;
}

/* Glitch Effect */
body.glitch {
    animation: glitch-anim 0.2s infinite;
}

@keyframes glitch-anim {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); filter: hue-rotate(90deg); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); filter: hue-rotate(-90deg); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

/* Fullscreen Overlays */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.fullscreen-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    max-width: 600px;
    padding: 20px;
    border: 2px solid #333;
    background: #0a0a0a;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

.overlay-btn {
    background: #222;
    color: #fff;
    border: 1px solid #fff;
    padding: 15px 30px;
    font-size: 18px;
    font-family: 'AlimamaShuHeiTi', sans-serif;
    cursor: pointer;
    margin-top: 30px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.overlay-btn:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 20px #fff;
}

.gallery-section {
    width: 100%;
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 20px;
}

.gallery-title {
    color: #888;
    font-size: 14px;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.gallery-container {
    width: 100%;
    height: 150px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    scrollbar-width: thin;
    scrollbar-color: #444 #111;
}

.gallery-container::-webkit-scrollbar {
    width: 8px;
}
.gallery-container::-webkit-scrollbar-track {
    background: #111;
}
.gallery-container::-webkit-scrollbar-thumb {
    background: #444;
}

.gallery-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #222;
    transition: background 0.2s;
}

.gallery-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.gallery-info {
    text-align: left;
}

.gallery-user {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: bold;
}

.gallery-time {
    color: #666;
    font-size: 12px;
    font-family: monospace;
}

.play-replay-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 12px;
    transition: all 0.2s;
}

.play-replay-btn:hover {
    border-color: #00ffff;
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
}

.glitch-text {
    font-size: 48px;
    color: #fff;
    margin-bottom: 20px;
    position: relative;
}

.glitch-text.red {
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000;
}

.instruction {
    color: #888;
    margin-top: 10px;
    font-family: monospace;
}

/* --- CRT Effects --- */
.crt-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 8000;
    pointer-events: none;
    opacity: 0.6;
}

.scanline {
    width: 100%;
    height: 5px;
    z-index: 8002;
    background: rgba(0, 255, 0, 0.1);
    opacity: 0.4;
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    animation: scanline 6s linear infinite;
}

@keyframes scanline {
    0% { top: -5%; }
    100% { top: 105%; }
}

.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(
        circle, 
        rgba(0,0,0,0) 60%, 
        rgba(0,0,0,0.6) 100%
    );
    z-index: 8001;
    pointer-events: none;
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .camera-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    body {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .title {
        font-size: 24px;
    }

    .camera-grid {
        grid-template-columns: 1fr;
    }

    .control-buttons {
        flex-wrap: wrap;
        gap: 10px;
    }

    .control-btn {
        width: calc(50% - 5px);
        flex-grow: 1;
    }

    .status-panel {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        width: 100%;
    }
    
    .title {
        font-size: 20px;
    }
    
    .system-status span {
        font-size: 12px;
    }
}