body {
    margin: 0;
    /* subtle dark radial background instead of flat black */
    background: radial-gradient(circle at 50% 45%, #07130b 0%, #020200 55%, #000 100%);
    color: #7CFFB2;
    /* cyber / hacker fonts */
    font-family: 'Share Tech Mono', 'Orbitron', Courier, monospace;
    position: relative;
    overflow-x: hidden;
}

/* Optimized sci-fi background texture - static, no animation */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    /* Simplified grid lines for better performance */
    background-image:
        linear-gradient(90deg, rgba(124,255,178,0.02) 1px, transparent 1px),
        linear-gradient(rgba(124,255,178,0.02) 1px, transparent 1px);
    background-size: 280px 280px, 280px 280px;
    background-position: 0 0, 0 0;
    will-change: auto;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    /* Much more subtle particle texture - reduced size and opacity */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="6" height="6" viewBox="0 0 6 6"><circle cx="1" cy="1" r="0.3" fill="rgba(124,255,178,0.015)"/></svg>');
    background-repeat: repeat;
    background-size: 24px 24px;
    will-change: auto;
}

/* Performance: use GPU-accelerated properties and contain paint */
.mech-portrait, .portrait-placeholder, #sidebar .sidebar-list button, .sidebar-title {
    contain: layout style paint;
    will-change: auto;
}

#initiate-btn, .border-corner, #sys-hud {
    contain: layout style paint;
    will-change: auto;
}

/* Additional containment for better performance */
#app, #sidebar, #terminal-app, #terminal {
    contain: layout style;
}

/* System HUD (sci-fi/hacker) */
#sys-hud {
    position: fixed;
    top: 28px;
    right: 32px;
    width: 180px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(31,255,51,0.08);
    padding: 10px 12px;
    color: #7CFFB2;
    font-family: Courier, monospace;
    font-size: 12px;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
    backdrop-filter: blur(4px) saturate(0.8);
    z-index: 60;
}

#sys-hud .hud-title {
    font-weight: 700;
    font-size: 11px;
    color: rgba(124,255,178,0.9);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    opacity: 0.92;
}

.hud-label { color: rgba(124,255,178,0.6); }
.hud-value { color: #7CFFB2; font-weight: 600; }

.hud-scan {
    margin-top: 8px;
    height: 6px;
    background: linear-gradient(90deg, rgba(0,0,0,0.15), rgba(0,0,0,0.02));
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.hud-scan::before {
    content: "";
    position: absolute;
    left: -40%;
    top: 0;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, rgba(124,255,178,0) 0%, rgba(124,255,178,0.16) 50%, rgba(124,255,178,0) 100%);
    transform: translateX(0);
    animation: hud-sweep 2.2s linear infinite;
}

@keyframes hud-sweep {
    0% { left: -40%; }
    100% { left: 140%; }
}

/* Union news feed - bottom right corner */
#news-feed {
    position: fixed;
    bottom: 28px;
    right: 32px;
    width: 460px;
    background: linear-gradient(180deg, rgba(200,255,220,0.07), rgba(180,255,200,0.05));
    border: 1px solid rgba(0,255,136,0.3);
    border-right-width: 2px;
    padding: 12px 14px 10px;
    color: #7CFFB2;
    font-family: 'Share Tech Mono', Courier, monospace;
    font-size: 12px;
    border-radius: 3px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 25px rgba(0,255,136,0.15), inset 0 0 30px rgba(255,255,255,0.015);
    backdrop-filter: blur(5px) saturate(0.9) brightness(1.12);
    z-index: 55;
    opacity: 0.9;
    transition: opacity 200ms ease, transform 200ms ease;
    display: none;
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}

#news-feed:hover {
    opacity: 1;
    transform: translateX(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 30px rgba(0,255,136,0.22), inset 0 0 30px rgba(255,255,255,0.025);
}

#news-feed .news-header {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #00FF88;
    margin-bottom: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    padding: 10px 8px;
    border: 2px solid rgba(0,255,136,0.35);
    border-radius: 3px;
    background: linear-gradient(135deg, rgba(0,255,136,0.1), rgba(0,200,100,0.08), rgba(0,255,136,0.1));
    box-shadow: 0 0 20px rgba(0,255,136,0.2), inset 0 0 30px rgba(0,255,136,0.05);
    text-shadow: 0 0 15px rgba(0,255,136,0.6), 0 0 30px rgba(0,255,136,0.3);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

