:root {
    --cyan: #00f3ff;
    --blue: #0066ff;
    --green: #00ff66;
    --dark: #010204;
    --panel-bg: rgba(6, 11, 20, 0.9);
    --border: rgba(0, 243, 255, 0.3);
    --primary: var(--cyan);
    --primary-glow: rgba(0, 243, 255, 0.4);
    --bg-dark: var(--dark);
    --glass-bg: var(--panel-bg);
    --glass-border: var(--border);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --success: var(--green);
    --warning: #f1c40f;
    --danger: #ff4b2b;
    --font-main: 'Rajdhani', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-orbitron: 'Orbitron', sans-serif;
    --input-bg: rgba(0,0,0,0.3);
    --input-border: #345;
}

body.light-mode {
    --bg-dark: #f0f2f5;
    --panel-bg: #ffffff;
    --text: #1a1f26;
    --text-dim: #4b5563;
    --primary: #2563eb; /* Strong Medical Blue */
    --primary-glow: rgba(37, 99, 235, 0.1);
    --border: #d1d5db;
    --glass-bg: #ffffff;
    --glass-border: #e5e7eb;
    --input-bg: #f9fafb;
    --input-border: #d1d5db;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --cyan: #2563eb;
}

body.light-mode {
    background-color: var(--bg-dark) !important;
    color: var(--text) !important;
}

/* Explicit text visibility in light mode */
body.light-mode h1, 
body.light-mode h2, 
body.light-mode h3, 
body.light-mode .ai-title, 
body.light-mode .num-val,
body.light-mode strong {
    color: var(--text) !important;
    text-shadow: none !important;
}

body.light-mode p, 
body.light-mode label, 
body.light-mode span:not(.verdict-badge), 
body.light-mode div:not(.verdict-badge), 
body.light-mode td, 
body.light-mode small {
    color: var(--text-dim) !important;
    text-shadow: none !important;
}

body.light-mode .ai-sub {
    color: var(--primary) !important;
    font-weight: 600;
}

/* Panel Overrides */
body.light-mode .glass, 
body.light-mode .panel, 
body.light-mode .cyber-panel {
    background: #ffffff !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* Video Player Labels & Overlays - HIGH CONTRAST */
body.light-mode .video-viewing-overlay {
    background: rgba(26, 31, 38, 0.9) !important; /* Dark background for label */
    color: #ffffff !important;
}
body.light-mode .video-viewing-overlay span {
    color: #ffffff !important;
}
body.light-mode #currentEvidenceText {
    color: var(--cyan) !important;
    font-weight: bold;
}

/* Hover States for Buttons */
body.light-mode .btn-icon {
    background: #ffffff !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}
body.light-mode .btn-icon:hover {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}
body.light-mode .btn-icon:hover .icon {
    color: #ffffff !important;
}

/* Table Readability */
body.light-mode .acls-table th {
    background: #f3f4f6 !important;
    color: var(--text) !important;
    border-bottom: 2px solid var(--border) !important;
}
body.light-mode .acls-table td {
    border-bottom: 1px solid #f3f4f6 !important;
    color: var(--text) !important;
}
body.light-mode .acls-table tr:hover {
    background: #f9fafb !important;
}

/* Input Clarity */
body.light-mode input, 
body.light-mode select, 
body.light-mode textarea {
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text) !important;
}
body.light-mode input:focus {
    border-color: var(--primary) !important;
    background: #ffffff !important;
}

/* DNA / Neural link clarity */
body.light-mode .node-tag {
    background: #1a1f26 !important;
    color: #ffffff !important;
    border: none !important;
}
body.light-mode .node-dot {
    background: var(--primary) !important;
}

/* Status Messages in scanning */
body.light-mode #loadingStatus {
    color: var(--primary) !important;
    font-weight: 700;
}

/* Footer Visibility */
body.light-mode footer {
    background: #e5e7eb !important;
    color: var(--text-dim) !important;
    border-top: 1px solid var(--border) !important;
}


