/* =============================================
   BSE Web Solutions — Main Stylesheet
   ============================================= */

/* --- Variables --- */
:root {
    --bg:          #060514;
    --bg-2:        #0c0a22;
    --bg-3:        #12102e;
    --purple:      #7c3aed;
    --purple-mid:  #8b5cf6;
    --purple-light:#a78bfa;
    --pink:        #db2777;
    --pink-light:  #ec4899;
    --gradient:    linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --text:        #f1f5f9;
    --text-2:      #cbd5e1;
    --text-muted:  #94a3b8;
    --glass:       rgba(12, 10, 34, 0.75);
    --glass-border:rgba(139, 92, 246, 0.2);
    --radius:      20px;
    --radius-sm:   12px;
    --ease:        cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    overflow-x: clip; /* prevents horizontal scroll without creating a scroll container (keeps sticky/fixed working) */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.2; color: var(--text); }
p { color: var(--text-2); line-height: 1.8; }

/* --- Utilities --- */
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-label {
    display: inline-block;
    padding: 6px 18px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--purple-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.section-label.centered { display: block; text-align: center; }

.section-title {
    font-size: clamp(1.9rem, 4vw, 2.9rem);
    font-weight: 800;
    margin-bottom: 1.25rem;
    line-height: 1.15;
}

.section-title.centered { text-align: center; }

.section-sub {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 580px;
    margin-bottom: 3rem;
}

.section-sub.centered { text-align: center; margin-left: auto; margin-right: auto; }

.section-text { color: var(--text-2); margin-bottom: 1.2rem; }

/* Scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Background blobs (decorative, parallax-driven) */
.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}

/* --- Buttons --- */
.btn-grad {
    display: inline-block;
    padding: 14px 32px;
    background: var(--gradient);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 100px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
    box-shadow: 0 4px 24px rgba(139, 92, 246, 0.35);
}
.btn-grad:hover { transform: translateY(-3px); box-shadow: 0 10px 36px rgba(139, 92, 246, 0.55); color: #fff; }

.btn-grad.btn-full {
    width: 100%;
    text-align: center;
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.btn-ghost {
    display: inline-block;
    padding: 14px 32px;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 100px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.2);
    transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.btn-ghost:hover { border-color: var(--purple-light); background: rgba(139,92,246,0.1); color: var(--text); }

/* =============================================
   NAVBAR
   ============================================= */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 1.2rem 0;
    transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease), padding 0.4s var(--ease), border-bottom 0.4s var(--ease);
}
.site-nav.scrolled {
    background: rgba(6, 5, 20, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0;
}

.site-nav .container { display: flex; align-items: center; justify-content: space-between; }

.nav-logo img { height: 38px; width: auto; }

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0; padding: 0;
}
.nav-links a {
    color: rgba(255,255,255,0.8);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: 8px;
    transition: color 0.25s, background 0.25s;
}
.nav-links a:hover { color: var(--purple-light); background: rgba(139,92,246,0.08); }

.nav-links a.nav-cta {
    margin-left: 0.5rem;
    padding: 9px 22px;
    background: var(--gradient);
    color: #fff !important;
    font-weight: 600;
    border-radius: 100px;
    box-shadow: 0 4px 16px rgba(139,92,246,0.3);
    transition: transform 0.25s, box-shadow 0.25s;
}
.nav-links a.nav-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(139,92,246,0.5); background: var(--gradient); }

/* Hamburger */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
}
.nav-hamburger span {
    display: block;
    width: 24px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s var(--ease), opacity 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =============================================
   HERO
   ============================================= */
.hero {
    position: relative;
    height: 100vh;
    min-height: 680px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-video {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 0;
    transform-origin: center center;
    will-change: transform;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(6,5,20,0.45) 0%,
        rgba(6,5,20,0.65) 40%,
        rgba(6,5,20,1)    100%
    );
    z-index: 1;
}

.hero-grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image:
        linear-gradient(rgba(139,92,246,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139,92,246,0.04) 1px, transparent 1px);
    background-size: 64px 64px;
}

/* Orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    pointer-events: none;
    will-change: transform;
}
.orb-1 {
    width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(124,58,237,0.32), transparent 70%);
    top: -120px; right: -80px;
}
.orb-2 {
    width: 420px; height: 420px;
    background: radial-gradient(circle, rgba(236,72,153,0.22), transparent 70%);
    bottom: 80px; left: -60px;
}
.orb-3 {
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(139,92,246,0.18), transparent 70%);
    top: 45%; left: 42%;
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 24px;
    max-width: 820px;
    will-change: transform, opacity;
}

.hero-badge {
    display: inline-block;
    padding: 8px 22px;
    background: rgba(139,92,246,0.12);
    border: 1px solid rgba(139,92,246,0.4);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--purple-light);
    letter-spacing: 0.13em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.hero-content h1 {
    font-size: clamp(3rem, 8.5vw, 6.2rem);
    font-weight: 900;
    line-height: 1.08;
    margin-bottom: 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hero-content h1 span { display: block; }
.hero-content h1 span:last-child {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 2.5rem;
    line-height: 1.75;
}

.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Scroll indicator */
.hero-scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.scroll-line {
    width: 1px; height: 48px;
    background: linear-gradient(to bottom, var(--purple-mid), transparent);
    animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50%       { opacity: 1;   transform: scaleY(0.7); }
}

/* =============================================
   ABOUT
   ============================================= */
.about-section {
    position: relative;
    padding: 130px 0;
    background: var(--bg-2);
    overflow: hidden;
}

.blob-about {
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(124,58,237,0.14), transparent 70%);
    top: -200px; right: -200px;
}

.stats-row { display: flex; gap: 2.5rem; margin-top: 2.5rem; flex-wrap: wrap; }

.stat-item { display: flex; flex-direction: column; }

.stat-num {
    font-size: 2.1rem;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* About visual */
.about-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.about-glow {
    position: absolute;
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(139,92,246,0.18), transparent 70%);
    border-radius: 50%;
}
.about-img {
    position: relative;
    z-index: 1;
    max-width: 85%;
    height: auto;
    filter: drop-shadow(0 24px 64px rgba(0,0,0,0.5));
}

.floating-tag {
    position: absolute;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 100px;
    padding: 9px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}
.floating-tag.tag-1 { top: 18%; left: -10px; animation: tagFloat 4s ease-in-out infinite; }
.floating-tag.tag-2 { bottom: 14%; right: 0; animation: tagFloat 4s ease-in-out 2s infinite; }

.tag-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gradient);
    flex-shrink: 0;
}

@keyframes tagFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

/* =============================================
   PORTFOLIO
   ============================================= */
.portfolio-section {
    position: relative;
    padding: 130px 0;
    background: var(--bg);
    overflow: hidden;
}

/* CSS Parallax via fixed background */
.portfolio-parallax-bg {
    position: absolute;
    inset: 0;
    background-image: url('../img/portofolio_bg.jpg');
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    opacity: 0.06;
    z-index: 0;
}

.portfolio-section .container { position: relative; z-index: 1; }

