/* =========================================================================
   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(16, 185, 129, 0.15);
    --border-lit: rgba(16, 185, 129, 0.4);
    
    --primary-color: #10b981; /* Emerald/Neon Green */
    --primary-glow: rgba(16, 185, 129, 0.35);
    --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(5, 150, 105, 0.2);
    --border-lit: rgba(5, 150, 105, 0.5);
    
    --text-main: #1e293b;
    --text-muted: #334155;
    
    --primary-glow: rgba(5, 150, 105, 0.2);
}

body.light-theme .bg-fx {
    background-image: url('../bg/backgroud_light.gif');
    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 LEFT CONTROLS
   ========================================================================= */
.top-left-controls {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    display: flex;
    gap: 0.75rem;
    z-index: 1000;
}

/* =========================================================================
   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: 0 4px 12px var(--primary-glow);
}

.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; }

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('../bg/background.gif');
    background-size: 100% 100%; /* Change from cover to 100% 100% to fit without excessive zooming */
    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;
}

/* UI Hidden State */
.profile-card,
.content-wrapper {
    transition: opacity 0.5s ease, transform 0.5s ease; /* Explicitly define only opacity and transform transitions */
    will-change: opacity, transform;
}

body.ui-hidden .profile-card,
body.ui-hidden .content-wrapper {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.98);
}

.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: 80px;
    height: 80px;
    margin: 0 auto 1rem;
}

.avatar-glow {
    position: absolute;
    inset: -8px;
    background: var(--primary-color);
    border-radius: 50%;
    filter: blur(15px);
    opacity: 0.3;
    animation: pulse 3s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 0.2; transform: scale(0.95); }
    100% { opacity: 0.5; transform: scale(1.05); }
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-lit);
    position: relative;
    z-index: 2;
}

.status-badge {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 185, 129, 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%;
    box-shadow: 0 0 8px var(--primary-color);
}

.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(16, 185, 129, 0.05);
}

.nav-link:active {
    transform: scale(0.95);
}

.nav-link.active {
    color: var(--primary-color);
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--border-dim);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.05);
}

.nav-link.active i {
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
    animation: bounce-small 2s infinite;
}

@keyframes bounce-small {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* 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: 0 8px 24px rgba(88, 101, 242, 0.05);
}

.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.4), 0 0 10px var(--primary-glow);
    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(16, 185, 129, 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: 0 4px 12px var(--primary-glow);
}

.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: 0 0 5px var(--primary-glow); }

/* 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: drop-shadow(0 0 8px var(--primary-glow));
}

.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: 0 0 10px var(--primary-color);
    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: 0 0 20px rgba(16, 185, 129, 0.15);
    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(16, 185, 129, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(16, 185, 129, 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(16, 185, 129, 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.5), 0 0 15px var(--primary-glow);
    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%); } }

/* =========================================================================
   BOTTOM METRICS & VIEWS BADGE
   ========================================================================= */
.bottom-metrics {
    margin-top: 1.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.view-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: var(--transition);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.view-badge i {
    font-size: 0.8rem;
    color: var(--text-main);
}

.view-badge:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    color: var(--text-main);
}

.music-btn {
    cursor: pointer;
    padding: 0.4rem 0.8rem;
}

.music-btn.playing i {
    animation: spin 3s linear infinite;
    color: var(--primary-color);
}

/* =========================================================================
   MUSIC PLAYER PANEL
   ========================================================================= */