#news-feed .news-lines {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#news-feed .news-line {
    line-height: 1.5;
    opacity: 1;
    transition: opacity 350ms ease;
    padding: 9px 10px;
    font-size: 12px;
    color: rgba(124,255,178,0.95);
    border-bottom: 1px solid rgba(0,255,136,0.12);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#news-feed .news-line:last-child {
    border-bottom: none;
}

#news-feed .news-line.fading {
    opacity: 0;
}

/* Breaking news styling - urgent red/orange theme */
#news-feed .news-line.breaking {
    border-left: 3px solid #FF6633;
    padding-left: 12px;
    color: rgba(255,200,180,1);
    font-weight: 600;
    border-bottom-color: rgba(255,100,50,0.2);
}

/* Union official news styling - calm professional blue theme */
#news-feed .news-line.union {
    border-left: 3px solid #66AAFF;
    padding-left: 12px;
    color: rgba(200,220,255,1);
    border-bottom-color: rgba(100,200,255,0.15);
}

/* Tag/prefix styling */
.news-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 5px;
    margin-right: 7px;
    border-radius: 2px;
    text-transform: uppercase;
    vertical-align: middle;
}

.news-tag.breaking {
    background: rgba(255,80,40,0.3);
    color: #FFAA77;
    border: 1px solid rgba(255,100,50,0.5);
    text-shadow: 0 0 10px rgba(255,100,50,0.7);
    box-shadow: 0 0 12px rgba(255,100,50,0.25);
}

.news-tag.union {
    background: rgba(100,180,255,0.25);
    color: #AACCFF;
    border: 1px solid rgba(100,180,255,0.5);
    text-shadow: 0 0 10px rgba(100,180,255,0.6);
    box-shadow: 0 0 12px rgba(100,180,255,0.2);
}

.news-location {
    font-size: 10px;
    color: rgba(0,255,136,0.65);
    letter-spacing: 0.3px;
    margin-left: 4px;
    font-style: italic;
}

/* News feed cycling animations - optimized for GPU */
#news-feed .news-line {
    will-change: transform, opacity;
    transform: translateZ(0);
}

#news-feed .news-line.slide-out-top {
    animation: slideOutTop 450ms cubic-bezier(0.4, 0, 0.6, 1) forwards;
    will-change: transform, opacity;
}

#news-feed .news-line.slide-in-bottom {
    animation: slideInBottom 550ms cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
    will-change: transform, opacity;
}

@keyframes slideOutTop {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
        max-height: 100px;
        margin-bottom: 0;
    }
    50% {
        opacity: 0;
        transform: translate3d(0, -15px, 0);
    }
    100% {
        opacity: 0;
        transform: translate3d(0, -25px, 0);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-bottom-width: 0;
    }
}

@keyframes slideInBottom {
    0% {
        opacity: 0;
        transform: translate3d(10px, 20px, 0);
    }
    60% {
        opacity: 0.7;
        transform: translate3d(3px, 5px, 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Audio toggle button - sci-fi terminal style */
#audio-toggle {
    position: fixed;
    bottom: 32px;
    left: 32px;
    padding: 8px 12px;
    background: linear-gradient(90deg, rgba(0,255,136,0.08) 0%, rgba(0,0,0,0.4) 100%);
    border: 2px solid rgba(0,255,136,0.2);
    border-left-width: 4px;
    color: rgba(124,255,178,0.8);
    font-family: 'Share Tech Mono', Courier, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
    border-radius: 2px;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
    box-shadow: 0 0 15px rgba(0,255,136,0.08), inset 0 0 20px rgba(0,255,136,0.02);
    text-shadow: 0 0 8px rgba(0,255,136,0.3);
    display: none;
    transform: translateZ(0);
}

#audio-toggle::before {
    content: "◉";
    display: inline-block;
    margin-right: 6px;
    font-size: 14px;
    color: #00FF88;
}

#audio-toggle:hover {
    background: linear-gradient(90deg, rgba(0,255,136,0.15) 0%, rgba(0,40,20,0.5) 100%);
    border-color: rgba(0,255,136,0.4);
    color: #00FF88;
    box-shadow: 0 0 25px rgba(0,255,136,0.2), inset 0 0 30px rgba(0,255,136,0.05);
    transform: translate3d(3px, 0, 0);
}

#audio-toggle:active {
    transform: translate3d(1px, 0, 0);
}

/* Muted state - change indicator to X */
#audio-toggle.muted::before {
    content: "⦸";
    color: rgba(255,100,100,0.8);
}

#audio-toggle.muted {
    border-color: rgba(255,100,100,0.2);
    color: rgba(255,150,150,0.7);
}

/* CRT overlay removed - no fallback needed */

