/* ============================================================
   HARSH RAJ — PORTFOLIO // 3D SCI-FI HUD THEME
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- TOKENS ---------- */
:root {
    --bg:            #030510;
    --bg-2:          #06091a;
    --panel:         rgba(10, 16, 34, 0.55);
    --panel-solid:   rgba(10, 16, 34, 0.92);
    --panel-border:  rgba(0, 240, 255, 0.22);
    --panel-border-strong: rgba(0, 240, 255, 0.5);

    --cyan:          #00f0ff;
    --cyan-dim:      #0097a7;
    --magenta:       #ff3df0;
    --lime:          #00ff9d;
    --amber:         #ffb800;

    --text:          #e6f0ff;
    --muted:         #8aa0c0;
    --dim:           #5a6a85;

    --glow-cyan:     0 0 24px rgba(0, 240, 255, 0.45);
    --glow-magenta:  0 0 24px rgba(255, 61, 240, 0.4);

    --font-display:  'Orbitron', sans-serif;
    --font-body:     'Rajdhani', sans-serif;
    --font-mono:     'JetBrains Mono', monospace;

    --radius:        2px;
    --max-w:         1240px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    min-height: 100vh;
    letter-spacing: 0.01em;
}

/* Starfield canvas sits behind everything */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    display: block;
}

/* Subtle vignette + noise */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(0, 240, 255, 0.08), transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(255, 61, 240, 0.06), transparent 60%),
        linear-gradient(180deg, rgba(3,5,16,0) 0%, rgba(3,5,16,0.6) 100%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--cyan); color: var(--bg); }

/* ---------- HUD STATUS BAR ---------- */
.hud-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: rgba(3, 5, 16, 0.85);
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
}
.hud-bar .left, .hud-bar .right { display: flex; align-items: center; gap: 18px; }
.hud-bar .brand {
    color: var(--cyan);
    font-weight: 600;
    text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}
.hud-bar .status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--lime);
}
.hud-bar .status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 10px var(--lime);
    animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}

.theme-switch {
    position: fixed;
    top: 44px;
    right: 20px;
    z-index: 99;
}
.theme-toggle-btn {
    width: 42px; height: 42px;
    background: var(--panel-solid);
    border: 1px solid var(--panel-border);
    color: var(--cyan);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s ease;
    position: relative;
    font-size: 15px;
}
.theme-toggle-btn::before {
    content: '';
    position: absolute;
    inset: -3px;
    border: 1px solid var(--panel-border);
    border-radius: 50%;
    opacity: 0.4;
}
.theme-toggle-btn:hover {
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
}
.theme-toggle-btn .fa-sun { display: none; }
.theme-toggle-btn .fa-moon { display: block; }
.theme-toggle-btn.light-mode .fa-sun { display: block; }
.theme-toggle-btn.light-mode .fa-moon { display: none; }

/* ---------- PANEL (HUD WINDOW) ---------- */
.glass-effect, .panel {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.glass-effect:hover, .panel:hover {
    border-color: var(--panel-border-strong);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.08);
}
/* Corner brackets via pseudo-elements */
.glass-effect::before, .glass-effect::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--cyan);
    pointer-events: none;
}
.glass-effect::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.glass-effect::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ---------- HEADER / HERO ---------- */
.header {
    max-width: var(--max-w);
    margin: 110px auto 50px;
    padding: 60px 56px 56px;
    position: relative;
}
.profile-container {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 50px;
    align-items: center;
}
.profile-image {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    filter: saturate(1.05) contrast(1.02);
    position: relative;
    z-index: 2;
    justify-self: center;
    align-self: center;
    border: 2px solid var(--cyan);
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.profile-image:hover {
    transform: scale(1.03);
    box-shadow: 0 0 32px rgba(0, 240, 255, 0.35);
}

.header-content h1.gradient-text {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5.2vw, 4.2rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
    background: linear-gradient(110deg, var(--cyan) 0%, #fff 40%, var(--magenta) 70%, var(--cyan) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-transform: uppercase;
    animation: holo-shift 6s linear infinite;
    filter: drop-shadow(0 0 18px rgba(0, 240, 255, 0.35));
}
@keyframes holo-shift {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
.header-content .subtitle {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.4em;
    text-transform: uppercase;
    margin: 14px 0 22px;
    position: relative;
    padding-left: 22px;
}
.header-content .subtitle::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    width: 14px; height: 1px;
    background: var(--cyan);
}

.highlights { display: flex; flex-wrap: wrap; gap: 10px; }
.highlight-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 7px 14px;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.35);
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    transition: all 0.25s ease;
    cursor: default;
}
.highlight-badge:hover {
    background: rgba(0, 240, 255, 0.18);
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.5);
}
.highlight-badge.glow { /* keeps compat */ }

/* ---------- SECTIONS ---------- */
.main-content { padding-bottom: 80px; }
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 20px;
}
.section {
    margin-bottom: 60px;
    position: relative;
    padding: 44px 40px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.section::before, .section::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 1.5px solid var(--cyan);
    pointer-events: none;
}
.section::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.section::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.section-title {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 32px;
    padding-bottom: 16px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
}
.section-title::before {
    content: '◢';
    color: var(--cyan);
    font-size: 0.85em;
    text-shadow: 0 0 10px var(--cyan);
}
.section-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--cyan) 0%, transparent 70%);
}