.floating-music-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 1px solid var(--border-lit);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 101;
    backdrop-filter: blur(12px);
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.floating-music-btn:hover {
    background: var(--bg-panel-hover);
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.floating-music-btn.playing i {
    animation: spin 3s linear infinite;
    color: var(--primary-color);
}

/* =========================================================================
   FLOATING VIEW COUNTER
   ========================================================================= */
.floating-view-badge {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-lit);
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1.25rem;
    backdrop-filter: blur(12px);
    transition: var(--transition);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 101;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.floating-view-badge i {
    font-size: 0.9rem;
    color: var(--primary-color);
    filter: drop-shadow(0 0 5px var(--primary-glow));
}

.floating-view-badge:hover {
    background: var(--bg-panel-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.music-content {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    z-index: 100;
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 260px;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.music-content.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.music-cover {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.music-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.music-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.ctrl-btn:hover {
    color: var(--primary-color);
    background: rgba(255,255,255,0.05);
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.volume-slider-container i {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.volume-slider-container input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none;
}

.volume-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments for music player && view counter */
@media (max-width: 768px) {
    .floating-music-btn {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
    .floating-view-badge {
        bottom: 1rem;
        left: 1rem;
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
    .music-content {
        bottom: 4.5rem;
        right: 1rem;
        width: calc(100% - 2rem);
        max-width: 300px;
        transform: translateY(20px) scale(0.95);
    }
    .music-content.active {
        transform: translateY(0) scale(1);
    }
}

/* =========================================================================
   SMALL CAPS TOOL
   ========================================================================= */
.tool-shell {
    padding: 1.5rem;
    background: linear-gradient(180deg, rgba(16, 22, 34, 0.82), rgba(10, 15, 24, 0.76));
    border: 1px solid rgba(34, 197, 94, 0.18);
}

.tool-section {
    max-width: 980px;
    margin: 0 auto 4rem;
    padding: 0 2rem;
}

.tool-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.2rem;
}

.tool-kicker {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 0.35rem;
}

.tool-subtitle {
    color: var(--text-muted);
    max-width: 58ch;
}

.tool-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.tool-chips span {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(34, 197, 94, 0.14);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
}

.tool-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1rem;
}

.tool-column {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(34, 197, 94, 0.12);
    border-radius: 18px;
    padding: 1rem;
}

.tool-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.tool-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.tool-field label,
.tool-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tool-select,
.tool-textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(34, 197, 94, 0.16);
    background: rgba(0, 0, 0, 0.24);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.tool-select:focus,
.tool-textarea:focus {
    border-color: var(--border-lit);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.tool-select {
    padding: 0.85rem 0.9rem;
    font-family: var(--font-mono);
}

.tool-textarea {
    min-height: 220px;
    padding: 0.95rem;
    resize: vertical;
    line-height: 1.6;
    font-family: var(--font-mono);
    font-size: 0.94rem;
    margin-top: 0.45rem;
}

.tool-output {
    min-height: 340px;
}

.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.9rem;
}

.tool-btn {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.72rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.tool-btn:hover {
    transform: translateY(-2px);
}

.tool-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), #16a34a);
    color: #04110a;
}

.tool-btn.secondary {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(96, 165, 250, 0.24);
    color: var(--text-main);
}

.tool-btn.success {
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.24);
    color: var(--text-main);
}

.tool-btn.ghost {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.tool-file-box {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.95rem;
}

.tool-file-input {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.tool-file-input::file-selector-button {
    margin-right: 0.8rem;
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 999px;
    padding: 0.6rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    cursor: pointer;
}

.tool-meta {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: 1rem;
}

.tool-status {
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-size: 0.84rem;
}

.tool-progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.tool-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.25s ease;
}

.tool-notes {
    margin-top: 1rem;
    display: grid;
    gap: 0.55rem;
}

.tool-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(34, 197, 94, 0.12);
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
}

/* =========================================================================
   SERVER OPTIMIZATION SECTION
   ========================================================================= */
.optimization-hero {
    padding: 1.5rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.optimization-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.optimization-card {
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.optimization-head {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.optimization-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.18);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.optimization-head h3 {
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.optimization-head .sub-text {
    font-size: 0.9rem;
    line-height: 1.5;
}

.optimization-list {
    display: grid;
    gap: 0.55rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    padding-left: 1.1rem;
}

.optimization-list li {
    line-height: 1.55;
}

.optimization-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.optimization-metric {
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(34, 197, 94, 0.12);
}

.optimization-metric .metric-value {
    display: block;
    font-family: var(--font-mono);
    color: var(--primary-color);
    font-size: 0.78rem;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.optimization-metric .metric-label {
    color: var(--text-main);
    font-size: 0.92rem;
    line-height: 1.45;
}

.optimization-launcher {
    padding: 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.optimization-launcher-copy {
    display: grid;
    gap: 0.75rem;
}

.optimization-meta-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.optimization-meta-item {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(34, 197, 94, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.optimization-fork-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.optimization-fork-card {
    appearance: none;
    width: 100%;
    border: 1px solid rgba(34, 197, 94, 0.14);
    border-radius: 22px;
    padding: 1.25rem;
    background: linear-gradient(180deg, rgba(18, 24, 36, 0.88), rgba(10, 14, 22, 0.86));
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.optimization-fork-card:hover {
    transform: translateY(-4px);
    border-color: rgba(34, 197, 94, 0.26);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
    background: linear-gradient(180deg, rgba(20, 28, 42, 0.92), rgba(12, 18, 28, 0.9));
}

.optimization-fork-card.active {
    border-color: rgba(34, 197, 94, 0.42);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12), 0 20px 48px rgba(0, 0, 0, 0.3);
    background: linear-gradient(180deg, rgba(22, 34, 28, 0.94), rgba(12, 18, 22, 0.9));
}

.optimization-fork-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), transparent 80%);
    border-radius: 22px 22px 0 0;
}

.optimization-fork-top {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.optimization-fork-logo-wrap {
    flex-shrink: 0;
}

.optimization-fork-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.optimization-fork-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.18rem;
}

.optimization-fork-title-row strong {
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.fork-name-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.optimization-fork-logo {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid var(--border-dim);
    display: block;
    background: rgba(0, 0, 0, 0.16);
}

.optimization-fork-status {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.optimization-fork-cta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border-dim);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    position: relative;
    z-index: 1;
}

.optimization-fork-card:hover .optimization-fork-cta,
.optimization-fork-card.active .optimization-fork-cta {
    border-color: var(--border-lit);
    background: rgba(34, 197, 94, 0.06);
}

.optimization-fork-cta .ip-text {
    flex: 1;
    font-size: 0.84rem;
    letter-spacing: 0.2px;
}

.optimization-fork-cta .fa-chevron-right {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.optimization-fork-card .role-badge {
    border-radius: 999px;
    padding: 0.18rem 0.65rem;
    flex-shrink: 0;
}

.optimization-fork-card .fork-name-sr {
    position: absolute;
    z-index: -1;
}

.optimization-workbench {
    margin-top: 1.25rem;
    padding: 1.35rem;
}

.optimization-workbench-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.optimization-workbench-head h3 {
    font-size: 1.45rem;
    margin: 0.15rem 0 0.3rem;
}

.optimization-sub-badge {
    margin-bottom: 0.4rem;
}

.optimization-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.22);
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

.optimization-workbench-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 1rem;
}

.optimization-workbench-column {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

#optimization-version {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.optimization-version-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: -0.05rem;
    margin-bottom: 0.15rem;
}

.optimization-version-chip {
    appearance: none;
    border: 1px solid rgba(34, 197, 94, 0.14);
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.12), transparent 52%),
        linear-gradient(180deg, rgba(16, 22, 34, 0.9), rgba(10, 14, 22, 0.86));
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.72rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.optimization-version-chip:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 197, 94, 0.24);
    color: var(--text-main);
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 56%),
        linear-gradient(180deg, rgba(18, 26, 39, 0.94), rgba(12, 18, 28, 0.9));
}

.optimization-version-chip.active {
    color: #ecfdf5;
    border-color: rgba(34, 197, 94, 0.38);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.1), 0 12px 24px rgba(0, 0, 0, 0.2);
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.28), transparent 58%),
        linear-gradient(180deg, rgba(18, 45, 33, 0.96), rgba(13, 28, 22, 0.92));
}

