/* --- USCM THEME VARIABLES --- */
:root {
    --bg-color: #0d1117;
    --panel-bg: #161b22;
    --text-main: white;
    --text-dim: #8b949e;
    --accent-green: #238636;
    --accent-green-bright: #2ea043;
    --accent-alert: #d29922;
    --accent-danger: #da3633;
    --accent-info: #1f6feb;
    --accent-blue: #388bfd;
    --accent-purple: #a371f7;
    --accent-red: #f85149;
    --accent-yellow: #d29922;

    --terminal-glow: 0 0 10px rgba(46, 160, 67, 0.2);
    --font-main: 'Courier New', Courier, monospace;
    --font-ui: system-ui, -apple-system, sans-serif;
    --border-style: 1px solid #30363d;
}

/* --- RESET & BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    flex-direction: column;
    overflow: hidden;
}

.no-scroll {
    overflow: hidden !important;
}

/* --- SCANLINE OVERLAY --- */
body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 1000;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

html {
    scroll-behavior: smooth;
    font-size: 18px;
    /* Increased from default 16px */
}

/* --- HEADER --- */
.top-bar {
    background-color: #010409;
    border-bottom: 2px solid var(--accent-green);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
    z-index: 20;
    position: relative;
    /* Ensure z-index applies */
    transition: transform 0.3s ease;
    /* For hide on scroll */
}

/* Class to hide header on scroll */
.top-bar.header-hidden {
    transform: translateY(-100%);
}

.logo-area {
    display: flex;
    align-items: center;
}

.logo-text h1 {
    font-family: 'Impact', sans-serif;
    letter-spacing: 2px;
    color: var(--accent-green-bright);
    font-size: 1.5rem;
    text-transform: uppercase;
    text-shadow: var(--terminal-glow);
    margin: 0;
}

.logo-text span {
    font-size: 0.8rem;
    color: var(--accent-alert);
    display: block;
    letter-spacing: 1px;
    font-family: var(--font-main);
}

.user-status {
    font-size: 0.85rem;
    color: var(--text-dim);
    border: 1px solid #30363d;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.3);
}

.status-light {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--accent-green-bright);
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 4s infinite;
}

/* --- BACK TO TOP BUTTON --- */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--accent-green);
    color: #000;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* Circle */
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-green);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--accent-green-bright);
    box-shadow: 0 0 15px var(--accent-green-bright);
    transform: translateY(-3px);
}

