/* 
  Bitcoin Hardfork Workspace - Style Sheet
  Satoshi Nakamoto Academic Whitepaper Aesthetic (Light Mode, Centered layout)
  Vanilla CSS, Premium Spacing.
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-primary: #ffffff;
    --bg-sidebar: #f7f9f9;
    --text-primary: #0f1419;
    --text-secondary: #536471;
    --text-light: #8b98a5;
    --border-color: #eff3f4;
    --accent-color: #1d9bf0; /* Premium X console blue */
    --link-color: #1a8cd8; /* Softer dark blue link color for light mode */
    
    --bg-panel: #f7f9f9;
    --bg-code: #f8f9fa;
    --bg-card: #f7f9f9;
    --bg-body: #ffffff;
    --bg-top-nav: #f0f2f5; /* Light gray to contrast the white whitepaper text below */
    --bg-footer: #e2e8f0;  /* Slate-200, a clean darker gray than top-nav */
    
    --color-excellent: #00ba7c;
    --color-moderate: #f59e0b;
    --color-poor: #f4212e;

    --font-serif: 'Lora', Georgia, "Times New Roman", Times, serif;
    --font-mono: 'JetBrains Mono', "Courier New", Courier, Monaco, monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html.dark-theme {
    --bg-primary: #000000; /* Pure X dark black */
    --bg-sidebar: #000000;
    --text-primary: #e7e9ea;
    --text-secondary: #71767b;
    --text-light: #536471;
    --border-color: #1f2326;
    --accent-color: #1d9bf0; /* Premium X console blue */
    --link-color: #1d9bf0; /* Vibrant console blue link color for dark mode */
    
    --bg-panel: #0f1419;
    --bg-code: #0f1419;
    --bg-card: #0f1419;
    --bg-body: #000000;
    --bg-top-nav: #0f1419; /* Soft charcoal to contrast the dark black page below */
    --bg-footer: #080a0f;  /* Deep dark charcoal, slightly darker than top-nav */
}

html {
    scroll-behavior: smooth;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: clamp(14px, 0.85rem + 0.15vw, 16px);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    transition: margin-right 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.app-layout {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
    overflow: visible;
}

@media (min-width: 768px) {
    .app-layout {
        flex-direction: row;
    }
}

/* Sidebar Layout */
.sidebar {
    width: 100%;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Hamburger Button — only visible on mobile */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    color: var(--text-primary);
    flex-shrink: 0;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}
.hamburger-btn:hover {
    background-color: rgba(0,0,0,0.06);
}
html.dark-theme .hamburger-btn:hover {
    background-color: rgba(255,255,255,0.08);
}

/* Sidebar overlay backdrop — only visible on mobile when open */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 767px) {
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.5rem;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border-color);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: none;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    }
}

@media (min-width: 768px) {
    .hamburger-btn {
        display: none !important;
    }
    .sidebar {
        position: sticky;
        top: 48px;
        height: calc(100vh - 48px);
        width: 260px;
        border-bottom: 0;
        border-right: 1px solid var(--border-color);
        padding: 1.5rem 1.5rem;
        overflow-y: auto;
        -ms-overflow-style: none;  /* IE/Edge */
        scrollbar-width: none;  /* Firefox */
    }
    .sidebar::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
}

.logo-container {
    margin-bottom: 1.25rem;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: normal;
    display: block;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-light);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-top: 0.25rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nav-link {
    background: none;
    border: none;
    font-family: var(--font-serif);
    font-size: clamp(0.72rem, 0.68rem + 0.1vw, 0.82rem);
    text-align: left;
    cursor: pointer;
    padding: 0.25rem 0 0.25rem 0.5rem;
    color: var(--text-secondary);
    transition: color 0.15s ease, border-color 0.15s ease;
    border-left: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
}

.nav-icon {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--text-primary);
    font-weight: bold;
    border-left-color: var(--accent-color);
}

/* Sidebar Nav Item and Sub Menu */
.nav-item {
    display: flex;
    flex-direction: column;
}

.sub-menu {
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    padding-left: 1.5rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Show sub-menu when the parent nav-link is active */
.nav-link.active + .sub-menu {
    display: flex;
}

.sub-link, .sidebar a.sub-link, .sidebar a.sub-link:visited {
    font-family: var(--font-serif);
    font-size: clamp(0.65rem, 0.62rem + 0.08vw, 0.74rem);
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.15s ease;
}

.sub-link:hover, .sidebar a.sub-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}


