/* --- BIOMEDISTATS AIOS: CORE VARIABLES --- */
:root {
    --bg: #ffffff;
    --accent: #008f5d;
    --text: #111111;
    --gray: #666666;
    --border: #eeeeee;
    --membrane: rgba(0, 143, 93, 0.4);
    --nucleus: #0077ff;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; margin: 0; line-height: 1.6; overflow-x: hidden; }

/* --- NAVIGATION & LOGO --- */
.navbar {
    position: fixed; top: 0; width: 100%; padding: 20px 40px;
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px);
    z-index: 1000; border-bottom: 1px solid var(--border); box-sizing: border-box;
}

.logo-container { display: flex; align-items: center; cursor: pointer; }
.logo-icon-small { width: 16px; height: 16px; background: var(--accent); border-radius: 50%; margin-right: 12px; }
.logo-text { font-weight: 900; letter-spacing: 2px; font-size: 1rem; }
.logo-container:hover .logo-text { animation: fluidWobble 1.5s infinite; color: var(--accent); }

.nav-link { color: var(--gray) !important; text-decoration: none !important; font-size: 0.85rem; font-weight: 700; margin-left: 25px; transition: 0.3s; }
.nav-link:hover { color: var(--accent) !important; }

.btn-primary { 
    background: var(--text) !important; color: #fff !important; text-decoration: none !important; 
    padding: 12px 24px; border-radius: 4px; font-size: 0.85rem; font-weight: 800; 
    margin-left: 30px; border: 1px solid var(--text); cursor: pointer; transition: 0.3s;
}
.btn-primary:hover { background: var(--accent) !important; border-color: var(--accent); }

