:root {
    --primary-color: #209869;
    --primary-dark: #135d41;
    --accent-color: #ffcc00;
    --text-white: #ffffff;
    --text-dark: #2c3e50;
    --bg-gradient: linear-gradient(135deg, #209869 0%, #0e4b34 100%);
    --card-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* Transition timings */
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s;
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    background: #0e4b34;
}

/* Global Premium Scrollbar */
html {
    scrollbar-gutter: stable;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0e4b34;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    border: 2px solid #0e4b34;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    z-index: -1;
}

.background-decor::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: rotate(30deg);
}

/* Main layout simplified: Single centered column */
.container {
    padding: 2rem 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

@media (max-width: 1200px) {
    .container {
        padding: 2rem;
        max-width: 100%;
    }
}

.header {
    margin-bottom: 3rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-weight: 300;
    opacity: 0.8;
    font-size: 1.1rem;
}

.game-card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    padding: 3rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    transition: transform 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    will-change: transform;
}

.game-card.celebrate {
    border-color: var(--accent-color);
    box-shadow: 0 0 50px rgba(255, 204, 0, 0.6);
    transform: scale(1.02);
}

.numbers-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    justify-items: center;
    min-height: 60px;
}

@media (min-width: 480px) {
    .numbers-display {
        grid-template-columns: repeat(6, 1fr);
    }
}


.ball {
    width: 60px;
    height: 60px;
    background-color: var(--text-white);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    border-radius: 50%;
    box-shadow: inset -5px -5px 15px rgba(0, 0, 0, 0.1), 5px 10px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ball.placeholder {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

.ball.new-number {
    animation: popIn 0.5s forwards;
    will-change: transform, opacity;
}

@keyframes popIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }

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

.generate-btn {
    background-color: var(--accent-color);
    color: var(--text-dark);
    border: none;
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 3rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 204, 0, 0.3);
}

.generate-btn:hover {
    transform: scale(1.05);
    background-color: #ffe066;
    box-shadow: 0 6px 20px rgba(255, 204, 0, 0.4);
}

.generate-btn:active {
    transform: scale(0.98);
}

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

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

    20% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

.actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal) ease;
    flex-shrink: 0;
    aspect-ratio: 1;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.9);
}

.history-section {
    margin-top: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.history-section h3 {
    font-size: 1rem;
    margin-bottom: 0;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.clear-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.clear-btn:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff4d4d;
    border-color: rgba(255, 0, 0, 0.2);
}

#history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Removed local scroll styles as requested */

.history-item {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 0.8rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-balls {
    display: flex;
    gap: 0.5rem;
}

.history-copy-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.history-copy-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.history-item:last-child {
    border-bottom: none;
}

.history-ball {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    background: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-dark);
    color: white;
    padding: 1rem 2rem;
    border-radius: 2rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Smoother entry for new items */
.slide-in {
    animation: slideDown 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
        /* Arbitrary enough height */
        margin-bottom: 0;
        /* Let normal flow handle it */
    }
}

.footer {
    margin-top: 2.5rem;
    font-size: 0.9rem;
    opacity: 0.6;
}

/* SEO Content - Premium & Unobtrusive */
.seo-content {
    margin-top: 3rem;
    width: 100%;
    max-width: 900px;
    background: rgba(0, 0, 0, 0.15);
    /* Darker, subtle background */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    padding: 2.5rem;

    /* Grid Layout for readability */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;

    text-align: left;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.7;
}

.seo-content h2,
.seo-content h3 {
    color: var(--accent-color);
    /* Gold accent for headers */
    font-size: 1.2rem;
    margin-bottom: 1rem;
    margin-top: 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* First H2 spans full width to act as section header */
.seo-content h2:first-of-type {
    grid-column: 1 / -1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-white);
}

.seo-content ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
    list-style-type: square;
}

.seo-content li {
    margin-bottom: 0.5rem;
}

.seo-content strong,
.seo-content em {
    color: white;
    font-weight: 600;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .seo-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1.5rem;
        margin-top: 2rem;
        text-align: left;
        /* Keep left align for readability */
    }

    .seo-content h2:first-of-type {
        font-size: 1.1rem;
    }
}

/* Mobile Responsiveness - Moved to end for specificity precedence */
@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .logo-img {
        width: 35px;
        height: 35px;
    }

    .game-card {
        padding: 2rem 1rem;
        gap: 1.5rem;
    }

    /* Use Flexbox for perfect centering on mobile */
    .numbers-display {
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
        /* Ensure single line */
        gap: 0.5rem;
        min-height: 40px;
        width: 100%;
    }

    .ball {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        flex-shrink: 0;
        /* Prevent squashing if possible, use media query for smaller screens */
    }

    .generate-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }

    .actions {
        flex-direction: column;
        width: 100%;
    }

    .copy-btn {
        width: 48px;
        height: 48px;
        margin-top: 0.5rem;
    }
}

/* Small mobile devices (iPhone SE, older Androids) */
@media (max-width: 380px) {
    .container {
        padding: 1rem;
    }

    .game-card {
        padding: 1.5rem 0.5rem;
        /* Reduced padding further for space */
    }

    .numbers-display {
        gap: 0.25rem;
        min-height: 32px;
    }

    .ball {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
    }
}