/* =========================================================================
   THEME VARIABLES (Cyber-Emerald & Dark-Slate)
   ========================================================================= */
:root {
    --bg-base: #060910;
    --bg-panel: rgba(13, 19, 31, 0.4);
    --bg-panel-hover: rgba(18, 26, 43, 0.6);
    --border-dim: rgba(255, 255, 255, 0.15);
    --border-lit: rgba(255, 255, 255, 0.4);
    
    --primary-color: #10b981; /* Emerald/Neon Green */
    --primary-glow: transparent;
    --secondary-color: #3b82f6; /* Minimal blue for accents if needed */
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 16px;
}

/* =========================================================================
   LIGHT THEME OVERRIDES
   ========================================================================= */
body.light-theme {
    --primary-color: #059669; /* Darker, more saturated Emerald for light theme contrast */
    --bg-panel: rgba(255, 255, 255, 0.4); /* Reduced opacity for better transparency */
    --bg-panel-hover: rgba(255, 255, 255, 0.6);
    --border-dim: rgba(0, 0, 0, 0.2);
    --border-lit: rgba(0, 0, 0, 0.5);
    
    --text-main: #1e293b;
    --text-muted: #334155;
    
    --primary-glow: transparent;
}

body.light-theme .bg-fx {
    background-image: url('./assets/backgroud_light.png');
    opacity: 1;
}

body.light-theme .bg-fx::after {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.3));
}

body.light-theme .discord-widget {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--border-dim);
}

body.light-theme .discord-username {
    color: var(--text-main);
}

body.light-theme .discord-act-main {
    color: var(--text-muted);
}

body.light-theme .discord-status-dot {
    border-color: #ffffff;
}

body.light-theme .ip-copy-container {
    background: rgba(255, 255, 255, 0.3);
}