.portfolio-notice {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 2.5rem;
    padding: 10px 16px;
    border-left: 2px solid rgba(139,92,246,0.35);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.portfolio-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.portfolio-card:hover {
    transform: translateY(-10px);
    border-color: rgba(139,92,246,0.55);
    box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}

.portfolio-card-img {
    position: relative;
    height: 200px;
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.portfolio-card-img img {
    width: 28%;
    opacity: 0.55;
    transition: opacity 0.35s, transform 0.35s;
}
.portfolio-card:hover .portfolio-card-img img { opacity: 0.3; transform: scale(1.08); }

.portfolio-overlay {
    position: absolute;
    inset: 0;
    background: rgba(124,58,237,0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.35s;
}
.portfolio-card:hover .portfolio-overlay { opacity: 1; }

.portfolio-link {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.portfolio-card-body { padding: 1.5rem; }

.portfolio-tag {
    display: inline-block;
    padding: 3px 12px;
    background: rgba(139,92,246,0.15);
    color: var(--purple-light);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 100px;
    margin-bottom: 0.75rem;
}
.portfolio-card-body h3 { font-size: 1.05rem; color: var(--text); margin-bottom: 0.45rem; }
.portfolio-card-body p  { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* =============================================
   SERVICES
   ============================================= */
.services-section {
    padding: 130px 0;
    background: var(--bg-3);
    position: relative;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.service-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.service-card:hover {
    transform: translateY(-6px);
    border-color: rgba(139,92,246,0.5);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.service-icon { font-size: 2rem; margin-bottom: 1rem; line-height: 1; }
.service-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.7rem; color: var(--text); }
.service-card p  { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; margin: 0; }

/* Address link */
address { font-style: normal; }
address a { color: var(--purple-light); text-decoration: none; }
address a:hover { text-decoration: underline; }

/* =============================================
   TEAM
   ============================================= */
.team-section {
    position: relative;
    padding: 130px 0;
    background: var(--bg-3);
    overflow: hidden;
}

.blob-team {
    width: 800px; height: 800px;
    background: radial-gradient(circle, rgba(236,72,153,0.09), transparent 70%);
    bottom: -350px; left: -250px;
}

.team-section .container { position: relative; z-index: 1; }

.team-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.team-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem 1.25rem;
    text-align: center;
    transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.team-card:hover {
    transform: translateY(-10px);
    border-color: rgba(139,92,246,0.5);
    box-shadow: 0 20px 48px rgba(0,0,0,0.35);
}

.team-img-wrap {
    width: 86px; height: 86px;
    border-radius: 50%;
    margin: 0 auto 1.25rem;
    overflow: hidden;
    border: 2px solid var(--glass-border);
    background: var(--bg-2);
    transition: border-color 0.35s;
}
.team-card:hover .team-img-wrap { border-color: var(--purple-mid); }

.team-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top;
}
.team-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: 0.35rem; }
.team-role { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }

/* =============================================
   SKILLS — Infinite Marquee
   ============================================= */
.skills-section {
    padding: 110px 0 120px;
    background: var(--bg-2);
    overflow: hidden;
}

.skills-section .container { position: relative; z-index: 1; }

.marquee-wrapper {
    position: relative;
    overflow: hidden;
    padding: 16px 0;
}
.marquee-wrapper:first-of-type { margin-top: 3.5rem; }
.marquee-wrapper + .marquee-wrapper { margin-top: 1rem; }

.marquee-reverse .marquee-track.ready {
    animation-direction: reverse;
}
/* Fade edges */
.marquee-wrapper::before,
.marquee-wrapper::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 160px;
    z-index: 2;
    pointer-events: none;
}
.marquee-wrapper::before { left:  0; background: linear-gradient(to right, var(--bg-2), transparent); }
.marquee-wrapper::after  { right: 0; background: linear-gradient(to left,  var(--bg-2), transparent); }

/* Track — animation starts only after JS sets --marquee-w and adds .ready */
.marquee-track {
    display: flex;
    gap: 1.25rem;
    width: max-content;
}
.marquee-track.ready {
    animation: marqueeScroll 35s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }

/* Technology name badges */
.tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
    cursor: default;
    transition: background 0.3s, border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.tech-badge:hover {
    background: color-mix(in srgb, var(--c) 12%, transparent);
    border-color: var(--c);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--c) 25%, transparent);
}
.tb-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--c);
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--c);
}

@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(-1 * var(--marquee-w, 50%))); }
}

/* =============================================
   CONTACT
   ============================================= */
.contact-section {
    position: relative;
    padding: 130px 0;
    background: var(--bg);
    overflow: hidden;
}

.blob-contact {
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.14), transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(236,72,153,0.1),  transparent 60%);
    top: 0; left: 0;
    right: 0; bottom: 0;
    border-radius: 0;
    filter: blur(60px);
}

.contact-section .container { position: relative; z-index: 1; }

.contact-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 3rem;
    backdrop-filter: blur(12px);
    margin-top: 0.5rem;
}

.contact-info { display: flex; flex-direction: column; gap: 2rem; height: 100%; justify-content: center; }

.contact-info-item { display: flex; align-items: flex-start; gap: 1rem; }

.contact-icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-sm);
    background: rgba(139,92,246,0.12);
    border: 1px solid rgba(139,92,246,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.contact-info-item h5 { font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.contact-info-item p  { font-size: 0.88rem; color: var(--text-muted); margin: 0; }

/* Form */
#contactForm input,
#contactForm textarea {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
}
#contactForm input::placeholder,
#contactForm textarea::placeholder { color: var(--text-muted); }
#contactForm input:focus,
#contactForm textarea:focus {
    border-color: var(--purple-mid);
    background: rgba(139,92,246,0.06);
}
#contactForm textarea { resize: vertical; min-height: 110px; }