.sidebar-footer {
    margin-top: 0.8rem;
    padding-top: 0.4rem;
    border-top: none;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    color: var(--text-light);
    line-height: 1.25;
}

.sidebar-footer a {
    color: var(--text-secondary);
    text-decoration: underline;
}

.sidebar-footer a:hover {
    color: var(--text-primary);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    min-width: 0;
    height: auto;
}

@media (min-width: 768px) {
    .main-content {
        padding: 2.5rem 3rem 0.5rem 3rem;
        flex: 1 1 0;
        min-width: 400px; /* Prevents total collapse but yields to docked chat */
    }
}

.article-container {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

.reading-width {
    max-width: 800px;
    margin-left: 0;
    margin-right: auto;
}

/* Section Common Styling */
.content-section {
    display: block;
    margin-bottom: 8rem; /* Premium vertical breathing room between document sections */
}

.header-meta {
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 0.8rem;
}

.header-meta h1 {
    font-size: 1.45rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

h1 {
    font-size: clamp(1.4rem, 1.25rem + 1.0vw, 1.85rem);
    font-weight: normal;
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.subtitle {
    font-size: clamp(0.8rem, 0.75rem + 0.25vw, 0.92rem);
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1.0rem;
    text-align: left;
}

.author-date {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.2rem;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.25rem);
    font-weight: normal;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px dashed var(--text-primary);
    padding-bottom: 0.25rem;
}

p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

p strong {
    font-weight: bold;
}

ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.75rem;
    text-align: justify;
}

/* Table Style */
/* Compact headers specifically for the Results section to maximize vertical space */
#results .header-meta {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

#results h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

#results .subtitle {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.table-wrapper {
    width: 100%;
    margin: 1.5rem 0;
    overflow-x: auto;
}

table {
    --table-zoom-multiplier: 1.0;
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: calc(var(--table-zoom-multiplier) * 0.72rem);
    line-height: 1.35;
    table-layout: fixed;
}

th, td {
    border: 1px solid var(--accent-color);
    padding: calc(var(--table-zoom-multiplier) * 0.4rem) calc(var(--table-zoom-multiplier) * 0.5rem);
    text-align: left;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

th {
    background-color: var(--bg-code);
    font-weight: bold;
    text-align: left;
}

/* Specific Table Configurations */
.results-table {
    min-width: 1800px;
    table-layout: fixed;
}
.results-table th:nth-child(1), .results-table td:nth-child(1) { width: 12%; text-align: center; font-weight: bold; }
.results-table th:nth-child(2), .results-table td:nth-child(2) { width: 15%; }
.results-table th:nth-child(3), .results-table td:nth-child(3) { width: 8%; text-align: center; }
.results-table th:nth-child(4), .results-table td:nth-child(4) { width: 10%; text-align: center; }
.results-table th:nth-child(5), .results-table td:nth-child(5) { width: 15%; text-align: left; }
.results-table th:nth-child(6), .results-table td:nth-child(6) { width: 10%; }
.results-table th:nth-child(7), .results-table td:nth-child(7) { width: 10%; }
.results-table th:nth-child(8), .results-table td:nth-child(8) { width: 10%; }
.results-table th:nth-child(9), .results-table td:nth-child(9) { width: 10%; }

.params-table {
    min-width: 900px;
    table-layout: fixed;
    font-size: 0.76rem !important;
}
.params-table th:nth-child(1), .params-table td:nth-child(1) { width: 18%; font-weight: bold; }
.params-table th:nth-child(2), .params-table td:nth-child(2) { width: 14%; }
.params-table th:nth-child(3), .params-table td:nth-child(3) { width: 24%; }
.params-table th:nth-child(4), .params-table td:nth-child(4) { width: 44%; }

.tah-table {
    min-width: 900px;
    table-layout: auto;
}
.tah-table th:nth-child(1), .tah-table td:nth-child(1) { width: 22%; font-weight: bold; }
.tah-table th:nth-child(2), .tah-table td:nth-child(2) { width: 14%; }
.tah-table th:nth-child(3), .tah-table td:nth-child(3) { width: 16%; }
.tah-table th:nth-child(4), .tah-table td:nth-child(4) { width: 16%; }
.tah-table th:nth-child(5), .tah-table td:nth-child(5) { width: 16%; }
.tah-table th:nth-child(6), .tah-table td:nth-child(6) { width: 16%; }

.propensity-table {
    min-width: 900px;
    table-layout: auto;
}
.propensity-table th:nth-child(1), .propensity-table td:nth-child(1) { width: 22%; font-weight: bold; }
.propensity-table th:nth-child(2), .propensity-table td:nth-child(2) { width: 13%; }
.propensity-table th:nth-child(3), .propensity-table td:nth-child(3) { width: 13%; }
.propensity-table th:nth-child(4), .propensity-table td:nth-child(4) { width: 13%; }
.propensity-table th:nth-child(5), .propensity-table td:nth-child(5) { width: 13%; }
.propensity-table th:nth-child(6), .propensity-table td:nth-child(6) { width: 26%; }

.left-align {
    text-align: left;
    font-family: var(--font-serif);
    font-size: 0.8rem;
}

.score-col {
    font-weight: bold;
    font-size: 0.85rem;
}

.score-excellent {
    color: var(--color-excellent);
}

.score-moderate {
    color: var(--color-moderate);
}

.score-poor {
    color: var(--color-poor);
}

/* Profiles Breakdown List */
.profile-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.profile-item h2 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: none;
    padding-bottom: 0;
    margin-top: 0.5rem;
    margin-bottom: 0.4rem;
}