body.light-theme .code-header {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .token.key { color: #2563eb; }
body.light-theme .token.value { color: #475569; }

/* =========================================================================
   TOP RIGHT CONTROLS
   ========================================================================= */
.top-right-controls {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.75rem;
    z-index: 1000;
}

.control-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: transform 0.2s ease, background 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.control-btn:hover {
    background: var(--bg-panel-hover);
    border-color: var(--border-lit);
    transform: translateY(-2px);
    box-shadow: none;
}

.control-btn .lang-text {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
}

/* =========================================================================
   RESET & FOUNDATION
   ========================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }
*:focus, *:focus-visible { outline: none; box-shadow: none; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }

/* =========================================================================
   BACKGROUND FX
   ========================================================================= */
.bg-fx {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background-color: var(--bg-base);
    background-image: url('./assets/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.85; /* Slight dimming so text remains readable */
}

/* Add an overlay to ensure contrast */
.bg-fx::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(6, 9, 16, 0.4), rgba(6, 9, 16, 0.8));
    z-index: 1;
}

/* Glass Card Utilities */
.glass-card {
    background: var(--bg-panel);
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border-dim);
    border-radius: var(--border-radius);
    padding: 2rem;
}

.glass-card.padding-override {
    padding: 1.5rem;
}

.app-container {
    display: flex;
    justify-content: center;
    max-width: 1550px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding: 3rem 2rem;
    gap: 6rem;
}

/* SIDEBAR (Fixed/Sticky) */
.sidebar-wrapper {
    width: 330px;
    flex-shrink: 0;
    position: relative;
}

.profile-card {
    position: fixed; /* Cố định sidebar */
    top: 2rem;
    width: 330px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 1.25rem 1.25rem 0.75rem; /* Giảm padding bottom */
    z-index: 100;
}

/* Hide scrollbar on sidebar */
.profile-card::-webkit-scrollbar { display: none; }
.profile-card { -ms-overflow-style: none; scrollbar-width: none; }

/* MAIN CONTENT (Scrollable natively by body) */
.content-wrapper {
    flex: 1;
    max-width: 950px;
    display: flex;
    flex-direction: column;
    gap: 5rem;
    padding-bottom: 4rem;
}

/* =========================================================================
   SIDEBAR PROFILE ELEMENTS
   ========================================================================= */
.avatar-container {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.avatar {
    display: block;
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    min-width: 80px;
    min-height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-lit);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.status-badge {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--primary-color);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 3;
    white-space: nowrap;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.status-dot {
    width: 5px;
    height: 5px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

.name {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    letter-spacing: -0.5px;
}

.role {
    font-size: 0.7rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 0.75rem;
}

.bio {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
    padding: 0 0.5rem;
}

/* Navigation Menu */
.nav-menu {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    border: 1px solid transparent;
}

.nav-link i {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link:active {
    transform: scale(0.95);
}

.nav-link.active {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-dim);
    box-shadow: none;
}

.nav-link.active i {
    color: var(--primary-color);
    text-shadow: none;
}

/* Social Links */
.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.social-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Discord Lanyard Widget */
.discord-widget {
    width: 100%;
    padding: 0.5rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    background: #080b0e;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    text-align: left;
    transition: var(--transition);
    height: auto;
    min-height: 50px;
}

.discord-widget:hover {
    border-color: rgba(88, 101, 242, 0.3);
    transform: translateY(-2px);
    box-shadow: none;
}

.discord-avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.discord-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.discord-decoration {
    width: 48px;
    height: 48px;
    position: absolute;
    z-index: 2;
    pointer-events: none;
    display: none;
}

.discord-status-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid #080b0e;
    background-color: #747f8d; /* offline */
    z-index: 3;
}

.discord-status-dot.online { background-color: #3ba55c; }
.discord-status-dot.idle { background-color: #faa61a; }
.discord-status-dot.dnd { background-color: #ed4245; }

/* Status Bubble styling (Like the image) */
.discord-status-bubble {
    position: absolute;
    top: -15px;
    left: 45px;
    background: var(--bg-panel);
    border: 1.5px solid var(--border-lit);
    padding: 6px 14px;
    border-radius: 18px 18px 18px 2px;
    font-size: 0.7rem;
    color: var(--text-main);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5);
    transform-origin: bottom left;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: pre-wrap;
    width: max-content;
    max-width: 160px;
    line-height: 1.4;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    font-weight: 500;
}

.discord-status-bubble.show {
    opacity: 1;
    transform: scale(1);
}

.discord-avatar-container {
    cursor: pointer;
}

.discord-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 2px;
}

.discord-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
}

.discord-username {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discord-discriminator {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.discord-badges-list {
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
}

.discord-badges-list img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.discord-badges-list i {
    color: #5865F2;
    font-size: 0.8rem;
}

.discord-activity {
    display: flex;
    gap: 6px;
    align-items: center;
    overflow: hidden;
}

.discord-act-main {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discord-act-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discord-act-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: none;
    object-fit: cover;
    margin-left: auto;
    border: 2px solid var(--primary-color);
}

.social-btn:hover {
    color: var(--primary-color);
    border-color: var(--border-lit);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

/* =========================================================================
   CONTENT SECTIONS
   ========================================================================= */
/* Section Reveal Animations */
.section { 
    position: relative; 
    scroll-margin-top: 2rem; /* Thêm khoảng cách đệm khi cuộn */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.section.in-view {
    opacity: 1;
    transform: translateY(0);
}

.section-header {
    margin-bottom: 2rem;
}

.header-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.reload-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    color: var(--primary-color);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.reload-btn:hover {
    background: var(--bg-panel-hover);
    border-color: var(--border-lit);
    transform: translateY(-2px) rotate(180deg);
    box-shadow: none;
}

.reload-btn:active {
    transform: translateY(0) scale(0.95);
}

.reload-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.section-badge {
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.mt-2 { margin-top: 2rem; }

/* Abstract text blocks */
.lead-text {
    font-size: 1.15rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.sub-text {
    color: var(--text-muted);
}

.sub-text strong {
    color: var(--primary-color);
}

/* Window Code Style */
.code-panel { padding: 0; overflow: hidden; }

.code-header {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.window-controls { display: flex; gap: 6px; }
.ctrl { width: 12px; height: 12px; border-radius: 50%; }
.ctrl.close { background: #ff5f56; }
.ctrl.min { background: #ffbd2e; }
.ctrl.max { background: #27c93f; }

.filename {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.code-panel pre { padding: 1.5rem; overflow-x: auto; margin:0; }
.code-panel code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.8;
}

.token.key { color: #93c5fd; }
.token.value { color: #cbd5e1; }
.token.highlight { color: var(--primary-color); text-shadow: none; }

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.service-card {
    transition: var(--transition);
}

.service-card:hover {
    border-color: var(--border-lit);
    background: var(--bg-panel-hover);
    transform: translateY(-5px);
}

.service-icon {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1.25rem;
    filter: none;
}

.service-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Skills Grid */
.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skill-box-title {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
}
.skill-box-title i { color: var(--primary-color); }

.tech-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.tech-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.skill-bar-item { margin-bottom: 1.25rem; }
.skill-bar-item:last-child { margin-bottom: 0; }

.skill-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
}

.skill-label .pct { color: var(--primary-color); font-weight: 600; }

.skill-track {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    width: 0; /* Animated by JS */
    background: var(--primary-color);
    box-shadow: none;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Projects Table/List */
.project-list {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .project-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.project-item.hover-glow:hover {
    border-color: var(--primary-color);
    box-shadow: none;
    background: var(--bg-panel-hover);
    transform: translateY(-4px);
}

.project-main-flex {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.project-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--border-dim);
    flex-shrink: 0;
}

.project-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.project-title-row h3 {
    font-size: 1.15rem;
    color: var(--text-main);
}

.role-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-weight: 600;
}

.role-badge.warn {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
}

.role-badge.alert {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ip-copy-container {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-dim);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: auto;
}

.ip-copy-container:hover {
    border-color: var(--border-lit);
    background: rgba(255, 255, 255, 0.05);
}

.ip-copy-container.discord-link {
    cursor: pointer;
}

.ip-copy-container.discord-link:hover {
    border-color: #5865F2; /* Discord blue */
    background: rgba(88, 101, 242, 0.05);
}
.ip-copy-container.discord-link i { color: #5865F2; }

.ip-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.ip-copy-container i {
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: var(--transition);
}

.ip-copy-container:hover i {
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Toast Notification (Copied to Clipboard) */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    z-index: 9999;
    transform: translateY(150px) scale(0.9);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Marquee / Partners */
.marquee-wrapper {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    width: 100%;
}
.marquee-wrapper::before, .marquee-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    width: 50px;
    height: 100%;
    z-index: 2;
}
.marquee-wrapper::before { left: 0; background: linear-gradient(to right, var(--bg-panel), transparent); }
.marquee-wrapper::after { right: 0; background: linear-gradient(to left, var(--bg-panel), transparent); }

.marquee-content {
    display: inline-flex;
    align-items: center;
    gap: 3rem;
    animation: marquee 20s linear infinite;
}

.marquee-content img {
    height: 40px;
    opacity: 0.5;
    transition: var(--transition);
    filter: grayscale(100%);
}

.marquee-content img:hover {
    opacity: 1;
    filter: grayscale(0%);
}

.text-partner {
    font-family: var(--font-mono);
    font-weight: bold;
    color: var(--text-muted);
    font-size: 1.2rem;
}

@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* Footer */
.main-footer {
    text-align: center;
}

.footer-content {
    padding: 1.5rem;
}

.footer-brand {
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-weight: 600;
}

.footer-msg {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =========================================================================
   ANIMATIONS (Intersection Observer classes)
   ========================================================================= */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-up.in-view {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }

/* =========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================= */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 999;
    background: var(--bg-panel);
    border: 1px solid var(--border-lit);
    color: var(--primary-color);
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        padding: 4rem 1.5rem 2rem;
        gap: 2rem;
    }
    .sidebar-wrapper {
        width: 100%;
    }
    .profile-card {
        position: relative;
        top: 0;
    }
    .nav-menu {
        display: none; /* Hide nav on mobile natively */
    }
    .services-grid {
        grid-template-columns: 1fr;
    }
    .main-content {
        gap: 3.5rem;
    }
}


/* =========================================================================
   STATIC CLEANUP + MOBILE OVERFLOW FIXES
   ========================================================================= */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

body {
    width: 100%;
}

.top-right-controls {
    top: max(1rem, env(safe-area-inset-top));
    right: max(1rem, env(safe-area-inset-right));
}

.app-container,
.sidebar-wrapper,
.profile-card,
.content-wrapper,
.section,
.glass-card,
.discord-widget,
.nav-menu,
.nav-link,
.panel-content,
.code-panel,
.services-grid,
.skills-grid,
.project-list,
.project-item,
.project-main-flex,
.project-content {
    min-width: 0;
}

.profile-card {
    max-width: 100%;
}

.name,
.role,
.bio,
.lead-text,
.sub-text,
.section-title,
.project-title,
.project-desc,
.ip-text,
.discord-username,
.discord-act-main,
.discord-act-detail {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 1024px) {
    .app-container {
        width: 100%;
        max-width: 100%;
        padding: 5rem 1rem 2rem;
        gap: 1.5rem;
    }

    .sidebar-wrapper,
    .content-wrapper,
    .profile-card {
        width: 100%;
        max-width: 100%;
    }

    .profile-card {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        padding: 1.25rem 1rem 1rem;
    }

    .content-wrapper {
        gap: 2.5rem;
        padding-bottom: 2rem;
    }

    .glass-card {
        padding: 1.25rem;
    }

    .section-title {
        font-size: clamp(2rem, 9vw, 2.5rem);
        line-height: 1.1;
    }

    .lead-text {
        font-size: 1rem;
    }

    .sub-text,
    .project-desc,
    .service-card p,
    .bio {
        font-size: 0.95rem;
    }

    .bio {
        padding: 0;
    }

    .nav-menu {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .nav-link {
        justify-content: center;
        text-align: center;
        min-height: 48px;
        padding: 0.75rem 0.65rem;
        line-height: 1.35;
        white-space: normal;
    }

    .nav-link i {
        width: auto;
    }

    .discord-widget {
        padding: 0.75rem;
        gap: 0.65rem;
    }

    .discord-name-row,
    .discord-activity {
        min-width: 0;
    }

    .project-main-flex {
        gap: 0.9rem;
    }

    .ip-copy-container {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .top-right-controls {
        top: max(0.85rem, env(safe-area-inset-top));
        right: max(0.85rem, env(safe-area-inset-right));
    }

    .control-btn {
        width: 44px;
        height: 44px;
    }

    .app-container {
        padding: 4.75rem 0.75rem 1.5rem;
    }

    .sidebar-wrapper,
    .content-wrapper {
        width: 100%;
    }

    .profile-card {
        border-radius: 20px;
    }

    .name {
        font-size: clamp(2rem, 9.5vw, 2.7rem);
        line-height: 1.05;
    }

    .role {
        font-size: 0.72rem;
        letter-spacing: 1px;
    }

    .section-header {
        margin-bottom: 1.25rem;
    }

    .section-badge {
        font-size: 0.72rem;
        letter-spacing: 1.5px;
    }

    .code-header,
    .code-panel pre {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .code-panel pre {
        overflow-x: auto;
    }

    .project-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
}


@media (max-width: 768px) {
    .bg-fx {
        background-size: cover;
        background-position: center center;
    }

    .avatar-container {
        width: 96px;
        height: 96px;
        margin-bottom: 1.25rem;
    }

    .avatar {
        width: 84px;
        height: 84px;
        max-width: 84px;
        max-height: 84px;
        min-width: 84px;
        min-height: 84px;
    }

    .status-badge {
        bottom: -8px;
    }
}


/* ===== Mobile overflow fix + full original layout support ===== */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

body {
    width: 100%;
}

.app-container,
.sidebar-wrapper,
.profile-card,
.content-wrapper,
.section,
.glass-card,
.services-grid,
.skills-grid,
.project-list,
.project-item,
.project-main-flex,
.project-content,
.discord-widget,
.nav-menu,
.social-links,
.footer-content {
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

.avatar {
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    min-width: 80px;
    min-height: 80px;
    display: block;
    margin: 0 auto;
}

.profile-card {
    width: min(330px, 100%);
}

.content-wrapper {
    min-width: 0;
}

.project-main-flex,
.discord-widget,
.discord-info,
.discord-name-row,
.discord-activity,
.ip-copy-container,
.project-content,
.project-title-row {
    min-width: 0;
}

.ip-text,
.discord-username,
.discord-discriminator,
.discord-act-main,
.discord-act-detail,
.project-title,
.project-desc,
.bio,
.role,
.name,
.lead-text,
.sub-text {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 1024px) {
    .profile-card {
        position: relative;
        top: 0;
        width: 100%;
        max-width: 100%;
    }

    .content-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .app-container {
        width: 100%;
        max-width: 100%;
        padding-left: 0.8rem;
        padding-right: 0.8rem;
        gap: 1.5rem;
    }

    .sidebar-wrapper,
    .content-wrapper,
    .profile-card,
    .section,
    .glass-card,
    .footer-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .profile-card,
    .glass-card {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .avatar-container {
        width: 92px;
        height: 92px;
        margin-bottom: 1.15rem;
    }

    .avatar {
        width: 76px;
        height: 76px;
        max-width: 76px;
        max-height: 76px;
        min-width: 76px;
        min-height: 76px;
    }

    .status-badge {
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100vw - 4rem);
    }

    .name {
        font-size: clamp(1.9rem, 10vw, 2.7rem);
    }

    .role,
    .bio,
    .lead-text,
    .sub-text,
    .project-desc {
        max-width: 100%;
    }

    .nav-menu {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .nav-link {
        min-width: 0;
    }

    .social-links {
        justify-content: center;
        flex-wrap: wrap;
    }

    .discord-widget,
    .project-main-flex {
        overflow: hidden;
    }

    .code-panel pre {
        white-space: pre-wrap;
        word-break: break-word;
        overflow-x: hidden;
    }
}
.hidden-project {
    display: none !important;
}