:root {
    --bg-deep: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-teal: #2dd4bf;
    --accent-blue: #38bdf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --hat-black: #e11d48;
    --hat-white: #f8fafc;
    --hat-yellow: #f59e0b;
    --hat-green: #10b981;
    --hat-blue: #3b82f6;
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5);
}

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

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    height: 100vh;
    overflow: hidden;
    background-image: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 40%);
}

#nexus-app {
    display: flex;
    height: 100vh;
    padding: 24px;
    gap: 24px;
}

.proctor-panel, .chat-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: var(--shadow-xl);
}

.proctor-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 20px;
}

.intel-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.intel-section h3 {
    font-size: 0.75rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

.intel-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    max-height: 250px;
    overflow-y: auto;
}

.policy-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-family: monospace;
    font-size: 0.75rem;
}
.policy-stat span { color: var(--text-secondary); }
.policy-stat strong { color: var(--accent-teal); }

.panel-header h2 { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.panel-header h2 span { color: var(--accent-teal); }

.hat-deliberation { 
    flex: 1; 
    overflow-y: auto; 
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-entry { 
    padding: 12px; 
    background: rgba(255,255,255,0.03); 
    border-radius: 12px; 
    font-size: 0.82rem; 
    line-height: 1.4;
    border-left: 3px solid var(--accent-blue);
    animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-5px); } to { opacity: 1; transform: translateX(0); } }

.chat-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.qa-stage-north, .status-hud, .input-zone {
    position: relative;
    z-index: 10;
}

.nexus-header { padding: 24px 32px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); }

.brand { display: flex; align-items: center; gap: 14px; }
.logo-orb { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent-blue), var(--accent-teal)); border-radius: 12px; box-shadow: 0 0 20px rgba(45, 212, 191, 0.3); }
/* North Zone (Inquiry) */
.qa-stage-north {
    display: flex;
    height: 45vh; /* Controlled height for the top half */
    border-bottom: 1px solid var(--glass-border);
    animation: fadeIn 0.6s ease-out;
}

.question-slot {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.agent-label {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-bottom: 16px;
    letter-spacing: 0.2em;
    font-weight: 700;
}

.candidate-response-preview {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px dashed var(--glass-border);
    opacity: 0.7;
    filter: saturate(0.5);
    font-size: 1.05rem;
}

/* Status HUD */
.status-hud {
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
}

.timer-group {
    display: flex;
    gap: 32px;
}

.timer-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-item .label {
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

.timer-item .value {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--accent-teal);
    font-variant-numeric: tabular-nums;
}

/* South Zone (Response Canvas) */
.input-zone.expanded {
    flex: 1; /* Takes the remaining 50% */
    padding: 32px;
    display: flex;
    flex-direction: column;
}

.input-zone.expanded .input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    gap: 20px;
}

.input-zone.expanded textarea {
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.8;
}

.input-actions {
    display: flex;
    justify-content: flex-end;
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#send-btn { 
    background: var(--accent-teal); 
    border: none; 
    padding: 0 32px;
    height: 54px; 
    border-radius: 16px; 
    display: flex; 
    align-items: center; 
    gap: 14px;
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    color: var(--bg-deep);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#send-btn:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 10px 20px rgba(45, 212, 191, 0.2);
}

/* Deliberation Overlay */
#deliberation-overlay {
    position: absolute;
    inset: 32px; /* Matches padding of input-zone */
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 20px;
    border-radius: 24px;
}

.pulse-ring {
    width: 60px;
    height: 60px;
    border: 3px solid var(--accent-teal);
    border-radius: 50%;
    animation: ringPulse 1.5s infinite;
}

.retry-link-btn {
    background: transparent;
    border: 1px solid var(--accent-teal);
    color: var(--accent-teal);
    padding: 12px 24px;
    border-radius: 12px;
    font-family: monospace;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    z-index: 101;
}

.retry-link-btn:hover {
    background: var(--accent-teal);
    color: var(--bg-deep);
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.4);
}

.retry-link-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

@keyframes ringPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.nexus-status-text {
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--accent-teal);
}

.risk-gauges { margin-top: auto; display: flex; flex-direction: column; gap: 16px; }
.gauge-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; }
.progress-bar { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.fill { height: 100%; background: var(--accent-teal); transition: width 0.5s ease; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

.diagnostic-monitor {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
    font-family: monospace;
    font-size: 0.75rem;
}
.diag-header { color: var(--accent-teal); margin-bottom: 8px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 4px; }
.diag-item { margin-bottom: 4px; color: #84cc16; }

.hidden { display: none !important; }

#integrity-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: monospace;
    font-weight: 700;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(-52%, -50%); }
    75% { transform: translate(-48%, -50%); }
}

.error-pulse {
    border-color: #ef4444 !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2) !important;
}

/* Nexus Voice Avatar - Center Glow */
#nexus-voice-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 1s ease-out;
    pointer-events: none;
    z-index: 0; /* Behind the text */
    opacity: 0.25; /* Subtle background presence */
    transition: opacity 0.5s ease;
}

.logo-orb.large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 50px rgba(45, 212, 191, 0.5);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-teal));
    transition: all 0.3s ease;
}

#nexus-voice-avatar.speaking {
    opacity: 0.7; /* Glows brightly when speaking */
}

#nexus-voice-avatar.speaking .logo-orb.large {
    transform: scale(1.15);
    box-shadow: 0 0 80px rgba(56, 189, 248, 0.9), inset 0 0 30px rgba(255, 255, 255, 0.6);
    background: linear-gradient(135deg, var(--accent-blue), #fff, var(--accent-teal));
}

.avatar-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--accent-teal);
    opacity: 0;
}

.avatar-ring.outer {
    width: 100%;
    height: 100%;
}

.avatar-ring.middle {
    width: 75%;
    height: 75%;
}

#nexus-voice-avatar.speaking .avatar-ring.outer {
    animation: voicePulse 1.5s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}

#nexus-voice-avatar.speaking .avatar-ring.middle {
    animation: voicePulse 1.5s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
    animation-delay: 0.3s;
}

@keyframes voicePulse {
    0% { transform: scale(0.5); opacity: 0.8; border-color: var(--accent-blue); }
    100% { transform: scale(1.2); opacity: 0; border-color: var(--accent-teal); }
}