#formResult {
    margin-top: 1rem;
    font-size: 0.88rem;
    text-align: center;
    color: var(--purple-light);
    min-height: 1.4em;
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    padding: 2rem 0;
    background: var(--bg-2);
    border-top: 1px solid var(--glass-border);
}
.footer-logo { height: 34px; width: auto; }
.footer-copy { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.footer-nav {
    list-style: none;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    padding: 0; margin: 0;
}
.footer-nav a {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.25s;
}
.footer-nav a:hover { color: var(--purple-light); }

/* =============================================
   GAME — Bug Squasher
   ============================================= */

/* Floating trigger button */
.game-trigger {
    position: fixed;
    bottom: max(2rem, env(safe-area-inset-bottom, 1rem) + 1rem);
    right: max(2rem, env(safe-area-inset-right, 1rem) + 1rem);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--gradient);
    border: none;
    border-radius: 100px;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(139,92,246,0.45);
    transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.game-trigger:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 8px 32px rgba(139,92,246,0.65); }
.game-trigger-icon { font-size: 1.2rem; }

/* Modal overlay */
.game-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(6,5,20,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    align-items: center;
    justify-content: center;
    /* scroll the overlay so game panels are never clipped */
    overflow-y: auto;
    padding: max(1rem, env(safe-area-inset-top))
             max(1rem, env(safe-area-inset-right))
             max(1rem, env(safe-area-inset-bottom))
             max(1rem, env(safe-area-inset-left));
}
.game-modal.open { display: flex; }

/* Game window */
.game-container {
    width: 100%;
    max-width: 460px;
    height: min(85vh, 680px);
    background: var(--bg-2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.game-container.shake {
    animation: cShake 0.4s ease;
}
@keyframes cShake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(8px); }
    60%      { transform: translateX(-6px); }
    80%      { transform: translateX(6px); }
}

/* Header */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.game-header-left { display: flex; align-items: center; gap: 10px; }
.game-logo { font-size: 1.4rem; }
.game-header h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.game-close {
    width: 32px; height: 32px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.game-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }

/* HUD */
.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Timer bar */
.timer-track {
    height: 3px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.timer-bar {
    height: 100%;
    width: 100%;
    background: var(--gradient);
    transition: width 1s linear;
}

/* Game area */
.game-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            0deg,
            transparent, transparent 29px,
            rgba(139,92,246,0.04) 29px, rgba(139,92,246,0.04) 30px
        );
    user-select: none;
}

/* Screen overlays (start / game over) */
.game-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6,5,20,0.88);
    backdrop-filter: blur(6px);
    z-index: 10;
}
.game-screen-inner { text-align: center; padding: 2rem 1.5rem; max-width: 320px; }
.gs-emoji  { font-size: 3.5rem; margin-bottom: 0.75rem; line-height: 1; }
.game-screen-inner h3 { font-size: 1.6rem; margin-bottom: 0.75rem; }
.game-screen-inner p  { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5rem; line-height: 1.6; }
.gs-hint   { font-size: 0.82rem !important; }
.gs-best   { color: var(--purple-light) !important; margin-bottom: 1.5rem !important; font-weight: 600; }
.gs-final  { font-size: 1.1rem !important; color: var(--text) !important; font-weight: 700; }
.gs-record { color: #fbbf24 !important; font-weight: 800 !important; font-size: 1rem !important; margin-top: 0.5rem; }

/* Bugs */
.gb {
    position: absolute;
    font-size: 2.2rem;
    cursor: pointer;
    line-height: 1;
    transition: top var(--fall-ms, 2s) linear;
    will-change: top;
    filter: drop-shadow(0 0 10px rgba(139,92,246,0.6));
}
.gb:hover       { transform: scale(1.15); }
.gb-caught      { animation: bugCaught 0.35s ease forwards; pointer-events: none; }
@keyframes bugCaught {
    0%   { transform: scale(1) rotate(0deg);    opacity: 1; }
    50%  { transform: scale(1.6) rotate(25deg); opacity: 0.8; }
    100% { transform: scale(0)   rotate(45deg); opacity: 0; }
}

/* Score pop effect */
.gb-pop {
    position: fixed;
    transform: translate(-50%, -50%);
    font-size: 1.3rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 10001;
    animation: gbPop 0.7s ease forwards;
}
@keyframes gbPop {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -160%) scale(1.4); }
}

/* =============================================
   COMMON GAME HELPERS
   ============================================= */
.btn-game-action {
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.12s;
}
.btn-game-action:hover { opacity: 0.85; transform: scale(1.04); }