@media (max-width: 768px) {
    .terminal-error-container {
        width: 100%;
        max-width: 350px;
        /* Prevent it from being too wide on small phones */
        padding: 1.5rem 1rem;
        margin: 0 1rem;
        /* Add margin so it doesn't touch edges */
        box-sizing: border-box;
        /* Ensure padding doesn't add to width */
    }

    .terminal-error-container::before {
        font-size: 0.8rem;
        top: -10px;
        left: 10px;
        padding: 0 5px;
    }

    .error-code {
        font-size: 3.5rem;
        /* Smaller font to fit */
        margin-left: -5px;
        /* Slight visual correction */
    }

    .error-message {
        font-size: 1rem;
        line-height: 1.4;
    }

    .terminal-text {
        font-size: 0.8rem;
        word-wrap: break-word;
        /* Prevent long text overflow */
    }

    .error-actions {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    .btn-terminal {
        width: 100%;
        text-align: center;
        padding: 12px 10px;
        font-size: 0.9rem;
        box-sizing: border-box;
    }
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

/* --- FOOTER STATUS --- */
.footer-status {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #30363d;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.status-online {
    color: var(--accent-green);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(46, 160, 67, 0.5);
}

.status-line-sub {
    font-size: 0.75rem;
    opacity: 0.7;
    padding-left: 18px;
    /* Align with text above (skip light) */
}

/* --- HEADER SEARCH (Restored/Updated) --- */
/* --- HEADER SEARCH (Compact) --- */
.header-search {
    position: relative;
    flex: 0 1 250px;
    /* Reduced from 350px */
    margin-right: 15px;
    /* Tighter margin */
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #30363d;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(46, 160, 67, 0.3);
    background: rgba(13, 17, 23, 0.8);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    /* Full width of sidebar */
    background: var(--panel-bg);
    border: 1px solid #30363d;
    border-top: none;
    max-height: 400px;
    /* Taller results area */
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    border-bottom: 1px solid #21262d;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: rgba(46, 160, 67, 0.1);
}

.search-result-title {
    display: block;
    color: var(--text-main);
    font-size: 0.95rem;
}

.search-result-section {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-top: 2px;
}

.search-no-results {
    padding: 15px 12px;
    color: var(--text-dim);
    text-align: center;
    font-style: italic;
}

@media (max-width: 768px) {
    /* Search visibility handled in main responsive block now */
}



.search-result-snippet {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-result-item:hover .search-result-snippet {
    color: #8b949e;
}

.search-result-snippet strong {
    color: var(--accent-alert);
}

/* --- 404 PAGE STYLES --- */
.error-page-body {
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

.terminal-error-container {
    width: 600px;
    padding: 2rem;
    border: 2px solid var(--accent-red);
    background: rgba(20, 0, 0, 0.9);
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.2);
    position: relative;
    font-family: 'Courier New', monospace;
}

.terminal-error-container::before {
    content: "КРИТИЧЕСКАЯ ОШБИКА";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #000;
    padding: 0 10px;
    color: var(--accent-red);
    font-weight: bold;
    border: 1px solid var(--accent-red);
}

.error-code {
    font-size: 5rem;
    color: var(--accent-red);
    text-shadow: 4px 4px 0px #4a0000;
    margin-bottom: 0.5rem;
    letter-spacing: 5px;
    font-weight: bold;
}

.error-message {
    font-size: 1.2rem;
    color: #ff8888;
    margin-bottom: 2rem;
    border-bottom: 1px solid #550000;
    padding-bottom: 1rem;
}

.terminal-text {
    color: #bbb;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.terminal-text::before {
    content: "> ";
    color: var(--accent-red);
}

.error-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.btn-terminal {
    background: transparent;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 10px 20px;
    text-transform: uppercase;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s;
    cursor: pointer;
    font-family: inherit;
}

.btn-terminal:hover {
    background: var(--accent-green);
    color: #000;
    box-shadow: 0 0 15px var(--accent-green);
}

.btn-terminal.danger {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-terminal.danger:hover {
    background: var(--accent-red);
    color: #000;
    box-shadow: 0 0 15px var(--accent-red);
}

.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 999;
}

/* --- LAYOUT --- */
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 280px;
    background-color: var(--panel-bg);
    border-right: var(--border-style);
    padding: 1rem;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    flex: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    font-size: 0.7rem;
    color: #444;
    text-align: center;
    padding-top: 15px;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-header {
    color: var(--accent-alert);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #30363d;
    padding-bottom: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.nav-header:hover {
    color: var(--accent-green-bright);
}

.nav-toggle {
    transition: transform 0.3s;
    display: inline-flex;
    align-items: center;
}

.nav-toggle svg {
    width: 16px;
    height: 16px;
}

.nav-section.collapsed .nav-toggle {
    transform: rotate(-90deg);
}

.nav-links {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.nav-section.collapsed .nav-links {
    max-height: 0;
    display: none;
    /* Helper for accessibility/layout */
}

.nav-links a {
    display: block;
    color: var(--text-main);
    text-decoration: none;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(46, 160, 67, 0.1);
    border-left: 2px solid var(--accent-green-bright);
    color: #fff;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    padding: 2rem 4rem;
    overflow-y: auto;
    background-color: var(--bg-color);
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-green) var(--bg-color);
}

.content-frame {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid #30363d;
    padding: 2.5rem;
    position: relative;
}

.content-frame::before {
    content: "";
    position: absolute;
    top: -1px;
    left: -1px;
    width: 20px;
    height: 20px;
    border-top: 2px solid var(--accent-green);
    border-left: 2px solid var(--accent-green);
}

.content-frame::after {
    content: "";
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 20px;
    height: 20px;
    border-bottom: 2px solid var(--accent-green);
    border-right: 2px solid var(--accent-green);
}

/* --- TYPOGRAPHY --- */
h1.page-title {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 0.5rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
    border-bottom: none;
}

.page-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
    border-bottom: 1px solid #30363d;
    padding-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    /* Prevent overflow on small screens */
    align-items: center;
    gap: 15px;
}

/* --- TABLE OF CONTENTS --- */
#table-of-contents {
    background: var(--panel-bg);
    border: 1px solid #30363d;
    margin-bottom: 2rem;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.toc-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toc-title {
    color: var(--accent-alert);
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.toc-toggle {
    color: var(--accent-green);
    transition: transform 0.3s;
}

.toc-collapsed .toc-toggle {
    transform: rotate(-90deg);
}

.toc-body {
    padding: 0 1rem 1rem 1rem;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.toc-collapsed .toc-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-list li {
    margin: 0;
}

.toc-h2>a {
    display: block;
    color: var(--accent-green-bright);
    text-decoration: none;
    padding: 4px 0;
    font-size: 0.9rem;
}

.toc-h2>a:hover {
    text-decoration: underline;
}

.toc-sublist {
    list-style: none;
    margin: 0;
    padding-left: 1.5rem;
    border-left: 1px solid #30363d;
    margin-left: 0.5rem;
}

.toc-h3 a {
    display: block;
    color: var(--text-dim);
    text-decoration: none;
    padding: 3px 0;
    font-size: 0.85rem;
}

.toc-h3 a:hover,
.toc-h4 a:hover,
.toc-h5 a:hover,
.toc-h6 a:hover {
    color: var(--accent-green-bright);
}

.toc-h4 a,
.toc-h5 a,
.toc-h6 a {
    display: block;
    color: var(--text-dim);
    text-decoration: none;
    padding: 2px 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

h2 {
    font-size: 1.5rem;
    color: var(--accent-green-bright);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #30363d;
    padding-bottom: 0.5rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
}

h3 {
    font-size: 1.2rem;
    color: #fff;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-green);
    padding-left: 10px;
}

p {
    margin-bottom: 1rem;
    color: white;
    font-size: 1rem;
}

ul,
ol {
    margin-left: 2.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

a {
    color: var(--accent-green-bright);
}

/* --- KEYBOARD KEYS --- */
kbd {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-bottom: 3px solid #30363d;
    border-radius: 4px;
    box-shadow: 0 1px 0 rgba(27, 31, 35, 0.04);
    color: #c9d1d9;
    display: inline-block;
    font-size: 11px;
    line-height: 10px;
    padding: 3px 5px;
    vertical-align: middle;
    font-family: var(--font-ui);
}

/* --- BADGES --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    vertical-align: middle;
}

.badge-alpha {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.badge-bravo {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

.badge-charlie {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
    border-color: var(--accent-purple);
}

.badge-delta {
    background: rgba(56, 139, 253, 0.15);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.badge-physical {
    background: rgba(218, 54, 51, 0.15);
    color: var(--accent-danger);
    border-color: var(--accent-danger);
}

.badge-burn {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

.badge-toxin {
    background: rgba(46, 160, 67, 0.15);
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.badge-respiratory {
    background: rgba(56, 139, 253, 0.15);
    color: var(--accent-info);
    border-color: var(--accent-info);
}

.badge-genetic {
    background: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
    border-color: var(--accent-purple);
}

/* --- ADMONITIONS --- */
.admonition {
    margin: 1.5rem 0;
    padding: 1rem;
    border-left: 4px solid;
    background: rgba(0, 0, 0, 0.2);
}

.admonition-title {
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
    font-size: 0.9rem;
}

.admonition.info {
    border-color: var(--accent-info);
    background: rgba(31, 111, 235, 0.05);
}

.admonition.info .admonition-title {
    color: var(--accent-info);
}

.admonition.danger {
    border-color: var(--accent-danger);
    background: rgba(218, 54, 51, 0.05);
}

.admonition.danger .admonition-title {
    color: var(--accent-danger);
}

.admonition.success {
    border-color: var(--accent-green-bright);
    background: rgba(46, 160, 67, 0.05);
}

.admonition.success .admonition-title {
    color: var(--accent-green-bright);
}

.admonition.abstract {
    border-color: var(--accent-purple);
    background: rgba(163, 113, 247, 0.05);
}

.admonition.abstract .admonition-title {
    color: var(--accent-purple);
}

/* --- IMAGES --- */
figure {
    margin: 2rem 0;
    border: 1px solid #30363d;
    background: #010409;
    padding: 5px;
}

figure img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.8;
    transition: opacity 0.3s;
}

figure img:hover {
    opacity: 1;
}

figcaption {
    padding: 8px;
    font-size: 1.0rem;
    color: white;
    text-align: center;
    border-top: 1px solid #30363d;
    font-style: italic;
}

/* --- TABLES --- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #30363d;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.uscm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.uscm-table th {
    text-align: left;
    padding: 10px;
    background: rgba(46, 160, 67, 0.1);
    color: var(--accent-green-bright);
    border-bottom: 1px solid #30363d;
    text-transform: uppercase;
}

.uscm-table td {
    padding: 10px;
    border-bottom: 1px solid #21262d;
}

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

/* --- INLINE ICONS --- */
.icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
}

.icon-inline svg {
    width: 1.2em;
    height: 1.2em;
}

.icon-info {
    color: #58a6ff;
}

.icon-warning {
    color: var(--accent-alert);
}

.icon-danger {
    color: var(--accent-red);
}

.icon-check {
    color: var(--accent-green);
}

.icon-star {
    color: #e3b341;
}

.icon-clipboard {
    color: #8b949e;
}

.icon-edit {
    color: #8b949e;
}

.icon-pin {
    color: var(--accent-red);
}

.icon-search {
    color: var(--accent-green);
}

.icon-settings {
    color: #8b949e;
}

.icon-abstract {
    color: #d2a8ff;
    /* Purple */
}

.icon-quote {
    color: #7d8590;
    /* Gray */
}

/* Admonition Title adjustment for icons */
.admonition-title .icon-inline {
    margin-right: 8px;
}

code {
    background: rgba(110, 118, 129, 0.4);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 85%;
    font-family: var(--font-main);
}

.code-block {
    background: #0d1117;
    border: 1px solid #30363d;
    padding: 1rem;
    font-family: var(--font-main);
    margin: 1rem 0;
    color: var(--accent-green-bright);
}

/* --- AUTHOR CARD --- */
.author-card {
    margin-top: 4rem;
    border-top: 2px dashed #30363d;
    padding-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar-terminal {
    width: 60px;
    height: 60px;
    background: #0d1117;
    border: 2px solid var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-family: var(--font-main);
}

.avatar-terminal::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--accent-green-bright);
    border-left: 2px solid var(--accent-green-bright);
}

.avatar-terminal::after {
    content: "";
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-bottom: 2px solid var(--accent-green-bright);
    border-right: 2px solid var(--accent-green-bright);
}

/* Instructor icon - star like dot of 'i' */
.instructor-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.instructor-icon .star {
    color: var(--accent-green-bright);
    width: 24px;
    height: 24px;
    animation: star-pulse 2s ease-in-out infinite;
}

.instructor-icon .line {
    width: 3px;
    height: 30px;
    background: var(--accent-green);
    border-radius: 2px;
}

@keyframes star-pulse {

    0%,
    100% {
        filter: drop-shadow(0 0 2px var(--accent-green-bright));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 8px var(--accent-green-bright));
        transform: scale(1.1);
    }
}

.author-info div {
    line-height: 1.3;
}

.author-name {
    color: #fff;
    font-weight: bold;
}

.author-rank {
    color: var(--accent-alert);
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .top-bar {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 10px;
        z-index: 100;
        /* Lower than sidebar */
        position: fixed;
        /* Fixed so it overlays content and doesn't leave gap */
        top: 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* Add padding to main content to account for fixed header */
    .main-content {
        padding-top: 150px !important;
        /* Header height + buffer */
    }

    /* Fix anchor scrolling overlapping with fixed header */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        scroll-margin-top: 160px;
    }

    /* Menu Button - Borderless, minimal style */
    .menu-toggle {
        display: block;
        background: none;
        border: none;
        color: var(--accent-green-bright);
        padding: 8px 10px;
        font-size: 0;
        /* Hide any fallback text */
        cursor: pointer;
        margin-right: 10px;
        transition: all 0.2s;
        filter: drop-shadow(0 0 5px rgba(46, 160, 67, 0.5));
    }

    .menu-toggle svg {
        width: 32px;
        height: 32px;
    }

    .menu-toggle:hover,
    .menu-toggle:active {
        color: #fff;
        filter: drop-shadow(0 0 8px rgba(46, 160, 67, 0.8));
    }

    /* Make search visible and full width on mobile */
    .header-search {
        display: block !important;
        flex: 0 0 100%;
        order: 3;
        margin-right: 0;
        margin-top: 5px;
    }

    .logo-text h1 {
        font-size: 1.2rem;
    }

    .container {
        flex-direction: column;
        z-index: auto;
        /* Reset stacking context so sidebar can escape */
        position: static;
        /* Remove positioning to free sidebar z-index */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px;
        z-index: 99999;
        /* Above header */
        z-index: 99999;
        /* Above header */
        transform: translateX(-100%);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.8);
        background-color: var(--panel-bg);
        /* Ensure solid background */
        overflow-x: hidden;
        /* Prevent horizontal scroll */
        overflow-y: auto;
    }

    /* Only animate transform when this class is added */
    .sidebar.animated {
        transition: transform 0.3s ease;
    }

    /* Close Button (Mobile Only) */
    .close-sidebar {
        display: block;
        position: absolute;
        top: 5px;
        right: 10px;
        background: rgba(0, 0, 0, 0.5);
        /* Semi-transparent background for visibility */
        border: 1px solid #30363d;
        border-radius: 4px;
        color: var(--text-dim);
        font-size: 0;
        cursor: pointer;
        z-index: 100002;
        line-height: 0;
        padding: 8px;
        width: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .close-sidebar svg {
        width: 20px;
        height: 20px;
    }

    .sidebar-content {
        margin-top: 30px;
        /* Push content down so button doesn't overlap text */
    }

    .close-sidebar:hover {
        color: var(--accent-red);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Blocking Overlay - covers entire screen when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99998;
        /* Just below sidebar */
    }

    .sidebar.open~.sidebar-overlay,
    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    /* When sidebar is open, prevent interaction with main content */
    body.sidebar-open .container {
        pointer-events: none;
        overflow: hidden;
    }

    body.sidebar-open .main-content {
        pointer-events: none;
        overflow: hidden;
    }

    /* BUT keep sidebar itself interactive! */
    body.sidebar-open .sidebar {
        pointer-events: auto;
    }

    .main-content {
        padding: 1rem;
        width: 100%;
    }

    .content-frame {
        padding: 1rem;
        margin-bottom: 50px;
    }
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }

    /* Verify close button is hidden on desktop */
    .close-sidebar {
        display: none;
    }
}

/* --- IMAGE ZOOM OVERLAY --- */
.image-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.image-zoom-overlay.active {
    opacity: 1;
    visibility: visible;
}

.zoomed-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border: 2px solid var(--accent-green);
    box-shadow: 0 0 30px rgba(46, 160, 67, 0.3);
    transition: transform 0.1s ease;
}

.zoom-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-close:hover {
    background: var(--accent-green);
    color: #000;
}

.zoom-level {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--accent-green);
    color: var(--accent-green-bright);
    padding: 5px 15px;
    font-size: 0.9rem;
    font-family: var(--font-main);
}