body.light-mode {
    color: var(--text) !important;
    background: var(--bg-dark) !important;
}

/* Force dark text on everything in light mode */
body.light-mode * {
    color: inherit;
    text-shadow: none !important;
}

body.light-mode .glass,
body.light-mode .panel,
body.light-mode .ai-panel,
body.light-mode .vitals-panel,
body.light-mode .form-panel,
body.light-mode .cyber-panel {
    background: var(--panel-bg) !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    color: var(--text) !important;
}

body.light-mode .ai-title,
body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode .num-val,
body.light-mode .timeline-time {
    color: var(--primary) !important;
}

body.light-mode .num-label,
body.light-mode .ai-sub,
body.light-mode p,
body.light-mode label,
body.light-mode .data-row,
body.light-mode .text-dim,
body.light-mode small {
    color: var(--text-dim) !important;
}

body.light-mode input,
body.light-mode select,
body.light-mode textarea {
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text) !important;
}

body.light-mode input::placeholder {
    color: #94a3b8 !important;
}

body.light-mode .btn-go {
    background: var(--primary) !important;
    color: #ffffff !important;
}

body.light-mode .btn-icon:hover {
    background: #f1f5f9 !important;
    border-color: var(--primary) !important;
}

body.light-mode .close-modal,
body.light-mode .close-modal-reasoning,
body.light-mode .close-modal-config {
    color: var(--text-dim) !important;
}

body.light-mode .close-modal:hover,
body.light-mode .close-modal-reasoning:hover,
body.light-mode .close-modal-config:hover {
    color: var(--primary) !important;
}

body.light-mode .acls-table th {
    background: #f1f5f9 !important;
    color: var(--primary) !important;
    border-bottom: 2px solid #cbd5e1 !important;
}

body.light-mode .acls-table td {
    color: var(--text) !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

body.light-mode .acls-table tr:hover {
    background: #f8fafc !important;
}

body.light-mode .timeline-item {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-left: 4px solid var(--primary) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

body.light-mode .timeline-event {
    color: var(--text) !important;
}

body.light-mode .handbook-quote {
    background: #f1f7ff !important;
    border-left: 4px solid var(--primary) !important;
    color: #1e293b !important;
}

body.light-mode footer {
    border-top: 1px solid #cbd5e1 !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
    opacity: 1 !important;
}

body.light-mode .separator {
    color: #cbd5e1 !important;
}

body.light-mode #bg-canvas {
    display: none !important;
}

body.light-mode .dna-node .node-dot {
    background: var(--primary) !important;
    box-shadow: 0 0 10px rgba(0, 86, 210, 0.4) !important;
}

body.light-mode .dna-node .node-tag {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text) !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
}

body.light-mode .dna-node .node-line {
    background: #cbd5e1 !important;
}

body.light-mode .helix-spine {
    background: #cbd5e1 !important;
    box-shadow: none !important;
    opacity: 0.5 !important;
}

body.light-mode .ai-reticle::after {
    background: var(--primary) !important;
    box-shadow: none !important;
}

body.light-mode .doc-holo {
    filter: drop-shadow(0 0 10px rgba(0, 86, 210, 0.2)) !important;
}