/* --- HERO & BIOMIMICRY --- */
.hero { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding-top: 100px; position: relative; }
.cell-container { width: 200px; height: 200px; margin-bottom: 25px; z-index: 2; cursor: pointer; }
.bio-membrane { width: 100%; height: 100%; border: 2px solid var(--membrane); border-radius: 50%; display: flex; justify-content: center; align-items: center; animation: morph 8s infinite; transition: 0.4s; background: radial-gradient(circle, rgba(0,143,93,0.1) 0%, #fff 70%); }
.cell-container:hover .bio-membrane { animation: morph 2s infinite, fluidWobble 1s infinite; transform: scale(1.1); border-color: var(--accent); }
.bio-nucleus { width: 50px; height: 50px; background: var(--nucleus); border-radius: 50%; box-shadow: 0 0 30px rgba(0,119,255,0.5); }

@keyframes morph { 0%, 100% { border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%; } 50% { border-radius: 60% 40% 55% 45% / 45% 55% 40% 60%; } }
@keyframes fluidWobble { 0%, 100% { transform: scale(1, 1) skewX(0deg); } 25% { transform: scale(0.92, 1.08) skewX(-3deg); } 50% { transform: scale(1.08, 0.92) skewX(3deg); } }

.reveal-text { font-size: 4.5rem; font-weight: 900; margin: 0; letter-spacing: -3px; line-height: 1; }
.subtitle { font-size: 1.2rem; color: var(--gray); margin-top: 15px; }

/* --- THE KERNEL TERMINAL (AIOS UI) --- */
.os-frame { 
    background: #0a0a0a; border: 1px solid var(--accent); width: 95%; max-width: 1000px !important; 
    border-radius: 12px; text-align: left; z-index: 10; margin-top: 40px; box-shadow: 0 30px 60px rgba(0,0,0,0.4); 
}
.os-header { background: #1a1a1a; padding: 15px 25px; color: var(--accent); border-bottom: 1px solid #333; font-weight: bold; font-size: 0.8rem; display: flex; align-items: center; border-radius: 12px 12px 0 0; }
.status-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; margin-right: 12px; }
.pulse { animation: pulseAnim 2s infinite; }
@keyframes pulseAnim { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }

.os-body { padding: 0; font-family: 'Courier New', monospace; color: #fff; min-height: 350px; }

/* --- TERMINAL TABS --- */
.tab-nav {
    display: flex;
    background: #111;
    border-bottom: 1px solid #333;
    flex-wrap: wrap; gap: 4px;
}
.tab-btn {
    background: transparent;
    color: #666;
    border: none;
    padding: 15px 25px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: 0.3s;
    text-transform: uppercase;
    flex: 1 1 auto;
    min-width: 160px;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    background: #0a0a0a;
}
.tab-pane { display: none; padding: 30px; }
.tab-pane.active { display: block; }

.os-controls { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; }
.os-select { 
    background: #000 !important; color: #fff !important; border: 1px solid #333; 
    padding: 12px; font-size: 0.85rem; flex: 1; border-radius: 4px; appearance: none; cursor: pointer;
}
.os-select:focus { border-color: var(--accent); outline: none; }

.os-btn { 
    background: var(--accent); color: #000; border: none; padding: 18px; 
    font-weight: 900; cursor: pointer; width: 100%; border-radius: 4px; 
    text-transform: uppercase; transition: 0.3s;
}
.os-btn:hover { background: #fff; transform: translateY(-2px); }

.results-pane {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 18px;
    min-height: 200px;
    max-height: 640px;
    overflow-y: auto;
    font-size: 0.98rem;
    line-height: 1.65;
    width: 100%;
    box-sizing: border-box;
}

/* ================================================================
   TERMINAL READABILITY OVERRIDES
   The terminal content (.results-pane) is built by script.js with
   hundreds of inline styles using dim greys (color:#666 etc.) and
   small fonts (font-size:0.6rem etc.). Rather than edit every one,
   these attribute-selectors override the inline values in place:
   greys are lightened toward white and small fonts are enlarged,
   while semantic colours (red/green/amber) are left untouched.
   ================================================================ */
.results-pane .typewriter { font-size: 0.98rem; }

/* --- Lighten dim grey text (darker greys -> bright near-white) --- */
.results-pane [style*="color:#444"], .results-pane [style*="color: #444"],
.results-pane [style*="color:#555"], .results-pane [style*="color: #555"],
.results-pane [style*="color:#666"], .results-pane [style*="color: #666"],
.results-pane [style*="color:#777"], .results-pane [style*="color: #777"],
.results-pane [style*="color:#888"], .results-pane [style*="color: #888"],
.results-pane [style*="color:#999"], .results-pane [style*="color: #999"] {
    color: #e8e8e8 !important;
}
/* --- Light greys -> essentially white --- */
.results-pane [style*="color:#aaa"], .results-pane [style*="color: #aaa"],
.results-pane [style*="color:#bbb"], .results-pane [style*="color: #bbb"],
.results-pane [style*="color:#ccc"], .results-pane [style*="color: #ccc"],
.results-pane [style*="color:#ddd"], .results-pane [style*="color: #ddd"] {
    color: #f6f6f6 !important;
}
/* --- Dim alpha-red subtitle (Site Risk Analysis) -> legible red --- */
.results-pane [style*="color:#ff005566"] { color: #ff8a9b !important; }

/* --- Enlarge small inline font-sizes (capped so layout stays sane) --- */
.results-pane [style*="font-size:0.5rem"],  .results-pane [style*="font-size: 0.5rem"],
.results-pane [style*="font-size:0.55rem"], .results-pane [style*="font-size: 0.55rem"],
.results-pane [style*="font-size:0.56rem"], .results-pane [style*="font-size: 0.56rem"],
.results-pane [style*="font-size:0.57rem"], .results-pane [style*="font-size: 0.57rem"],
.results-pane [style*="font-size:0.58rem"], .results-pane [style*="font-size: 0.58rem"],
.results-pane [style*="font-size:0.59rem"], .results-pane [style*="font-size: 0.59rem"] {
    font-size: 0.74rem !important;
}
.results-pane [style*="font-size:0.6rem"],  .results-pane [style*="font-size: 0.6rem"],
.results-pane [style*="font-size:0.61rem"], .results-pane [style*="font-size: 0.61rem"],
.results-pane [style*="font-size:0.62rem"], .results-pane [style*="font-size: 0.62rem"],
.results-pane [style*="font-size:0.63rem"], .results-pane [style*="font-size: 0.63rem"],
.results-pane [style*="font-size:0.64rem"], .results-pane [style*="font-size: 0.64rem"] {
    font-size: 0.78rem !important;
}
.results-pane [style*="font-size:0.65rem"], .results-pane [style*="font-size: 0.65rem"],
.results-pane [style*="font-size:0.66rem"], .results-pane [style*="font-size: 0.66rem"],
.results-pane [style*="font-size:0.67rem"], .results-pane [style*="font-size: 0.67rem"],
.results-pane [style*="font-size:0.68rem"], .results-pane [style*="font-size: 0.68rem"],
.results-pane [style*="font-size:0.69rem"], .results-pane [style*="font-size: 0.69rem"] {
    font-size: 0.83rem !important;
}
.results-pane [style*="font-size:0.7rem"],  .results-pane [style*="font-size: 0.7rem"],
.results-pane [style*="font-size:0.71rem"], .results-pane [style*="font-size: 0.71rem"],
.results-pane [style*="font-size:0.72rem"], .results-pane [style*="font-size: 0.72rem"],
.results-pane [style*="font-size:0.73rem"], .results-pane [style*="font-size: 0.73rem"],
.results-pane [style*="font-size:0.74rem"], .results-pane [style*="font-size: 0.74rem"] {
    font-size: 0.88rem !important;
}
.results-pane [style*="font-size:0.75rem"], .results-pane [style*="font-size: 0.75rem"],
.results-pane [style*="font-size:0.76rem"], .results-pane [style*="font-size: 0.76rem"],
.results-pane [style*="font-size:0.78rem"], .results-pane [style*="font-size: 0.78rem"] {
    font-size: 0.92rem !important;
}
.results-pane [style*="font-size:0.8rem"],  .results-pane [style*="font-size: 0.8rem"],
.results-pane [style*="font-size:0.82rem"], .results-pane [style*="font-size: 0.82rem"],
.results-pane [style*="font-size:0.84rem"], .results-pane [style*="font-size: 0.84rem"],
.results-pane [style*="font-size:0.85rem"], .results-pane [style*="font-size: 0.85rem"] {
    font-size: 0.98rem !important;
}

/* --- SECURE GATEKEEPER PORTAL (REQUEST ACCESS) --- */
.hidden-portal { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0, 0, 0, 0.95); z-index: 99999; 
    justify-content: center; align-items: center; backdrop-filter: blur(5px);
}
.hidden-portal.active { display: flex; }

.portal-content { 
    background: #111; padding: 50px; border: 1px solid var(--accent); 
    border-radius: 12px; text-align: center; box-shadow: 0 0 50px rgba(0, 143, 93, 0.3); 
    width: 100%; max-width: 400px; color: #fff; 
}
#primeKey { 
    width: 100%; padding: 12px; background: #000; border: 1px solid #333; 
    color: var(--accent); font-family: monospace; margin-top: 20px; box-sizing: border-box; 
}
.btn-main { background: var(--accent); color: #000; border: none; padding: 15px; width: 100%; cursor: pointer; font-weight: 900; margin-top: 15px; border-radius: 4px; }
.btn-cancel { background: transparent; color: #666; border: none; padding: 10px; width: 100%; cursor: pointer; margin-top: 10px; }

/* --- SOVEREIGN GHOST TERMINAL --- */
#ghostTerminal { border-radius: 8px 8px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.5); }
#ghostOutput p { margin: 5px 0; font-family: 'Courier New', monospace; font-size: 0.8rem; }

/* --- CONTENT SECTIONS --- */
.content-block { padding: 120px 40px; text-align: center; max-width: 1000px; margin: 0 auto; }
.gray-bg { background: #fafafa; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); max-width: 100%; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; margin-top: 60px; }
.card { background: #fff; padding: 40px; border: 1px solid var(--border); border-radius: 4px; transition: 0.3s; text-align: left; }
.card:hover { border-color: var(--accent); box-shadow: 0 20px 40px rgba(0,0,0,0.05); }

#particleCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.1; z-index: 1; pointer-events: none; }
/* ============================================================
   BIOMEDISTATS — RESCUE SITE COMPARISON PANEL
   ============================================================ */

/* ── Comparison grid (responsive) ── */
.rescue-comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
@media (max-width: 680px) {
    .rescue-comparison-grid { grid-template-columns: 1fr; }
}

/* ── Panel shared ── */
.rescue-panel { border-radius: 4px; overflow: hidden; font-family: 'Courier New', monospace; }
.rescue-panel-header { padding: 8px 12px; border-bottom-width: 1px; border-bottom-style: solid; }
.rescue-panel-header p { margin: 0; }
.rescue-panel-body { padding: 10px; max-height: 480px; overflow-y: auto; scrollbar-width: thin; }

/* ── Distressed (left) panel ── */
.rescue-panel--distress { border: 1px solid rgba(255,0,85,0.27); }
.rescue-panel--distress .rescue-panel-header { background: rgba(255,0,85,0.08); border-bottom-color: rgba(255,0,85,0.27); }
.rescue-panel--distress .rescue-panel-header .panel-title { color: #ff4d4d; }
.rescue-panel--distress .rescue-panel-header .panel-sub   { color: rgba(255,0,85,0.55); }

/* ── Alternative (right) panel ── */
.rescue-panel--alt { border: 1px solid rgba(0,255,136,0.27); }
.rescue-panel--alt .rescue-panel-header { background: rgba(0,255,136,0.05); border-bottom-color: rgba(0,255,136,0.27); }
.rescue-panel--alt .rescue-panel-header .panel-title { color: #00ff88; }
.rescue-panel--alt .rescue-panel-header .panel-sub   { color: rgba(0,255,136,0.5); }

/* ── Risk badges ── */
.risk-badge { display:inline-block; font-size:0.6rem; padding:1px 5px; border-radius:2px; font-weight:bold; white-space:nowrap; }
.risk-badge--critical { background:rgba(255,0,85,0.12);  color:#ff4d4d; border:1px solid rgba(255,0,85,0.4); }
.risk-badge--caution  { background:rgba(255,204,0,0.12); color:#ffe57a; border:1px solid rgba(255,204,0,0.4); }
.risk-badge--ok       { background:rgba(0,195,255,0.10); color:#00c3ff; border:1px solid rgba(0,195,255,0.3); }

/* ── Geo match badges ── */
.geo-badge--match { background:rgba(0,255,136,0.12); color:#00ff88; border:1px solid rgba(0,255,136,0.4); }
.geo-badge--alt   { background:rgba(51,51,51,0.35);  color:#888;    border:1px solid #444; }

/* ── Tally row ── */
.site-tally { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px; font-size:0.65rem; }
.site-tally span { padding:2px 7px; border-radius:2px; font-weight:bold; }

/* ── Export toolbar ── */
.rescue-export-toolbar {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px;
    padding: 10px 12px; background: rgba(0,0,0,0.4);
    border: 1px solid #2a2a2a; border-radius: 4px; align-items: center;
}
.rescue-export-toolbar .toolbar-label {
    font-size: 0.63rem; color: #444; text-transform: uppercase;
    letter-spacing: 1px; font-weight: bold; margin-right: 4px; white-space: nowrap;
}
.rescue-export-btn {
    padding: 7px 14px; font-size: 0.68rem; font-weight: bold;
    border-radius: 2px; cursor: pointer; border: none; letter-spacing: 0.5px;
    transition: opacity 0.2s, transform 0.15s; white-space: nowrap;
    font-family: 'Courier New', monospace;
}
.rescue-export-btn:hover { opacity: 0.82; transform: translateY(-1px); }
.rescue-export-btn.pdf   { background: #ff4d4d; color: #fff; }
.rescue-export-btn.excel { background: #00ff88; color: #000; }
.rescue-export-btn.json  { background: #00c3ff; color: #000; }

/* ── Print tender styles ── */
@media print {
    body > *:not(#rescue-print-frame) { display: none !important; }
    #rescue-print-frame { display: block !important; position: fixed; top:0; left:0; width:100%; height:100%; background:#fff; z-index:999999; overflow:auto; }
    .rescue-comparison-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Spinner for the "Loading account…" nav pill (and any inline spinner). */
@keyframes bm-spin { to { transform: rotate(360deg); } }