/* ---------- ABOUT ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 36px;
    align-items: start;
}
.about-intro {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}
.highlight-text {
    color: var(--cyan);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}
.about-description {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 26px;
}
.about-highlights {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
.highlight-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(0, 240, 255, 0.04);
    border-left: 2px solid var(--cyan);
    transition: all 0.25s ease;
}
.highlight-item:hover {
    background: rgba(0, 240, 255, 0.1);
    transform: translateX(4px);
}
.highlight-icon { font-size: 1.25rem; }
.highlight-info {
    color: var(--text);
    font-weight: 500;
    font-size: 0.98rem;
}
.about-quote {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-style: italic;
    color: var(--muted);
    padding: 18px 22px;
    border: 1px dashed rgba(255, 61, 240, 0.35);
    background: rgba(255, 61, 240, 0.03);
    position: relative;
}
.about-quote::before {
    content: 'TRANSMISSION';
    position: absolute;
    top: -8px; left: 16px;
    background: var(--bg);
    padding: 0 8px;
    font-size: 9px;
    color: var(--magenta);
    letter-spacing: 0.2em;
}

/* --- Profile Photo (scanning / received data) --- */
.about-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.profile-frame {
    position: relative;
    border: 1px solid var(--cyan);
    padding: 6px;
    background: rgba(0, 15, 30, 0.6);
    overflow: hidden;
    animation: profileReveal 1.8s ease-out both;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.1), inset 0 0 20px rgba(0, 240, 255, 0.03);
}
@keyframes profileReveal {
    0% { opacity: 0; clip-path: inset(0 0 100% 0); }
    30% { opacity: 1; }
    100% { clip-path: inset(0 0 0% 0); }
}
.profile-img {
    width: 100%;
    display: block;
    filter: saturate(0.35) brightness(0.85) contrast(1.15);
    animation: imgDecode 2.5s ease-out both;
    mix-blend-mode: luminosity;
}
@keyframes imgDecode {
    0% { filter: saturate(0) brightness(0.4) contrast(2) blur(6px); opacity: 0.3; }
    40% { filter: saturate(0.15) brightness(0.7) contrast(1.4) blur(2px); opacity: 0.7; }
    70% { filter: saturate(0.3) brightness(0.8) contrast(1.2) blur(0); }
    100% { filter: saturate(0.35) brightness(0.85) contrast(1.15); opacity: 1; }
}
.profile-frame:hover .profile-img {
    filter: saturate(0.7) brightness(0.9) contrast(1.1);
    mix-blend-mode: normal;
    transition: filter 0.6s ease;
}
/* Scanning line */
.profile-scanline {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    box-shadow: 0 0 12px var(--cyan), 0 0 30px rgba(0, 240, 255, 0.3);
    z-index: 3;
    animation: scanDown 3s ease-in-out infinite;
    opacity: 0.8;
}
@keyframes scanDown {
    0% { top: 0; opacity: 0.8; }
    50% { top: 100%; opacity: 0.6; }
    51% { opacity: 0; }
    52% { top: 0; opacity: 0; }
    53% { opacity: 0.8; }
    100% { top: 0; opacity: 0.8; }
}
/* CRT flicker overlay */
.profile-flicker {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 240, 255, 0.015) 2px,
        rgba(0, 240, 255, 0.015) 4px
    );
}
/* Bottom tag */
.profile-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--cyan);
    text-align: center;
    padding: 8px 0 4px;
    opacity: 0.6;
}
.profile-status {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--green, #00ff9d);
    text-align: center;
    padding-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    animation: statusBlink 4s ease-in-out infinite;
}
@keyframes statusBlink {
    0%, 90%, 100% { opacity: 0.7; }
    95% { opacity: 0.2; }
}
.status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--green, #00ff9d);
    box-shadow: 0 0 6px var(--green, #00ff9d);
    animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
/* Corner brackets on frame */
.profile-frame::before,
.profile-frame::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: var(--cyan);
    border-style: solid;
    z-index: 4;
    opacity: 0.5;
}
.profile-frame::before {
    top: 3px; left: 3px;
    border-width: 1px 0 0 1px;
}
.profile-frame::after {
    bottom: 3px; right: 3px;
    border-width: 0 1px 1px 0;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.stat-card {
    padding: 28px 22px;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid var(--panel-border);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(0, 240, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}
.stat-card:hover {
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
    transform: translateY(-3px);
}
.stat-card:hover::before { opacity: 1; }
.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--cyan);
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
    line-height: 1;
}
.stat-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 10px;
}