.optimization-input {
    width: 100%;
}

.optimization-file-input {
    width: 100%;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    border: 1px solid rgba(34, 197, 94, 0.16);
    background: rgba(0, 0, 0, 0.24);
    color: var(--text-muted);
}

.optimization-file-input::file-selector-button {
    margin-right: 0.75rem;
}

.optimization-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.2rem 0;
}

.optimization-package-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.optimization-file-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.optimization-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(34, 197, 94, 0.12);
    color: var(--text-main);
    font-size: 0.82rem;
}

.optimization-file-chip i {
    color: var(--primary-color);
}

.optimization-file-link {
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.optimization-file-link:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.08);
}

.optimization-file-button {
    appearance: none;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.optimization-file-button:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.08);
}

.optimization-file-button.active {
    border-color: rgba(34, 197, 94, 0.34);
    background: rgba(34, 197, 94, 0.12);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.08);
}

.optimization-output {
    min-height: 250px;
}

.optimization-actions {
    margin-top: 0.35rem;
}

.optimization-actions .tool-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

body.light-theme .optimization-fork-card,
body.light-theme .optimization-workbench,
body.light-theme .optimization-launcher,
body.light-theme .optimization-meta-item {
    border-color: rgba(5, 150, 105, 0.14);
}

@media (max-width: 1024px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tool-shell {
        padding: 1.1rem;
    }

    .tool-hero {
        flex-direction: column;
    }

    .tool-chips {
        justify-content: flex-start;
    }

    .tool-row {
        grid-template-columns: 1fr;
    }

    .tool-file-box {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-textarea {
        min-height: 180px;
    }

    .tool-output {
        min-height: 240px;
    }

    .optimization-grid,
    .optimization-metrics {
        grid-template-columns: 1fr;
    }

    .optimization-hero,
    .optimization-card {
        padding: 1.15rem;
    }

    .optimization-meta-strip,
    .optimization-workbench-grid,
    .optimization-package-meta {
        grid-template-columns: 1fr;
    }

    .optimization-fork-grid {
        grid-template-columns: 1fr;
    }

    .optimization-workbench-head {
        flex-direction: column;
    }

    .optimization-fork-card {
        min-height: 0;
    }
}
/* 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;
    }
}

/* =========================================================================
   PREMIUM REFRESH OVERRIDES
   ========================================================================= */
:root {
    --bg-base: #05070d;
    --bg-panel: rgba(10, 16, 26, 0.58);
    --bg-panel-hover: rgba(15, 23, 36, 0.74);
    --border-dim: rgba(34, 197, 94, 0.14);
    --border-lit: rgba(34, 197, 94, 0.34);
    --primary-color: #22c55e;
    --primary-glow: rgba(34, 197, 94, 0.28);
    --secondary-color: #60a5fa;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-radius: 20px;
}

body {
    background:
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 34%),
        radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.12), transparent 28%),
        linear-gradient(180deg, #04060b 0%, #070b12 58%, #05070d 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    pointer-events: none;
    z-index: -1;
    filter: blur(40px);
    opacity: 0.8;
}