/* Back button shared by all game modals */
.game-back {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.65);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.game-back:hover { background: rgba(255,255,255,0.13); color: #fff; }

/* Updated game header for back+close layout */
.game-header-right { display: flex; align-items: center; gap: 8px; }

/* =============================================
   GAME HUB
   ============================================= */
.hub-container {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem 2.25rem;
    width: min(480px, 94vw);
    max-height: calc(100svh - 2rem);
    overflow-y: auto;
    position: relative;
    text-align: center;
}
.hub-header { margin-bottom: 1.5rem; }
.hub-icon-main { font-size: 2.8rem; display: block; margin-bottom: 0.4rem; }
.hub-header h2 {
    font-size: 1.7rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.25rem;
}
.hub-header p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

.hub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.875rem;
}
.hub-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 12px;
    padding: 1.25rem 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.18s;
    user-select: none;
}
.hub-card:hover, .hub-card:focus-visible {
    background: rgba(139,92,246,0.14);
    border-color: var(--purple-mid);
    transform: translateY(-3px);
    outline: none;
}
.hub-card-icon  { font-size: 2.4rem; margin-bottom: 0.5rem; }
.hub-card-name  { font-weight: 700; color: #fff; margin-bottom: 0.2rem; font-size: 0.95rem; }
.hub-card-desc  { font-size: 0.73rem; color: var(--text-muted); line-height: 1.5; }

/* =============================================
   TIC-TAC-TOE
   ============================================= */
.ttt-container {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem 2rem;
    width: min(380px, 94vw);
    max-height: calc(100svh - 2rem);
    overflow-y: auto;
    position: relative;
    text-align: center;
}
.ttt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.ttt-title {
    font-size: 1.55rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.5rem;
}
.ttt-status {
    font-size: 0.92rem;
    color: rgba(255,255,255,0.75);
    margin-bottom: 1.1rem;
    min-height: 1.4em;
}
.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 270px;
    margin: 0 auto 1.25rem;
}
.ttt-cell {
    aspect-ratio: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
    user-select: none;
}
.ttt-cell:not(.ttt-x):not(.ttt-o):hover { background: rgba(139,92,246,0.14); }
.ttt-cell.ttt-x { color: #4ade80; cursor: default; }
.ttt-cell.ttt-o { color: #f472b6; cursor: default; }
.ttt-cell.ttt-win { background: rgba(139,92,246,0.28); border-color: var(--purple-mid); }

.ttt-scores {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}
.ttt-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.ttt-score-box span:last-child {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

/* =============================================
   MEMORY MATCH
   ============================================= */
.mem-container {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem 1.25rem 1.75rem;
    width: min(420px, 94vw);
    max-height: calc(100svh - 2rem);
    overflow-y: auto;
    position: relative;
    text-align: center;
}
.mem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}
.mem-title {
    font-size: 1.55rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.6rem;
}
.mem-hud {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.mem-hud b { color: #fff; }
.mem-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}
.mem-card {
    aspect-ratio: 1;
    perspective: 700px;
    cursor: pointer;
}
.mem-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(.4,0,.2,1);
}
.mem-card.mem-flipped .mem-card-inner,
.mem-card.mem-matched  .mem-card-inner { transform: rotateY(180deg); }

.mem-card-front,
.mem-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.09);
    font-size: 1.55rem;
}
.mem-card-front {
    background: rgba(139,92,246,0.12);
    color: rgba(255,255,255,0.3);
    font-size: 1.1rem;
    font-weight: 700;
}
.mem-card-back {
    background: rgba(255,255,255,0.06);
    transform: rotateY(180deg);
}
.mem-card.mem-matched .mem-card-back {
    background: rgba(74,222,128,0.12);
    border-color: rgba(74,222,128,0.4);
}