/* ---------- TIMELINES (EXPERIENCE / EDUCATION) ---------- */
.experience-timeline,
.education-timeline {
    position: relative;
    padding-left: 32px;
}
.experience-timeline::before,
.education-timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, var(--cyan) 0%, var(--magenta) 100%);
    opacity: 0.5;
}
.experience-card,
.education-card {
    position: relative;
    padding: 22px 24px;
    margin-bottom: 26px;
    background: rgba(10, 16, 34, 0.4);
    border: 1px solid var(--panel-border);
    transition: all 0.3s ease;
}
.experience-card::before,
.education-card::before {
    content: '';
    position: absolute;
    left: -30px; top: 28px;
    width: 14px; height: 14px;
    background: var(--bg);
    border: 2px solid var(--cyan);
    box-shadow: 0 0 12px var(--cyan);
    transform: rotate(45deg);
}
.experience-card:hover,
.education-card:hover {
    border-color: var(--cyan);
    transform: translateX(6px);
    box-shadow: -8px 0 20px rgba(0, 240, 255, 0.1);
}
.exp-year, .edu-year {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--magenta);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 8px;
}
.experience-card h3,
.education-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}
.experience-card p,
.education-card p {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 8px;
}
.exp-session {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--cyan);
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}
.exp-description, .edu-highlights {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ---------- SKILLS ---------- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}
.skill-category {
    padding: 26px;
    background: rgba(10, 16, 34, 0.4);
    border: 1px solid var(--panel-border);
    position: relative;
}
.skill-category h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}
.skill-item {
    margin-bottom: 18px;
}
.skill-item > span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.skill-bar {
    height: 6px;
    background: rgba(0, 240, 255, 0.1);
    position: relative;
    overflow: hidden;
}
.skill-bar::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    box-shadow: 0 0 12px var(--cyan);
    transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.skill-bar.animated::after {
    width: var(--level, 0%);
}
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.skill-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 6px 12px;
    background: rgba(255, 61, 240, 0.08);
    border: 1px solid rgba(255, 61, 240, 0.35);
    color: var(--magenta);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.25s ease;
}
.skill-tag:hover {
    background: rgba(255, 61, 240, 0.2);
    box-shadow: var(--glow-magenta);
}

/* ---------- RESEARCH ---------- */
.section-content p {
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.75;
    margin-bottom: 16px;
}
.section-content strong {
    color: var(--cyan);
    font-weight: 700;
}

/* ---------- PROJECTS ---------- */
.projects-section { padding-bottom: 60px; }
.project-carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}
.project-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    perspective: 1200px;
}
.project-card {
    position: relative;
    padding: 28px 26px;
    background: rgba(10, 16, 34, 0.55);
    border: 1px solid var(--panel-border);
    transition: transform 0.25s ease-out, box-shadow 0.4s ease, border-color 0.4s ease;
    transform-style: preserve-3d;
    overflow: hidden;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
    display: flex;
    flex-direction: column;
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 60px; height: 2px;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
}
.project-card::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 60px; height: 2px;
    background: var(--magenta);
    box-shadow: 0 0 10px var(--magenta);
}
.project-card:hover {
    border-color: var(--cyan);
    box-shadow: 0 20px 60px rgba(0, 240, 255, 0.15), 0 0 30px rgba(0, 240, 255, 0.2);
}
.project-card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}
.project-card .tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.tech-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 4px 10px;
    background: rgba(0, 255, 157, 0.08);
    border: 1px solid rgba(0, 255, 157, 0.4);
    color: var(--lime);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.project-card .section-content {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 18px;
    flex: 1;
}
.project-link { margin-top: auto; }
.github-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: transparent;
    border: 1px solid var(--cyan);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.25s ease;
}
.github-link img {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(82%) sepia(63%) saturate(3266%) hue-rotate(139deg) brightness(100%) contrast(101%);
}
.github-link:hover {
    background: var(--cyan);
    color: var(--bg);
    box-shadow: var(--glow-cyan);
}
.github-link:hover img {
    filter: brightness(0);
}

.carousel-nav {
    width: 44px; height: 44px;
    background: var(--panel-solid);
    border: 1px solid var(--panel-border);
    color: var(--cyan);
    font-family: var(--font-display);
    font-size: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}
.carousel-nav:hover {
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
    background: rgba(0, 240, 255, 0.1);
}

/* ---------- FOOTER ---------- */
.footer {
    max-width: var(--max-w);
    margin: 60px auto 40px;
    padding: 40px 40px;
    position: relative;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}
.footer-section h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}
.footer-section p {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.8;
}
.social-links {
    display: flex;
    gap: 14px;
}
.social-links a {
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid var(--panel-border);
    transition: all 0.25s ease;
}
.social-links a:hover {
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
    transform: translateY(-3px);
}
.social-links img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