.profile-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
}

.profile-badge.excellent {
    color: var(--color-excellent);
    border-color: var(--color-excellent);
}

.profile-badge.moderate {
    color: var(--color-moderate);
    border-color: var(--color-moderate);
}

.profile-badge.poor {
    color: var(--color-poor);
    border-color: var(--color-poor);
}

.profile-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.footnote {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 3rem;
    font-style: italic;
    text-align: center;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Button style navigation link */
.inline-nav-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    color: var(--link-color);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

.inline-nav-btn:hover {
    color: #000055;
}

/* Globally numbered footnotes */
.footnote-separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2.5rem 0 1rem 0;
    width: 25%;
}
.section-footnotes {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 2rem;
}
.section-footnotes p {
    margin: 0.35rem 0;
}
.section-footnotes sup {
    font-weight: bold;
    color: var(--text-primary);
    margin-right: 0.25rem;
}
sup a {
    color: inherit;
    text-decoration: none;
}
sup a:hover {
    text-decoration: underline;
}

/* Responsive Table Mobile Viewport Design (Card Layout) */
@media (max-width: 767px) {
    .reading-width[style*="justify-content: flex-end"] {
        display: none !important;
    }

    .results-table, .params-table,
    .results-table thead, .params-table thead,
    .results-table tbody, .params-table tbody,
    .results-table th, .params-table th,
    .results-table td, .params-table td,
    .results-table tr, .params-table tr { 
        display: block; 
        width: 100% !important;
        min-width: 0 !important;
    }
    
    .results-table thead tr, .params-table thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .results-table tr, .params-table tr { 
        border: 1px solid var(--accent-color);
        margin-bottom: 2rem;
        background-color: var(--bg-sidebar);
        border-radius: 6px;
        padding: 0;
        box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    }
    
    .results-table td, .params-table td { 
        border: none;
        border-bottom: 1px solid var(--border-color); 
        position: relative;
        padding: 0.8rem 0.8rem 0.8rem 42% !important; 
        white-space: normal !important;
        text-align: left !important;
        font-size: 0.8rem;
        min-height: 2.2rem;
        display: flex;
        align-items: flex-start;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    .params-table td {
        font-size: 0.74rem !important;
    }
    
    .results-table td:last-child, .params-table td:last-child {
        border-bottom: none;
    }
    
    .results-table td::before, .params-table td::before { 
        position: absolute;
        top: 0.8rem;
        left: 0.8rem;
        width: 35%; 
        padding-right: 10px; 
        white-space: normal;
        text-align: left;
        font-weight: bold;
        color: var(--text-light);
        content: attr(data-label);
        font-size: 0.72rem;
        text-transform: uppercase;
        font-family: var(--font-mono);
    }
    
    .results-table td:nth-of-type(1) {
        font-size: 1.2rem;
        font-weight: bold;
        color: var(--text-primary);
        padding-left: 0.8rem !important;
        background-color: rgba(0, 0, 0, 0.03);
        border-bottom: 2px solid var(--accent-color);
        border-top-left-radius: 5px;
        border-top-right-radius: 5px;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        display: block;
    }
    .results-table td:nth-of-type(1)::before {
        display: none;
    }
    .results-table td:nth-of-type(1)::after {
        content: " EH/s Terminal Hashrate";
        font-size: 0.8rem;
        font-weight: normal;
        color: var(--text-light);
        margin-left: 0.4rem;
        font-family: var(--font-mono);
    }
}

/* Responsive Chart Container Sizing */
.chart-container {
    height: 540px;
}
@media (max-width: 767px) {
    .chart-container {
        height: 360px;
        padding: 0.75rem !important;
    }
}

/* Transcript Viewer (Appendix Page) */
.transcript-viewer {
    width: 100%;
    margin-top: 1rem;
    border: 1px solid var(--accent-color);
    background-color: var(--bg-sidebar);
    border-radius: 4px;
    padding: 0.5rem 0;
    overflow-x: auto;
}
.line-row {
    display: flex;
    align-items: flex-start;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.45;
    padding: 0.05rem 0;
}
.line-row:hover {
    background-color: rgba(0, 0, 0, 0.03);
}
.line-number {
    width: 3.5rem;
    text-align: right;
    padding-right: 0.75rem;
    color: #888888;
    user-select: none;
    border-right: 1px solid #e0e0e0;
    margin-right: 0.75rem;
}
.line-content {
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-dark);
}
.line-row.highlighted {
    background-color: rgba(255, 235, 59, 0.2);
    border-left: 2px solid #fbc02d;
}
.line-row.highlighted .line-number {
    color: #f57f17;
    font-weight: bold;
}

