:root {
    --primary-color: #1e3c72;
    --secondary-color: #2a5298;
    --accent-color: #ff7e5f;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --text-color: #495057;
    --border-radius: 12px;
    --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background: #f9f9f9;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

.welcome-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.welcome-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    transform: rotate(30deg);
}

h1,
h2,
h3 {
    margin: 0 0 1rem;
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    color: var(--dark-color);
    padding-bottom: 0.75rem;
    margin-top: 2.5rem;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    border-radius: 2px;
}

h3 {
    font-size: 1.4rem;
    color: var(--dark-color);
    margin-top: 1.5rem;
}


/* --- START: Interactive 2-Column Hub (SHARED STYLES) --- */
.interactive-hub-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2.5rem 0;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
    gap: 2rem;
}

.hub-grid-column {
    flex: 2;
    /* Make grid column wider */
    min-width: 320px;
}

.hub-preview-column {
    flex: 1;
    /* Make preview column narrower */
    min-width: 340px;
    /* Min width to fit phone/pc preview */
    max-width: 400px;
    /* Max width to fit phone */
    margin: 0 auto;
}

.game-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    /* Bigger min size */
    gap: 1.5rem;
    /* More gap */
    max-height: 700px;
    /* Taller */
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
}

.hub-card-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--dark-color);
    padding: 1.25rem;
    /* More padding */
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: #f8f9fa;
    border: 1px solid #eee;
    cursor: pointer;
}

.hub-card-button:hover {
    transform: translateY(-5px) scale(1.03);
    /* More reactive */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
    background: white;
    border-color: var(--primary-color);
}

.hub-card-button.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(42, 82, 152, 0.4);
}

.hub-card-button img {
    width: 80px;
    /* Bigger image */
    height: 80px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    background: white;
    border: 1px solid #ddd;
}

.hub-card-button span {
    font-size: 0.9rem;
    /* Bigger font */
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
    min-height: 2.6em;
}

.hub-preview-area {
    position: relative;
    width: 100%;
    padding-top: 1rem;
}

/* --- Mobile Phone Frame CSS --- */
.phone-preview-frame {
    width: 100%;
    max-width: 375px;
    /* iPhone X width */
    height: 720px;
    /* Taller */
    margin: 0 auto;
    background: #111;
    border: 12px solid #111;
    border-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    padding: 0;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 28px;
    overflow: hidden;
    /* This clips the iframe */
    position: relative;
}

.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 20px;
    background: #111;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    z-index: 10;
}

#mobilePreviewFrame {
    width: 100%;
    height: 100%;
    border: none;
    background: #f9f9f9;
    /* BG for the iframe */
}

/* --- PC Preview Frame CSS --- */
.pc-preview-frame {
    width: 100%;
    height: 350px;
    margin: 0 auto;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    position: relative;
    padding: 0;
    overflow: hidden;
    /* Clips the iframe */
}

#pcPreviewFrame {
    width: 100%;
    height: 100%;
    border: none;
    background: #f9f9f9;
}

.hub-preview-column.pc-preview {
    max-width: 800px;
    flex: 1.5;
    /* Give it a bit more weight */
}

.preview-play-button-container {
    text-align: center;
    margin-top: 1.5rem;
}

.preview-play-button {
    font-size: 1.2rem;
    padding: 0.8rem 2rem;
}

@keyframes uiFadeEffect {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- END: Interactive 2-Column Hub --- */


.welcome-content {
    max-width: 800px;
    margin-top: 1.5rem;
}

.username {
    color: var(--accent-color);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.welcome-message {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    opacity: 0.95;
    position: relative;
    padding-left: 1.5rem;
}

.welcome-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    height: 60%;
    width: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

.login-banner {
    display: none;
}

.auth-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.button-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 600px;
    width: 100%;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    min-width: 150px;
    text-align: center;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-google {
    background-color: #fff;
    color: #757575;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-google:hover {
    background-color: #f8f9fa;
    border-color: #ccc;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    background-color: #ff6a45;
}

.btn-outline:hover {
    background-color: rgba(30, 60, 114, 0.05);
}

.btn i {
    margin-right: 0.5rem;
}

.user-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-dashboard {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.dashboard-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.dashboard-card h4 {
    margin: 0 0 0.5rem 0;
    color: var(--dark-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-card .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.dashboard-card .description {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
}

.popular-games-container {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.section-subtitle {
    color: #6c757d;
    font-size: 0.95rem;
    margin: -0.5rem 0 1rem;
    font-weight: 500;
}

.popular-games-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.popular-game-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.popular-game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.popular-game-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.popular-game-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.popular-game-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark-color);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popular-game-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: auto;
}

.popular-game-stat {
    background: rgba(30, 60, 114, 0.05);
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
}

.popular-game-stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.popular-game-stat-value {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.monthly-stat .popular-game-stat-value {
    color: var(--accent-color);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.game-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.game-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.game-info {
    flex: 1;
}

.game-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.game-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

.subscription-container {
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.token-balance {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* Added for responsiveness */
    gap: 10px;
    /* Added for responsiveness */
}

.auth-button {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: var(--transition);
}

.auth-button:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

@media (max-width: 992px) {

    .popular-games-row,
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .interactive-hub-container {
        flex-direction: column;
    }

    .hub-preview-column {
        max-width: 375px;
        /* Lock to phone width */
        min-width: 320px;
        flex: 1;
    }

    .hub-grid-column {
        flex: 1;
    }

    .hub-preview-column.pc-preview {
        max-width: 600px;
        /* Allow it to be wider */
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-top: 2rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .welcome-section {
        padding: 1.75rem;
    }

    .welcome-message {
        font-size: 1.1rem;
        padding-left: 1rem;
    }

    .user-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .button-container {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .phone-preview-frame {
        height: 600px;
    }

    .pc-preview-frame {
        height: 300px;
    }

    .game-hub-grid {
        max-height: 400px;
    }
}

@media (max-width: 576px) {
    body {
        padding: 0;
    }

    /* Let container handle padding */
    .container {
        padding: 0 10px;
    }

    /* Add padding to container */
    .welcome-section {
        padding: 1.5rem 1rem;
    }

    .popular-games-row,
    .game-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .game-hub-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.75rem;
    }

    .hub-card-button img {
        width: 60px;
        height: 60px;
    }

    .hub-card-button span {
        font-size: 0.8rem;
    }

    .hub-preview-column {
        min-width: 100%;
    }

    .pc-preview-frame {
        height: 300px;
        /* Adjust PC frame height */
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }

    .welcome-message {
        font-size: 1rem;
        padding-left: 0.75rem;
    }

    .welcome-message::before {
        width: 3px;
    }

    .phone-preview-frame {
        height: 568px;
    }

    /* iPhone 5 dimensions */
    .pc-preview-frame {
        height: 250px;
        /* Adjust PC frame height */
    }

    .game-hub-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}