/* ---------- SCROLL REVEAL ---------- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 960px) {
    .profile-container { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 30px; }
    .header-content .subtitle { padding-left: 0; }
    .header-content .subtitle::before { display: none; }
    .highlights { justify-content: center; }
    .about-grid { grid-template-columns: 1fr; }
    .about-right { align-items: center; }
    .profile-frame { max-width: 280px; }
    .about-stats { flex-direction: row; }
    .stat-card { flex: 1; }
    .footer-content { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 768px) {
    .docs-wrapper .skills-grid,
    .docs-wrapper .project-grid {
        grid-template-columns: 1fr;
    }
    .docs-wrapper .about-grid { grid-template-columns: 1fr; }
    .docs-wrapper .about-stats { flex-direction: row; }
    .docs-wrapper .stat-card { flex: 1; }
    .docs-wrapper .section { padding: 28px 18px; margin-bottom: 40px; }
    .docs-wrapper .section-title { font-size: 1.1rem; letter-spacing: 0.12em; }
    .docs-wrapper .header { margin: 80px 12px 24px; padding: 32px 20px; }
    .docs-wrapper .profile-container { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 20px; }
    .docs-wrapper .header-content .subtitle { padding-left: 0; }
    .docs-wrapper .header-content .subtitle::before { display: none; }
    .docs-wrapper .highlights { justify-content: center; }
    .docs-wrapper .footer-content { grid-template-columns: 1fr; gap: 20px; text-align: center; }
    .docs-wrapper .footer { margin: 30px 12px 20px; padding: 28px 18px; }
    .docs-wrapper .social-links { justify-content: center; }
    .docs-wrapper .experience-timeline,
    .docs-wrapper .education-timeline { padding-left: 24px; }
    .docs-wrapper .experience-card,
    .docs-wrapper .education-card { padding: 18px 16px; }
    .docs-wrapper .hud-bar .meta { display: none; }
    .docs-wrapper .minimap { display: none; }
    .docs-wrapper .highlight-badge { font-size: 9px; padding: 5px 10px; }
    .docs-wrapper .project-card { clip-path: none; }
    body.docs-mode .docs-scanline { display: none; }
}
@media (max-width: 640px) {
    .header { margin: 90px 12px 30px; padding: 40px 24px; }
    .section { padding: 32px 22px; }
    .section-title { font-size: 1.2rem; }
    .profile-image { width: 150px; height: 150px; }
    .about-stats { flex-direction: column; }
    .hud-bar { padding: 0 14px; font-size: 9px; letter-spacing: 0.1em; }
    .hud-bar .left, .hud-bar .right { gap: 10px; }
    .theme-switch { top: 44px; right: 12px; }
    .footer { margin: 40px 12px 30px; padding: 30px 24px; }
    .docs-wrapper .header-content h1.gradient-text { font-size: 1.8rem; }
    .docs-wrapper .stat-number { font-size: 1.8rem; }
}
@media (max-width: 480px) {
    .docs-wrapper .hud-bar { height: 30px; font-size: 8px; padding: 0 10px; }
    .docs-wrapper .theme-switch { top: 36px; right: 8px; }
    .docs-wrapper .theme-toggle-btn { width: 34px; height: 34px; font-size: 12px; }
    .docs-wrapper .section { padding: 22px 14px; }
    .docs-wrapper .highlight-item { padding: 8px 10px; }
    .docs-wrapper .about-stats { flex-direction: column; }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .docs-scanline,
    .docs-wrapper::before,
    .skill-bar::after { animation: none !important; }
    .docs-wrapper .section,
    .docs-wrapper .project-card,
    .docs-wrapper .experience-card,
    .docs-wrapper .education-card { transform: none !important; }
}

/* ---------- LIGHT MODE ---------- */
html[data-theme="light"] {
    --bg:            #f7f8fc;
    --bg-2:          #edf0f7;
    --panel:         rgba(255, 255, 255, 0.92);
    --panel-solid:   rgba(255, 255, 255, 0.97);
    --panel-border:  rgba(0, 100, 180, 0.15);
    --panel-border-strong: rgba(0, 100, 180, 0.35);
    --text:          #1a1f36;
    --muted:         #4a5568;
    --dim:           #718096;
    --cyan:          #0077aa;
    --cyan-dim:      #005580;
    --magenta:       #c5286e;
    --lime:          #059669;
    --amber:         #d97706;
    --glow-cyan:     0 0 8px rgba(0, 119, 170, 0.12);
    --glow-magenta:  0 0 8px rgba(197, 40, 110, 0.12);
}
html[data-theme="light"] body {
    background: #f7f8fc;
}
html[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse at 30% 0%, rgba(0, 119, 170, 0.05), transparent 50%),
        radial-gradient(ellipse at 70% 100%, rgba(197, 40, 110, 0.03), transparent 50%);
}
html[data-theme="light"] .about-quote::before { background: var(--bg); }

/* Light panels — solid white, subtle shadow, no blur */
html[data-theme="light"] .section,
html[data-theme="light"] .glass-effect,
html[data-theme="light"] .panel {
    background: #ffffff;
    border-color: rgba(0, 100, 180, 0.12);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
}
html[data-theme="light"] .section:hover,
html[data-theme="light"] .glass-effect:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.03);
}
html[data-theme="light"] .section::before,
html[data-theme="light"] .section::after,
html[data-theme="light"] .glass-effect::before,
html[data-theme="light"] .glass-effect::after {
    border-color: var(--cyan);
    opacity: 0.35;
}

