:root {
    --bg-color: #0d0d0d;
    --text-color: #ffffff;
    --accent-color: #7b2cbf;
    /* Deep Purple */
    --accent-light: #9d4edd;
    --glass-bg: rgba(20, 20, 20, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --secondary-text: #a0a0a0;
    --success-color: #00b894;
    --danger-color: #ff7675;
    --card-radius: 16px;
    --modal-radius: 24px;
    --nav-height: 80px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #000;
    color: var(--text-color);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Mobile Container - Fixed 9:16 Vertical Screen */
.mobile-container {
    height: 100%;
    aspect-ratio: 9/16;
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

/* On very wide screens, perhaps limit content width internally, but for now user asked for full vertical screen */
/* We will keep the bottom nav somewhat contained so it doesn't stretch 1920px wide if opened on desktop */
.bottom-nav {
    max-width: 600px;
    margin: 0 auto;
    /* Center it */
}

/* Modals to match */
.bottom-sheet {
    max-width: 600px;
    margin: 0 auto;
    /* Center horizontally */
    left: 0;
    right: 0;
}


/* Game Feed */
.game-feed {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

/* Loading State */
.loading-state {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 10;
    color: var(--secondary-text);
    font-size: 14px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error / Empty State in feed */
.feed-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    color: var(--secondary-text);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.game-card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 95px;
    /* Stop just above bottom nav */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;
    border-radius: 0 0 16px 16px;
    overflow: hidden;
}

.game-card.active {
    opacity: 1;
    transform: none;
    z-index: 2;
}

.game-preview {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #222, #333);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Itch.io Game Iframe */
.game-iframe {
    width: 100%;
    height: calc(100% + 38px);
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.game-preview .play-icon {
    font-size: 80px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.game-info-overlay {
    position: absolute;
    bottom: 100px;
    /* Above nav */
    left: 20px;
    right: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.game-info-overlay h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.game-info-overlay p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}


/* Bottom Nav */
.bottom-nav {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 70px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 35px;
    display: flex;
    justify-content: space-around;
    /* Distribute evenly */
    align-items: center;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 0 10px;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--secondary-text);
    /* Muted by default */
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8px;
    transition: transform 0.2s, color 0.2s;
    flex: 1;
    /* Equal width buttons */
}

.nav-btn:active {
    transform: scale(0.9);
}

.nav-btn .material-icons-round {
    font-size: 28px;
}

/* Active/Primary states for center actions */
.nav-btn.icon-btn {
    color: white;
    /* Brighter */
}

.nav-btn.icon-btn .material-icons-round {
    font-size: 26px;
    /* Slightly adjusted */
}

.nav-btn .badge {
    position: absolute;
    top: 5px;
    right: 15px;
    /* Adjusted due to flex spacing */
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 15px;
    text-align: center;
    display: none;
    /* Hidden if 0 */
}

/* Profile Button specific styling */
.profile-btn .avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent-color);
}

.profile-btn .avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* Like Button Animation */
@keyframes likeEffect {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

.icon-btn.liked .material-icons-round {
    color: var(--danger-color);
    animation: likeEffect 0.3s ease-out;
}


/* Comments Bottom Sheet */
.bottom-sheet {
    position: absolute;
    bottom: 0px;
    /* Start slightly off-screen or flush */
    left: 0;
    right: 0;
    height: 60vh;
    background: #1a1a1a;
    border-top-left-radius: var(--modal-radius);
    border-top-right-radius: var(--modal-radius);
    z-index: 200;
    transform: translateY(101%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 40px rgba(0, 0, 0, 0.6);
}

.bottom-sheet.open {
    transform: translateY(0);
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.sheet-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sheet-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.comment-item {
    margin-bottom: 15px;
    font-size: 13px;
    line-height: 1.4;
    border-left: 2px solid var(--accent-color);
    padding-left: 10px;
    animation: fadeIn 0.3s ease-in;
}

.comment-item .author {
    font-weight: 700;
    color: var(--accent-light);
    margin-right: 5px;
}

.empty-state {
    text-align: center;
    color: var(--secondary-text);
    margin-top: 50px;
    font-size: 14px;
}

.comment-input-area {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    /* Separator */
    display: flex;
    gap: 10px;
    background: #222;
    /* Slightly distinguishing bg */
}

.comment-input-area input {
    flex: 1;
    background: #333;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    outline: none;
}

.comment-input-area button {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}


/* Profile Overlay */
.full-screen-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0d0d0d;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
}

.full-screen-modal.open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.close-fab {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-content {
    margin-top: 40px;
    text-align: center;
    width: 100%;
}

.avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    border: 4px solid var(--accent-color);
}

.avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.username {
    font-size: 22px;
    margin-bottom: 5px;
}

.level-badge {
    display: inline-block;
    background: #333;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--accent-light);
    font-weight: 600;
    margin-bottom: 25px;
}

.xp-section {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: left;
}

.xp-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ccc;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    width: 0%;
    transition: width 0.5s ease-out;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 30px;
}

.stat-card {
    background: #1a1a1a;
    padding: 15px 10px;
    border-radius: 16px;
    text-align: center;
    display: flex;
    /* Flex to center content vertically if needed */
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-card .icon {
    font-size: 24px;
    color: var(--accent-color);
}

.stat-card .value {
    font-size: 18px;
    font-weight: 700;
}

.stat-card .label {
    font-size: 10px;
    color: var(--secondary-text);
}

.recent-activity {
    text-align: left;
}

.recent-activity h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--secondary-text);
}

.activity-item {
    font-size: 13px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}


/* Toast */
.toast-container {
    position: absolute;
    top: 80px;
    /* Below safe area / top */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toast {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: all;
    animation: fadeInSlide 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.toast .icon {
    color: var(--accent-light);
    font-size: 16px;
}