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

:root {
    --void-black: #050505;
    --bone-white: #E8E8E8;
    --trace-red: #FF3366;
    --access-green: #00FF88;
    --warn-amber: #FFB800;
    --cyber-blue: #00D9FF;
    --deep-purple: #9D00FF;
    --border-thickness: 1px;
    --glow-intensity: 0.4;
    --panel-bg: rgba(10, 10, 10, 0.95);
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--void-black);
    color: var(--bone-white);
    overflow: auto;
    /* allow scrolling on small screens */
    min-height: 100vh;
    cursor: default;
}

/* CRT Effect Layer */
#crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background:
        repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.15),
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px);
    animation: flicker 0.15s infinite;
}

#crt-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(232, 232, 232, 0.1);
    animation: scanline 8s linear infinite;
}

@keyframes flicker {
    0% {
        opacity: 0.98;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.97;
    }
}

@keyframes scanline {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(100vh);
    }
}

/* Main Container - Complex Grid Layout */
#main-container {
    display: grid;
    grid-template-columns: 300px 1fr 320px;
    grid-template-rows: 50px 1fr 240px;
    height: 100vh;
    gap: var(--border-thickness);
    padding: 0;
    background: transparent;
    /* keep the dark theme consistent */
}

/* Mobile-first responsive design */
@media (max-width: 1200px) {
    #main-container {
        grid-template-columns: 250px 1fr 250px;
    }
}

@media (max-width: 992px) {
    #main-container {
        grid-template-columns: 1fr;
        grid-template-rows: 50px 1fr auto auto auto;
        height: auto;
        min-height: 100vh;
        padding-bottom: 100px;
    }

    #top-bar {
        grid-column: 1;
        grid-row: 1;
    }

    #center-area {
        grid-column: 1;
        grid-row: 2;
    }

    /* Move radio to bottom as 80px mobile player */
    .music-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 80px;
        border-top: var(--border-thickness) solid var(--cyber-blue);
        border-bottom: none;
        border-left: none;
        border-right: none;
        margin: 0;
        z-index: 100;
        background: rgba(5, 5, 5, 0.98);
        overflow: hidden;
    }

    .music-panel .panel-header {
        /* display: false; */
    }

    .music-panel .panel-toggle {
        /* display: none; */
    }

    .music-panel .panel-content {
        display: flex;
        flex-direction: row;
        gap: 10px;
        padding: 8px 12px;
        align-items: center;
        margin: 0;
        height: auto;
    }

    .music-panel #music-player {
        display: flex;
        flex-direction: row;
        gap: 8px;
        align-items: center;
        width: 100%;
        justify-content: flex-start;
    }

    .music-panel .album-art {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .music-panel .music-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .music-panel .music-title {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--cyber-blue);
        line-height: 1;
    }

    .music-panel .music-artist {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--bone-white);
    }

    .music-panel .music-controls {
        display: flex;
        gap: 4px;
        flex-shrink: 0;
    }

    .music-panel .music-btn {
        padding: 4px 8px;
        font-size: 11px;
        background: none;
        border: 1px solid var(--cyber-blue);
        color: var(--cyber-blue);
        cursor: pointer;
        line-height: 1;
    }

    .music-panel .music-btn:hover {
        background: rgba(0, 217, 255, 0.1);
    }

    .music-panel .radio-stations {
        display: none;
    }

    #left-sidebar {
        grid-column: 1;
        grid-row: 3;
        max-height: 50vh;
        border-right: none;
        border-bottom: var(--border-thickness) solid var(--bone-white);
    }

    #right-sidebar {
        grid-column: 1;
        grid-row: 4;
        max-height: 50vh;
        border-left: none;
        border-top: var(--border-thickness) solid var(--bone-white);
    }
}

@media (max-width: 600px) {
    #main-container {
        grid-template-rows: auto 1fr auto auto auto;
    }

    #top-bar {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        min-height: auto;
        font-size: 10px;
    }

    #connection-status {
        flex-wrap: wrap;
        gap: 10px;
    }

    #left-sidebar,
    #right-sidebar {
        max-height: 45vh;
    }
}

/* Top Bar */
#top-bar {
    grid-column: 1 / -1;
    background: var(--void-black);
    border-bottom: var(--border-thickness) solid var(--bone-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Orbitron', monospace;
}

#system-time {
    color: var(--access-green);
    font-weight: 700;
}

#connection-status {
    display: flex;
    gap: 20px;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--access-green);
    box-shadow: 0 0 8px var(--access-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Left Sidebar - Map & Email */
#left-sidebar {
    grid-column: 1;
    grid-row: 2 / 4;
    background: var(--void-black);
    border: var(--border-thickness) solid var(--bone-white);
    display: flex;
    flex-direction: column;
    gap: var(--border-thickness);
    overflow-y: auto;
    /* Allow sidebars to scroll when panels exceed available height */
    padding: 8px;
    /* small inner padding to avoid content flush to edges */
    min-width: 250px;
    min-height: 400px;
    max-height: 100%;
}

@media (max-width: 992px) {
    #left-sidebar {
        grid-column: 1;
        grid-row: 3;
        min-width: unset;
        overflow-y: auto;
        max-height: none;
        height: auto;
        min-height: 200px;
    }
}

