/* =============================================
   BUTTERLOOP — GLOBAL DESIGN SYSTEM
   ============================================= */
:root {
    --yellow: #ffc800;
    --yellow-glow: rgba(255, 200, 0, 0.35);
    --white: #ffffff;
    --off-white: #f9f6ee;
    --black: #0e0e0e;
    --dark: #1b1b1b;
    --muted: #888880;
    --glass: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.1);
    --font: 'Outfit', sans-serif;
    --nav-h: 72px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
    width: 100%;
    height: 100%;
    font-family: var(--font);
    background: var(--black);
    color: var(--white);
    -webkit-font-smoothing: antialiased;
}

body.no-scroll {
    overflow: hidden;
}

/* ---- Backgrounds ---- */
.bg-gradient {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 60% 60% at 75% 20%, rgba(255, 200, 0, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 10% 80%, rgba(255, 200, 0, 0.08) 0%, transparent 60%),
        var(--black);
    pointer-events: none;
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.bg-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: drift 18s ease-in-out infinite alternate;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 200, 0, 0.18), transparent 70%);
    top: -150px;
    right: -100px;
    animation-duration: 16s;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255, 200, 0, 0.10), transparent 70%);
    bottom: -80px;
    left: -80px;
    animation-duration: 22s;
    animation-delay: -8s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255, 220, 80, 0.12), transparent 70%);
    top: 50%;
    left: 40%;
    animation-duration: 14s;
    animation-delay: -4s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(40px, 40px) scale(1.15);
    }
}

/* ---- Navigation ---- */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    background: rgba(14, 14, 14, 0.6);
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--white);
}

.logo .dot {
    color: var(--yellow);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: color 0.2s var(--ease);
    position: relative;
    padding-bottom: 2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--yellow);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0.25s var(--ease);
    transform-origin: left;
}

.nav-link:hover,
.nav-link.active {
    color: var(--white);
}

.nav-link.active::after,
.nav-link:hover::after {
    transform: scaleX(1);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    border-radius: 100px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s var(--ease);
    line-height: 1;
}

.btn-primary {
    background: var(--yellow);
    color: var(--black);
    box-shadow: 0 0 0 0 var(--yellow-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 40px var(--yellow-glow), 0 10px 30px rgba(0, 0, 0, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--white);
    border: 1.5px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--yellow);
    color: var(--yellow);
}

/* ---- Eyebrow tag ---- */
.eyebrow-tag {
    display: inline-block;
    border: 1px solid rgba(255, 200, 0, 0.4);
    color: var(--yellow);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.3rem 0.9rem;
    border-radius: 100px;
    margin-bottom: 1.5rem;
    animation: fadeUp 0.6s var(--ease) both;
}

.mobile-hint {
    display: none;
}

/* ==============
   HOME PAGE
   ============== */
body.home-page .hero-full {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    bottom: 56px;
    /* bottom-bar height */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8%;
    gap: 4rem;
    z-index: 10;
}

.hero-left {
    flex: 1;
    max-width: 560px;
    animation: fadeUp 0.7s var(--ease) 0.1s both;
}

.hero-headline {
    font-size: clamp(4rem, 8vw, 8rem);
    font-weight: 900;
    line-height: 0.85;
    letter-spacing: -4px;
    margin-bottom: 1.8rem;
}

.headline-line {
    display: block;
}

.accent-underline {
    position: relative;
    display: inline-block;
    color: var(--yellow);
}

.accent-underline::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--yellow);
    border-radius: 2px;
    opacity: 0.6;
}

.hero-desc {
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--muted);
    line-height: 1.8;
    margin-bottom: 2.5rem;
}

.hero-ctas {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 3.5rem;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    animation: fadeUp 0.7s var(--ease) 0.3s both;
}

.stat-val {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--white);
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 0.2rem;
}

.stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* Right visual */
.hero-right {
    flex: 0 0 620px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    animation: fadeUp 0.7s var(--ease) 0.2s both;
}

