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

:root {
    --skibs-blue: #00a8ff;
    --skibs-dark: #1e1e1e;
    --skibs-bg: #000;
    --nav-height: 60px;
    
    /* Light Mode Variables */
    --light-bg: #f0f8ff;
    --light-text: #333;
    --light-shimmer-1: #e6f7ff;
    --light-shimmer-2: #d0efff;
}

body {
    background-color: var(--skibs-bg);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
}

/* Light Mode Override for specific pages */
body.light-mode .page:not(#page-skibs) {
    background: linear-gradient(135deg, var(--light-shimmer-1), var(--light-shimmer-2));
    color: var(--light-text);
    animation: shimmer 10s infinite alternate;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* Light Mode Text Overrides */
body.light-mode .page:not(#page-skibs) .header {
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #ddd;
    color: var(--light-text);
}

body.light-mode .page:not(#page-skibs) .search-bar {
    background-color: #fff;
    border: 1px solid #ddd;
}

body.light-mode .page:not(#page-skibs) .search-bar input {
    color: var(--light-text);
}

body.light-mode .page:not(#page-skibs) .content-center {
    color: #666;
}

body.light-mode .page:not(#page-skibs) .profile-header .avatar {
    background-color: #fff;
    border-color: var(--skibs-blue);
    color: #333;
}

body.light-mode .page:not(#page-skibs) .profile-tabs {
    border-color: #ddd;
}

body.light-mode .page:not(#page-skibs) .profile-tabs .tab {
    color: #888;
}

body.light-mode .page:not(#page-skibs) .profile-tabs .tab.active {
    color: var(--skibs-blue);
    border-bottom-color: var(--skibs-blue);
}

body.light-mode .page:not(#page-skibs) .grid-item {
    background-color: #fff;
    border: 1px solid #eee;
}

body.light-mode .bottom-nav {
    background-color: #fff;
    border-top: 1px solid #eee;
}

body.light-mode .nav-item {
    color: #999;
}

body.light-mode .nav-item.active {
    color: var(--skibs-blue);
}

#app-container {
    width: 100vw;
    height: 100vh; /* Fallback */
    height: 100dvh; /* Mobile fix */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Pages */
.page {
    flex: 1;
    display: none; /* Hidden by default */
    overflow-y: auto;
    height: calc(100vh - var(--nav-height)); /* Fallback */
    height: calc(100dvh - var(--nav-height)); /* Mobile fix */
    background-color: var(--skibs-bg);
}

.page.active {
    display: block;
}

/* Game View Page */
.game-content-view {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100% - 60px); /* Minus header */
    background: #000;
}

.game-content-view img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.back-btn {
    position: absolute;
    left: 20px;
    font-size: 16px;
    cursor: pointer;
    color: var(--skibs-blue);
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px; /* Added padding */
    background: rgba(0, 0, 0, 0.3); /* Slight background for better touch target */
    border-radius: 20px;
    z-index: 10;
}

/* Profile Game Item */
.grid-item.game-created {
    position: relative;
    border: 1px solid var(--skibs-blue);
}

.game-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 168, 255, 0.8); /* Semi-transparent blue */
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

/* --- SKIBS PAGE (FEED) --- */
#page-skibs {
    /* The feed container handles its own scrolling */
    overflow: hidden; 
    position: relative;
}

.feed-header {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.feed-header .toggle-btn {
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.3s, transform 0.2s;
}

.feed-header .toggle-btn.active {
    color: #fff;
    font-size: 18px;
    border-bottom: 2px solid #fff;
}

.feed-header .separator {
    margin: 0 10px;
    font-size: 12px;
    opacity: 0.5;
}

#feed-container {
    height: 100%;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    /* Hide scrollbar */
    scrollbar-width: none; 
}
#feed-container::-webkit-scrollbar { 
    display: none; 
}

.video-item {
    position: relative;
    height: 100%;
    width: 100%;
    scroll-snap-align: start;
    overflow: hidden;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain to prevent stretching */
    background-color: #000; /* Black background for letterboxing */
    display: block;
}

/* Overlay UI */
.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 20px 70px 20px; /* Extra bottom padding for nav bar */
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 40%;
}

.info-container {
    margin-bottom: 10px;
    pointer-events: auto;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    width: 80%;
}