#right-sidebar {
    grid-column: 3;
    grid-row: 2 / 4;
    background: var(--void-black);
    border: var(--border-thickness) solid var(--bone-white);
    display: flex;
    flex-direction: column;
    gap: var(--border-thickness);
    overflow-y: auto;
    /* Allow sidebars to scroll when panels exceed available height */
    padding: 8px;
    /* small inner padding to avoid content flush to edges */
}

.panel {
    background: var(--panel-bg);
    border-bottom: var(--border-thickness) solid var(--bone-white);
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    /* give panels breathing room */
    flex: 0 0 auto;
    /* default: take only needed space */
    min-height: 80px;
    /* ensure panels have minimum usable height */
    max-height: 500px;
    /* prevent panels from becoming too large */
}

.panel:not(.collapsed) {
    flex: 0 0 auto;
    /* let panels size naturally based on content */
    min-height: 200px;
    /* expanded panels need substantial minimum height */
}

/* Blog panels should be larger to show multiple entries */
.panel:has(#blog-list),
.panel:has(#email-list) {
    min-height: 200px;
    max-height: 600px;
}

.panel:has(#blog-list):not(.collapsed),
.panel:has(#email-list):not(.collapsed) {
    min-height: 300px;
}

.panel:last-child {
    border-bottom: none;
}

.panel-header {
    padding: 12px 15px;
    border-bottom: var(--border-thickness) solid var(--bone-white);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: 'Orbitron', monospace;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 255, 136, 0.05);
}

.panel-header-icon {
    color: var(--access-green);
    font-weight: 700;
}

.panel-content {
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 60px;
    max-height: 350px;
    /* allow content inside panels to scroll if large */
}

/* World Map */
#map-panel {
    height: 280px;
    position: relative;
}


#world-map {
    width: 100%;
    height: 100%;
    padding: 8px;
    /* smaller padding so inner visuals fit without overflow */
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.map-container {
    width: 100%;
    height: 100%;
    position: relative;
    background:
        radial-gradient(circle at 30% 40%, rgba(0, 255, 136, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(0, 217, 255, 0.03) 0%, transparent 50%),
        #000;
    border: 1px solid var(--bone-white);
    box-sizing: border-box;
    padding: 8px;
    /* inner padding so grid/nodes don't touch borders */
    overflow: hidden;
}

.map-grid {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(232, 232, 232, 0.1) 19px, rgba(232, 232, 232, 0.1) 20px),
        repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(232, 232, 232, 0.1) 19px, rgba(232, 232, 232, 0.1) 20px);
}

#map-nodes {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
}

.map-node {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--access-green);
    box-shadow: 0 0 15px var(--access-green);
    animation: nodeBlip 2s infinite;
    cursor: pointer;
    transition: all 0.3s;
    transform: translate(-50%, -50%);
}

.map-node:hover {
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 0 25px var(--access-green);
}

.map-node.hostile {
    background: var(--trace-red);
    box-shadow: 0 0 15px var(--trace-red);
}

.map-node.hostile:hover {
    box-shadow: 0 0 25px var(--trace-red);
}

.map-node.neutral {
    background: var(--warn-amber);
    box-shadow: 0 0 15px var(--warn-amber);
}

@keyframes nodeBlip {

    0%,
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.map-connection {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, var(--access-green), transparent);
    transform-origin: left center;
    opacity: 0.3;
    animation: dataFlow 2s infinite;
}

@keyframes dataFlow {
    0% {
        opacity: 0.1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 0.1;
    }
}

.map-tooltip {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.9);
    padding: 6px 10px;
    border: 1px solid var(--access-green);
    display: none;
    z-index: 5;
    pointer-events: none;
    /* avoid blocking mouse events */
}

.map-legend {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 10px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--bone-white);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 5px currentColor;
}

/* Email Panel */
#email-panel {
    flex: 1;
    min-height: 80px;
    max-height: 300px;
    overflow: hidden;
}

#email-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    /* panel-content handles padding */
}

#email-list::-webkit-scrollbar {
    width: 6px;
}

#email-list::-webkit-scrollbar-track {
    background: var(--void-black);
}

#email-list::-webkit-scrollbar-thumb {
    background: var(--bone-white);
}

.email-item {
    padding: 8px;
    margin: 2px 0;
    background: rgba(255, 255, 255, 0.01);
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 10px;
    color: #bdbdbd;
    flex: 0 0 auto;
    min-height: auto;
}

.email-item:hover {
    background: rgba(255, 255, 255, 0.02);
    transform: translateX(4px);
}

.email-item.unread {
    border-left-color: var(--trace-red);
    background: rgba(255, 51, 102, 0.04);
    color: var(--bone-white);
    font-weight: 700;
}

.email-item.read {
    border-left-color: #777;
    color: #9a9a9a;
    background: rgba(255, 255, 255, 0.01);
    font-weight: 400;
}

.email-from {
    color: var(--access-green);
    font-size: 9px;
    font-weight: 700;
    margin-bottom: 1px;
}

.email-subject {
    color: var(--bone-white);
    margin-bottom: 1px;
    font-size: 10px;
}