.butter-card {
    width: 280px;
    height: 280px;
    border-radius: 36px;
    background: rgba(255, 200, 0, 0.06);
    border: 1.5px solid rgba(255, 200, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 80px rgba(255, 200, 0, 0.08);
    animation: cardFloat 6s ease-in-out infinite alternate;
}

@keyframes cardFloat {
    0% {
        transform: translateY(0px) rotate(-1deg);
    }

    100% {
        transform: translateY(-20px) rotate(1deg);
    }
}

.card-inner {
    text-align: center;
    position: relative;
    z-index: 2;
}

.butter-icon {
    font-size: 5rem;
    line-height: 1;
    margin-bottom: 0.8rem;
    animation: iconSpin 8s linear infinite;
}

@keyframes iconSpin {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

.card-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
}

.card-sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.2rem;
    margin-bottom: 1rem;
}

.card-play-btn {
    display: inline-flex;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--yellow);
    color: var(--black);
    font-size: 1.1rem;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 900;
    transition: all 0.3s var(--ease);
    box-shadow: 0 0 20px var(--yellow-glow);
}

.card-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px var(--yellow-glow);
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 200, 0, 0.15);
    animation: ripple 4s linear infinite;
}

.ring-1 {
    width: 340px;
    height: 340px;
    animation-delay: 0s;
}

.ring-2 {
    width: 420px;
    height: 420px;
    animation-delay: -2s;
}

@keyframes ripple {
    0% {
        transform: scale(0.9);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

.float-tag {
    position: absolute;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 100px;
    white-space: nowrap;
}

.float-tag-tl {
    top: 10px;
    left: -60px;
    animation: floatA 5s ease-in-out infinite alternate;
}

.float-tag-br {
    bottom: 10px;
    right: -40px;
    animation: floatB 7s ease-in-out infinite alternate;
}

@keyframes floatA {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(8px, -8px);
    }
}

@keyframes floatB {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-8px, 8px);
    }
}

/* ---- Bottom bar / footer ---- */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    background: rgba(14, 14, 14, 0.85);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.footer-left,
.footer-right {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    flex: 0 0 140px;
}

.footer-right {
    text-align: right;
}

.footer-marquee {
    flex: 1;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, black 15%, black 85%, transparent);
}

.marquee-inner {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 18s linear infinite;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--yellow);
}

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

    100% {
        transform: translateX(-50%);
    }
}

/* ==============
   GAME PAGE
   ============== */
body.game-page .game-main {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 2rem 5%;
    z-index: 10;
}

.game-sidebar {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeUp 0.5s var(--ease) both;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -1.5px;
    color: var(--yellow);
}

.game-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.7;
}

.game-score-box {
    padding: 1rem 1.2rem;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    backdrop-filter: blur(10px);
}

.score-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.score-val {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--yellow);
    line-height: 1;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.control-key {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.control-label {
    font-size: 0.7rem;
    color: var(--muted);
}

/* Game canvas wrapper */
.game-wrap {
    flex: 0 0 340px;
    height: calc(100vh - var(--nav-h) - 4rem);
    max-height: 600px;
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    border: 1.5px solid var(--border);
    box-shadow: 0 0 80px rgba(255, 200, 0, 0.07), 0 40px 80px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.5s var(--ease) 0.1s both;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #0e0e0e;
}

/* Game overlay */
.game-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 14, 14, 0.85);
    backdrop-filter: blur(16px);
    z-index: 20;
    transition: opacity 0.3s var(--ease);
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    padding: 2rem;
}

.overlay-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: iconSpin 4s ease-in-out infinite;
}