/* add a global page padding so content doesn't hug the viewport edges */
body {
    padding: 24px 32px;
}

/* make sizing predictable and allow padding without overflow surprises */
*, *::before, *::after {
    box-sizing: border-box;
}

/* START SCREEN */
#start-screen {
    /* take the available viewport height minus the body padding so centering works visually */
    min-height: calc(100vh - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#initiate-btn {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(90deg, rgba(0,255,136,0.15) 0%, rgba(0,0,0,0.3) 100%);
    color: #00FF88;
    border: 3px solid #00FF88;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    padding: 24px 60px;
    cursor: pointer;
    border-radius: 8px;
    clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
    box-shadow: 0 0 30px rgba(0,255,136,0.3), inset 0 0 40px rgba(0,255,136,0.05);
    text-shadow: 0 0 15px rgba(0,255,136,0.5);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

#initiate-btn:hover {
    background: linear-gradient(90deg, rgba(0,255,136,0.25) 0%, rgba(0,40,20,0.4) 100%);
    box-shadow: 0 0 50px rgba(0,255,136,0.5), inset 0 0 60px rgba(0,255,136,0.1);
    transform: translate3d(0, 0, 0) scale(1.05);
}

/* TERMINAL SCREEN */
#terminal-screen {
    display: none;
    position: relative;
    min-height: calc(100vh - 48px);
    width: 100%;
    padding: 16px;
    overflow: hidden;
    isolation: isolate;
}

.terminal-columns {
    display: flex;
    gap: 32px;
    height: 100%;
    /* Keep the boot text anchored so it doesn't drift as lines are typed,
       and horizontally center the whole boot block in the same region as
       the main app. */
    align-items: flex-start;
    justify-content: center;
    margin-top: 18vh; /* push boot content closer to true vertical center */
}

#terminal-screen #terminal {
	/* Fix the boot terminal width so it doesn't re-center as text grows */
	flex: 0 0 700px;
	width: 700px;
	max-width: 700px;
	/* Let the terminal size to its content vertically */
	height: auto;
	overflow-y: auto;
	white-space: pre-wrap;
	line-height: 1.3;
	color: #7CFFB2;
	font-family: Courier, monospace;
}

#terminal-logo {
	flex: 0 0 520px; /* reserve logo width from the start so text never shifts horizontally */
	width: 520px;
	max-width: 520px;
	white-space: pre;
	line-height: 1.1;
	color: #7CFFB2;
	font-family: Courier, monospace;
	font-size: 11px;
	opacity: 0;
	transition: opacity 200ms ease;
	text-align: center;
}

/* MAIN APP */
#app {
    display: flex;
    min-height: calc(100vh - 48px);
    /* allow the app to size to its content so margin:auto can center it */
    width: auto;
    max-width: 920px;
    margin: 0 auto; /* center horizontally inside the page padding */
    padding: 16px; /* internal padding inside the app area */
    gap: 20px; /* space between sidebar and terminal */
    align-items: stretch;
    position: relative; /* allow CRT overlay to sit above app content */
    isolation: isolate; /* ensure blending works reliably in Firefox and other browsers */
    background: rgba(0,0,0,0.035);
    border: 1px solid rgba(124,255,178,0.03);
    border-radius: 6px;
}

/* Sidebar */
#sidebar {
    width: 420px;
    min-width: 320px;
    border-right: 2px solid #00FF88;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(180deg, rgba(0,20,10,0.08), rgba(0,0,0,0.02));
}

/* Sidebar header / titles */
.sidebar-header {
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

.sidebar-header:hover {
    transform: translate3d(2px, 0, 0);
}

.sidebar-header:hover .sidebar-title {
    box-shadow: 0 0 28px rgba(0,255,136,0.25), inset 0 0 35px rgba(0,255,136,0.06);
    border-color: rgba(0,255,136,0.9);
}

.sidebar-header:hover .sidebar-subtitle {
    color: rgba(0,255,136,0.95);
    text-shadow: 0 0 12px rgba(0,255,136,0.3);
}

.sidebar-title {
    font-family: 'Orbitron', 'Share Tech Mono', sans-serif;
    font-size: 32px;
    color: #00FF88;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    padding: 16px 18px;
    border: 2px solid #00FF88;
    border-radius: 0;
    background: linear-gradient(90deg, rgba(0,255,136,0.08) 0%, rgba(0,0,0,0.02) 100%);
    box-shadow: 0 0 20px rgba(0,255,136,0.15), inset 0 0 30px rgba(0,255,136,0.04);
    font-weight: 700;
    text-shadow: 0 0 12px rgba(0,255,136,0.4);
    border-radius: 4px; /* Fallback for browsers without clip-path support */
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
    position: relative;
}

.sidebar-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: rgba(0,255,136,0.75);
    margin-top: 8px;
    margin-left: 8px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: none;
    text-shadow: 0 0 8px rgba(0,255,136,0.15);
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* COMP/CON style large angular buttons */
#sidebar .sidebar-list button {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #00FF88;
    background: linear-gradient(90deg, rgba(0,255,136,0.12) 0%, rgba(0,20,10,0.06) 100%);
    border: 2px solid #00FF88;
    border-left-width: 6px;
    padding: 18px 20px;
    cursor: pointer;
    text-align: left;
    position: relative;
    border-radius: 4px;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(0,255,136,0.08), inset 0 0 20px rgba(0,255,136,0.02);
    text-shadow: 0 0 8px rgba(0,255,136,0.3);
    transform: translateZ(0);
}