.email-preview {
    color: #888;
    font-size: 8px;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Center Area - Terminal & Ninja Graph */
#center-area {
    grid-column: 2;
    grid-row: 2 / 4;
    display: flex;
    flex-direction: column;
    gap: var(--border-thickness);
}

@media (max-width: 992px) {
    #center-area {
        grid-column: 1;
        grid-row: 2;
        min-height: 300px;
    }
}

/* Terminal Pane */
#terminal-pane {
    flex: 1;
    background: var(--void-black);
    border: var(--border-thickness) solid var(--bone-white);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

#terminal-pane.focused {
    position: sticky;
    top: 50px;
    max-height: 80vh;
    z-index: 50;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    border-color: var(--access-green);
    flex: 1;
}

#terminal-header {
    padding: 10px 15px;
    border-bottom: var(--border-thickness) solid var(--bone-white);
    font-size: 10px;
    letter-spacing: 1.5px;
    background: rgba(0, 255, 136, 0.05);
    font-family: 'Orbitron', monospace;
}

#terminal-output {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    scroll-behavior: smooth;
}

#terminal-output::-webkit-scrollbar {
    width: 8px;
}

#terminal-output::-webkit-scrollbar-track {
    background: var(--void-black);
}

#terminal-output::-webkit-scrollbar-thumb {
    background: var(--bone-white);
    border: 1px solid var(--void-black);
}

.terminal-line {
    margin: 2px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.prompt {
    color: var(--access-green);
    text-shadow: 0 0 5px rgba(0, 255, 136, var(--glow-intensity));
}

.error {
    color: var(--trace-red);
    text-shadow: 0 0 5px rgba(255, 51, 102, var(--glow-intensity));
}

.success {
    color: var(--access-green);
}

.warning {
    color: var(--warn-amber);
}

.system {
    color: #888;
    font-style: italic;
}

#terminal-input-line {
    display: flex;
    padding: 10px 15px;
    border-top: var(--border-thickness) solid var(--bone-white);
    background: rgba(232, 232, 232, 0.02);
}

#terminal-prompt {
    color: var(--access-green);
    margin-right: 10px;
    text-shadow: 0 0 5px rgba(0, 255, 136, var(--glow-intensity));
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--bone-white);
    font-family: inherit;
    font-size: 13px;
    caret-color: var(--access-green);
}

/* Ninja Graph Panel */
#network-graph-panel {
    height: 220px;
    background: var(--void-black);
    border: var(--border-thickness) solid var(--bone-white);
}

#network-graph {
    height: calc(100% - 45px);
    padding: 15px;
    position: relative;
}

.graph-canvas {
    width: 100%;
    height: 100%;
    background: rgba(0, 20, 10, 0.5);
    border: 1px solid var(--bone-white);
    position: relative;
    overflow: hidden;
}

.graph-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.interest-graph {
    stroke: var(--trace-red);
    stroke-width: 2;
    fill: none;
    filter: drop-shadow(0 0 5px var(--trace-red));
}

.network-graph {
    stroke: var(--access-green);
    stroke-width: 2;
    fill: none;
    filter: drop-shadow(0 0 5px var(--access-green));
}

.talent-graph {
    stroke: var(--cyber-blue);
    stroke-width: 2;
    fill: none;
    filter: drop-shadow(0 0 5px var(--cyber-blue));
}

.graph-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 9px;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px;
    border: 1px solid var(--bone-white);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0;
}

.legend-color {
    width: 12px;
    height: 2px;
}

/* Right Sidebar - Stats & Music */
#right-sidebar {
    grid-column: 3;
    grid-row: 2 / 4;
    background: var(--void-black);
    border: var(--border-thickness) solid var(--bone-white);
    display: flex;
    flex-direction: column;
    gap: var(--border-thickness);
    overflow-y: auto;
    /* Allow sidebars to scroll when panels exceed available height */
    padding: 8px;
    /* small inner padding to avoid content flush to edges */
    min-width: 250px;
    min-height: 400px;
    max-height: 100%;
}

@media (max-width: 992px) {
    #right-sidebar {
        grid-column: 1;
        grid-row: 4;
        min-width: unset;
        overflow-y: auto;
        max-height: none;
        height: auto;
        min-height: 200px;
    }
}

/* Music Player */
#music-panel {
    flex: 0 0 auto;
    min-height: 140px;
    max-height: 280px;
}

#music-player {
    height: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    min-height: 120px;
}

.album-art {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, var(--deep-purple), var(--cyber-blue));
    border: 1px solid var(--bone-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    position: relative;
    overflow: hidden;
}

.album-art::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.05) 10px,
            rgba(255, 255, 255, 0.05) 20px);
    animation: albumSpin 10s linear infinite;
}

@keyframes albumSpin {
    0% {
        transform: translateX(-20px);
    }

    100% {
        transform: translateX(20px);
    }
}

.music-info {
    font-size: 11px;
    text-align: center;
}

.music-title {
    color: var(--access-green);
    font-weight: 700;
    margin-bottom: 3px;
}

.music-artist {
    color: #888;
    font-size: 9px;
}

.music-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 0;
}

