@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Light Mode Variables */
    --bg-color: #f0f2f5;
    --text-color: #1a1a1a;
    --text-muted: #666;
    --card-bg: rgba(255, 255, 255, 0.6);
    --card-border: rgba(255, 255, 255, 0.4);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent-color: #10b981;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --gradient-bg: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.6);
    --card-border: rgba(255, 255, 255, 0.05);
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --accent-color: #34d399;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --gradient-bg: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

/* Rank Colors */
:root {
    --rank-standard: #64748b;
    --rank-pro: #22c55e;
    --rank-ultra: #3b82f6;
    --rank-vip: #a855f7;
    --rank-moderator: #f97316;
    --rank-administrator: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    background: var(--gradient-bg);
    color: var(--text-color);
    min-height: calc(var(--vh, 1vh) * 100);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding: 0;
    overflow-x: hidden;
}

.sidebar {
    width: 280px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--card-border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    height: calc(var(--vh, 1vh) * 100);
    overflow-y: auto;
}

/* Background Animated Elements */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate;
    pointer-events: none;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-color);
    bottom: -50px;
    right: -50px;
    animation-delay: -10s;
}

/* Rank Widget */
.rank-widget {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
    backdrop-filter: blur(10px);
    font-weight: bold;
    color: white;
    transition: all 1s ease;
}

/* Broadcast Banner */
.broadcast-banner {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
    padding: 1rem 3rem;
    border-radius: 0 0 20px 20px;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.5);
    transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: center;
}
.broadcast-banner.show {
    top: 0;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

header {
    width: 100%;
    max-width: 1000px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.live-indicator {
    width: 12px;
    height: 12px;
    background-color: var(--accent-color);
    border-radius: 50%;
    position: relative;
}
.live-indicator::after {
    content: '';
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    background-color: var(--accent-color);
    border-radius: 50%;
    opacity: 0.4;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(2); opacity: 0; }
}

/* LiveChat Sidebar */
.livechat-sidebar {
    position: fixed;
    top: 0;
    left: -350px;
    bottom: 0;
    width: 350px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 30px rgba(0,0,0,0.5);
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.livechat-sidebar.open {
    left: 0;
}

.friends-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    bottom: 0;
    width: 350px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--card-border);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0,0,0,0.5);
    transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#friends-slider-toggle:checked ~ .friends-sidebar {
    right: 0;
}
.livechat-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-color);
}
.livechat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.livechat-messages::-webkit-scrollbar { width: 6px; }
.livechat-messages::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }
.chat-msg {
    background: rgba(0,0,0,0.2);
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
    word-wrap: break-word;
    font-size: 0.95rem;
    animation: fadeInUp 0.3s ease-out;
}
.chat-rank {
    font-weight: 800;
    margin-right: 0.2rem;
}
.chat-username {
    font-weight: bold;
    margin-right: 0.5rem;
    color: var(--text-color);
}
.chat-text {
    color: var(--text-muted);
}
.livechat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 0.5rem;
}
.livechat-input {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 0.8rem;
    border-radius: 8px;
    outline: none;
}
.livechat-input:focus { border-color: var(--primary-color); }
.livechat-send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.livechat-send-btn:hover { background: var(--primary-hover); }
.livechat-toggle-btn {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    font-size: 1.5rem;
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, background 0.3s ease;
}
.livechat-toggle-btn.open {
    left: 350px;
    border-radius: 12px 0 0 12px;
}
.livechat-toggle-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-50%) scale(1.08);
}

.livechat-toggle-btn ion-icon {
    pointer-events: none;
}

/* Animated Colored Icons */
ion-icon {
    transition: transform 0.3s ease, filter 0.3s ease, color 0.3s ease;
    filter: drop-shadow(0 0 2px currentColor);
}

/* Hover animations for icons inside buttons or interactive elements */
button:hover ion-icon, .app-card:hover ion-icon, .sidebar-link:hover ion-icon, .admin-tab:hover ion-icon, .setting-row:hover ion-icon {
    animation: iconPulse 0.5s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 8px currentColor);
}

@keyframes iconPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