/* Light cards */
html[data-theme="light"] .experience-card,
html[data-theme="light"] .education-card,
html[data-theme="light"] .skill-category,
html[data-theme="light"] .project-card {
    background: #ffffff;
    border-color: rgba(0, 100, 180, 0.1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
html[data-theme="light"] .stat-card {
    background: rgba(0, 119, 170, 0.04);
    border-color: rgba(0, 100, 180, 0.1);
}
html[data-theme="light"] .highlight-item {
    background: rgba(0, 119, 170, 0.03);
}
html[data-theme="light"] .highlight-badge {
    background: rgba(0, 119, 170, 0.06);
    border-color: rgba(0, 119, 170, 0.2);
    color: #005580;
}

/* Light HUD bar */
html[data-theme="light"] .hud-bar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: rgba(0, 100, 180, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
html[data-theme="light"] .hud-bar .brand { text-shadow: none; }
html[data-theme="light"] .footer {
    background: #ffffff;
    border-color: rgba(0, 100, 180, 0.1);
}

/* Light images */
html[data-theme="light"] .github-link img {
    filter: brightness(0) saturate(100%) invert(25%);
}
html[data-theme="light"] .social-links img {
    filter: none;
}

/* Light profile image */
html[data-theme="light"] .profile-image {
    border-color: var(--cyan);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Light docs-wrapper — clean white background */
html[data-theme="light"] .docs-wrapper {
    background: #f7f8fc;
}
html[data-theme="light"] .docs-wrapper::before {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(0, 119, 170, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(197, 40, 110, 0.02) 0%, transparent 50%);
}
html[data-theme="light"] .docs-wrapper::after { display: none; }

/* Light docs section title */
html[data-theme="light"] .docs-wrapper .section-title {
    color: var(--text);
}
html[data-theme="light"] .docs-wrapper .section-title::after {
    background: var(--cyan);
}

/* Light docs panels */
html[data-theme="light"] body.docs-mode .section,
html[data-theme="light"] body.docs-mode .glass-effect,
html[data-theme="light"] body.docs-mode .footer {
    background: #ffffff;
    border-color: rgba(0, 100, 180, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* Light docs cards */
html[data-theme="light"] body.docs-mode .experience-card,
html[data-theme="light"] body.docs-mode .education-card {
    background: #fafbfe;
    border-color: rgba(0, 100, 180, 0.08);
}
html[data-theme="light"] body.docs-mode .experience-card::before,
html[data-theme="light"] body.docs-mode .education-card::before {
    background: #ffffff;
    border-color: var(--cyan);
}
html[data-theme="light"] body.docs-mode .exp-year,
html[data-theme="light"] body.docs-mode .edu-year {
    color: var(--cyan);
}
html[data-theme="light"] body.docs-mode .project-card {
    background: #fafbfe;
    border-color: rgba(0, 100, 180, 0.08);
}
html[data-theme="light"] body.docs-mode .stat-card {
    background: rgba(0, 119, 170, 0.03);
}

/* Light skill bars */
html[data-theme="light"] .skill-bar {
    background: rgba(0, 119, 170, 0.06);
    border-color: rgba(0, 100, 180, 0.08);
}
html[data-theme="light"] .skill-bar::after {
    box-shadow: none;
}
html[data-theme="light"] .skill-tag {
    background: rgba(197, 40, 110, 0.05);
    border-color: rgba(197, 40, 110, 0.18);
    color: #c5286e;
}
html[data-theme="light"] .tech-badge {
    background: rgba(5, 150, 105, 0.05);
    border-color: rgba(5, 150, 105, 0.2);
    color: #059669;
}

/* Light profile frame */
html[data-theme="light"] .profile-frame {
    background: #ffffff;
    border-color: var(--cyan);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
html[data-theme="light"] .profile-img {
    filter: saturate(0.9) brightness(1) contrast(1.02);
    mix-blend-mode: normal;
}
html[data-theme="light"] .profile-scanline {
    background: linear-gradient(90deg, transparent, rgba(0, 119, 170, 0.3), transparent);
    box-shadow: 0 0 6px rgba(0, 119, 170, 0.15);
}
html[data-theme="light"] .profile-tag { color: var(--muted); }
html[data-theme="light"] .profile-status { color: var(--lime); }
html[data-theme="light"] .status-dot {
    background: var(--lime);
    box-shadow: 0 0 4px var(--lime);
}

/* Light gradient text */
html[data-theme="light"] .gradient-text {
    background: linear-gradient(110deg, #005580 0%, #1a1f36 40%, #c5286e 70%, #005580 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    filter: none;
}

/* Light theme toggle */
html[data-theme="light"] .theme-toggle-btn {
    background: #ffffff;
    border-color: rgba(0, 100, 180, 0.15);
    color: var(--cyan);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
html[data-theme="light"] .theme-toggle-btn::before {
    border-color: rgba(0, 100, 180, 0.1);
}

/* ==========================================================
   3D GAME MODE — INTRO, HUD, OVERLAYS, LABELS
   ========================================================== */

/* --- DOCS-MODE TOGGLE --- */
/* In game mode (default on desktop), hide the docs-wrapper */
.docs-wrapper { display: none; }
/* When body gets docs-mode (mobile / reduced-motion / skip), show docs, hide game UI */
body.docs-mode .docs-wrapper { display: block; }
body.docs-mode .intro-screen,
body.docs-mode .game-hud,
body.docs-mode .dock-prompt,
body.docs-mode #labels,
body.docs-mode .station-overlay { display: none !important; }
body.docs-mode #bg-canvas { display: none; }
body.docs-mode #docs-bg-canvas { display: none; }

/* ============================================================
   DOCS MODE — CLEAN MODERN TEMPLATE
   ============================================================ */

/* --- Clean background — no heavy starfield, minimal decoration --- */
body.docs-mode .docs-wrapper {
    position: relative;
    background: var(--bg);
    min-height: 100vh;
}
/* Subtle gradient accent — lightweight */
body.docs-mode .docs-wrapper::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(0, 240, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(255, 61, 240, 0.04) 0%, transparent 50%);
}
body.docs-mode .docs-wrapper::after { display: none; }

/* Hide scanline in docs */
.docs-scanline { display: none; }

/* --- Clean panels — NO backdrop-filter for performance --- */
body.docs-mode .section,
body.docs-mode .glass-effect,
body.docs-mode .footer {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    position: relative;
    overflow: visible;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body.docs-mode .section:hover,
body.docs-mode .glass-effect:hover {
    border-color: var(--panel-border-strong);
    box-shadow: 0 4px 24px rgba(0, 240, 255, 0.06);
}
body.docs-mode .hud-bar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
/* Corner brackets */
body.docs-mode .section::before,
body.docs-mode .glass-effect::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 16px; height: 16px;
    border: 1.5px solid var(--cyan);
    border-right: none; border-bottom: none;
    border-radius: 2px 0 0 0;
    pointer-events: none;
    z-index: 1;
}
body.docs-mode .section::after,
body.docs-mode .glass-effect::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px;
    width: 16px; height: 16px;
    border: 1.5px solid var(--cyan);
    border-left: none; border-top: none;
    border-radius: 0 0 2px 0;
    pointer-events: none;
    z-index: 1;
}

/* --- Section title — clean with accent --- */
body.docs-mode .section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 28px;
    padding-bottom: 14px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1;
}
body.docs-mode .section-title::before {
    content: '//';
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--cyan);
    font-weight: 600;
}
body.docs-mode .section-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 60px;
    height: 2px;
    background: var(--cyan);
    z-index: 1;
}

/* --- Timeline cards --- */
body.docs-mode .experience-timeline,
body.docs-mode .education-timeline {
    position: relative;
    padding-left: 32px;
}
body.docs-mode .experience-timeline::before,
body.docs-mode .education-timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--cyan), var(--magenta) 70%, transparent 100%);
    opacity: 0.3;
}
body.docs-mode .experience-card,
body.docs-mode .education-card {
    background: rgba(0, 240, 255, 0.02);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 22px 24px;
    margin-bottom: 20px;
    position: relative;
    transition: border-color 0.25s ease, transform 0.25s ease;
}
body.docs-mode .experience-card::before,
body.docs-mode .education-card::before {
    content: '';
    position: absolute;
    left: -29px; top: 24px;
    width: 10px; height: 10px;
    background: var(--bg);
    border: 2px solid var(--cyan);
    border-radius: 50%;
    z-index: 1;
}
body.docs-mode .experience-card:hover,
body.docs-mode .education-card:hover {
    border-color: var(--cyan);
    transform: translateX(4px);
}
body.docs-mode .exp-year,
body.docs-mode .edu-year {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 6px;
    font-weight: 600;
}

/* --- Skill bars --- */
body.docs-mode .skill-bar {
    height: 6px;
    background: rgba(0, 240, 255, 0.06);
    border: 1px solid rgba(0, 240, 255, 0.08);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}
body.docs-mode .skill-bar::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
body.docs-mode .skill-bar.animated::after {
    width: var(--level, 0%);
}

/* --- Project cards --- */
body.docs-mode .project-card {
    background: rgba(0, 240, 255, 0.02);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
body.docs-mode .project-card:hover {
    border-color: var(--cyan);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.08);
}

/* --- Stat cards --- */
body.docs-mode .stat-card {
    background: rgba(0, 240, 255, 0.03);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
}
body.docs-mode .stat-card:hover {
    border-color: var(--cyan);
    box-shadow: 0 4px 16px rgba(0, 240, 255, 0.1);
}

/* Section spacing */
body.docs-mode .section + .section {
    margin-top: 0;
}

/* --- INTRO SCREEN --- */
.intro-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(3,5,16,0.92) 0%, #030510 100%);
    backdrop-filter: blur(6px);
}
.intro-screen.hidden { display: none; }
.intro-inner {
    text-align: center;
    max-width: 520px;
    padding: 40px;
}
.intro-globe {
    display: block;
    margin: 0 auto 16px;
    width: 120px;
    height: 120px;
}
.intro-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.intro-sub {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.3em;
    margin-bottom: 24px;
}
.intro-desc {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 28px;
}
.intro-controls {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 24px;
    text-align: left;
    margin-bottom: 32px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.08em;
}
.ctrl-row kbd {
    display: inline-block;
    min-width: 50px;
    padding: 2px 8px;
    margin-right: 6px;
    background: rgba(0,240,255,0.08);
    border: 1px solid rgba(0,240,255,0.3);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-align: center;
}
.intro-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}
.btn-mission {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    padding: 14px 36px;
    background: var(--cyan);
    color: var(--bg);
    border: none;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    transition: all 0.25s;
}
.btn-mission:hover {
    background: #fff;
    box-shadow: 0 0 30px rgba(0,240,255,0.6);
}
.btn-skip {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    padding: 14px 24px;
    background: transparent;
    color: var(--muted);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.25s;
}
.btn-skip:hover {
    color: var(--text);
    border-color: var(--text);
}