body.light-mode .scanner-container,
body.light-mode .medical-hud-player {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

body.light-mode .scan-line {
    background: var(--primary) !important;
    box-shadow: 0 0 10px var(--primary) !important;
}

body.light-mode .scanner-container,
body.light-mode .medical-hud-player {
    background: #f1f5f9 !important;
    border: 2px solid #cbd5e1 !important;
}

body.light-mode .player-overlay {
    background: rgba(255, 255, 255, 0.05) !important;
}


body.light-mode .doc-holo img {
    filter: brightness(1.1) contrast(1.1) grayscale(0.2) !important;
}

body.light-mode .ai-reticle {
    border-color: rgba(0, 86, 210, 0.2) !important;
}

body.light-mode .ai-reticle::after {
    background: var(--primary) !important;
    box-shadow: 0 0 10px rgba(0, 86, 210, 0.4) !important;
}

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

body {
    margin: 0;
    background: var(--dark);
    font-family: var(--font-main);
    color: white;
    user-select: none;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
}

.app-container {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
    padding: 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* --- LANDING UI (3 COLUMNS) --- */
.main-ui {
    display: grid;
    grid-template-columns: 450px 1fr 420px;
    gap: 25px;
    min-height: 85vh;
    margin-top: 5vh;
}

/* --- LEFT COLUMN --- */
.col-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.ai-panel {
    flex: 1.5;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-top: 3px solid var(--cyan);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ai-header {
    padding: 12px 20px;
    background: linear-gradient(0deg, rgba(0, 243, 255, 0.1), transparent);
    border-top: 1px solid rgba(0, 243, 255, 0.1);
    z-index: 5;
}

.ai-title {
    font-family: var(--font-orbitron);
    font-size: 1.2rem;
    color: var(--cyan);
    letter-spacing: 1px;
}

.ai-sub {
    font-size: 0.8rem;
    color: #88aaff;
    letter-spacing: 2px;
}

.brain-viz {
    flex-grow: 1;
    position: relative;
    background: radial-gradient(circle at center, rgba(0, 243, 255, 0.05), transparent 70%);
}

#brain-container {
    width: 100%;
    height: 100%;
}

.ai-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    border: 1px dashed rgba(0, 243, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    animation: spinReticle 10s linear infinite;
}

.ai-reticle::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
}

@keyframes spinReticle {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.doc-holo {
    position: absolute;
    bottom: 0px;
    left: 10px;
    width: 250px;
    opacity: 0.85;
    filter: drop-shadow(0 0 15px var(--cyan));
    z-index: 2;
    pointer-events: none;
    animation:
        holoFloat 4s ease-in-out infinite,
        holoGlow 3s ease-in-out infinite,
        holoFlicker 5s linear infinite;
}

.doc-holo img {
    width: 100%;
    height: auto;
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

@keyframes holoFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.01);
    }
}

@keyframes holoGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 15px var(--cyan)) brightness(1);
    }

    50% {
        filter: drop-shadow(0 0 30px var(--cyan)) brightness(1.3);
    }
}

@keyframes holoFlicker {

    0%,
    100% {
        opacity: 0.85;
    }

    31% {
        opacity: 0.85;
    }

    32% {
        opacity: 0.7;
    }

    33% {
        opacity: 0.85;
    }

    34% {
        opacity: 0.9;
    }

    35% {
        opacity: 0.85;
    }

    80% {
        opacity: 0.85;
    }

    81% {
        opacity: 1;
    }

    82% {
        opacity: 0.85;
    }
}

.ai-data-overlay {
    position: absolute;
    top: 10px;
    right: 20px;
    text-align: right;
    font-family: var(--font-orbitron);
    font-size: 0.7rem;
    color: var(--green);
}

.neural-sync { color: var(--cyan); }
.status-online { color: var(--green); }

.blink {
    animation: blink 0.5s infinite;
}

/* Vitals */
.vitals-panel {
    flex: 0.8;
    background: #000;
    border: 1px solid #333;
    border-bottom: 3px solid var(--green);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.monitor-grid {
    display: flex;
    height: 100%;
}

.wave-area {
    width: 65%;
    position: relative;
    border-right: 1px solid #222;
}

#waveCanvas {
    width: 100%;
    height: 100%;
}

.numeric-area {
    width: 35%;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    padding: 10px;
}

.num-box {
    text-align: right;
}

.num-label {
    font-size: 0.7rem;
    color: #666;
    font-weight: bold;
}

.num-val {
    font-family: var(--font-orbitron);
    font-size: 2.2rem;
    line-height: 1;
}

.c-ecg {
    color: var(--green);
    text-shadow: 0 0 5px rgba(0, 255, 100, 0.3);
}

.c-spo2 {
    color: var(--cyan);
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.3);
}

/* --- BUTTONS --- */
.header-actions {
    display: flex;
    gap: 12px;
}