/* Give base icons a slight tint based on their container color or primary theme */
.sidebar-link ion-icon { color: var(--primary-color); }
.app-card ion-icon { color: var(--accent-color); }
h2 ion-icon, h3 ion-icon { color: #ef4444; }
/* livechat sidebar open state via .open class - toggle button hidden when sidebar is open */

.friends-toggle-btn {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
    font-size: 1.5rem;
    transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s ease;
}
#friends-slider-toggle:checked ~ .friends-toggle-btn { right: 350px; background: var(--card-bg); color: var(--text-color); border: 1px solid var(--card-border); }

.friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: 0.3s;
}
.friend-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--primary-color);
}
.friend-item-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* Theme Toggle */
.theme-switch-wrapper { display: flex; align-items: center; }
.theme-switch { display: inline-block; height: 34px; position: relative; width: 60px; }
.theme-switch input { display: none; }
.slider { background-color: #cbd5e1; bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0; transition: .4s; border-radius: 34px; }
.slider:before { background-color: #fff; bottom: 4px; content: ""; height: 26px; left: 4px; position: absolute; transition: .4s; width: 26px; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(26px); }
.slider-icon { position: absolute; top: 50%; transform: translateY(-50%); font-size: 14px; z-index: 1; pointer-events: none; }
.sun-icon { left: 8px; color: #f59e0b; opacity: 1; transition: 0.3s; }
.moon-icon { right: 8px; color: #f1f5f9; opacity: 0; transition: 0.3s; }
input:checked ~ .sun-icon { opacity: 0; }
input:checked ~ .moon-icon { opacity: 1; }

/* Dashboard List Layout */
.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
}

.section-title {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 0.5rem;
    animation: fadeInUp 0.5s ease-out backwards;
}

.row-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.8s ease-out backwards;
}

.row-card:hover {
    transform: translateX(10px);
    box-shadow: 0 15px 40px 0 rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

/* Stagger animations */
.row-card:nth-child(1) { animation-delay: 0.1s; }
.row-card:nth-child(2) { animation-delay: 0.2s; }
.row-card:nth-child(3) { animation-delay: 0.3s; }
.row-card:nth-child(4) { animation-delay: 0.4s; }
.row-card:nth-child(5) { animation-delay: 0.5s; }
.row-card:nth-child(6) { animation-delay: 0.6s; }

.row-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-width: 250px;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

.card-footer {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.row-middle {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.row-right {
    min-width: 150px;
    display: flex;
    justify-content: flex-end;
}

.card-value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
}

.card-unit {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 5px;
}

.joke-text {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-muted);
    font-style: italic;
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(150, 150, 150, 0.2);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 5px;
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.high { background: #ef4444; }
.progress-bar.medium { background: #f59e0b; }

/* File Upload Zone */
.upload-zone {
    border: 2px dashed var(--card-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}
[data-theme="dark"] .upload-zone { background: rgba(255,255,255,0.02); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary-color); background: rgba(99, 102, 241, 0.05); transform: translateY(-2px); }
.upload-zone p { font-size: 1.1rem; font-weight: 500; }

/* File List */
.file-list-container { margin-top: 2rem; }
.file-list-container h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-color); }
.file-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; max-height: 300px; overflow-y: auto; padding-right: 10px; }
.file-list::-webkit-scrollbar { width: 6px; }
.file-list::-webkit-scrollbar-track { background: transparent; }
.file-list::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 3px; }

.file-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; background: rgba(0,0,0,0.03); border: 1px solid var(--card-border);
    border-radius: 12px; transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeInUp 0.5s ease-out;
}
[data-theme="dark"] .file-item { background: rgba(255,255,255,0.03); }
.file-item:hover { transform: translateX(5px); border-color: var(--primary-color); }

.file-info { display: flex; align-items: center; gap: 1rem; overflow: hidden; }
.file-info ion-icon { font-size: 1.5rem; color: var(--accent-color); }
.file-name { font-weight: 500; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.file-meta { font-size: 0.9rem; color: var(--text-muted); }
.file-actions a { color: var(--primary-color); text-decoration: none; font-weight: 600; padding: 0.5rem 1rem; background: rgba(99, 102, 241, 0.1); border-radius: 8px; transition: all 0.2s; }
.file-actions a:hover { background: var(--primary-color); color: white; }

@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* App-like Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--card-border);
    z-index: 9999;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.3);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    list-style: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    gap: 4px;
    transition: 0.3s;
    width: 25%;
}