#sidebar .sidebar-list button::before {
    content: "▶";
    display: inline-block;
    margin-right: 12px;
    font-size: 16px;
    color: #00FF88;
    transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar .sidebar-list button:hover {
    background: linear-gradient(90deg, rgba(0,255,136,0.18) 0%, rgba(0,40,20,0.1) 100%);
    box-shadow: 0 0 25px rgba(0,255,136,0.2), inset 0 0 30px rgba(0,255,136,0.05);
    transform: translate3d(4px, 0, 0);
}

#sidebar .sidebar-list button:hover::before {
    transform: translate3d(4px, 0, 0);
}

/* Keyboard navigation selected state - visual targeting only */
#sidebar .sidebar-list button.selected {
    background: linear-gradient(90deg, rgba(0,255,136,0.22) 0%, rgba(0,40,20,0.15) 100%);
    border-color: #00FF88;
    border-left-width: 8px;
    box-shadow: 0 0 30px rgba(0,255,136,0.35), inset 0 0 40px rgba(0,255,136,0.08);
    transform: translate3d(6px, 0, 0);
}

#sidebar .sidebar-list button.selected::before {
    transform: translate3d(6px, 0, 0) scale(1.2);
    text-shadow: 0 0 12px rgba(0,255,136,0.8);
}

/* Active/loaded pilot - diamond indicator */
#sidebar .sidebar-list button.active::before {
    content: "◆";
}

/* Support alternate id used by the app container */
#terminal-app {
    flex: 1; /* stretch to fill remaining space */
    padding: 24px 36px;
    white-space: pre-wrap;
    line-height: 1.3;
    overflow-y: auto;
    color: #7CFFB2;
    font-family: Courier, monospace;
    box-sizing: border-box;
}

#terminal-app {
    background: rgba(0,0,0,0.02);
    border-left: 1px solid rgba(31,255,51,0.03);
    border-radius: 0 6px 6px 0;
}

/* Profile two-column layout */
.profile {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: start;
    padding: 12px 6px;
}

.profile-left {
    /* allow the left column to shrink correctly inside a grid */
    min-width: 0;
    font-family: 'Share Tech Mono', 'Courier New', Courier, monospace;
    color: #7CFFB2;
    line-height: 1.45;
    white-space: pre-wrap;
    font-size: 15px;
    padding-right: 16px;
    border-right: 1px solid rgba(31,255,51,0.03);
}

.profile-right {
    width: 360px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding-left: 12px;
}

.profile-left h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #A8FFD0;
}

.profile-notes pre {
    margin: 0;
    font-family: 'Share Tech Mono', 'Courier New', Courier, monospace;
    font-size: 13px;
    color: rgba(124,255,178,0.92);
    white-space: pre-wrap;
}

/* make portrait area more prominent */
.mech-portrait { width: 320px; margin-bottom: 18px; }
.mech-portrait img { max-height: 260px; object-fit: contain; display: block; }

/* ensure a clear gap between portrait and notes */
.profile-right .mech-portrait + .profile-notes,
.profile-right .mech-portrait + .portrait-placeholder {
    margin-top: 18px;
}

/* portrait area stacked above text */
.profile-portraits {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 6px;
}

.profile-text {
    font-family: 'Share Tech Mono', 'Courier New', Courier, monospace;
    color: #7CFFB2;
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-wrap;
    padding: 12px 8px 24px 8px;
}

/* Generic image styling inside the terminal app; visibility is controlled
   via the more specific .mech-portrait rules below. */
#terminal-app img {
	max-width: 280px;
	width: 100%;
	height: auto;
	display: block;
	margin-top: 12px;
	border: 1px solid rgba(31,255,51,0.15);
	border-radius: 6px;
	background: transparent;
}