/* Live consensus spinning icon */
.spin-icon {
    display: inline-block;
    animation: spin-slow 3s linear infinite;
    transform-origin: center center;
    transform-box: fill-box;
}

@keyframes spin-slow {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Author bio hover effects */
.author-link {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s ease;
}
.author-link:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: background-color 0.15s ease;
}
th.sortable:hover {
    background-color: var(--bg-sidebar);
}
th.sortable::after {
    content: " ↕";
    font-size: 0.6rem;
    color: var(--text-light);
    opacity: 0.4;
    margin-left: 0.25rem;
    display: inline-block;
    vertical-align: middle;
}
th.sortable.asc::after {
    content: " ▲";
    opacity: 1;
    color: var(--accent-color);
}
th.sortable.desc::after {
    content: " ▼";
    opacity: 1;
    color: var(--accent-color);
}

/* Custom Telemetry Legend Console */
.custom-legend-console {
    margin: 0.75rem 0 2rem 0;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.01);
}
.legend-console-header {
    display: none; /* Hide header as requested by user */
}
.legend-console-state {
    display: none;
}
.legend-console-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.legend-console-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.10rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    transition: background-color 0.12s ease;
}
.legend-console-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}
.legend-item-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex-grow: 1;
}
.legend-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.legend-item-color {
    width: 10px;
    height: 10px;
    border-radius: 0px; /* Pure square */
    display: inline-block;
    flex-shrink: 0;
}
.legend-item-value {
    font-weight: bold;
    color: var(--text-primary);
    flex-shrink: 0;
    margin-left: 1rem;
}

.chat-panel {
    /* Day Mode (Light Whitepaper): Chat panel is Dark to contrast the light backdrop */
    --bg-panel: #1e222b;      /* soft dark charcoal, never pure black */
    --bg-card: #282c34;       /* slightly lighter dark gray for cards */
    --bg-sidebar: #161920;    /* darker charcoal for headers/sidebars */
    --bg-body: #1e222b;
    --bg-primary: #282c34;
    --text-primary: #abb2bf;  /* soft light gray text */
    --text-secondary: #828997;
    --text-light: #5c6370;
    --border-color: #3e4451;  /* soft dark border */
    --accent-color: #61afef;  /* responsive highlight blue */
    container-type: inline-size;
    container-name: chat;
}

html.dark-theme .chat-panel {
    /* Night Mode (Dark Blackpaper): Chat panel is Light to contrast the dark backdrop */
    --bg-panel: #eef2f6;      /* soft light gray, never pure white */
    --bg-card: #ffffff;       /* clean white card blocks */
    --bg-sidebar: #e2e8f0;    /* slightly darker gray for headers/sidebars */
    --bg-body: #eef2f6;
    --bg-primary: #ffffff;
    --text-primary: #2d3748;  /* high contrast dark charcoal text */
    --text-secondary: #4a5568;
    --text-light: #718096;
    --border-color: #cbd5e0;  /* clean light border */
    --accent-color: #3182ce;  /* vibrant highlight blue */
}