.nav-item ion-icon {
    font-size: 1.6rem;
    transition: 0.3s;
}

.nav-item:active, .nav-item.active {
    color: var(--primary-color);
}

.nav-item:active ion-icon, .nav-item.active ion-icon {
    transform: translateY(-4px);
    filter: drop-shadow(0 4px 8px rgba(99, 102, 241, 0.5));
}

/* User Sidebar */
.glass-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: calc(var(--vh, 1vh) * 100);
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255,255,255,0.05);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 1rem;
}

.close-sidebar-btn {
    cursor: pointer;
    font-size: 2rem;
    color: var(--text-muted);
    transition: 0.3s;
}

.close-sidebar-btn:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

#user-sidebar-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 10000;
    background: var(--primary-color);
    border: none;
    border-radius: 12px 0 0 12px;
    width: 50px;
    height: 50px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s ease;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}

.glass-sidebar.open ~ #user-sidebar-toggle {
    right: 320px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--card-border);
}

#user-sidebar-toggle:hover {
    background: var(--primary-hover);
}

.sidebar-rank-group {
    margin-bottom: 1.5rem;
}

.sidebar-rank-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    margin-bottom: 0.8rem;
    opacity: 0.8;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.02);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 0.5rem;
    transition: 0.3s;
}

.sidebar-user:hover {
    background: rgba(255,255,255,0.05);
    transform: translateX(-5px);
    border-color: rgba(255,255,255,0.15);
}

.sidebar-avatar {
    position: relative;
}

.sidebar-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
}