body::before {
    top: -120px;
    right: -120px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.16), transparent 70%);
}

body::after {
    bottom: -150px;
    left: -160px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.12), transparent 68%);
}

.bg-fx {
    opacity: 0.7;
    filter: saturate(0.9) contrast(0.95);
}

.app-container {
    max-width: 1600px;
    gap: 4.5rem;
    padding: 4rem 2rem 3rem;
    align-items: flex-start;
}

.sidebar-wrapper {
    width: 340px;
}

.profile-card {
    width: 340px;
    padding: 1.4rem 1.35rem 1rem;
    background: linear-gradient(180deg, rgba(18, 24, 36, 0.92), rgba(10, 14, 22, 0.86));
    border: 1px solid rgba(34, 197, 94, 0.16);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
    border-radius: 24px;
}

.name {
    font-size: 1.5rem;
    margin-top: 0.35rem;
}

.role {
    letter-spacing: 1.6px;
    margin-bottom: 0.9rem;
}

.bio {
    line-height: 1.65;
    margin-bottom: 1.1rem;
}

.nav-menu {
    gap: 0.35rem;
    margin-bottom: 1.1rem;
}

.nav-link {
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.nav-link:hover {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.12);
}

.nav-link.active {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.22);
    transform: translateX(4px);
}

.social-links {
    gap: 0.6rem;
}