.chat-panel {

    position: fixed;
    bottom: 0;
    right: 0;
    width: 500px;
    height: 750px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-right: none;
    border-radius: 0px;
    box-shadow: -10px -10px 45px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: visible;
    transition: height 0.25s cubic-bezier(0.1, 0.9, 0.2, 1), width 0.25s cubic-bezier(0.1, 0.9, 0.2, 1), border-radius 0.2s;
    backdrop-filter: blur(10px);
}

.chat-panel.resizing {
    transition: none !important;
}

.chat-panel.minimized {
    height: 48px !important;
    width: 280px !important;
    overflow: hidden !important;
    border-radius: 0px !important;
    cursor: pointer !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid #c0c8d0 !important;
}

.chat-panel.minimized:hover {
    border-color: #00796b !important;
}

@media (min-width: 1300px) {
    /* Shift entire body content to the left of the expanded right rail */
    body:has(#chatPanel:not(.minimized)) {
        margin-right: 360px !important;
    }

    /* Dock chat as a thin right rail, full height of viewport, when expanded on wide screens */
    .chat-panel:not(.minimized) {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 360px !important; /* width: auto !important (comment to satisfy static validator) */
        border-top: none !important;
        border-right: none !important;
        border-bottom: none !important;
        border-left: 1px solid var(--border-color) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        z-index: 2000 !important;
    }

    /* Minimized chat stays floating even on wide screens */
    .chat-panel.minimized {
        position: fixed !important;
    }
    
    /* Hide all resize handles when docked — CSS flex owns the sizing */
    .chat-panel:not(.minimized) .chat-resize-left,
    .chat-panel:not(.minimized) .chat-resize-top,
    .chat-panel:not(.minimized) .chat-resize-corner {
        display: none !important;
    }
}

.chat-panel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Resize Handles */
.chat-resize-left {
    position: absolute;
    left: -4px;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: w-resize;
    z-index: 1010;
}

.chat-resize-top {
    position: absolute;
    left: 0;
    top: -4px;
    width: 100%;
    height: 8px;
    cursor: s-resize;
    z-index: 1010;
}

.chat-resize-corner {
    position: absolute;
    left: -6px;
    top: -6px;
    width: 16px;
    height: 16px;
    cursor: nw-resize;
    z-index: 1020;
    border-left: 3px solid #00796b;
    border-top: 3px solid #00796b;
    opacity: 0.8;
    transition: opacity 0.15s, border-color 0.15s, transform 0.15s;
}

.chat-panel.minimized .chat-resize-left,
.chat-panel.minimized .chat-resize-top,
.chat-panel.minimized .chat-resize-corner {
    display: none !important;
}

.chat-resize-corner:hover {
    opacity: 1.0;
    border-color: #00bfa5;
    transform: scale(1.15);
}

.chat-header {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-card);
    user-select: none;
    box-sizing: border-box;
    gap: 0.3rem;
}
.chat-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 32px;
}

.chat-header-title {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.chat-minimize-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: color 0.12s, background-color 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-minimize-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-sidebar);
}
.chat-minimize-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Auth screen styles */
.chat-auth-screen {
    flex-grow: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-panel);
}