.status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-color);
}
.status-Online { background-color: #10b981; box-shadow: 0 0 10px #10b981; }
.status-AFK { background-color: #f59e0b; box-shadow: 0 0 10px #f59e0b; }
.status-DND { background-color: #ef4444; box-shadow: 0 0 10px #ef4444; }
.status-Offline { background-color: #6b7280; }


/* --- MOBILE SCALING SYSTEM --- */

body.mobile-device {
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    
    /* Safe Area for iOS Notches & Android Cutouts */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

body.ios-device .bottom-nav {
    /* Extra padding for iOS Home Indicator */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

body.mobile-device .main-content {
    /* Account for safe areas in scrolling containers */
    padding-left: calc(1rem + env(safe-area-inset-left)) !important;
    padding-right: calc(1rem + env(safe-area-inset-right)) !important;
}

/* Sortable JS styles */
.sortable-ghost {
    opacity: 0.4;
    transform: scale(0.95);
}
.sortable-chosen {
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 0 20px var(--primary-color) !important;
}
.sortable-drag {
    cursor: grabbing !important;
}

@media (max-width: 768px) {
    /* Global Mobile Adjustments */
    html, body {
        flex-direction: column !important;
        padding-bottom: 0px !important; /* Removed 80px bottom padding since nav is gone */
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
        position: relative;
    }
    .main-content {
        padding: 1rem !important;
        height: auto !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    /* Hide Desktop Sidebar/Nav */
    .sidebar { display: none !important; }
    .nav-links { display: none !important; }
    
    /* Hide Bottom Nav per user request */
    .bottom-nav { display: none !important; }

    /* Typography & Logo */
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.2rem !important; }

    .mario-logo {
        font-size: 2.2rem !important;
        justify-content: flex-start !important;
        padding-left: 1rem !important;
    }

    /* Apple Watch Grid Layout for Mainpage */
    .grid-container {
        display: grid !important;
        grid-template-columns: repeat(3, 80px) !important;
        justify-content: start !important;
        justify-items: start !important;
        align-items: center !important;
        gap: 15px !important;
        padding: 1rem !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
    }

    .func-card {
        width: 80px !important;
        height: 80px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    .func-card:nth-child(even) {
        /* Removed the confusing translateY offset for a clean grid */
        transform: none !important;
    }
    
    .func-card:hover {
        transform: scale(1.1) !important;
    }

    .func-title, .func-desc {
        display: none !important;
    }

    .icon-wrapper {
        margin: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        background: transparent !important;
    }
    .icon-wrapper::after { display: none !important; }

    .func-icon {
        font-size: 2.2rem !important;
        margin: 0 !important;
    }

    /* Subpage Lists (Admin, System, etc) */
    .row-card, .dashboard-list .row-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1.5rem !important;
        padding: 1.2rem !important;
        width: 100% !important;
    }
    .row-left { width: 100% !important; min-width: unset !important; }
    .row-middle { width: 100% !important; }
    .row-right { width: 100% !important; justify-content: flex-start !important; }
    .action-btn { width: 100% !important; text-align: center; justify-content: center; }

    /* Tables (Admin) */
    table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--card-border);
        border-radius: 8px;
    }
    th, td { padding: 0.8rem !important; }

    /* LiveChat & Friends Sidebars */
    .livechat-sidebar, .friends-sidebar {
        width: 100% !important;
        height: calc(calc(var(--vh, 1vh) * 100) - 70px) !important;
    }
    .livechat-sidebar { left: -100% !important; }
    .livechat-sidebar.open { left: 0 !important; }
    
    .friends-sidebar { right: -100% !important; }
    #friends-slider-toggle:checked ~ .friends-sidebar { right: 0 !important; }
    
    .livechat-toggle-btn.open { left: calc(100% - 40px) !important; }
    #friends-slider-toggle:checked ~ .friends-toggle-btn { right: calc(100% - 40px) !important; background: var(--card-bg); color: var(--text-color); border: 1px solid var(--card-border); }

    .livechat-toggle-btn, .friends-toggle-btn {
        width: 40px !important;
        height: 60px !important;
        font-size: 1.2rem !important;
    }

    /* Mobile HUD System */
    
    /* Rank Widget -> Top Left */
    .rank-widget {
        bottom: unset !important;
        top: 15px !important;
        left: 15px !important;
        transform: none !important;
        width: auto !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
        z-index: 10001 !important;
        border-radius: 30px !important;
    }
    
    /* Account Settings & Logout -> Top Right */
    .account-widget-container {
        bottom: unset !important;
        top: 15px !important;
        right: 15px !important;
        left: unset !important;
        flex-direction: row-reverse !important;
        align-items: center !important;
        gap: 10px !important;
        z-index: 10001 !important;
    }

    .account-widget {
        bottom: unset !important;
        left: unset !important;
        transform: none !important;
        width: auto !important;
        border-radius: 50px !important;
        padding: 0.2rem !important;
        box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
    }

    .account-widget img {
        width: 35px !important;
        height: 35px !important;
    }
    .account-widget span {
        display: none !important;
    }

    .logout-menu {
        padding: 0 !important;
        font-size: 0 !important;
        width: 40px !important;
        height: 40px !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }
    .logout-menu ion-icon {
        font-size: 1.5rem !important;
        margin: 0 !important;
    }

    /* Admin Tools Card -> Bottom Right FAB */
    #admin-card {
        top: unset !important;
        bottom: 90px !important;
        right: 15px !important;
        width: 60px !important;
        height: 60px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        justify-content: center !important;
        align-items: center !important;
        z-index: 10000 !important;
        background: #ef4444 !important;
        flex-direction: column !important;
    }
    #admin-card .icon-wrapper {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        border: none !important;
        background: transparent !important;
    }
    #admin-card .func-icon {
        font-size: 2rem !important;
        color: white !important;
        margin: 0 !important;
    }
    #admin-card > div:not(.icon-wrapper) {
        display: none !important;
    }
}


/* Global Toast System */
#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 99999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(30, 41, 59, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 12px 20px; border-radius: 12px; font-family: 'Outfit', sans-serif; font-size: 1rem; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); opacity: 0; transform: translateY(-20px) scale(0.95); transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.toast.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.toast-info ion-icon { color: #3b82f6; font-size: 1.4rem; }
.toast-success ion-icon { color: #10b981; font-size: 1.4rem; }
.toast-error ion-icon { color: #ef4444; font-size: 1.4rem; }
.toast-warning ion-icon { color: #f59e0b; font-size: 1.4rem; }
@media (max-width: 768px) { #toast-container { top: auto; bottom: 80px; width: 90%; left: 5%; transform: none; } .toast { width: 100%; justify-content: center; padding: 15px; } }
