:root {
    --bg-base: #030712;
    --panel-bg: rgba(17, 24, 39, 0.75);
    --panel-border: rgba(31, 41, 55, 0.8);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --accent-teal: #14b8a6;
    --accent-glow: rgba(20, 184, 166, 0.15);
    --accent-blue: #3b82f6;
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Light Telemetry Mode Toggle Class */
body.light-telemetry-mode {
    --bg-base: #f3f4f6;
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(209, 213, 219, 0.9);
    --text-main: #111827;
    --text-muted: #4b5563;
    --accent-teal: #0d9488;
    --accent-glow: rgba(13, 148, 136, 0.1);
}

/* Background Glowing Elements & Grid Overlay */
.medical-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -2;
    opacity: 0.35;
    pointer-events: none;
}

.glow-1 {
    width: 500px;
    height: 500px;
    background: #0d9488;
    top: -100px;
    left: -150px;
    animation: pulseGlow 12s ease-in-out infinite alternate;
}

.glow-2 {
    width: 600px;
    height: 600px;
    background: #1e40af;
    bottom: -200px;
    right: -150px;
    animation: pulseGlow 16s ease-in-out infinite alternate-reverse;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translateY(0); opacity: 0.3; }
    100% { transform: scale(1.15) translateY(40px); opacity: 0.5; }
}

.medical-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
}

/* Container */
.research-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem 5rem 1.5rem;
}

/* Top Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--panel-border);
    animation: fadeInDown 0.6s ease-out;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-teal);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-teal);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-teal);
    animation: blinkDot 2s infinite;
}

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

.nav-actions {
    display: flex;
    gap: 0.8rem;
}

.action-btn {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.action-btn:hover {
    border-color: var(--accent-teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.primary-action {
    background: var(--accent-teal);
    color: #030712;
    font-weight: 600;
    border: none;
}

.primary-action:hover {
    background: #0f766e;
    color: #ffffff;
}

/* Research Header */
.research-header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInUp 0.7s ease-out;
}

.meta-tags {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    background: var(--accent-glow);
    color: var(--accent-teal);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: 20px;
}

.research-header h1 {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 750px;
    margin: 0 auto 2rem auto;
}

.author-block {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    text-align: left;
}

.author-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-teal), #2563eb);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.author-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.author-title {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toolbar Card */
.toolbar-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-info {
    display: flex;
    gap: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toolbar-buttons {
    display: flex;
    gap: 0.6rem;
}

.tool-btn {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}

.accent-tool {
    background: rgba(20, 184, 166, 0.1);
    border-color: rgba(20, 184, 166, 0.4);
    color: var(--accent-teal);
}

/* Content Sections */
.content-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease-out;
}

.glass-panel:hover {
    transform: translateY(-3px);
    border-color: rgba(20, 184, 166, 0.4);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}

.glass-panel h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-main);
}

.glass-panel h2 span {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-teal);
    background: var(--accent-glow);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(20, 184, 166, 0.3);
}

.glass-panel p {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}

.glass-panel p:last-child {
    margin-bottom: 0;
}

.glass-panel strong {
    color: var(--text-main);
}

/* Matrix Grid */
.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin-top: 1.5rem;
}

@media(max-width: 650px) {
    .matrix-grid {
        grid-template-columns: 1fr;
    }
}

.matrix-box {
    background: rgba(3, 7, 18, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 1.4rem;
}

.matrix-box h3 {
    font-size: 0.95rem;
    color: var(--accent-teal);
    margin-bottom: 0.6rem;
}

.matrix-box p {
    font-size: 0.9rem;
    margin: 0;
}

/* Clinical Image Panel */
.clinical-image-container {
    position: relative;
    margin-top: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    background: #000000;
}

.clinical-image-container img {
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: cover;
    display: block;
    filter: brightness(0.8) contrast(1.15);
    transition: transform 0.4s ease, filter 0.4s ease;
}

.clinical-image-container img:hover {
    transform: scale(1.02);
    filter: brightness(0.95) contrast(1.2);
}

.image-overlay-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(3, 7, 18, 0.85);
    border: 1px solid rgba(20, 184, 166, 0.4);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent-teal);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.clinical-image-container figcaption {
    padding: 1rem 1.2rem;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: rgba(17, 24, 39, 0.9);
    border-top: 1px solid var(--panel-border);
}

/* Callout Box */
.callout-box {
    background: rgba(20, 184, 166, 0.05);
    border-left: 4px solid var(--accent-teal);
    padding: 1.2rem;
    border-radius: 0 10px 10px 0;
    margin-top: 1.2rem;
}

.callout-box p {
    margin: 0;
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Clinical List */
.clinical-list {
    list-style: none;
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.clinical-list li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-muted);
    background: rgba(3, 7, 18, 0.3);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
}

.clinical-list li strong {
    color: var(--text-main);
}

/* Footer */
.research-footer {
    text-align: center;
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--panel-border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--accent-teal);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Keyframes */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}