.btn-icon {
    position: relative;
    background: rgba(10, 20, 35, 0.4);
    /* More transparent */
    border: 1px solid rgba(0, 243, 255, 0.2);
    color: var(--cyan);
    padding: 6px 14px;
    /* More compact */
    border-radius: 2px;
    /* Sharper corners */
    cursor: pointer;
    font-family: var(--font-orbitron);
    font-weight: 700;
    font-size: 0.65rem;
    /* Smaller text */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.05);
}

.btn-icon:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--cyan);
    color: #fff;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    transform: translateY(-1px);
}

.icon {
    font-size: 1rem;
}

/* --- PANEL BOXES --- */
.panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 12px 20px;
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.1), transparent);
    border-bottom: 1px solid rgba(0, 243, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2,
.panel-header h3 {
    font-family: var(--font-orbitron);
    font-size: 0.9rem;
    color: var(--cyan);
    margin: 0;
    letter-spacing: 2px;
}

.panel-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* --- CENTER: DNA --- */
.col-center {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 800px;
    overflow: visible;
}

.helix-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--cyan), transparent);
    box-shadow: 0 0 15px var(--cyan);
    opacity: 0.5;
}

.dna-container {
    width: 100%;
    height: 80%;
    position: relative;
    transform-style: preserve-3d;
}

.dna-node {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    align-items: center;
    transform-style: preserve-3d;
}

.node-dot {
    width: 8px;
    height: 8px;
    background: var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--cyan);
}

.node-line {
    height: 1px;
    width: 30px;
    background: var(--cyan);
    opacity: 0.5;
}

.node-tag {
    background: rgba(0, 20, 40, 0.9);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
}

/* --- RIGHT: FORM --- */
.col-right {
    align-self: center;
}

.form-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    padding: 35px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
}

.form-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    animation: scanBorder 2.5s infinite ease-in-out;
}

@keyframes scanBorder {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.form-head h1 {
    font-family: var(--font-orbitron);
    margin: 0;
    font-size: 1.8rem;
    color: white;
}

.form-head p {
    color: var(--cyan);
    font-size: 0.75rem;
    letter-spacing: 3px;
    margin-bottom: 25px;
}

.inp-grp {
    margin-bottom: 20px;
}

.inp-grp label {
    display: block;
    color: #68a;
    font-size: 0.75rem;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.inp-grp input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #345;
    padding: 12px;
    color: white;
    font-family: var(--font-main);
    font-size: 1rem;
    box-sizing: border-box;
    transition: 0.3s;
}

.inp-grp input:focus {
    border-color: var(--cyan);
    background: rgba(0, 243, 255, 0.05);
    outline: none;
}

.upload-box {
    border: 1px dashed #446;
    padding: 20px;
    text-align: center;
    color: #889;
    cursor: pointer;
    transition: 0.3s;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
}

.upload-box:hover {
    border-color: var(--cyan);
    color: white;
    background: rgba(0, 243, 255, 0.05);
}

.btn-go {
    width: 100%;
    padding: 15px;
    background: var(--cyan);
    border: none;
    font-family: var(--font-orbitron);
    font-weight: 700;
    cursor: pointer;
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    transition: 0.3s;
    font-size: 0.9rem;
    color: var(--dark);
}

.btn-go:hover {
    background: white;
    box-shadow: 0 0 30px var(--cyan);
    letter-spacing: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0
    }
}

/* Results Grid Styles */
.workspace {
    flex: 1;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: auto;
}


.timeline-panel {
    grid-area: timeline;
    display: flex;
    flex-direction: column;
}

.checkpoint-panel {
    grid-area: table;
    display: flex;
    flex-direction: column;
}

.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 4px;
    /* Sharper HUD corners */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    position: relative;
}

/* Cyber Corner Utilities for Results Panels */
.cyber-panel::before,
.cyber-panel::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid var(--cyan);
    pointer-events: none;
    z-index: 10;
}

.cyber-panel::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.cyber-panel::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

/* Processing */
.scanner-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 2rem;
}