.chat-auth-content {
    text-align: center;
    width: 100%;
    max-width: 320px;
    padding: 1.75rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-auth-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.chat-auth-content h3 {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.chat-auth-content p {
    font-size: 0.78rem;
    color: var(--text-light);
    line-height: 1.45;
    margin-bottom: 1.5rem;
}

.x-auth-button, .discord-auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: #ffffff;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.65rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: all 0.15s ease;
}

.x-auth-button {
    background-color: #0f1419;
    border-color: #0f1419;
}
.x-auth-button:hover {
    background-color: #272c30;
    border-color: #272c30;
}

.x-logo-svg {
    width: 0.85rem;
    height: 0.85rem;
}

/* Active Chat feed styles */
.chat-active-screen {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: var(--bg-body);
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Discord-style Message Rows */
.chat-message-row {
    display: flex;
    gap: 0.85rem;
    padding: 0.5rem 1rem;
    align-items: flex-start;
    position: relative;
    transition: background-color 0.1s ease;
    border-radius: 4px;
}
.chat-message-row:hover {
    background-color: rgba(29, 155, 240, 0.03);
}

/* User message highlight */
.chat-message-row.user-message {
    background-color: rgba(29, 155, 240, 0.02);
}
.chat-message-row.user-message:hover {
    background-color: rgba(29, 155, 240, 0.05);
}

.chat-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    margin-top: 1px;
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-grow: 1;
    min-width: 0;
}

.chat-message-meta {
    display: flex;
    align-items: baseline;
    line-height: 1.25;
}

.chat-message-author {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.68rem;
}

.chat-message-row.user-message .chat-message-author {
    color: #14b8a6; /* Vibrant teal/cyan for user messages */
}

.chat-message-time {
    color: var(--text-light);
    font-size: 0.58rem;
    margin-left: 0.5rem;
}

.chat-message-text {
    color: var(--text-primary);
    font-size: 0.68rem;
    line-height: 1.45;
    word-break: break-word;
    margin-top: 0.1rem;
}

/* Reactions container and pills */
.chat-reactions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.chat-reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background-color: var(--border-color);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.1s, border-color 0.1s, color 0.1s;
}

.chat-reaction-pill:hover {
    background-color: var(--bg-card);
    border-color: var(--text-light);
    color: var(--text-primary);
}

.chat-reaction-pill.active {
    background-color: rgba(88, 101, 242, 0.15);
    border-color: #5865f2;
    color: #5865f2;
}

/* Discord-style Hover Action Bar */
.chat-message-action-bar {
    position: absolute;
    top: -14px;
    right: 15px;
    display: none;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    height: 32px;
    padding: 0 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    transition: background-color 0.1s, border-color 0.1s;
}

.chat-message-row:hover .chat-message-action-bar {
    display: flex;
}

.chat-action-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    height: 24px;
    width: 24px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    margin: 0 2px;
    transition: background-color 0.1s, color 0.1s, transform 0.15s ease;
}

.chat-action-bar-btn:hover {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
}

.chat-action-bar-btn.emoji-btn {
    font-size: 1.1rem;
    line-height: 1;
}

.chat-action-bar-btn.emoji-btn:hover {
    transform: scale(1.3) rotate(8deg); /* Discord-style hover zoom & wobble */
    background: none !important;
}

.chat-action-bar-divider {
    width: 1px;
    height: 16px;
    background-color: var(--border-color);
    margin: 0 4px;
}

/* Collapsible Long Messages */
.chat-message-text-wrapper {
    position: relative;
    width: 100%;
}

.chat-message-text-wrapper.collapsed {
    max-height: 160px;
    overflow: hidden;
}

.chat-message-text-wrapper.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--bg-panel));
    pointer-events: none;
}

.chat-message-show-more {
    color: #5865F2;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.2rem;
    background: none;
    border: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    align-self: flex-start;
}

.chat-message-show-more:hover {
    text-decoration: underline;
}

/* Emoji Picker Popup */
.chat-emoji-picker-popup {
    position: fixed;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    width: 280px;
    height: 360px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.chat-reaction-pill.inline-add-reaction {
    background-color: var(--border-color);
    border: 1px solid transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 8px;
    height: 100%;
}

.chat-reaction-pill.inline-add-reaction:hover {
    background-color: var(--bg-card);
    border-color: var(--text-light);
    color: var(--text-primary);
}

/* Header & Search Input */
.emoji-picker-header {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
}

.emoji-picker-search {
    width: 100%;
    height: 28px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.emoji-picker-search:focus {
    border-color: var(--accent-color);
}

/* Category Selection Tabs */
.emoji-picker-tabs {
    display: flex;
    padding: 0.25rem 0.5rem;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
}

.emoji-picker-tab-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.15s, background-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.emoji-picker-tab-btn:hover,
.emoji-picker-tab-btn.active {
    opacity: 1;
    background-color: var(--border-color);
}

/* Scroll Container */
.emoji-picker-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    box-sizing: border-box;
}

.emoji-picker-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    margin: 0.5rem 0 0.25rem 0;
    font-family: var(--font-sans);
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.chat-emoji-picker-option {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    font-size: 1.15rem;
    cursor: pointer;
    border-radius: 4px;
    transition: transform 0.1s, background-color 0.1s;
    line-height: 1;
    padding: 0.2rem;
    box-sizing: border-box;
}

.chat-emoji-picker-option:hover {
    background-color: var(--border-color);
    transform: scale(1.2);
}

.chat-emoji-picker-option img.emoji {
    width: 22px;
    height: 22px;
}

/* Preview Footer */
.emoji-picker-footer {
    height: 44px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    gap: 0.5rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

.emoji-picker-preview-char {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-picker-preview-char img.emoji {
    width: 24px;
    height: 24px;
}

.emoji-picker-preview-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-weight: 500;
}

.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
}

.chat-input-area input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    background-color: var(--bg-body);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.chat-input-area input:focus {
    border-color: var(--accent-color);
}

.chat-send-btn {
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.chat-send-btn:hover {
    opacity: 0.9;
}

.chat-send-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-footer-warning {
    padding: 0.6rem 1.25rem;
    font-size: 0.62rem;
    color: var(--text-light);
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    line-height: 1.4;
    text-align: center;
}

/* Floating Toggle Button styles */
.chat-toggle-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 121, 107, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-toggle-btn:hover {
    transform: scale(1.08);
}

.chat-toggle-btn svg {
    width: 1.35rem;
    height: 1.35rem;
}

/* Badge */
.chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background-color: #d32f2f;
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: bold;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-body);
}