/* mech portrait wrapper + reveal animation */
.mech-portrait {
    width: 280px;
    margin-top: 12px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(31,255,51,0.06);
    background: linear-gradient(180deg, rgba(0,0,0,0.035), rgba(0,0,0,0.02));
    position: relative;
    min-height: 300px; /* reserve space to prevent jitter */
}

/* loading state shows subtle pulse */
.mech-portrait.loading {
    min-height: 300px;
    background: linear-gradient(180deg, rgba(0,255,136,0.02), rgba(0,0,0,0.01));
    animation: portrait-pulse 2.4s ease-in-out infinite;
}

@keyframes portrait-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.7; }
}

.mech-portrait img {
    display: block;
    width: 100%;
    height: auto;
    transform: translate3d(0, 4px, 0) scale(0.98);
    opacity: 0;
    transition: transform 220ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
    will-change: transform, opacity;
}

.mech-portrait::after {
    /* a soft sweep that travels across the image when it loads */
    content: "";
    position: absolute;
    left: -60%;
    top: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, rgba(124,255,178,0) 0%, rgba(124,255,178,0.08) 40%, rgba(124,255,178,0) 100%);
    transform: translateX(0);
    pointer-events: none;
    opacity: 0.9;
}

.mech-portrait.loaded img {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    will-change: auto;
}

.mech-portrait.loaded::after {
    animation: mech-sweep 560ms ease forwards;
}

@keyframes mech-sweep {
    0% { left: -60%; opacity: 0.9 }
    60% { left: 80%; opacity: 0.18 }
    100% { left: 140%; opacity: 0 }
}

/* placeholder shown when portrait cannot load */
.portrait-placeholder {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #00FF88;
    background: 
        linear-gradient(180deg, rgba(0,255,136,0.03), rgba(0,0,0,0.01)),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(0,255,136,0.02) 10px,
            rgba(0,255,136,0.02) 20px
        );
    border: 2px dashed #00FF88;
    border-radius: 8px; /* Fallback for browsers without clip-path support */
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
    box-shadow: 
        inset 0 0 40px rgba(0,255,136,0.04),
        0 0 20px rgba(0,255,136,0.1);
    text-shadow: 0 0 10px rgba(0,255,136,0.3);
    position: relative;
    overflow: hidden;
}

.portrait-placeholder::before {
    content: "";
    position: absolute;
    inset: 20px;
    border: 1px solid rgba(0,255,136,0.15);
    border-radius: 6px; /* Fallback for browsers without clip-path support */
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
    pointer-events: none;
}

.portrait-placeholder::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    margin: -40px 0 0 -40px;
    border: 2px solid rgba(0,255,136,0.2);
    border-radius: 50%;
    border-top-color: #00FF88;
    animation: placeholder-spin 4s linear infinite;
    will-change: transform;
}

@keyframes placeholder-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* background fallback when <img> cannot be displayed */
.mech-portrait.bg {
    background-size: cover;
    background-position: center;
    min-height: 360px;
}

/* jittery cursor used during typing */
.cursor {
    display: inline-block;
    min-width: 0.9em;
    color: #7CFFB2;
    font-weight: 700;
    margin-left: 2px;
    background: transparent;
}

/* ensure terminal content sits beneath the CRT overlay so the overlay is visible */
#terminal, #terminal-app {
    position: relative;
    z-index: 1;
}

/* CRT overlay and flicker animation removed */

/* Angular viewport border frame */
#viewport-border {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    border: 2px solid #00FF88;
    border-radius: 8px; /* Fallback for browsers without clip-path support */
    box-shadow: 
        inset 0 0 30px rgba(0,255,136,0.08),
        0 0 20px rgba(0,255,136,0.12);
    clip-path: polygon(
        0 0, 
        calc(100% - 40px) 0, 
        100% 40px, 
        100% 100%, 
        40px 100%, 
        0 calc(100% - 40px)
    );
}