.music-btn {
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid var(--bone-white);
    color: var(--bone-white);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    font-family: 'Orbitron', monospace;
}

.music-btn:hover {
    background: var(--access-green);
    color: var(--void-black);
    box-shadow: 0 0 15px var(--access-green);
}

.music-btn.active {
    background: var(--access-green);
    color: var(--void-black);
}

.radio-stations {
    font-size: 9px;
    max-height: 100px;
    overflow-y: auto;
}

.radio-station {
    padding: 5px;
    margin: 2px 0;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.radio-station:hover {
    background: rgba(0, 255, 136, 0.1);
    border-left-color: var(--access-green);
    transform: translateX(3px);
}

.radio-station.active {
    background: rgba(0, 255, 136, 0.15);
    border-left-color: var(--access-green);
    font-weight: 700;
}

/* Interest Visualization */
#interest-panel {
    flex: 0 0 auto;
    min-height: 140px;
    max-height: 280px;
}

#interest-viz {
    height: auto;
    min-height: 120px;
    padding: 8px;
    position: relative;
    box-sizing: border-box;
}

.interest-radar {
    width: 100%;
    height: 100%;
    position: relative;
    border: 1px solid var(--bone-white);
    background:
        radial-gradient(circle, transparent 30%, rgba(255, 51, 102, 0.1) 70%, transparent 100%),
        #000;
    overflow: hidden;
}

.radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 50%;
    background: linear-gradient(to top, var(--trace-red), transparent);
    transform-origin: bottom center;
    animation: radarSweep 4s linear infinite;
}

@keyframes radarSweep {
    0% {
        transform: translate(-50%, -100%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -100%) rotate(360deg);
    }
}

.interest-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 51, 102, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.threat-marker {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--trace-red);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--trace-red);
    animation: threatPulse 1s infinite;
    transform: translate(-50%, -50%);
}

@keyframes threatPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.5;
    }
}

.interest-level {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--trace-red);
    text-shadow: 0 0 10px var(--trace-red);
    font-family: 'Orbitron', monospace;
}

/* System Stats */
#stats-panel {
    flex: 0 0 auto;
    min-height: 150px;
    max-height: 300px;
}

.stat-content {
    padding: 15px;
    max-height: 280px;
    overflow-y: auto;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    font-size: 11px;
}

.stat-label {
    opacity: 0.6;
    font-family: 'Rajdhani', sans-serif;
}

.stat-value {
    font-weight: 700;
    color: var(--access-green);
    font-family: 'Orbitron', monospace;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(232, 232, 232, 0.1);
    margin-top: 5px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--access-green);
    box-shadow: 0 0 8px var(--access-green);
    transition: width 0.3s ease;
}

/* News Ticker */
#news-panel {
    flex: 0 0 auto;
    min-height: 120px;
    max-height: 250px;
}

#news-ticker {
    height: auto;
    min-height: 100px;
    max-height: 220px;
    overflow-y: auto;
    font-size: 10px;
    line-height: 1.5;
    padding: 0;
    /* panel-content handles padding */
}

#news-ticker::-webkit-scrollbar {
    width: 4px;
}

#news-ticker::-webkit-scrollbar-thumb {
    background: var(--bone-white);
}

.news-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(232, 232, 232, 0.1);
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.news-time {
    color: var(--access-green);
    font-size: 8px;
    margin-bottom: 4px;
    font-family: 'Orbitron', monospace;
}

#news-ticker a.news-link {
    color: var(--bone-white);
    text-decoration: underline;
}

#news-ticker a.news-link:hover {
    color: var(--access-green);
}

/* Boot Sequence */
#boot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-black);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    font-size: 13px;
    line-height: 1.8;
}

#boot-text {
    width: 100%;
    max-width: 800px;
    text-align: left;
}

.boot-line {
    margin: 3px 0;
    opacity: 0;
    animation: bootFade 0.1s forwards;
}

@keyframes bootFade {
    to {
        opacity: 1;
    }
}

#boot-logo {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 8px;
    color: var(--access-green);
    text-shadow: 0 0 20px var(--access-green);
    margin-bottom: 40px;
    animation: glitch 2s infinite;
    font-family: 'Orbitron', monospace;
}

@keyframes glitch {

    0%,
    90%,
    100% {
        transform: translateX(0);
        filter: hue-rotate(0deg);
    }

    92% {
        transform: translateX(-2px);
        filter: hue-rotate(90deg);
    }

    94% {
        transform: translateX(2px);
        filter: hue-rotate(-90deg);
    }
}

/* Email Modal */
#email-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.email-content {
    background: var(--void-black);
    border: 2px solid var(--access-green);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
}

.email-header {
    border-bottom: 1px solid var(--bone-white);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.email-meta {
    font-size: 11px;
    margin: 5px 0;
}

.email-body {
    font-size: 13px;
    line-height: 1.8;
    margin: 20px 0;
}

.email-close {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: #888;
    cursor: pointer;
}

.email-close:hover {
    color: var(--access-green);
}

/* ASCII Art */
.ascii-art {
    font-size: 8px;
    line-height: 1;
    color: var(--access-green);
    opacity: 0.6;
    font-family: 'JetBrains Mono', monospace;
    white-space: pre;
    overflow-x: auto;
    word-wrap: normal;
    word-break: normal;
}

/* Mission Graphics */
.mission-graphic {
    width: 100%;
    height: 60px;
    margin: 10px 0;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 217, 255, 0.1));
    border: 1px solid var(--access-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    font-family: 'Orbitron', monospace;
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--access-green);
    position: relative;
    overflow: hidden;
}