/* Win overlay — fixed so it covers the panel even when the container scrolls */
.mem-win {
    position: fixed;
    inset: 0;
    background: rgba(6,5,20,0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    z-index: 10001;
}
.mem-win-emoji { font-size: 3.5rem; }
.mem-win-text  { font-size: 1rem; color: rgba(255,255,255,0.8); }

/* =============================================
   SNAKE
   ============================================= */
.snake-container {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 1.5rem;
    width: min(360px, 94vw);
    max-height: calc(100svh - 2rem);
    overflow-y: auto;
    position: relative;
    text-align: center;
}
.snake-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}
.snake-hud {
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.snake-hud b { color: #fff; }
.snake-canvas-wrap {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}
#snakeCanvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(139,92,246,0.3);
    touch-action: none;
}
.snake-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(6,5,20,0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.snake-over-msg { font-size: 0.92rem; color: rgba(255,255,255,0.8); padding: 0 1rem; }
.snake-hint     { margin-top: 0.6rem; font-size: 0.72rem; color: var(--text-muted); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 992px) {
    .team-grid     { grid-template-columns: repeat(2, 1fr); }
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    .floating-tag  { display: none; }
    .about-visual  { margin-top: 2rem; }
    .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    /* Hero */
    .hero-content h1 { font-size: 2.6rem; }
    .hero-sub { font-size: 1rem; }
    .hero-sub br { display: none; }
    .hero-scroll-indicator { display: none; }

    /* Navbar */
    .site-nav .container { flex-wrap: wrap; gap: 0; }
    .nav-hamburger { display: flex; }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background: rgba(6,5,20,0.97);
        border-top: 1px solid var(--glass-border);
        padding: 0.75rem 0 1rem;
        gap: 0;
    }
    .nav-links.open { display: flex; }
    .nav-links li { width: 100%; }
    .nav-links a { display: block; padding: 12px 20px; border-radius: 0; font-size: 1rem; }
    .nav-links a.nav-cta {
        margin: 0.75rem 1rem 0;
        display: inline-block;
        border-radius: 100px;
        text-align: center;
    }

    /* Sections */
    .about-section, .portfolio-section, .team-section,
    .contact-section, .skills-section { padding: 80px 0; }
    .section-title { font-size: 1.85rem; }
    .section-sub { font-size: 0.95rem; }

    /* Portfolio & Services */
    .portfolio-grid { grid-template-columns: 1fr; }
    .services-grid  { grid-template-columns: 1fr; }
    .portfolio-notice { font-size: 0.78rem; }

    /* Contact */
    .contact-card { padding: 2rem 1.25rem; }
    .contact-info { gap: 1.5rem; }

    /* Marquee */
    .marquee-wrapper::before,
    .marquee-wrapper::after { width: 60px; }
    .tech-badge { font-size: 0.85rem; padding: 10px 16px; gap: 8px; }
    .tb-dot { width: 7px; height: 7px; }

    /* Footer */
    .footer-nav { justify-content: center; }
    .footer-copy { text-align: center; margin: 0.75rem 0; }
    .footer-logo { display: block; margin: 0 auto 0.75rem; }
}

@media (max-width: 576px) {
    /* Hero */
    .hero-content h1 { font-size: 2.1rem; }
    .hero-badge { font-size: 0.68rem; padding: 7px 16px; }
    .hero-cta { flex-direction: column; align-items: center; }
    .hero-cta .btn-grad,
    .hero-cta .btn-ghost { width: 100%; max-width: 280px; text-align: center; }

    /* Team */
    .team-grid { grid-template-columns: repeat(2, 1fr); gap: 0.875rem; }
    .team-card { padding: 1.5rem 1rem; }
    .team-img-wrap { width: 72px; height: 72px; }

    /* Stats */
    .stats-row { gap: 1.5rem; justify-content: flex-start; flex-wrap: wrap; }

    /* Marquee */
    .marquee-wrapper::before,
    .marquee-wrapper::after { width: 40px; }
    .tech-badge { font-size: 0.8rem; padding: 9px 14px; }

    /* About */
    .about-img { max-width: 75%; }

    /* Games — compact layout on small screens */
    .game-trigger-label { display: none; }
    .game-trigger        { padding: 12px 14px; }

    .hub-grid        { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
    .hub-card        { padding: 1rem 0.6rem; }
    .hub-card-icon   { font-size: 2rem; }
    .hub-card-name   { font-size: 0.82rem; }
    .hub-card-desc   { display: none; }

    .ttt-board       { max-width: 240px; gap: 6px; }
    .ttt-cell        { font-size: 1.65rem; }

    .mem-board       { gap: 5px; }
    .mem-card-front,
    .mem-card-back   { font-size: 1.25rem; }
}

@media (max-width: 400px) {
    .hero-content h1 { font-size: 1.85rem; }
    .portfolio-grid { grid-template-columns: 1fr; }
    .contact-card { padding: 1.5rem 1rem; }
    .team-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .team-img-wrap { width: 64px; height: 64px; }
    .team-card h4 { font-size: 0.9rem; }
    .team-role { font-size: 0.72rem; }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .marquee-track { animation: none; }
    .floating-tag { animation: none; }
    .scroll-line { animation: none; }
    html { scroll-behavior: auto; }
}