.scanner-container {
    width: 60%;
    aspect-ratio: 16/9;
    background: #000;
    border: 1px solid var(--cyan);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

.scanner-active-bar {
    width: 100%;
    height: 100%;
    background-size: 200% 100% !important;
    background-position: 100% 0;
    animation: scannerMoving 1.5s linear infinite !important;
}

@keyframes scannerMoving {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

/* --- CUSTOM AI VIDEO PLAYER --- */
.medical-hud-player {
    width: 100%;
    /* Fill container width */
    height: auto;
    aspect-ratio: 16/9;
    /* Force aspect ratio */
    margin: 1rem auto;
    background: #000;
    position: relative;
    border: 2px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

#resultPlayer {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Prevent stretching */
}

.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    padding: 10px;
    opacity: 0;
    transition: 0.3s;
    z-index: 20;
}

.medical-hud-player:hover .custom-controls {
    opacity: 1;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    box-shadow: 0 0 10px var(--primary);
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hud-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
}

.hud-btn:hover {
    transform: scale(1.2);
    text-shadow: 0 0 10px var(--primary);
}

.time-display {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    /* Increased size */
    color: var(--text-dim);
}

/* --- SCORE DIAL --- */
.score-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.score-dial {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-dial svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.dial-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 8;
}

.dial-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 2s ease-out;
}

.dial-text {
    position: absolute;
    text-align: center;
}

#scoreNumber {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 15px var(--primary);
}

.dial-text small {
    font-size: 0.5rem;
    color: var(--text-dim);
    text-transform: uppercase;
    display: block;
}

.quick-review p {
    font-size: 0.9rem;
    /* Increased size */
    line-height: 1.6;
    color: var(--text-dim);
    text-align: center;
}

/* Timeline & Checklist Panels */
.timeline-panel {
    min-height: 400px;
    /* Ensure enough room for logs */
}

.checkpoint-panel {
    min-height: 800px;
}

.checkpoint-panel .panel-content {
    overflow-x: auto;
}

/* .timeline-scroll removed (duplicate) */

.timeline-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.2rem;
    border-left: 3px solid var(--blue);
    background: rgba(0, 102, 255, 0.05);
    margin-bottom: 0.8rem;
    border-radius: 0 8px 8px 0;
    transition: 0.3s;
}

.timeline-item:hover {
    background: rgba(0, 102, 255, 0.15);
    border-left-color: var(--cyan);
    transform: translateX(10px);
}

.timeline-item:active {
    background: rgba(0, 102, 255, 0.25);
    transform: translateX(5px) scale(0.98);
}

.timeline-time {
    font-family: var(--font-mono);
    color: var(--cyan);
    font-weight: 700;
    font-size: 1rem;
    min-width: 60px;
}

.timeline-event {
    flex: 1;
    color: #fff;
    font-weight: 500;
}

.btn-timeline-seek {
    background: transparent;
    border: 1px solid var(--cyan);
    color: var(--cyan);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    /* Squared AI feel */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: 0.3s;
    flex-shrink: 0;
}

.btn-timeline-seek:hover {
    background: var(--cyan);
    color: var(--dark);
    box-shadow: 0 0 15px var(--cyan);
    transform: scale(1.1);
}

/* CHECKLIST FIX */
/* .checkpoint-panel removed (duplicate) */

/* .checkpoint-scroll removed (duplicate) */

/* --- TABLE READABILITY RESTORATION --- */
.acls-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    border-bottom: 2px solid var(--border);
}

.acls-table th {
    font-family: var(--font-orbitron);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--cyan);
    padding: 1rem 10px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px solid var(--border);
    background: rgba(0, 243, 255, 0.05);
}

.acls-table td {
    padding: 1rem 10px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.1);
    vertical-align: top;
    color: #fff;
    font-size: 0.9rem;
    font-family: var(--font-main);
    /* Cleaner sans font for readability */
}

/* Explicit widths to prevent wrapping in small columns */
.acls-table th:nth-child(1),
.acls-table td:nth-child(1) {
    width: 40px;
    text-align: center;
}