/* --- GAME HUD --- */
.game-hud {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    pointer-events: none;
    padding: 14px 20px;
}
.hud-top {
    display: flex;
    gap: 24px;
    justify-content: center;
}
.hud-block {
    background: rgba(3,5,16,0.7);
    border: 1px solid var(--panel-border);
    padding: 6px 16px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: var(--muted);
    backdrop-filter: blur(8px);
}
.hud-label {
    color: var(--cyan);
    margin-right: 8px;
    font-weight: 600;
}
.hud-val { color: var(--text); }
.hud-missions {
    position: fixed;
    bottom: 16px; left: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    color: var(--dim);
}
.hud-station {
    padding: 4px 10px;
    background: rgba(3,5,16,0.5);
    border-left: 2px solid var(--dim);
    transition: all 0.3s;
}
.hud-station.done {
    color: var(--lime);
    border-left-color: var(--lime);
}

/* --- DOCK PROMPT --- */
.dock-prompt {
    position: fixed;
    bottom: 120px;
    left: 50%; transform: translateX(-50%);
    z-index: 55;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--text);
    background: rgba(3,5,16,0.8);
    border: 1px solid var(--cyan);
    padding: 10px 24px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,240,255,0.3);
    animation: dock-pulse 1.5s ease-in-out infinite;
}
.dock-prompt kbd {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 4px;
    background: rgba(0,240,255,0.15);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    font-family: var(--font-mono);
}
.dock-prompt strong {
    color: var(--cyan);
    margin-left: 6px;
}
@keyframes dock-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0,240,255,0.3); }
    50% { box-shadow: 0 0 35px rgba(0,240,255,0.6); }
}