/* Screen transition glitch/fizzle effect - GPU optimized */
@keyframes screen-fizzle {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
    20% {
        opacity: 0.7;
        transform: translate3d(-3px, 2px, 0) scale(0.99);
    }
    40% {
        opacity: 0.3;
        transform: translate3d(3px, -3px, 0) scale(1.01);
    }
    60% {
        opacity: 0.1;
        transform: translate3d(-2px, 3px, 0) scale(0.98);
    }
    80% {
        opacity: 0.03;
        transform: translate3d(2px, -2px, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes screen-unfizzle {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) scale(1.02);
    }
    20% {
        opacity: 0.1;
        transform: translate3d(-3px, 3px, 0) scale(1.01);
    }
    40% {
        opacity: 0.4;
        transform: translate3d(3px, -2px, 0) scale(0.99);
    }
    60% {
        opacity: 0.7;
        transform: translate3d(-2px, 2px, 0) scale(1);
    }
    80% {
        opacity: 0.9;
        transform: translate3d(1px, -1px, 0) scale(1);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* RGB chromatic aberration for harsh glitch */
@keyframes rgb-split {
    0%, 100% {
        text-shadow: 0 0 0 transparent;
    }
    20% {
        text-shadow: -3px 0 #FF0080, 3px 0 #00FFFF;
    }
    40% {
        text-shadow: 3px 0 #00FF00, -3px 0 #FF00FF, 0 3px #FFFF00;
    }
    60% {
        text-shadow: -2px 0 #FF0000, 2px 0 #00FF00, 0 -2px #0000FF;
    }
    80% {
        text-shadow: 4px 0 #FF00FF, -4px 0 #00FFFF;
    }
}

.screen-fizzle-out {
    animation: screen-fizzle 150ms cubic-bezier(0.4, 0, 0.6, 1) forwards;
    will-change: transform, opacity;
}

.screen-fizzle-out * {
    animation: rgb-split 150ms steps(4) forwards;
}

.screen-fizzle-in {
    animation: screen-unfizzle 150ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
    will-change: transform, opacity;
}

.screen-fizzle-in * {
    animation: rgb-split 150ms steps(4) reverse;
}

/* ==================== INFO SCREEN STYLES ==================== */
#info-screen {
    display: none;
    position: fixed;
    inset: 0;
    min-height: 100vh;
    overflow: hidden; /* prevent the overall page from scrolling while info is open */
}

#info-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 16px;
    will-change: transform;
}

#info-content {
	max-width: 780px;
	/* The info card sized to fit all content without scrolling while
	   staying comfortably inside 1080p viewports with clear margins. */
	max-height: min(900px, calc(100vh - 120px));
	background: linear-gradient(180deg, rgba(0,20,10,0.12), rgba(0,0,0,0.06));
	border: 2px solid #00FF88;
	padding: 22px 36px 20px;
	border-radius: 4px;
	clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 30px 100%, 0 calc(100% - 30px));
	box-shadow: 0 0 30px rgba(0,255,136,0.2), inset 0 0 40px rgba(0,255,136,0.05);
	transform: translateZ(0);
	will-change: transform;
}

#info-title {
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 20px;
    border-bottom: 2px solid #00FF88;
    padding-bottom: 14px;
    text-align: center;
}

#info-title .main-title {
	font-size: 30px;
    color: #00FF88;
    letter-spacing: 6px;
    text-transform: uppercase;
    text-shadow: 0 0 25px rgba(0,255,136,0.7), 0 0 50px rgba(0,255,136,0.4), 0 0 80px rgba(0,255,136,0.2);
    display: block;
    line-height: 1.3;
    font-weight: 700;
    padding: 8px 0;
}

#info-title .sub-title {
    font-size: 14px;
    color: rgba(124,255,178,0.75);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(0,255,136,0.3);
    display: block;
    margin-top: 4px;
    font-weight: 400;
}

#info-text {
    font-family: 'Share Tech Mono', monospace;
	font-size: 13px;
    color: rgba(124,255,178,0.9);
	line-height: 1.55;
}

.header-section {
    margin-bottom: 16px;
}

.greeting {
    font-family: 'Orbitron', sans-serif;
	font-size: 20px;
    color: #00FF88;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-shadow: 0 0 12px rgba(0,255,136,0.6);
    text-align: center;
}

.subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: rgba(124,255,178,0.7);
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    line-height: 1.5;
    text-align: center;
}

.section-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #00FF88, transparent);
    margin: 16px 0;
    box-shadow: 0 0 8px rgba(0,255,136,0.3);
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 17px;
    color: #00FF88;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 16px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0,255,136,0.5);
    border-left: 3px solid #00FF88;
    padding-left: 12px;
}

.section-content {
	margin-bottom: 14px;
	text-align: left;
}

.left-column, .right-column {
	margin-bottom: 12px;
}

/* Two-column layout for info sections */
#info-text {
	display: flex;
	flex-direction: column;
}

.left-column {
	width: 100%;
}

.right-column {
	width: 100%;
}