.mission-graphic::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 20px,
            rgba(255, 255, 255, 0.03) 20px,
            rgba(255, 255, 255, 0.03) 40px);
    animation: graphicSlide 5s linear infinite;
}

@keyframes graphicSlide {
    0% {
        transform: translate(-25%, -25%);
    }

    100% {
        transform: translate(0%, 0%);
    }
}

/* Email Modal */
#email-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.email-content {
    background: var(--panel-bg);
    border: 1px solid var(--bone-white);
    padding: 20px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.email-header {
    border-bottom: 1px solid var(--bone-white);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.email-meta {
    margin: 5px 0;
    color: var(--cyber-blue);
}

.email-body {
    white-space: pre-wrap;
    color: var(--bone-white);
}

.email-close {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: #888;
    cursor: pointer;
}

.email-close:hover {
    color: var(--access-green);
}

/* Blog Modal */
#blog-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.blog-content {
    background: var(--panel-bg);
    border: 1px solid var(--bone-white);
    padding: 20px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

.blog-header {
    border-bottom: 1px solid var(--bone-white);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.blog-meta {
    margin: 5px 0;
    color: var(--cyber-blue);
}

.blog-body {
    color: var(--bone-white);
}

.blog-body h1,
.blog-body h2,
.blog-body h3 {
    color: var(--access-green);
    margin-top: 20px;
    margin-bottom: 10px;
}

.blog-body p {
    margin-bottom: 15px;
}

.blog-body code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 2px;
    font-family: 'JetBrains Mono', monospace;
}

.blog-close {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: #888;
    cursor: pointer;
}

.blog-close:hover {
    color: var(--access-green);
}

/* Collapsible Panels */
.panel.collapsible .panel-header {
    cursor: pointer;
    user-select: none;
}

.panel.collapsible .panel-header:hover {
    background: rgba(0, 217, 255, 0.1);
}

.panel-toggle {
    margin-left: auto;
    margin-right: 5px;
    font-size: 12px;
    color: var(--cyber-blue);
    transition: transform 0.2s;
}

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

.panel.collapsed .panel-content {
    display: none;
}

/* Ensure panels never collapse to tiny sizes when expanded */
.panel:not(.collapsed) {
    min-height: 140px;
}

/* More generous space for map, interest, and music visualizations */
.panel.map-panel:not(.collapsed),
.panel.interest-panel:not(.collapsed),
.panel.music-panel:not(.collapsed) {
    min-height: 150px;
    /* ensure special panels have minimum height when expanded */
}

.panel.music-panel:not(.collapsed) {
    min-height: 56px;
    /* ensure special panels have minimum height when expanded */
}

.panel.map-panel:not(.collapsed) .panel-content {
    min-height: 150px;
    /* strict min for map panel */
    display: flex;
    padding: 8px;
    /* reduce inner padding so map has more usable space */
    overflow: hidden;
    box-sizing: border-box;
}

.panel.interest-panel:not(.collapsed) .panel-content {
    min-height: 150px;
    /* strict min for interest/trace panel */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    overflow: hidden;
    box-sizing: border-box;
}

.panel.music-panel:not(.collapsed) .panel-content {
    min-height: 56px;
    /* strict min for music/radio panel */
    display: flex;
    flex-direction: column;
    padding: 8px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Ensure inner visualization containers respect the min heights and expand to fill */
/* Make world map layout vertical so the legend remains visible below the map */
#world-map {
    display: flex;
    flex-direction: column;
    min-height: 150px;
    box-sizing: border-box;
    padding: 8px;
}

.map-container {
    flex: 1 1 auto;
    min-height: 120px;
    box-sizing: border-box;
    padding: 0;
    overflow: hidden;
}

.map-legend {
    flex: 0 0 auto;
    /* keep legend visible beneath the map */
    margin-top: 8px;
}

#interest-viz,
.interest-radar {
    min-height: 150px;
    height: 100%;
    box-sizing: border-box;
    padding: 8px;
    overflow: hidden;
}

#music-player {
    height: 100%;
    box-sizing: border-box;
    padding: 8px;
    overflow: hidden;
}

/* Blog list styles: cleaner layout, readable previews */
#blog-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    /* panel-content handles padding */
    overflow-y: auto;
    min-height: 200px;
}

#email-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow-y: auto;
    min-height: 150px;
}

.blog-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--access-green);
    padding: 10px;
    margin: 4px 0;
    cursor: pointer;
    transition: transform 0.15s ease-in-out, box-shadow 0.15s;
    font-size: 12px;
    border-radius: 2px;
    flex: 0 0 auto;
    min-height: auto;
}

.blog-item.unread {
    border-left-color: var(--cyber-blue);
    background: rgba(0, 217, 255, 0.03);
    font-weight: 700;
}

.blog-item.unread .blog-title {
    color: var(--cyber-blue);
}