.overlay-title {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.overlay-sub {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

.overlay-score {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.overlay-score span {
    color: var(--yellow);
    font-weight: 800;
    font-size: 2rem;
    display: block;
    margin-top: 0.3rem;
}

/* ==============
   ABOUT PAGE
   ============== */
body.about-page .about-main {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    /* Exactly fills the slot between nav and ribbon — no scroll */
    bottom: 56px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8%;
    gap: 4rem;
    z-index: 10;
}

.about-content {
    flex: 1;
    max-width: 520px;
    animation: fadeUp 0.7s var(--ease) 0.1s both;
    /* Ensure flex doesn't compress the button out of view */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Tighter eyebrow spacing for compact fit */
.about-content .eyebrow-tag {
    margin-bottom: 0.8rem;
}

.about-headline {
    /*
     * Clamp keeps headline compact on small screens.
     * Max 4rem ensures 2 lines fit without overflow.
     */
    font-size: clamp(2rem, 3.8vw, 4rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -2px;
    margin-bottom: 1.2rem;
}

.about-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.about-body p {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.7;
}

.about-body strong {
    color: var(--white);
}

.about-visual {
    flex: 0 0 320px;
    animation: fadeUp 0.7s var(--ease) 0.2s both;
}

.about-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: var(--glass);
}

.about-card-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.about-card-row:last-child {
    border-bottom: none;
}

.about-card-row:hover {
    background: rgba(255, 200, 0, 0.05);
}

.about-card-icon {
    font-size: 1.8rem;
}

.about-card-title {
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}

.about-card-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    margin-top: 0.1rem;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 900px) {
    body.home-page .hero-full {
        flex-direction: column;
        justify-content: center;
        padding: 2rem 5%;
    }

    .hero-right {
        display: none;
    }

    .hero-headline {
        font-size: 4rem;
    }

    body.game-page .game-main {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 5%;
    }

    .game-sidebar {
        flex-direction: row;
        flex: none;
        width: 100%;
        gap: 0.5rem;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    .game-title {
        font-size: 1.8rem;
    }

    .game-desc,
    .game-controls {
        display: none;
    }

    .game-score-box {
        padding: 0.5rem 0.8rem;
    }

    .score-label {
        font-size: 0.5rem;
        margin-bottom: 0.1rem;
    }

    .score-val {
        font-size: 1.4rem;
    }

    .game-wrap {
        flex: 1;
        width: 100%;
        height: auto;
        min-height: 50vh;
        max-height: none;
        touch-action: none;
        /* Prevent swipe-to-back/refresh interfering with game */
    }

    .mobile-hint {
        display: block;
    }

    body.about-page .about-main {
        flex-direction: column;
    }

    .about-visual {
        display: none;
    }
}

/* ==============
   GAMES HUB PAGE
   ============== */
body.games-hub-page .games-hub-main {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    bottom: 56px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 8%;
    gap: 2.5rem;
    z-index: 10;
}

.games-hub-header {
    text-align: center;
    animation: fadeUp 0.6s var(--ease) both;
}

.games-hub-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
}

.games-grid {
    display: flex;
    gap: 1.5rem;
    animation: fadeUp 0.7s var(--ease) 0.15s both;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.8rem 2rem;
    width: 340px;
    background: var(--glass);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    backdrop-filter: blur(16px);
    text-decoration: none;
    color: var(--white);
    transition: all 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 200, 0, 0.08) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}

.game-card:hover {
    border-color: rgba(255, 200, 0, 0.5);
    transform: translateY(-6px);
    box-shadow: 0 0 50px rgba(255, 200, 0, 0.1), 0 20px 60px rgba(0, 0, 0, 0.4);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card-emoji {
    font-size: 2.5rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 10px rgba(255, 200, 0, 0.4));
    transition: transform 0.3s var(--ease);
}

.game-card:hover .game-card-emoji {
    transform: scale(1.15) rotate(-5deg);
}

.game-card-info {
    flex: 1;
    min-width: 0;
}

.game-card-tag {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--yellow);
    margin-bottom: 0.3rem;
}

.game-card-name {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

.game-card-desc {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.6;
}

.game-card-arrow {
    font-size: 1.2rem;
    color: var(--muted);
    flex-shrink: 0;
    transition: all 0.3s var(--ease);
}

.game-card:hover .game-card-arrow {
    color: var(--yellow);
    transform: translateX(4px);
}

@media (max-width: 800px) {
    .games-grid {
        flex-direction: column;
    }

    .game-card {
        width: 100%;
        max-width: 400px;
    }
}