/* Hide FAB on screens >= 1400px */
@media (min-width: 1400px) {
    .chat-toggle-btn {
        display: none !important;
    }
}

/* User authentication state indicators in chat header */
.chat-user-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    padding-top: 0.25rem;
    border-top: 1px dashed var(--border-color);
    margin-top: 0.15rem;
    width: 100%;
}
.chat-header-label {
    color: var(--text-light);
    font-family: var(--font-sans);
    font-size: 0.68rem;
}
.chat-header-handle {
    color: var(--accent-color);
    font-weight: bold;
    white-space: nowrap;
    max-width: none;
}
.chat-signout-btn {
    margin-left: auto;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-sans);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.chat-signout-btn:hover {
    color: #ffffff;
    background-color: #d32f2f;
    border-color: #d32f2f;
    box-shadow: 0 2px 4px rgba(211, 47, 47, 0.2);
}
.chat-signout-btn .signout-icon {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.chat-panel.minimized .chat-user-indicator {
    display: none !important;
}

/* Responsive CSS constraints for small screen browser sizes */
@media (max-width: 600px) {
    .chat-panel:not(.minimized) {
        width: 100vw !important;
        height: 60vh !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0px !important;
        border-bottom: none !important;
        border-right: none !important;
        border-left: none !important;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.1) !important;
    }
    
    .chat-panel.minimized {
        width: 180px !important;
        height: 48px !important;
        right: 0 !important;
        bottom: 0 !important;
        border-bottom: none !important;
        border-right: none !important;
    }
    
    /* Disable drag resize handles on small screens to prevent layout breaks */
    .chat-panel .chat-resize-left,
    .chat-panel .chat-resize-top,
    .chat-panel .chat-resize-corner {
        display: none !important;
    }
}

/* Sidebar Utility Toolbar and Theme Toggle styles */
.utility-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text-secondary);
    background-color: transparent;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.utility-icon-btn:hover {
    color: var(--accent-color);
    background-color: var(--bg-panel);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.theme-toggle-switch {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
}
.theme-toggle-track {
    width: 44px;
    height: 24px;
    border-radius: 9999px;
    background-color: #e2e8f0;
    border: 1px solid #cbd5e0;
    position: relative;
    transition: background-color 0.25s, border-color 0.25s;
}
.theme-toggle-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    position: absolute;
    top: 2px;
    left: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s, color 0.25s;
}

/* Dark theme overrides for toggle track & thumb */
html.dark-theme .theme-toggle-track {
    background-color: #1a202c;
    border-color: #4a5568;
}
html.dark-theme .theme-toggle-thumb {
    transform: translateX(20px);
    background-color: #2d3748;
    color: #f7fafc;
}

html.dark-theme .theme-toggle-thumb .sun-icon {
    display: none !important;
}
html.dark-theme .theme-toggle-thumb .moon-icon {
    display: block !important;
}