.acls-table th:nth-child(2),
.acls-table td:nth-child(2) {
    width: 160px;
    font-weight: 700;
    color: var(--cyan);
}

.acls-table th:nth-child(3),
.acls-table td:nth-child(3) {
    width: 80px;
    text-align: center;
}

.acls-table th:nth-child(4),
.acls-table td:nth-child(4) {
    width: auto;
}

.acls-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.checkpoint-scroll {
    overflow-x: auto;
    /* Handle table overflow if screen is small */
}


.verdict-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    /* Increased size */
    font-weight: 700;
}

.verdict-A {
    background: var(--success);
    color: #000;
}

.verdict-B {
    background: var(--warning);
    color: #000;
}

.verdict-C {
    background: var(--danger);
    color: #fff;
}

.proof-note {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    /* Increased size */
    margin-bottom: 0.5rem;
}

.ai-reasoning {
    font-size: 0.85rem;
    /* Increased size */
    color: var(--text-dim);
    line-height: 1.5;
    border-left: 2px solid var(--primary);
    padding-left: 10px;
}

/* Play Button Logic */
.btn-seek {
    background: var(--primary);
    border: none;
    color: #000;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    margin-right: 10px;
    transition: 0.3s;
}

/* History & Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
}

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

.history-actions {
    display: flex;
    gap: 10px;
}

.btn-delete {
    background: rgba(255, 75, 43, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.6rem;
    cursor: pointer;
    transition: 0.3s;
}

.btn-delete:hover {
    background: var(--danger);
    color: #fff;
}

/* Footer */
footer {
    position: relative;
    margin-top: 100px;
    /* Force extra space */
    padding: 30px 0;
    width: 100%;
    z-index: 100;
    text-align: center;
    border-top: 1px solid rgba(0, 243, 255, 0.05);
    color: var(--text-dim);
    font-size: 0.65rem;
    font-family: var(--font-mono);
    pointer-events: none;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* --- REASONING CELL STYLES --- */
.chk-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.btn-evidence {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-evidence:hover {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.btn-reasoning {
    background: var(--glass-bg);
    border: 1px solid var(--text-dim);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: 0.2s;
    margin-top: 4px;
}

.btn-reasoning:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.reasoning-preview {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- REASONING MODAL --- */
.reasoning-modal-content {
    background: rgba(10, 18, 35, 0.85);
    /* More transparent / glassy */
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 600px;
    max-width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal-reasoning {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.close-modal-reasoning:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    transform: rotate(90deg);
}

.reasoning-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.reasoning-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.timestamp-badge {
    font-family: var(--font-mono);
    color: var(--primary);
    font-size: 0.9rem;
    border: 1px solid var(--primary);
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(0, 210, 255, 0.05);
}

/* Handbook / Dr. Quote Style */
.handbook-quote {
    background: rgba(0, 210, 255, 0.03);
    border-left: 3px solid var(--primary);
    padding: 1rem;
    color: var(--text);
    /* Brighter text */
    font-size: 1rem;
    line-height: 1.6;
    font-family: var(--font-main);
    position: relative;
    border-radius: 0 8px 8px 0;
}

.handbook-quote::before {
    content: "⚕️";
    /* Medical icon */
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.ai-note-text {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--glass-border);
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 16px 16px;
}

.btn-evidence-modal {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.btn-evidence-modal:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* --- VIDEO VIEWING OVERLAY --- */
.video-viewing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, rgba(0, 243, 255, 0.4), transparent);
    color: #fff;
    padding: 10px 15px;
    font-family: var(--font-orbitron);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    z-index: 25;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

#currentEvidenceText {
    color: var(--cyan);
}

/* --- PLAYBACK HIGHLIGHTING --- */
.playback-active {
    background: rgba(0, 243, 255, 0.15) !important;
    border-left: 5px solid var(--cyan) !important;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
    transform: scale(1.02);
}

.acls-table tr.playback-active {
    background: rgba(0, 243, 255, 0.1) !important;
    box-shadow: inset 4px 0 0 var(--cyan);
}

.viewing-label {
    display: none;
    font-family: var(--font-orbitron);
    font-size: 0.6rem;
    color: var(--cyan);
    margin-bottom: 4px;
    letter-spacing: 1px;
    font-weight: bold;
    animation: blink 1s infinite;
}

.playback-active .viewing-label {
    display: block;
}

/* --- LOADING SPINNER --- */
.spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 243, 255, 0.3);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.is-loading .spinner {
    display: inline-block;
}

.is-loading .btn-icon-text {
    display: none;
}

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

/* --- RESULTS VIEW GRID (FORCE OVERRIDE) --- */
.results-grid {
    display: grid;
    grid-template-columns: 480px 1fr;
    grid-template-areas:
        "video timeline"
        "video table";
    gap: 2rem;
    margin-top: 10vh;
    padding-bottom: 50px;
    align-items: start;
}

.result-main {
    grid-area: video;
    display: flex;
    flex-direction: column;
    position: sticky !important;
    /* Force override of any .glass position:relative */
    top: 50px;
    z-index: 50;
    align-self: start;
}
/* Configuration Modal & Close Buttons */
.close-modal,
.close-modal-reasoning,
.close-modal-config {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 2rem;
    cursor: pointer;
    transition: 0.3s;
}

.close-modal:hover,
.close-modal-reasoning:hover,
.close-modal-config:hover {
    color: white;
    transform: rotate(90deg);
}

/* Additional Light Mode Refinements */
body.light-mode .vitals-panel {
    background: #fff !important;
    border-color: #cbd5e1 !important;
}

body.light-mode .wave-area {
    border-right-color: #f1f5f9 !important;
}

body.light-mode .num-label {
    color: #64748b !important;
}

body.light-mode .c-ecg {
    color: #059669 !important;
    text-shadow: none !important;
}

body.light-mode .c-spo2 {
    color: #0056d2 !important;
    text-shadow: none !important;
}

body.light-mode .ai-data-overlay {
    color: #059669 !important;
}

body.light-mode .data-row {
    color: #64748b !important;
}

body.light-mode #basePromptText {
    background: #f8fafc !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

body.light-mode .upload-box {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
}

body.light-mode .upload-box:hover {
    border-color: var(--primary) !important;
    background: #f1f7ff !important;
    color: var(--primary) !important;
}

body.light-mode .btn-timeline-seek {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

body.light-mode .btn-timeline-seek:hover {
    background: var(--primary) !important;
    color: #fff !important;
}

body.light-mode .verdict-A { background: #dcfce7 !important; color: #166534 !important; }
body.light-mode .verdict-B { background: #fef9c3 !important; color: #854d0e !important; }
body.light-mode .verdict-C { background: #fee2e2 !important; color: #991b1b !important; }

body.light-mode .btn-reasoning {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text) !important;
}

body.light-mode .btn-reasoning:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

body.light-mode .btn-evidence {
    border: 1px solid var(--primary) !important;
    color: var(--primary) !important;
}

body.light-mode .btn-evidence:hover {
    background: rgba(0, 86, 210, 0.05) !important;
}

body.light-mode .reasoning-preview {
    color: var(--text-dim) !important;
}

/* --- MEDICAL DISCLAIMER STYLES --- */
.medical-disclaimer-box {
    margin: 15px 0;
    padding: 12px 18px;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 6px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.medical-disclaimer-box i {
    color: var(--cyan);
    font-size: 1.2rem;
}

.medical-disclaimer-box p {
    margin: 0;
    font-size: 0.8rem !important;
    line-height: 1.5 !important;
    color: #e2e8f0 !important;
    text-align: left !important;
    font-weight: 500 !important;
}

body.light-mode .medical-disclaimer-box {
    background: #f0f7ff !important;
    border: 1px solid #0056d2 !important;
}

body.light-mode .medical-disclaimer-box p {
    color: #1e293b !important;
}

body.light-mode .medical-disclaimer-box i {
    color: #0056d2 !important;
}