/* --- 3D LABELS (projected from world) --- */
#labels {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    overflow: hidden;
}
.station-label {
    position: absolute;
    top: 0; left: 0;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--muted);
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    transition: opacity 0.3s;
    text-shadow: 0 0 8px rgba(0,0,0,0.8);
}
.station-label .lbl-name {
    display: block;
    color: var(--c, var(--cyan));
    font-weight: 600;
    font-size: 0.65rem;
}
.station-label .lbl-dist {
    display: block;
    font-size: 0.55rem;
    opacity: 0.7;
}
.station-label.near .lbl-name {
    font-size: 0.8rem;
    text-shadow: 0 0 12px var(--c, var(--cyan));
}
.station-label.visited .lbl-name {
    color: var(--lime);
}

/* --- STATION OVERLAYS --- */
.station-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
}
.station-overlay.active {
    display: flex;
}
.overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3,5,16,0.75);
    backdrop-filter: blur(6px);
}
.overlay-panel {
    position: relative;
    z-index: 1;
    max-width: 700px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--panel-solid);
    border: 1px solid var(--panel-border);
    padding: 40px;
}
.overlay-panel--wide {
    max-width: 960px;
}
.overlay-close {
    position: absolute;
    top: 10px; right: 12px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 2rem;
    line-height: 1;
    transition: color 0.2s;
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
}
.overlay-close:hover, .overlay-close:active { color: var(--cyan); }
.overlay-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--c, var(--cyan));
    text-transform: uppercase;
    margin-bottom: 28px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0,240,255,0.2);
    text-shadow: 0 0 16px var(--c, var(--cyan));
}
.overlay-body {
    color: var(--text);
}

/* When overlay is open, dim HUD */
body.overlay-open .game-hud { opacity: 0.2; }

/* Custom scrollbar for overlay panels */
.overlay-panel::-webkit-scrollbar { width: 4px; }
.overlay-panel::-webkit-scrollbar-track { background: transparent; }
.overlay-panel::-webkit-scrollbar-thumb { background: var(--cyan); }

/* --- OVERLAY OPENING ANIMATION --- */
.station-overlay.active .overlay-panel {
    animation: panel-materialize 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes panel-materialize {
    0% { opacity: 0; transform: scale(0.92) translateY(20px); filter: blur(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

/* Holographic scan line on overlay panels */
.overlay-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    animation: holo-scan 3s ease-in-out infinite;
    z-index: 10;
}
@keyframes holo-scan {
    0%   { top: 0; opacity: 0.7; }
    50%  { top: 100%; opacity: 0.3; }
    100% { top: 0; opacity: 0.7; }
}

/* --- TRANSMISSION / LOADING SPINNER --- */
.overlay-panel.transmitting::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    background: var(--panel-solid);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--cyan);
    z-index: 20;
    animation: transmission-pulse 0.6s ease-in-out infinite alternate;
}
.overlay-panel.transmitting::before {
    content: 'RECEIVING TRANSMISSION...';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.35em;
    color: var(--cyan);
    z-index: 25;
    text-shadow: 0 0 12px var(--cyan);
    animation: blink-cursor 0.5s step-end infinite;
}
@keyframes transmission-pulse {
    0%   { background: rgba(10, 16, 34, 0.98); }
    100% { background: rgba(0, 30, 50, 0.95); }
}
/* Hide body during transmission, smooth reveal after */
.overlay-panel.transmitting .overlay-body {
    display: none;
}
.overlay-body {
    transition: opacity 0.5s ease;
}

/* --- TYPEWRITER CURSOR on overlay titles --- */
.overlay-title::after {
    content: '_';
    color: var(--c, var(--cyan));
    animation: blink-cursor 0.8s step-end infinite;
    margin-left: 4px;
}
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- LOADING RING on intro screen --- */

/* --- SIGNAL BARS on HUD --- */
.hud-block::before {
    content: '';
    display: inline-block;
    width: 3px; height: 8px;
    background: var(--cyan);
    margin-right: 6px;
    vertical-align: middle;
    opacity: 0.6;
    animation: signal-pulse 2s ease-in-out infinite;
}
@keyframes signal-pulse {
    0%, 100% { opacity: 0.3; height: 4px; }
    50% { opacity: 1; height: 10px; }
}

/* --- MINIMAP --- */
.minimap {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 1px solid rgba(0,240,255,0.25);
    pointer-events: none;
}

/* --- COMPASS HUD --- */
.hud-compass-block {
    border-color: rgba(0,240,255,0.35);
}

/* (old heavy docs-mode enhancements removed for performance) */

/* --- Clean reveal in docs mode (no blur filter) --- */
body.docs-mode .reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================
   MOBILE TOUCH CONTROLS
   ========================================================== */
#touch-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 190;
    overflow: hidden;
}