/* Side-by-side layout for larger screens */
@media (min-width: 800px) {
	#info-text {
		display: block;
	}

	.left-column, .right-column {
		display: inline-block;
		width: 48%;
		vertical-align: top;
		margin-bottom: 12px;
	}

	.left-column {
		margin-right: 3%;
	}
}

.ps-section {
    position: relative;
    margin-top: 24px;
	padding: 26px 20px 14px;
    background: linear-gradient(135deg, rgba(255,150,0,0.15), rgba(255,80,0,0.08));
    border: 2px solid #FF9900;
    border-top-width: 3px;
    border-bottom-width: 3px;
    box-shadow: 0 0 25px rgba(255,150,0,0.25), inset 0 0 30px rgba(255,150,0,0.08);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.ps-section::before {
    content: "⚠ PRIORITY NOTICE ⚠";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #FF9900;
    background: #0a0e0d;
    padding: 3px 14px;
    border: 1px solid #FF9900;
    text-shadow: 0 0 10px rgba(255,150,0,0.8);
    box-shadow: 0 0 15px rgba(255,150,0,0.3);
    z-index: 10;
}

.ps-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: #FFAA33;
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-shadow: 0 0 12px rgba(255,170,51,0.7);
    font-weight: 700;
}

.ps-content {
	font-size: 13px;
	color: rgba(255,220,180,0.95);
	text-shadow: 0 0 6px rgba(255,150,0,0.2);
	line-height: 1.55;
	text-align: left;
}

.signature {
    margin-top: 12px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: rgba(255,200,150,0.85);
}

/* ==================== VIEW BIOGRAPHY BUTTON ==================== */
.view-bio-button {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #00FF88;
    background: linear-gradient(90deg, rgba(0,255,136,0.12) 0%, rgba(0,20,10,0.06) 100%);
    border: 2px solid #00FF88;
    border-left-width: 4px;
    padding: 12px 20px;
    cursor: pointer;
    margin-top: 20px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(0,255,136,0.08), inset 0 0 20px rgba(0,255,136,0.02);
    text-shadow: 0 0 8px rgba(0,255,136,0.3);
    display: block;
    width: fit-content;
    transform: translateZ(0);
}

.view-bio-button .bio-arrow {
    display: inline-block;
    margin-right: 8px;
    font-size: 11px;
    color: #00FF88;
    transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

.view-bio-button:hover {
    background: linear-gradient(90deg, rgba(0,255,136,0.18) 0%, rgba(0,40,20,0.1) 100%);
    box-shadow: 0 0 25px rgba(0,255,136,0.2), inset 0 0 30px rgba(0,255,136,0.05);
    transform: translate3d(4px, 0, 0);
}

.view-bio-button:hover .bio-arrow {
    transform: translate3d(4px, 0, 0);
}

/* ==================== DETAILED PILOT SCREEN - MINIMAL ==================== */
#detailed-pilot-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, #07130b 0%, #020200 55%, #000 100%);
    overflow-y: auto;
    z-index: 1000;
    padding: 60px 40px 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

#detailed-pilot-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==================== COMPACT HEADER ==================== */
.detailed-header {
    text-align: center;
    margin-bottom: 20px;
}

.hero-callsign {
    font-family: 'Orbitron', sans-serif;
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 10px;
    text-transform: uppercase;
    color: #00FF88;
    text-shadow: 
        0 0 40px rgba(0,255,136,1),
        0 0 80px rgba(0,255,136,0.6);
    margin-bottom: 12px;
}

.header-status {
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    color: rgba(124,255,178,0.8);
    letter-spacing: 2px;
}

.header-status .hero-name,
.header-status .hero-status,
.header-status .hero-origin {
    color: #00FF88;
    font-weight: 700;
}

/* ==================== TWO COLUMN GRID ==================== */
.detailed-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.pilot-column,
.mech-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #00FF88;
    text-shadow: 0 0 15px rgba(0,255,136,0.6);
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0,255,136,0.3);
}

/* ==================== PILOT COLUMN ==================== */
.detailed-portrait {
    width: 100%;
    height: 350px;
    border: 2px solid rgba(0,255,136,0.3);
    background: linear-gradient(180deg, rgba(0,255,136,0.03), rgba(0,0,0,0.02));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.detailed-portrait.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0,255,136,0.1) 50%,
        transparent 100%
    );
    animation: portrait-scan 2s linear infinite;
}

@keyframes portrait-scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.detailed-pilot-img {
    max-width: 280px;
    max-height: 280px;
    width: auto;
    height: auto;
    display: block;
}

/* hard cap any pilot image inside the detailed portrait, even if
 * the specific class is missing for some reason */
.detailed-portrait img {
    max-width: 280px;
    max-height: 280px;
    width: auto;
    height: auto;
    display: block;
}