.username {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--skibs-blue); /* Brand color */
}

.description {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Right Side Actions (Like, Comment, Game) */
.actions-container {
    position: absolute;
    right: 10px;
    bottom: 80px; /* Above nav bar */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    pointer-events: auto;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.action-btn span {
    font-size: 12px;
    margin-top: 5px;
    font-weight: 600;
}

.action-btn.liked i {
    color: #ff2d55;
}

.action-btn.report-btn i {
    font-size: 20px; /* Slightly smaller icon */
    opacity: 0.8;
}

.action-btn.report-btn:hover i {
    color: #ffcc00;
    opacity: 1;
}

/* Game Button (Spinning) */
.game-btn-container {
    margin-top: 10px;
}

.game-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.6);
    border: 2px solid var(--skibs-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    animation: spin 4s linear infinite;
    text-decoration: none;
    color: #fff;
    backdrop-filter: blur(4px);
}

/* --- OTHER PAGES --- */
.header {
    padding: 20px;
    border-bottom: 1px solid #333;
    background-color: #000;
    position: sticky;
    top: 0;
    z-index: 5;
}

.content-padding {
    padding: 20px;
}

.content-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
}

/* Search Page */
.search-bar {
    background-color: #333;
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: #fff;
    margin-left: 10px;
    width: 100%;
    font-size: 16px;
    outline: none;
}

.trending-tags .tag {
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid #333;
    border-radius: 20px;
    margin: 5px 5px 5px 0;
    font-size: 14px;
    color: var(--skibs-blue);
}

/* Create Page */
.upload-btn-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--skibs-blue), #00d2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #fff;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 168, 255, 0.5);
    cursor: pointer;
    transition: transform 0.2s;
}

.upload-btn-large:active {
    transform: scale(0.95);
}

/* Messages Page */
.message-list {
    display: flex;
    flex-direction: column;
}

.message-item {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.2s;
}

body.light-mode .message-item {
    border-bottom-color: #eee;
}

.message-item:hover {
    background-color: rgba(255,255,255,0.05);
}

body.light-mode .message-item:hover {
    background-color: rgba(0,0,0,0.02);
}

.message-item.unread {
    background-color: rgba(0, 168, 255, 0.1);
}

.msg-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    flex-shrink: 0;
}