.social-btn {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.content-wrapper {
    max-width: 980px;
    gap: 4.2rem;
}

.section {
    scroll-margin-top: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.3rem;
}

.section-badge {
    font-size: 0.75rem;
    letter-spacing: 2.8px;
    color: var(--primary-color);
    opacity: 0.92;
}

.section-title {
    font-size: clamp(2rem, 2.4vw, 3.15rem);
    line-height: 0.98;
}

.glass-card {
    background: linear-gradient(180deg, rgba(16, 22, 34, 0.8), rgba(12, 17, 26, 0.72));
    border: 1px solid rgba(34, 197, 94, 0.16);
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.glass-card:hover {
    border-color: rgba(34, 197, 94, 0.22);
}

.lead-text {
    font-size: 1.08rem;
}

.service-card,
.skill-box,
.project-item,
.code-panel {
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.service-card:hover,
.project-item.hover-glow:hover,
.skill-box:hover {
    transform: translateY(-6px);
    border-color: rgba(34, 197, 94, 0.28);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}

.services-grid {
    gap: 1.25rem;
}

.service-card {
    padding: 1.6rem;
}

.service-icon {
    margin-bottom: 1rem;
}

.service-card h3,
.skill-box-title,
.project-title-row h3 {
    letter-spacing: -0.02em;
}

.skills-grid {
    gap: 1.25rem;
}

.skill-box-title {
    font-size: 1.05rem;
}

.tech-item {
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(34, 197, 94, 0.12);
    border-radius: 10px;
}

.skill-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.skill-fill {
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.5);
}

.project-list {
    gap: 1.25rem;
}

.project-item {
    padding: 1.6rem;
}

.project-main-flex {
    gap: 1rem;
}

.project-logo {
    width: 60px;
    height: 60px;
    border-radius: 14px;
}

.project-title-row {
    margin-bottom: 0.35rem;
}

.project-title-row h3 {
    font-size: 1.06rem;
}

.role-badge {
    border-radius: 999px;
    padding: 0.18rem 0.6rem;
}

.ip-copy-container {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.ip-copy-container:hover {
    background: rgba(34, 197, 94, 0.06);
}

.footer-content {
    border-radius: 18px;
    padding: 1.2rem 1.4rem;
}

.floating-view-badge,
.floating-music-btn,
.music-content,
.toast {
    border-color: rgba(34, 197, 94, 0.22);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.32);
}

.floating-view-badge {
    backdrop-filter: blur(18px);
}

.music-content {
    border-radius: 18px;
}

@media (max-width: 1280px) {
    .content-wrapper {
        max-width: 900px;
    }
}

@media (max-width: 1024px) {
    .app-container {
        padding-top: 5rem;
    }

    .sidebar-wrapper,
    .profile-card {
        width: 100%;
    }

    .profile-card {
        position: relative;
        top: 0;
    }

    .content-wrapper {
        max-width: 100%;
        gap: 3.4rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 4.5rem 1rem 8rem;
        gap: 1.6rem;
    }

    .top-left-controls,
    .top-right-controls {
        top: 1rem;
    }

    .top-left-controls {
        left: 1rem;
    }

    .top-right-controls {
        right: 1rem;
    }

    .profile-card {
        padding: 1.1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .services-grid,
    .project-list {
        grid-template-columns: 1fr;
    }

    .glass-card,
    .service-card,
    .skill-box,
    .project-item {
        padding: 1.2rem;
    }

    .section-title {
        font-size: 1.9rem;
    }

    .floating-view-badge {
        left: 1rem;
        bottom: 1rem;
        font-size: 0.8rem;
        padding: 0.45rem 0.9rem;
    }

    .floating-music-btn {
        right: 1rem;
        bottom: 1rem;
        width: 46px;
        height: 46px;
    }

    .music-content {
        right: 1rem;
        bottom: 4.8rem;
        width: calc(100vw - 2rem);
        max-width: 310px;
    }

    .toast {
        right: 1rem;
        bottom: 5rem;
    }
}
