:root {
    --primary-color: #111;
    --duck-yellow: #f1c40f;
    --bg-light: #f4f4f0; /* Manila folder / document paper tone */
    --border-color: #111; /* Harsh black borders for institutional feel */
    --text-muted: #555;
    --trust-color: #27ae60;
    --distrust-color: #c0392b;
    --font-ui: "Courier New", Courier, monospace; /* Bureaucratic typewriter/data font */
    --font-heading: "Impact", "Times New Roman", serif; /* Serious institutional header */
    --btn-shadow: 0 4px 0 #888;
    --btn-shadow-active: 0 1px 0 #888;
    
    /* Institutional Metallic Palette */
    --inst-dark: #1a1a1a;
    --inst-gold: #c5a059;
    --inst-gold-muted: #a68b54;
    --inst-beige: #dcd0b9;
}

body {
    font-family: var(--font-ui);
    background-color: #e8e8e3; /* Slightly darker institutional wall color */
    background-image: radial-gradient(#d1d1ca 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--primary-color);
    margin: 0;
    padding: 120px 20px 40px 20px; /* Increased top padding for fixed header */
    display: flex;
    justify-content: center;
    line-height: 1.5;
}

.container {
    max-width: 1200px; /* Wider container for two-column layout */
    width: 100%;
    text-align: center;
}

/* Header Styles - Fixed Ministerial Banner */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--inst-dark);
    background-image: url("https://www.transparenttextures.com/patterns/dark-leather.png");
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    border-bottom: 3px solid var(--inst-gold);
    padding: 15px 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.ministerial-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    text-align: left;
}