.ai-avatar {
    background: linear-gradient(45deg, var(--skibs-blue), #a0e0ff);
    color: #fff;
}

.msg-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.msg-name {
    font-weight: bold;
    font-size: 16px;
}

.msg-time {
    font-size: 12px;
    color: #888;
}

.msg-preview {
    font-size: 14px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.light-mode .msg-name { color: #333; }
body.light-mode .msg-preview { color: #666; }

/* Search Page - Games */
.section-title {
    font-size: 18px;
    font-weight: bold;
    margin: 20px 0 10px 0;
    color: var(--skibs-blue);
}

.games-scroll {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 10px;
    margin-bottom: 20px;
    scrollbar-width: none;
}

.games-scroll::-webkit-scrollbar {
    display: none;
}

.game-card {
    min-width: 100px;
    height: 120px;
    background-color: #222;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #333;
}

body.light-mode .game-card {
    background-color: #fff;
    border-color: #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.game-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.game-card span {
    font-size: 12px;
    font-weight: 600;
}

/* Rankings Section */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.rank-item {
    display: flex;
    align-items: center;
    background-color: #222;
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid #333;
}

body.light-mode .rank-item {
    background-color: #fff;
    border-color: #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.rank-num {
    font-size: 18px;
    font-weight: bold;
    width: 30px;
    color: var(--skibs-blue);
}

.rank-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rank-avatar {
    font-size: 20px;
}

.rank-score {
    font-weight: bold;
    color: #aaa;
    font-size: 14px;
}

body.light-mode .rank-score {
    color: #666;
}

/* Profile Page */
.profile-header {
    padding: 30px 20px;
    text-align: center;
}

.avatar {
    width: 80px;
    height: 80px;
    background-color: #333;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 2px solid var(--skibs-blue);
}

.stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
    font-size: 14px;
}

.edit-profile-btn {
    background: transparent;
    border: 1px solid #555;
    color: #fff;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
}

body.light-mode .edit-profile-btn {
    border-color: #ccc;
    color: #333;
}

.profile-tabs {
    display: flex;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}

.profile-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    color: #777;
    cursor: pointer;
}

.profile-tabs .tab.active {
    color: #fff;
    border-bottom: 2px solid #fff;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
}

.grid-item {
    background-color: #222;
    aspect-ratio: 3/4;
}

/* --- BOTTOM NAVIGATION --- */
.bottom-nav {
    height: var(--nav-height);
    background-color: #000;
    border-top: 1px solid #222;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    flex-shrink: 0; /* Prevent shrinking */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #777;
    font-size: 10px;
    cursor: pointer;
    width: 16.66%; /* Adjusted for 6 items */
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-item.active {
    color: #fff;
}

/* New Create Button Style */
.nav-item.create-nav-btn {
    width: 16.66%; /* Adjusted for 6 items */
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-item.create-nav-btn .plus-icon {
    width: 40px; /* Slightly smaller to fit */
    height: 28px;
    background: #555; /* Grey as requested */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Removed side borders (parentheses) */
    box-sizing: content-box; 
}

/* Tab Switchers (Messages & Ranking) */
.tab-header {
    display: flex;
    justify-content: center;
    background: #000;
    padding: 10px 0;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 60px; /* Below main header */
    z-index: 4;
}

body.light-mode .tab-header {
    background: #fff;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    padding: 8px 20px;
    margin: 0 5px;
    cursor: pointer;
    font-weight: 600;
    color: #888;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #fff;
    border-bottom: 2px solid var(--skibs-blue);
}

body.light-mode .tab-btn.active {
    color: #000;
}

/* Klubs List Styles */
.klub-list {
    display: none; /* Hidden by default */
    padding: 10px;
}

.klub-list.active {
    display: block;
}

.klub-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #222;
}

body.light-mode .klub-item {
    border-bottom: 1px solid #eee;
}

.klub-avatar {
    width: 50px;
    height: 50px;
    border-radius: 10px; /* Square-ish for groups */
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}

.klub-info {
    flex: 1;
}

.klub-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.klub-members {
    font-size: 0.8rem;
    color: #888;
}

/* Audio Toggle on Video */


/* Create Page Options */
.create-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    padding-top: 40px;
}

.create-card {
    background-color: #222;
    border-radius: 15px;
    padding: 25px;
    width: 100%;
    max-width: 350px;
    text-align: center;
    border: 1px solid #333;
    transition: transform 0.2s;
}

body.light-mode .create-card {
    background-color: #fff;
    border-color: #eee;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.create-card:active {
    transform: scale(0.98);
}

.create-icon {
    font-size: 40px;
    color: var(--skibs-blue);
    margin-bottom: 15px;
}

.create-card h2 {
    margin-bottom: 10px;
    font-size: 20px;
}

.create-card p {
    color: #888;
    margin-bottom: 20px;
    font-size: 14px;
}

.create-card textarea {
    width: 100%;
    height: 80px;
    background-color: #111;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    color: #fff;
    margin-bottom: 15px;
    resize: none;
}

body.light-mode .create-card textarea {
    background-color: #f9f9f9;
    border-color: #ddd;
    color: #333;
}

.skibs-btn {
    background-color: var(--skibs-blue);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
}

.skibs-btn.ai-btn {
    background: linear-gradient(45deg, var(--skibs-blue), #a0e0ff);
}

.divider-text {
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

/* Ranking Page Styles */
.rank-item.gold { border-left: 4px solid #ffd700; }
.rank-item.silver { border-left: 4px solid #c0c0c0; }
.rank-item.bronze { border-left: 4px solid #cd7f32; }

/* Action Sheet / Modal */
.action-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: flex-end;
}

.action-sheet {
    background-color: #222;
    width: 100%;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 20px;
    animation: slideUp 0.3s ease-out;
}

body.light-mode .action-sheet {
    background-color: #fff;
    color: #333;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sheet-option {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #333;
    font-size: 16px;
    cursor: pointer;
}

body.light-mode .sheet-option {
    border-bottom-color: #eee;
}

.sheet-option:last-child {
    border-bottom: none;
    font-weight: bold;
    margin-top: 10px;
}

.sheet-option.danger {
    color: #ff2d55;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