.blog-item:hover {
    transform: translateX(6px);
    background: rgba(0, 255, 136, 0.06);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

.blog-title {
    color: var(--access-green);
    font-weight: 800;
    font-size: 14px;
}

.blog-preview {
    color: #bdbdbd;
    font-size: 11px;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-date {
    color: #99a;
    font-size: 9px;
    margin-top: 2px;
    opacity: 0.8;
}

.blog-item .meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}


.panel-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--bone-white);
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-header-icon {
    margin-left: auto;
    opacity: 0.7;
}

.panel-content {
    padding: 10px;
    overflow: auto;
    /* allow content inside panels to scroll if large */
}

/* Collapsible Panels */
.panel.collapsible .panel-header {
    cursor: pointer;
    user-select: none;
}

.panel.collapsible .panel-header:hover {
    background: rgba(0, 217, 255, 0.1);
}

.panel-toggle {
    margin-left: auto;
    margin-right: 5px;
    font-size: 12px;
    color: var(--cyber-blue);
    transition: all 0.2s;
}

.panel-toggle::before {
    content: '−';
}

.panel.collapsed .panel-toggle::before {
    content: '+';
}

.panel.collapsed .panel-content {
    display: none !important;
}

/* Matrix Glitch Effect */
.matrix-glitch {
    animation: matrix-glitch 0.3s infinite;
}

@keyframes matrix-glitch {
    0% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }

    20% {
        transform: translate(-2px, 2px);
        filter: hue-rotate(90deg);
    }

    40% {
        transform: translate(-2px, -2px);
        filter: hue-rotate(180deg);
    }

    60% {
        transform: translate(2px, 2px);
        filter: hue-rotate(270deg);
    }

    80% {
        transform: translate(2px, -2px);
        filter: hue-rotate(360deg);
    }

    100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
}

/* Responsive adjustments for terminal pane */
@media (max-width: 992px) {
    #terminal-pane {
        min-height: 300px;
    }

    #terminal-output {
        font-size: 12px;
    }

    #network-graph-panel {
        min-height: 200px;
    }
}

@media (max-width: 600px) {
    #terminal-output {
        font-size: 11px;
        padding: 10px;
    }

    #terminal-header {
        font-size: 9px;
        padding: 8px 10px;
    }

    #terminal-prompt {
        font-size: 10px;
    }

    #terminal-input {
        font-size: 10px;
    }

    #network-graph-panel {
        min-height: 150px;
    }
}

/* Donation Banner */
.donation-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--panel-bg);
    border: var(--border-thickness) solid var(--access-green);
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(0, 255, 136, var(--glow-intensity));
    font-family: 'JetBrains Mono', monospace;
    animation: slideIn 0.5s ease-out;
}

@media (max-width: 992px) {
    .donation-banner {
        position: fixed;
        bottom: 80px;
        right: auto;
        left: 0;
        right: 0;
        top: auto;
        max-width: none;
        border-bottom: 1px solid var(--access-green);
        border-radius: 0;
        padding: 12px 15px;
        margin: 0;
        z-index: 98;
        display: block;
        background: rgba(5, 5, 5, 0.95);
        box-shadow: none;
    }

    .close-donation {
        position: absolute;
        top: 8px;
        right: 10px;
        flex-shrink: 0;
        font-size: 20px;
        padding: 0;
        width: 24px;
        height: 24px;
        line-height: 24px;
        background: none;
        border: none;
        color: var(--trace-red);
        cursor: pointer;
    }

    .close-donation:hover {
        color: var(--warn-amber);
    }

    .donation-content {
        display: block;
        padding-right: 30px;
    }

    .donation-title {
        font-size: 14px;
        margin: 0 0 6px 0;
        color: var(--access-green);
        font-weight: bold;
    }

    .donation-text {
        display: block;
        font-size: 12px;
        color: var(--bone-white);
        margin: 0 0 8px 0;
        line-height: 1.4;
    }

    .donation-links {
        display: flex;
        flex-direction: row;
        gap: 8px;
        margin: 0;
        flex-wrap: wrap;
    }

    .donation-link {
        font-size: 11px;
        padding: 6px 10px;
        flex-shrink: 0;
        border-radius: 3px;
        white-space: nowrap;
        border: 1px solid rgba(0, 255, 136, 0.3);
        background: rgba(0, 255, 136, 0.08);
        color: var(--access-green);
        text-decoration: none;
    }

    .donation-link:hover {
        background: rgba(0, 255, 136, 0.15);
        text-decoration: underline;
    }

    .donation-hint {
        display: none;
    }
}

.donation-banner.hidden {
    display: none;
}

.close-donation {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--trace-red);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.close-donation:hover {
    color: var(--warn-amber);
}