.detailed-portrait.loaded {
    padding: 20px;
}

.pilot-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: rgba(124,255,178,0.8);
    display: flex;
    gap: 8px;
    align-items: center;
}

.info-label {
    color: rgba(124,255,178,0.6);
    letter-spacing: 1px;
}

.detailed-origin-text {
    color: #00FF88;
    font-weight: 700;
}

.detailed-flag {
    width: 100%;
    height: 100px;
    border: 2px solid rgba(0,255,136,0.3);
    background: linear-gradient(180deg, rgba(0,255,136,0.03), rgba(0,0,0,0.02));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.detailed-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flag-placeholder {
    font-family: 'Orbitron', sans-serif;
    font-size: 36px;
    color: #00FF88;
    text-shadow: 0 0 20px rgba(0,255,136,0.6);
}

/* ==================== MECH COLUMN ==================== */
.detailed-mech {
    width: 100%;
    height: 400px;
    border: 2px solid rgba(0,255,136,0.3);
    background: linear-gradient(180deg, rgba(0,255,136,0.03), rgba(0,0,0,0.02));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.detailed-mech.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0,255,136,0.1) 50%,
        transparent 100%
    );
    animation: portrait-scan 2s linear infinite;
}

.detailed-mech-img {
    max-width: 320px;
    max-height: 320px;
    width: auto;
    height: auto;
    display: block;
}

/* same safety net for mech images in case the class isn't applied */
.detailed-mech img {
    max-width: 320px;
    max-height: 320px;
    width: auto;
    height: auto;
    display: block;
}

.detailed-mech.loaded {
    padding: 20px;
}

.detailed-mech-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #00FF88;
    text-align: center;
    letter-spacing: 1.5px;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(0,255,136,0.3);
    text-shadow: 0 0 10px rgba(0,255,136,0.5);
}

/* ==================== BIOGRAPHY FOOTER ==================== */
.bio-footer {
    border-top: 2px solid rgba(0,255,136,0.3);
    padding-top: 16px;
}

.bio-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #00FF88;
    text-shadow: 0 0 10px rgba(0,255,136,0.5);
    margin-bottom: 8px;
}

.bio-content {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: rgba(124,255,178,0.85);
    line-height: 1.6;
    max-height: 80px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(0,255,136,0.15);
    scrollbar-width: thin;
    scrollbar-color: #00FF88 rgba(0,0,0,0.3);
}

.bio-content::-webkit-scrollbar {
    width: 6px;
}

.bio-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
}

.bio-content::-webkit-scrollbar-thumb {
    background: #00FF88;
    box-shadow: 0 0 10px rgba(0,255,136,0.5);
}

/* ==================== PLACEHOLDER ==================== */
.portrait-placeholder-detailed {
    font-family: 'Orbitron', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #00FF88;
    text-align: center;
    padding: 40px 20px;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(0,255,136,0.02) 10px,
            rgba(0,255,136,0.02) 20px
        );
    text-shadow: 0 0 10px rgba(0,255,136,0.4);
}

/* ==================== BACK BUTTON ==================== */
#detailed-back-button,
#back-button {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #00FF88;
    background: linear-gradient(90deg, rgba(0,255,136,0.12) 0%, rgba(0,20,10,0.06) 100%);
    border: 2px solid #00FF88;
    border-left-width: 4px;
    padding: 10px 24px;
    cursor: pointer;
    margin: 0 auto;
    display: block;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(0,255,136,0.1), inset 0 0 20px rgba(0,255,136,0.02);
    text-shadow: 0 0 8px rgba(0,255,136,0.3);
    transform: translateZ(0);
}

/* Extra breathing room between the info notice and its RETURN button */
#back-button {
    margin-top: 28px;
}

#detailed-back-button .back-arrow,
#back-button .back-arrow {
    display: inline-block;
    margin-right: 8px;
    font-size: 11px;
    color: #00FF88;
    transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

#detailed-back-button:hover,
#back-button:hover {
    background: linear-gradient(90deg, rgba(0,255,136,0.22) 0%, rgba(0,40,20,0.15) 100%);
    box-shadow: 0 0 25px rgba(0,255,136,0.25), inset 0 0 30px rgba(0,255,136,0.05);
    transform: translate3d(-4px, 0, 0);
}

#detailed-back-button:hover .back-arrow,
#back-button:hover .back-arrow {
    transform: translate3d(-4px, 0, 0);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .detailed-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .hero-callsign {
        font-size: 42px;
        letter-spacing: 8px;
    }
}