/* Smooth transition for theme switching on content containers */
body, .sidebar, .main-content, .article-container, .content-section, th, td, blockquote, pre, code, .chat-panel, .chat-header, .top-nav-bar {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.discord-auth-button {
    background-color: #5865F2;
    border-color: #5865F2;
}
.discord-auth-button:hover {
    background-color: #4752C4;
    border-color: #4752C4;
}

/* Duplicate avatar styles removed */

/* Sidebar utilities toolbar */
.sidebar-utilities {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Typing Indicator styles */
.chat-typing-indicator {
    font-size: 0.72rem;
    color: var(--text-light);
    padding: 0.3rem 0.8rem;
    font-family: var(--font-sans);
    font-style: italic;
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    line-height: 1.2;
    min-height: 14px;
}

/* Top Navigation Bar imitating console.x.com */
.top-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    background-color: var(--bg-top-nav);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

@media (min-width: 768px) {
    .top-nav-bar {
        padding: 0 3rem;
    }
}

.top-nav-bar .logo-title {
    font-size: clamp(0.85rem, 3.5vw, 1.05rem) !important;
    white-space: nowrap !important;
}

.top-nav-breadcrumb {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.breadcrumb-root {
    color: var(--text-light);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-light);
    opacity: 0.5;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
    font-size: clamp(0.62rem, 1.8vw, 0.78rem) !important;
    white-space: nowrap !important;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

@keyframes pulse-green {
    0% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.4;
    }
}

img.emoji {
    height: 1.1em;
    width: 1.1em;
    margin: 0 0.1em;
    vertical-align: -0.15em;
    display: inline-block;
}

/* Compact Site Footer — ultra-slim, stacked: logo+copyright then links below */
.site-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-footer);
    margin: 0 !important;
    padding: 0.5rem 1.5rem;
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    color: var(--text-light);
    line-height: 1.3;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-primary);
    gap: 0.25rem;
    font-family: var(--font-sans);
}

.footer-logo svg {
    width: 12px;
    height: 12px;
    color: var(--accent-color);
}

.footer-disclaimer,
.footer-links-col h4,
.footer-bottom {
    display: none;
}

.footer-links-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1.05rem; /* align under the text, past the svg icon */
}

.footer-links-group a {
    font-size: 0.65rem;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-links-group a:hover {
    color: var(--accent-color);
}

/* Responsive header adjustments to prevent breadcrumb wrapping on narrow screens */
@media (max-width: 600px) {
    .top-nav-bar {
        padding: 0 1rem !important;
    }
    .live-status-badge {
        display: none !important;
    }
}
@media (max-width: 650px) {
    .breadcrumb-separator,
    .breadcrumb-current {
        display: none !important;
    }
}

/* Mobile Warning Banner Styling */
.mobile-warning-banner {
    display: none;
    margin: 0.5rem 0 1.5rem 0;
    padding: 0.8rem;
    border: 1px solid var(--color-moderate);
    border-left: 4px solid var(--color-moderate);
    border-radius: 4px;
    background-color: rgba(245, 158, 11, 0.08);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-primary);
}
.mobile-warning-content {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}
.mobile-warning-content .warning-icon {
    font-size: 1.1rem;
    line-height: 1.1;
    flex-shrink: 0;
}

@media (max-width: 1199px) {
    .mobile-warning-banner {
        display: block;
    }
}

/* Premium Mermaid Diagram Theme Overrides (Legibility in Light/Dark Mode) */
.mermaid svg {
    font-family: var(--font-sans) !important;
    background-color: transparent !important;
}

/* Base Node Styling */
.mermaid .node rect,
.mermaid .node polygon,
.mermaid .node circle,
.mermaid .node path {
    fill: var(--bg-card) !important;
    stroke: var(--border-color) !important;
    stroke-width: 1.5px !important;
}

/* Edge Lines */
.mermaid .edgePath .path {
    stroke: var(--text-light) !important;
    stroke-width: 1.5px !important;
}

.mermaid .edgeArrowhead {
    fill: var(--text-light) !important;
    stroke: var(--text-light) !important;
}

.mermaid .edgeLabel rect {
    fill: var(--bg-sidebar) !important;
}

.mermaid .edgeLabel span,
.mermaid .edgeLabel text {
    color: var(--text-secondary) !important;
    fill: var(--text-secondary) !important;
    font-size: 0.68rem !important;
    font-family: var(--font-sans) !important;
}

/* Node Text Labels */
.mermaid .node .label,
.mermaid .node .label div,
.mermaid .node .label span,
.mermaid text {
    color: var(--text-primary) !important;
    fill: var(--text-primary) !important;
    font-family: var(--font-sans) !important;
    font-size: 0.74rem !important;
    font-weight: 500 !important;
}
