/* ===== Variables ===== */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    
    --green: #4ade80;
    --green-dark: #22c55e;
    --pink: #f472b6;
    --pink-dark: #ec4899;
    --yellow: #fbbf24;
    --yellow-dark: #f59e0b;
    --purple: #a78bfa;
    --blue: #60a5fa;
    --red: #f87171;
    
    --text: #ffffff;
    --text-muted: #94a3b8;
    
    --radius: 16px;
    --radius-lg: 24px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Floating Beans Background ===== */
.beans-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-bean {
    position: absolute;
    font-size: 2rem;
    opacity: 0.15;
    animation: floatBean 20s linear infinite;
}

@keyframes floatBean {
    0% {
        transform: translateY(100vh) rotate(0deg);
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
    }
}

/* ===== Container ===== */
.game-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo {
    height: 50px;
    width: auto;
    transition: transform 0.2s;
}

.site-logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ===== Hero ===== */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    padding: 60px 0;
    min-height: 70vh;
}

.title-badge {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--yellow) 0%, var(--red) 100%);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #000;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.hero-title {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero-title .highlight {
    color: var(--yellow);
    text-shadow: 4px 4px 0 var(--yellow-dark);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    max-width: 500px;
}

/* ===== Play Section ===== */
.play-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.name-input-wrap {
    position: relative;
    max-width: 350px;
}

.name-input {
    width: 100%;
    padding: 16px 20px;
    padding-right: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
}

.name-input::placeholder {
    color: var(--text-muted);
}

.name-input:focus {
    border-color: var(--green);
    background: rgba(255, 255, 255, 0.15);
}

.input-bean {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.play-btn {
    position: relative;
    max-width: 350px;
    padding: 20px 40px;
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    border: none;
    border-radius: var(--radius);
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    box-shadow: 0 6px 0 #15803d, var(--shadow);
}

.play-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 0 #15803d, var(--shadow);
}

.play-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #15803d;
}

.play-btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.player-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--green);
    border-radius: 50%;
    animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ===== Game Modes ===== */
.game-modes {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.mode-card.active {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--green);
}

.mode-icon {
    font-size: 1.75rem;
}

.mode-name {
    font-weight: 700;
    font-size: 1rem;
}

.mode-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Hero Beans ===== */
.hero-beans {
    position: relative;
    height: 400px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.bean {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bean-1 {
    left: 10%;
    bottom: 20px;
    animation: beanJump 2s ease-in-out infinite;
    animation-delay: 0s;
}

.bean-2 {
    left: 40%;
    bottom: 60px;
    animation: beanJump 2s ease-in-out infinite;
    animation-delay: 0.3s;
    z-index: 2;
}

.bean-3 {
    right: 10%;
    bottom: 20px;
    animation: beanJump 2s ease-in-out infinite;
    animation-delay: 0.6s;
}

@keyframes beanJump {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}

.bean-body {
    width: 80px;
    height: 120px;
    border-radius: 40px 40px 35px 35px;
    position: relative;
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.2), inset 10px 10px 20px rgba(255,255,255,0.1);
}

.bean-2 .bean-body {
    width: 100px;
    height: 150px;
    border-radius: 50px 50px 45px 45px;
}

.bean-body.green { background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%); }
.bean-body.pink { background: linear-gradient(135deg, #f472b6 0%, #ec4899 100%); }
.bean-body.yellow { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); }

.bean-face {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
}

.bean-eyes {
    display: flex;
    gap: 12px;
}

.bean-2 .bean-eyes {
    gap: 16px;
}

.eye {
    width: 14px;
    height: 20px;
    background: #000;
    border-radius: 50%;
    position: relative;
}

.bean-2 .eye {
    width: 18px;
    height: 26px;
}

.eye::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 3px;
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
}

.bean-accessory {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
}

.bean-shadow {
    width: 60px;
    height: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    margin-top: 10px;
    animation: shadowPulse 2s ease-in-out infinite;
}

.bean-2 .bean-shadow {
    width: 80px;
}

@keyframes shadowPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(0.8); opacity: 0.5; }
}

/* ===== Features ===== */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 60px 0;
}

.feature-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-8px);
    border-color: var(--purple);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ===== Section Title ===== */
.section-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 32px;
}

/* ===== Leaderboard ===== */
.leaderboard-section {
    padding: 60px 0;
}

.leaderboard {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lb-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.lb-entry:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lb-entry.gold {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-color: var(--yellow);
}

.lb-entry.silver {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.2) 0%, rgba(100, 116, 139, 0.1) 100%);
    border-color: #94a3b8;
}

.lb-entry.bronze {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.2) 0%, rgba(234, 88, 12, 0.1) 100%);
    border-color: #fb923c;
}

.lb-rank {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    width: 40px;
    text-align: center;
}

.lb-entry.gold .lb-rank { color: var(--yellow); }
.lb-entry.silver .lb-rank { color: #94a3b8; }
.lb-entry.bronze .lb-rank { color: #fb923c; }

.lb-player {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.lb-bean {
    font-size: 1.5rem;
}

.lb-name {
    font-weight: 700;
}

.lb-wins {
    font-size: 0.9rem;
    color: var(--green);
    font-weight: 600;
}

/* ===== How to Play ===== */
.how-to-play {
    padding: 60px 0;
}

.controls-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.key-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.key-row {
    display: flex;
    gap: 4px;
}

.key {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    padding: 0 16px;
    background: linear-gradient(180deg, #3a3a5c 0%, #2a2a4c 100%);
    border: 2px solid #4a4a6c;
    border-bottom-width: 4px;
    border-radius: 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.key.wide {
    min-width: 120px;
}

.control-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== Footer ===== */
.footer {
    padding: 40px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 40px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-logo-img {
    height: 36px;
    width: auto;
}

.footer-brand p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text);
}

/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-screen.active {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    width: 150px;
    height: auto;
    animation: loadingBounce 0.6s ease-in-out infinite;
}

@keyframes loadingBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

.loading-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    margin: 20px 0;
}

.loading-bar {
    width: 300px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    overflow: hidden;
    margin: 0 auto 20px;
}

.loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
    border-radius: 100px;
    animation: loadingProgress 4s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    50% { width: 85%; }
    100% { width: 95%; }
}

.loading-tip {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 40px 0;
    }

    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }

    .play-section {
        align-items: center;
    }

    .name-input-wrap,
    .play-btn {
        max-width: 100%;
        width: 100%;
    }

    .game-modes {
        justify-content: center;
    }

    .hero-beans {
        height: 250px;
        order: -1;
    }

    .bean-body {
        width: 60px;
        height: 90px;
    }

    .bean-2 .bean-body {
        width: 75px;
        height: 110px;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }

    .controls-grid {
        gap: 24px;
    }
}