.donation-title {
    color: var(--access-green);
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.donation-text {
    color: var(--bone-white);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 15px;
    text-align: center;
}

.donation-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.donation-link {
    display: inline-block;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.donation-link.primary {
    background: var(--access-green);
    color: var(--void-black);
    border-color: var(--access-green);
}

.donation-link.primary:hover {
    background: var(--void-black);
    color: var(--access-green);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.donation-link.secondary {
    background: transparent;
    color: var(--cyber-blue);
    border-color: var(--cyber-blue);
}

.donation-link.secondary:hover {
    background: var(--cyber-blue);
    color: var(--void-black);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
}

.donation-hint {
    color: var(--warn-amber);
    font-size: 12px;
    text-align: center;
    font-style: italic;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* COMPREHENSIVE MOBILE RESPONSIVE STYLES */

/* Tablet and smaller desktops */
@media (max-width: 1024px) {
    :root {
        --border-thickness: 1px;
    }

    body {
        font-size: 14px;
    }

    #top-bar {
        font-size: 10px;
        padding: 0 10px;
    }

    .panel-header {
        font-size: 10px;
        padding: 8px 10px;
    }

    .panel-content {
        padding: 8px;
    }
}

/* Tablets and small devices */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    .ascii-art {
        font-size: 7px;
        line-height: 0.95;
        white-space: pre;
        overflow-x: auto;
    }

    #top-bar {
        flex-direction: column;
        gap: 6px;
        padding: 8px;
        height: auto;
    }

    #connection-status {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 9px;
    }

    .status-indicator {
        gap: 4px;
    }

    .status-dot {
        width: 5px;
        height: 5px;
    }

    #terminal-output {
        font-size: 12px;
        line-height: 1.4;
        padding: 10px;
    }

    #terminal-header {
        font-size: 9px;
        padding: 8px;
    }

    #terminal-input {
        font-size: 12px;
    }

    #terminal-prompt {
        margin-right: 5px;
        font-size: 11px;
    }

    .panel {
        margin-bottom: 4px;
        min-height: 70px;
        max-height: 350px;
    }

    .panel:not(.collapsed) {
        min-height: 130px;
    }

    /* Blog and email panels should be taller on tablets to show more entries */
    .panel:has(#blog-list),
    .panel:has(#email-list) {
        min-height: 140px;
        max-height: 400px;
    }

    .panel:has(#blog-list):not(.collapsed),
    .panel:has(#email-list):not(.collapsed) {
        min-height: 200px;
    }

    .panel-content {
        padding: 6px;
        min-height: 50px;
        max-height: 320px;
    }

    .email-item {
        padding: 8px;
        font-size: 10px;
    }

    .email-from {
        font-size: 9px;
    }

    .email-preview {
        font-size: 8px;
    }

    .stat-row {
        font-size: 10px;
        margin: 6px 0;
    }

    .music-title {
        font-size: 12px;
    }

    .music-artist {
        font-size: 9px;
    }

    .music-btn {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .news-item {
        padding: 6px 0;
        font-size: 9px;
    }

    .news-time {
        font-size: 7px;
    }

    .album-art {
        height: 70px;
        font-size: 24px;
    }

    #boot-logo {
        font-size: 20px;
        letter-spacing: 4px;
    }

    .email-content,
    .blog-content {
        padding: 15px;
        max-width: 90vw;
        font-size: 11px;
    }

    .email-body,
    .blog-body {
        font-size: 11px;
        line-height: 1.6;
    }

    .donation-banner {
        max-width: calc(100vw - 40px);
        top: 10px;
        right: 10px;
        padding: 15px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    body {
        font-size: 12px;
    }

    .ascii-art {
        font-size: 6px;
        line-height: 0.9;
        white-space: pre;
        overflow-x: auto;
    }

    #main-container {
        grid-template-rows: auto 1fr auto auto auto;
        gap: 0;
    }

    #top-bar {
        flex-direction: column;
        gap: 4px;
        padding: 6px;
        font-size: 9px;
        min-height: auto;
    }

    #system-time {
        font-size: 10px;
    }

    #connection-status {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 8px;
    }

    .status-indicator {
        gap: 3px;
    }

    .status-dot {
        width: 4px;
        height: 4px;
        box-shadow: 0 0 4px currentColor;
    }

    #left-sidebar,
    #right-sidebar {
        height: auto;
        min-height: 150px;
        max-height: none;
        overflow-y: auto;
    }

    #terminal-pane {
        min-height: 250px;
    }

    #terminal-output {
        font-size: 11px;
        line-height: 1.3;
        padding: 8px;
    }

    #terminal-header {
        font-size: 8px;
        padding: 6px;
        letter-spacing: 0.5px;
    }

    #terminal-input {
        font-size: 11px;
    }

    #terminal-prompt {
        font-size: 9px;
        margin-right: 3px;
    }

    #terminal-input-line {
        padding: 8px;
        gap: 4px;
    }

    .panel {
        margin-bottom: 2px;
    }

    .panel-header {
        font-size: 9px;
        padding: 6px 8px;
        letter-spacing: 0.5px;
    }

    .panel {
        min-height: 60px;
        max-height: 280px;
    }

    .panel:not(.collapsed) {
        min-height: 110px;
    }

    /* Blog and email panels should show multiple entries on mobile */
    .panel:has(#blog-list),
    .panel:has(#email-list) {
        min-height: 120px;
        max-height: 300px;
    }

    .panel:has(#blog-list):not(.collapsed),
    .panel:has(#email-list):not(.collapsed) {
        min-height: 180px;
    }

    .panel-content {
        padding: 4px;
        min-height: 50px;
        max-height: 260px;
    }

    .email-item {
        padding: 6px;
        margin: 3px 0;
        font-size: 9px;
    }

    .email-from {
        font-size: 8px;
        margin-bottom: 2px;
    }

    .email-subject {
        font-size: 9px;
        margin-bottom: 2px;
    }

    .email-preview {
        font-size: 8px;
        margin-top: 2px;
    }

    .blog-item {
        padding: 8px;
        margin: 4px 0;
        gap: 4px;
    }

    .blog-title {
        font-size: 12px;
    }

    .blog-preview {
        font-size: 10px;
        margin-top: 4px;
    }

    .blog-date {
        font-size: 9px;
        margin-top: 2px;
    }

    .stat-row {
        font-size: 9px;
        margin: 4px 0;
    }

    .stat-label {
        font-size: 8px;
    }

    .stat-value {
        font-size: 10px;
    }

    .progress-bar {
        height: 3px;
        margin-top: 3px;
    }

    .music-title {
        font-size: 11px;
    }

    .music-artist {
        font-size: 8px;
    }

    .music-controls {
        gap: 6px;
        padding: 6px 0;
    }

    .music-btn {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }

    .album-art {
        height: 60px;
        font-size: 20px;
    }

    .radio-station {
        padding: 4px;
        font-size: 8px;
    }

    .news-item {
        padding: 4px 0;
        font-size: 8px;
        line-height: 1.3;
    }

    .news-time {
        font-size: 7px;
        margin-bottom: 2px;
    }

    #network-graph-panel {
        min-height: 130px;
    }

    .graph-legend {
        font-size: 8px;
        padding: 4px;
        top: 4px;
        right: 4px;
    }

    .legend-item {
        gap: 4px;
        margin: 1px 0;
    }

    .legend-color {
        width: 10px;
        height: 1.5px;
    }

    .map-legend {
        font-size: 8px;
        margin-top: 6px;
        padding: 3px;
        gap: 4px;
    }

    .legend-color {
        width: 8px;
        height: 8px;
    }

    #boot-overlay {
        padding: 20px;
        font-size: 11px;
    }

    #boot-logo {
        font-size: 16px;
        letter-spacing: 2px;
        margin-bottom: 20px;
    }

    .boot-line {
        margin: 2px 0;
        font-size: 10px;
    }

    .email-content,
    .blog-content {
        padding: 12px;
        max-width: calc(100vw - 24px);
        font-size: 10px;
        max-height: 85vh;
        line-height: 1.4;
    }

    .email-header,
    .blog-header {
        padding-bottom: 10px;
        margin-bottom: 10px;
    }

    .email-meta,
    .blog-meta {
        font-size: 9px;
        margin: 3px 0;
    }

    .email-body,
    .blog-body {
        font-size: 10px;
        line-height: 1.5;
    }

    .email-body h1,
    .email-body h2,
    .email-body h3,
    .blog-body h1,
    .blog-body h2,
    .blog-body h3 {
        font-size: 11px;
        margin-top: 12px;
        margin-bottom: 8px;
    }

    .email-body p,
    .blog-body p {
        margin-bottom: 10px;
    }

    .email-close,
    .blog-close {
        margin-top: 12px;
        font-size: 9px;
    }

    .donation-banner {
        max-width: calc(100vw - 20px);
        top: 8px;
        right: 8px;
        left: 8px;
        padding: 12px;
        margin: 0;
    }

    .donation-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .donation-text {
        font-size: 11px;
        margin-bottom: 10px;
    }

    .donation-links {
        gap: 6px;
        margin-bottom: 10px;
    }

    .donation-link {
        padding: 8px 10px;
        font-size: 11px;
    }

    .donation-hint {
        font-size: 9px;
    }

    .close-donation {
        width: 24px;
        height: 24px;
        font-size: 18px;
    }

    /* Ensure modals scale for mobile */
    #email-modal,
    #blog-modal {
        padding: 10px;
        align-items: flex-start;
    }

    #map-nodes {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .map-grid {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .interest-radar {
        min-height: 120px;
    }

    .interest-level {
        font-size: 16px;
    }

    .threat-marker {
        width: 6px;
        height: 6px;
    }
}

/* Very small phones (below 360px) */
@media (max-width: 360px) {
    body {
        font-size: 11px;
    }

    .ascii-art {
        font-size: 5px;
        line-height: 0.85;
        white-space: pre;
        overflow-x: auto;
    }

    #top-bar {
        font-size: 8px;
        padding: 4px;
        gap: 2px;
    }

    #connection-status {
        gap: 4px;
        font-size: 7px;
    }

    .status-indicator {
        gap: 2px;
    }

    .status-dot {
        width: 3px;
        height: 3px;
    }

    #terminal-output {
        font-size: 10px;
        padding: 6px;
    }

    #terminal-header {
        font-size: 7px;
        padding: 4px;
    }

    .panel-header {
        font-size: 8px;
        padding: 4px 6px;
    }

    .email-item {
        padding: 4px;
        font-size: 8px;
    }

    .stat-row {
        font-size: 8px;
        margin: 3px 0;
    }

    .progress-bar {
        height: 2px;
    }
}