/* --- Joystick (left side) --- */
.tc-joystick-zone {
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    touch-action: none;
}
.tc-joystick-base {
    position: absolute;
    left: 24px;
    bottom: 24px;
    width: 120px;
    height: 120px;
    border: 2px solid rgba(0, 240, 255, 0.4);
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
}
.tc-joystick-knob {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.3);
    border: 2px solid rgba(0, 240, 255, 0.7);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
    will-change: transform;
}

/* --- Round action buttons (right side) --- */
.tc-buttons-right {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
    touch-action: none;
}
.tc-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.tc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
    background: rgba(0, 240, 255, 0.1);
    border: 2px solid rgba(0, 240, 255, 0.45);
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    padding: 0;
}
.tc-btn svg {
    display: block;
}
.tc-btn:active {
    transform: scale(0.9);
}

/* Thrust — large round arrow-up */
.tc-thrust {
    width: 68px;
    height: 68px;
    background: rgba(0, 240, 255, 0.14);
    border-color: rgba(0, 240, 255, 0.6);
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
}
.tc-thrust:active {
    background: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 28px rgba(0, 240, 255, 0.6);
}

/* Brake — round stop icon */
.tc-brake {
    width: 56px;
    height: 56px;
    background: rgba(255, 61, 240, 0.1);
    border-color: rgba(255, 61, 240, 0.45);
    color: var(--magenta);
    box-shadow: 0 0 12px rgba(255, 61, 240, 0.15);
}
.tc-brake:active {
    background: rgba(255, 61, 240, 0.35);
    box-shadow: 0 0 24px rgba(255, 61, 240, 0.5);
}

/* View (dock) — round eye icon */
.tc-dock {
    width: 56px;
    height: 56px;
    background: rgba(0, 255, 157, 0.1);
    border-color: rgba(0, 255, 157, 0.45);
    color: var(--lime);
    box-shadow: 0 0 12px rgba(0, 255, 157, 0.15);
}
.tc-dock:active {
    background: rgba(0, 255, 157, 0.35);
    box-shadow: 0 0 24px rgba(0, 255, 157, 0.5);
}

/* Auto Pilot — top left pill button */
.tc-auto {
    position: absolute;
    top: 50px;
    left: 16px;
    border-radius: 20px;
    width: auto;
    height: auto;
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(157, 77, 255, 0.1);
    border-color: rgba(157, 77, 255, 0.4);
    color: #9d4dff;
    box-shadow: 0 0 10px rgba(157, 77, 255, 0.15);
}
.tc-auto:active {
    background: rgba(157, 77, 255, 0.3);
    box-shadow: 0 0 20px rgba(157, 77, 255, 0.5);
}

/* Hide touch controls in docs mode, overlay open, and non-touch */
body.docs-mode #touch-controls { display: none !important; }
body.overlay-open #touch-controls { display: none !important; }
body:not(.is-touch) #touch-controls { display: none !important; }

/* Desktop/mobile toggle for intro controls */
.mobile-only { display: none; }
.desktop-only { display: inline-grid; }
body.is-touch .mobile-only { display: block; }
body.is-touch .desktop-only { display: none !important; }
.intro-mobile-hint {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    margin-bottom: 16px;
    opacity: 0.8;
}

/* Mobile game: compact HUD */
@media (max-width: 900px) and (hover: none) {
    .game-hud .hud-top { font-size: 9px; padding: 4px 8px; gap: 8px; }
    .game-hud .hud-missions { display: none; }
    .game-hud .minimap { width: 80px; height: 80px; bottom: auto; top: 8px; right: 8px; }
    .game-hud .hud-block { padding: 2px 6px; }
    /* Intro screen compact for mobile */
    .intro-inner { padding: 20px; max-width: 100%; }
    .intro-title { font-size: 1.6rem; }
    .intro-sub { font-size: 0.65rem; margin-bottom: 12px; }
    .intro-desc { font-size: 0.85rem; margin-bottom: 16px; }
    .intro-globe { width: 80px; height: 80px; }
    .btn-mission, .btn-skip { padding: 10px 20px; font-size: 0.75rem; }
}

/* --- Rotate-phone alert box --- */
#rotate-prompt {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(3, 5, 16, 0.95);
    border: 1.5px solid var(--cyan);
    border-radius: 12px;
    padding: 28px 36px;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--cyan);
    font-family: var(--font-mono);
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.2), 0 20px 60px rgba(0, 0, 0, 0.6);
    max-width: 280px;
}
#rotate-prompt .rotate-icon {
    width: 40px;
    height: 60px;
    border: 2px solid var(--cyan);
    border-radius: 8px;
    position: relative;
    animation: rotate-nudge 2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}
#rotate-prompt .rotate-icon::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 3px;
    background: var(--cyan);
    border-radius: 2px;
}
@keyframes rotate-nudge {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}
#rotate-prompt .rotate-text {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.6;
}
#rotate-prompt .rotate-sub {
    font-size: 0.55rem;
    color: var(--muted);
    letter-spacing: 0.08em;
}
body.docs-mode #rotate-prompt { display: none !important; }