.crest-placeholder {
    width: 50px;
    height: 50px;
    border: 2px solid var(--inst-gold);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222;
    font-size: 1.5rem;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.crest-icon {
    filter: sepia(1) saturate(2) hue-rotate(10deg) brightness(0.8);
}

.ministerial-titles {
    display: flex;
    flex-direction: column;
}

.main-dept {
    font-family: "Times New Roman", serif;
    font-weight: 900;
    color: var(--inst-gold);
    font-size: 1.2rem;
    letter-spacing: 2px;
    line-height: 1;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.sub-dept {
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--inst-beige);
    letter-spacing: 1px;
    margin-top: 5px;
    text-transform: uppercase;
    opacity: 0.8;
}

.minimal-nav {
    display: flex;
    align-items: center;
}

.minimal-nav a {
    color: var(--inst-gold-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 5px 15px;
    border: 1px solid var(--inst-gold-muted);
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.minimal-nav a:hover, .minimal-nav a:focus {
    background: var(--inst-gold-muted);
    color: var(--inst-dark);
    outline: none;
}

/* Page Title Block */
.title-block {
    margin-bottom: 40px;
}

.title-block h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    margin: 0 0 5px 0;
    letter-spacing: -1px;
    text-transform: uppercase;
    line-height: 1;
}

.title-block .subtitle {
    font-family: var(--font-ui);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Operational Zone - Two Column Layout */
.operational-zone {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.left-column {
    flex: 1;
    max-width: 550px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.right-column {
    flex: 1;
    max-width: 550px;
}

/* Duck Display Area - More Compact */
#subject-area {
    margin-bottom: 0;
}

.exhibit-frame {
    position: relative;
    padding: 30px; /* Reduced padding */
    border: 1px solid #ccc;
    background-color: white;
    background-image: 
        linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    display: block;
    box-shadow: 10px 10px 0 rgba(0,0,0,0.05);
    box-sizing: border-box;
}

.frame-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid var(--primary-color);
}

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

.exhibit-id {
    margin-top: 20px;
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
}

.duck-container {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.duck-display-area {
    width: 180px; /* Reduced fixed size for predictability */
    height: 180px;
    background-color: var(--bg-light);
    background-image: radial-gradient(circle, rgba(241, 196, 15, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
    border: 3px solid white;
    transition: transform 0.3s ease;
    position: relative;
}

.exhibit-frame:hover .duck-display-area {
    transform: scale(1.05);
}

.duck-image {
    width: 90%; /* Increased from 80% to 90% */
    height: auto;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.15));
    z-index: 3;
}

/* System Controls */
#actions {
    margin-bottom: 0;
}

.system-controls {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Increased gap for better rhythm */
}

.primary-trigger {
    width: 100%;
}

.secondary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
}

/* Button Base - Institutional Skeuomorphism */
.btn-skeuo {
    font-family: var(--font-ui);
    font-weight: 900;
    text-transform: uppercase;
    border: 2px solid #777;
    background: #eee;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 54px; /* Ensure equal height */
}

.btn-skeuo:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    filter: grayscale(1);
    box-shadow: none !important;
    transform: none !important;
}

/* Specific Button Identities */
.btn-analyze {
    width: 100%;
    font-size: 1rem;
    padding: 15px;
    background: linear-gradient(to bottom, #f1c40f, #d4ac0d);
    color: #111;
    border-color: #997300;
    box-shadow: 0 4px 0 #997300;
}

.btn-deeper {
    background: linear-gradient(to bottom, #78909c, #546e7a);
    color: white;
    border-color: #37474f;
    box-shadow: 0 4px 0 #37474f;
}

.btn-trust {
    background: linear-gradient(to bottom, #66bb6a, #43a047);
    color: white;
    border-color: #2e7d32;
    box-shadow: 0 4px 0 #2e7d32;
}

.btn-ministry {
    background: linear-gradient(to bottom, #5d4037, #3e2723);
    color: #d7ccc8;
    border-color: #1b1210;
    box-shadow: 0 4px 0 #1b1210;
}

.btn-distrust {
    background: linear-gradient(to bottom, #ef5350, #c62828);
    color: white;
    border-color: #b71c1c;
    box-shadow: 0 4px 0 #7f0000;
}

/* Hover States - Subtle Lift */
.btn-skeuo:hover:not(:disabled):not(.active-mode) {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* Active/Selected State - Pressed In */
.btn-skeuo.active-mode {
    transform: translateY(3px);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.4) !important;
    border-style: inset;
    filter: brightness(0.9);
    outline: 2px solid var(--inst-gold);
    outline-offset: 2px;
}

/* Tooltip Implementation */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--inst-dark);
    color: var(--inst-beige);
    padding: 8px 12px;
    font-size: 0.65rem;
    font-weight: normal;
    text-transform: none;
    white-space: normal;
    width: 200px;
    border: 1px solid var(--inst-gold-muted);
    border-radius: 2px;
    box-shadow: 5px 5px 0 rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
    pointer-events: none;
    text-align: center;
    line-height: 1.3;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.case-management {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end; /* Align to the right to feel secondary */
}

.btn-reset.btn-skeuo {
    width: auto;
    min-width: 120px;
    padding: 6px 12px;
    font-size: 0.6rem;
    background: linear-gradient(to bottom, #cfd8dc, #b0bec5);
    color: #455a64;
    border-color: #78909c;
    box-shadow: 0 3px 0 #546e7a;
    letter-spacing: 0.5px;
}

.btn-reset.btn-skeuo:hover:not(:disabled) {
    background: linear-gradient(to bottom, #b0bec5, #90a4ae);
    transform: translateY(-1px);
}

.btn-reset.btn-skeuo:active:not(:disabled) {
    box-shadow: 0 1px 0 #546e7a;
    transform: translateY(2px);
}

.error-message {
    color: var(--distrust-color);
    border: 1px solid var(--distrust-color);
    padding: 15px;
    background: #fdedec;
    font-size: 0.85rem;
    position: relative;
    margin: 10px 0;
}

.error-message::before {
    content: "⚠ WARNING: ";
    font-weight: bold;
}

.btn-secondary.btn-skeuo, .btn-deeper.btn-skeuo, .btn-trust.btn-skeuo, .btn-ministry.btn-skeuo, .btn-distrust.btn-skeuo {
    flex: 1;
    min-width: 140px;
    padding: 10px;
    font-size: 0.65rem;
}

/* Ensure Primary button also follows layout if it was in a flex container */
.btn-analyze.btn-skeuo:active:not(:disabled) {
    box-shadow: 0 1px 0 #997300;
    transform: translateY(3px);
}

/* Result Panel - Dossier Feel */
#report-panel {
    height: 100%;
}

.report-card {
    background-color: white;
    background-image: url("https://www.transparenttextures.com/patterns/paper-fibers.png");
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 40px;
    text-align: left;
    box-shadow: 15px 15px 0 rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    height: 520px; /* Fixed height on desktop */
    display: flex;
    flex-direction: column;
}

.report-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 5px;
    background: repeating-linear-gradient(90deg, #ccc, #ccc 10px, transparent 10px, transparent 20px);
    z-index: 10;
}

.report-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-shrink: 0; /* Keep header from shrinking */
}

.report-title {
    font-family: "Times New Roman", serif;
    font-weight: 900;
    color: var(--primary-color);
    font-size: 1.2rem;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.report-metadata {
    font-size: 0.65rem;
    font-weight: bold;
    width: 100%;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #eee;
    padding: 4px 0;
}

.dossier-body {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    line-height: 1.6;
    color: #222;
    flex-grow: 1;
    overflow-y: auto; /* Enable scrolling */
    padding-right: 15px; /* Space for scrollbar */
    margin-bottom: 10px;
}

/* Custom Scrollbar for Institutional Feel */
.dossier-body::-webkit-scrollbar {
    width: 6px;
}

.dossier-body::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-left: 1px solid #ddd;
}

.dossier-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 0;
}

.dossier-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.dossier-body {
    scrollbar-width: thin;
    scrollbar-color: #888 #f0f0f0;
}

.dossier-footer {
    margin-top: auto; /* Push to bottom */
    padding-top: 15px;
    border-top: 1px dashed #ccc;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0; /* Keep footer from shrinking */
}

.footer-seal {
    font-weight: 900;
    border: 3px solid var(--distrust-color);
    color: var(--distrust-color);
    padding: 5px 15px;
    transform: rotate(-5deg);
    font-size: 0.8rem;
    opacity: 0.6;
    user-select: none;
}

/* Threat Level Styling */
.threat-negligible { color: #888; }
.threat-low { color: #27ae60; }
.threat-moderate { color: #f39c12; }
.threat-elevated { color: #e67e22; }
.threat-unclear { color: #c0392b; font-weight: bold; }

footer {
    margin-top: 60px;
    color: #999;
    font-size: 0.7rem;
    border-top: 1px solid #ccc;
    padding-top: 30px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Responsive Overrides */
@media (max-width: 900px) {
    .operational-zone {
        flex-direction: column;
        align-items: center;
    }
    
    .left-column, .right-column {
        width: 100%;
        max-width: 100%;
    }
    
    .report-card {
        min-height: auto;
    }
}

@media (max-width: 600px) {
    body {
        padding: 100px 10px 20px 10px;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .main-dept {
        font-size: 1rem;
    }
}
