/* Modern Esports Dark Theme overrides for Bootstrap 5 */
:root {
    --bs-body-bg: #121212;
    --bs-body-color: #e0e0e0;
    --bs-card-bg: #1e1e1e;
    --bs-border-color: #2b2b2b;
    --bs-secondary-bg: #1e1e1e;
    --bs-secondary-color: #e0e0e0;
    --bs-link-color: #7ad3ff;
    --bs-link-hover-color: #9be0ff;
    --bs-primary: #2b6cff;
    --bs-primary-rgb: 43, 108, 255;
    --bs-success: #19d27c;
    --bs-success-rgb: 25, 210, 124;
    --ink: #e0e0e0;
    --muted: #9b9b9b;
    --accent: #2b6cff;
    --accent-dark: #1f5be0;
    --accent-soft: #162033;
    --bg: #121212;
    --bg-2: #1a1a1a;
    --surface: #1e1e1e;
    --line: #2b2b2b;
}

body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Sora', sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(43, 108, 255, 0.12), transparent 45%),
        radial-gradient(circle at 80% 12%, rgba(25, 210, 124, 0.08), transparent 50%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--bs-link-color);
}

a:hover,
a:focus {
    color: var(--bs-link-hover-color);
}

/* Navbar */
.navbar {
    background-color: #111111 !important;
    border-bottom: 1px solid #242424;
}

.nav-shell {
    background-color: #111111 !important;
    border-bottom: 1px solid #242424 !important;
}

.navbar .navbar-brand,
.navbar .nav-link {
    color: #e0e0e0 !important;
    font-family: 'Sora', sans-serif;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: #ffffff !important;
}

.navbar-toggler {
    border-color: #2f2f2f;
}

/* Cards and containers */
.card,
.modal-content,
.dropdown-menu,
.list-group-item,
.table,
.table-responsive,
.table > :not(caption) > * > * {
    background-color: #1e1e1e;
    color: #e0e0e0;
    border-color: #2b2b2b;
}

.card,
.modal-content {
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

.form-card,
.section-card,
.bracket-shell,
.tournament-card,
.empty-state {
    background-color: #1e1e1e;
    border-color: #2b2b2b;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

.text-muted {
    color: #9b9b9b !important;
}

/* Buttons */
.btn-primary {
    background-color: #2b6cff;
    border-color: #2b6cff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #3f7cff;
    border-color: #3f7cff;
}

.btn-success {
    background-color: #19d27c;
    border-color: #19d27c;
}

.btn-success:hover,
.btn-success:focus {
    background-color: #27e089;
    border-color: #27e089;
}

.btn-outline-primary {
    color: #7aa7ff;
    border-color: #7aa7ff;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: #7aa7ff;
    border-color: #7aa7ff;
    color: #0f0f0f;
}

.btn-outline-danger {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background-color: #ff6b6b;
    border-color: #ff6b6b;
    color: #0f0f0f;
}

.btn-outline-secondary {
    color: #b0b0b0;
    border-color: #3a3a3a;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background-color: #3a3a3a;
    border-color: #3a3a3a;
    color: #e0e0e0;
}

/* Forms */
.form-control,
.form-select,
.form-check-input,
.input-group-text {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #2b2b2b;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.2) !important;
    opacity: 1;
}

.form-control::placeholder,
.form-select::placeholder {
    color: #9a9a9a;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border-color: #4a74ff;
    box-shadow: 0 0 0 0.2rem rgba(74, 116, 255, 0.2);
}

/* File input styling for dark theme */
input[type="file"].form-control {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #2b2b2b;
}

input[type="file"].form-control::file-selector-button {
    background-color: #2b6cff;
    color: #ffffff;
    border: none;
    padding: 0.375rem 0.75rem;
    margin: -0.375rem -0.75rem;
    margin-inline-end: 0.75rem;
    border-radius: 0.375rem 0 0 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

input[type="file"].form-control::file-selector-button:hover {
    background-color: #1f5be0;
}

input[type="file"].form-control::-webkit-file-upload-button {
    background-color: #2b6cff;
    color: #ffffff;
    border: none;
    padding: 0.375rem 0.75rem;
    margin: -0.375rem -0.75rem;
    margin-inline-end: 0.75rem;
    border-radius: 0.375rem 0 0 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

input[type="file"].form-control::-webkit-file-upload-button:hover {
    background-color: #1f5be0;
}

/* Small file input variant */
input[type="file"].form-control-sm::file-selector-button {
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    margin-inline-end: 0.5rem;
    font-size: 0.875rem;
}

input[type="file"].form-control-sm::-webkit-file-upload-button {
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.5rem;
    margin-inline-end: 0.5rem;
    font-size: 0.875rem;
}

/* Tables */
.table {
    color: #e0e0e0;
}

.table thead th {
    color: #c8c8c8;
    border-bottom: 1px solid #2b2b2b;
}

.table tbody tr {
    border-color: #2b2b2b;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #181818;
}

/* Alerts */
.alert {
    border-color: #2b2b2b;
}

.alert-info {
    background-color: #16212b;
    color: #c7d9e6;
}

.alert-success {
    background-color: #10281d;
    color: #bff2d7;
}

.alert-danger {
    background-color: #2b1414;
    color: #f3c2c2;
}

/* Badges */
.badge {
    color: #0f0f0f;
}

.badge.text-light,
.badge.text-white {
    color: #e0e0e0 !important;
}

.user-chip {
    color: #e0e0e0 !important;
}

.user-picker-list .list-group-item.active {
    color: #ffffff !important;
}

.badge.bg-secondary {
    background-color: #3b3b3b !important;
    color: #e0e0e0;
}

/* Live indicator and spectators */
.live-indicator {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4);
    z-index: 1000;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: live-pulse 1.5s infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.spectator-badge {
    position: fixed;
    top: 80px;
    right: 100px;
    background: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(13, 202, 240, 0.3);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spectator-badge:hover {
    background: rgba(13, 202, 240, 0.25);
}

.spectator-badge .dropdown-indicator {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.spectator-badge.open .dropdown-indicator {
    transform: rotate(180deg);
}

.spectator-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #1a1d29;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1001;
}

.spectator-badge.open .spectator-tooltip {
    display: block;
}

.spectator-list-header {
    padding: 8px 14px;
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spectator-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: #e5e7eb;
    text-decoration: none;
    transition: background 0.15s ease;
}

.spectator-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.spectator-list-item .spectator-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #ffffff;
    flex-shrink: 0;
}

.spectator-list-item .spectator-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.spectator-list-item .spectator-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spectator-guest-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 0.8rem;
    color: #9ca3af;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.spectator-guest-row .bi {
    font-size: 1rem;
    color: #6b7280;
}

/* Dropdown */
.dropdown-menu {
    border: 1px solid #2b2b2b;
    z-index: 1050 !important;
}

.dropdown-item {
    color: #e0e0e0;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #2a2a2a;
    color: #ffffff;
}

/* Notifications dropdown specific styles */
.notifications-dropdown-menu {
    min-width: 350px;
    max-width: 400px;
}

.notifications-dropdown-menu .sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
}

.notifications-dropdown-menu .dropdown-item {
    transition: background-color 0.2s ease;
}

.notifications-dropdown-menu .dropdown-item:last-child {
    border-bottom: none !important;
}

.tz-menu {
    max-height: 320px;
    background-color: #1e1e1e !important;
}

.tz-list {
    max-height: 220px;
    overflow-y: auto;
}

.tz-list .list-group-item {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border-color: #2b2b2b;
    cursor: pointer;
}

.tz-list .list-group-item:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

.tz-list .list-group-item.active {
    background-color: #2b6cff;
    color: #ffffff;
    border-color: #2b6cff;
}

/* Timezone dropdown button */
#timezone-dropdown {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
    border-color: #2b2b2b !important;
}

#timezone-dropdown:hover,
#timezone-dropdown:focus {
    background-color: #2a2a2a !important;
    color: #ffffff !important;
    border-color: #3a3a3a !important;
}

/* Timezone filter input */
#timezone-filter {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border-color: #2b2b2b;
}

#timezone-filter:focus {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border-color: #4a74ff;
}

/* Jumbotron-like sections */
.bg-light,
.text-dark {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
}

/* Inputs autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: #e0e0e0;
    -webkit-box-shadow: 0 0 0px 1000px #1a1a1a inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Scrollbar (optional, WebKit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #141414;
}

::-webkit-scrollbar-thumb {
    background: #2b2b2b;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

/* Profile Glow Effects */
.profile-glow-basic {
    box-shadow: 0 0 20px rgba(43, 108, 255, 0.5), 0 0 40px rgba(43, 108, 255, 0.3), 0 0 60px rgba(43, 108, 255, 0.15) !important;
    animation: pulse-glow-basic 3s ease-in-out infinite;
}

@keyframes pulse-glow-basic {
    0%, 100% {
        box-shadow: 0 0 20px rgba(43, 108, 255, 0.5), 0 0 40px rgba(43, 108, 255, 0.3), 0 0 60px rgba(43, 108, 255, 0.15);
    }
    50% {
        box-shadow: 0 0 30px rgba(43, 108, 255, 0.6), 0 0 60px rgba(43, 108, 255, 0.4), 0 0 90px rgba(43, 108, 255, 0.2);
    }
}

.profile-glow-advanced {
    box-shadow: 0 0 25px rgba(25, 210, 124, 0.6), 0 0 50px rgba(25, 210, 124, 0.4), 0 0 75px rgba(25, 210, 124, 0.25), 0 0 100px rgba(25, 210, 124, 0.15) !important;
    animation: pulse-glow-advanced 2s ease-in-out infinite;
}

@keyframes pulse-glow-advanced {
    0%, 100% {
        box-shadow: 0 0 25px rgba(25, 210, 124, 0.6), 0 0 50px rgba(25, 210, 124, 0.4), 0 0 75px rgba(25, 210, 124, 0.25), 0 0 100px rgba(25, 210, 124, 0.15);
    }
    50% {
        box-shadow: 0 0 35px rgba(25, 210, 124, 0.7), 0 0 70px rgba(25, 210, 124, 0.5), 0 0 105px rgba(25, 210, 124, 0.35), 0 0 140px rgba(25, 210, 124, 0.2);
    }
}

.profile-glow-elite {
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.7), 0 0 60px rgba(251, 191, 36, 0.5), 0 0 90px rgba(251, 191, 36, 0.35), 0 0 120px rgba(251, 191, 36, 0.2), 0 0 150px rgba(251, 191, 36, 0.1) !important;
    animation: pulse-glow-elite 1.5s ease-in-out infinite;
    border: 2px solid rgba(251, 191, 36, 0.4) !important;
}

@keyframes pulse-glow-elite {
    0%, 100% {
        box-shadow: 0 0 30px rgba(251, 191, 36, 0.7), 0 0 60px rgba(251, 191, 36, 0.5), 0 0 90px rgba(251, 191, 36, 0.35), 0 0 120px rgba(251, 191, 36, 0.2), 0 0 150px rgba(251, 191, 36, 0.1);
        border-color: rgba(251, 191, 36, 0.4);
    }
    50% {
        box-shadow: 0 0 45px rgba(251, 191, 36, 0.85), 0 0 90px rgba(251, 191, 36, 0.65), 0 0 135px rgba(251, 191, 36, 0.45), 0 0 180px rgba(251, 191, 36, 0.3), 0 0 225px rgba(251, 191, 36, 0.15);
        border-color: rgba(251, 191, 36, 0.7);
    }
}

.profile-glow-legendary {
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.8), 0 0 80px rgba(168, 85, 247, 0.6), 0 0 120px rgba(168, 85, 247, 0.45), 0 0 160px rgba(168, 85, 247, 0.3), 0 0 200px rgba(168, 85, 247, 0.2), 0 0 240px rgba(168, 85, 247, 0.1) !important;
    animation: pulse-glow-legendary 1.2s ease-in-out infinite;
    border: 3px solid transparent !important;
    background-clip: padding-box;
    position: relative;
}

.profile-glow-legendary::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #a855f7, #ec4899, #f59e0b, #10b981, #3b82f6, #a855f7);
    background-size: 400% 400%;
    border-radius: inherit;
    z-index: -1;
    animation: legendary-border 3s ease infinite;
}

@keyframes pulse-glow-legendary {
    0%, 100% {
        box-shadow: 0 0 40px rgba(168, 85, 247, 0.8), 0 0 80px rgba(168, 85, 247, 0.6), 0 0 120px rgba(168, 85, 247, 0.45), 0 0 160px rgba(168, 85, 247, 0.3), 0 0 200px rgba(168, 85, 247, 0.2), 0 0 240px rgba(168, 85, 247, 0.1);
    }
    50% {
        box-shadow: 0 0 60px rgba(168, 85, 247, 0.9), 0 0 120px rgba(168, 85, 247, 0.75), 0 0 180px rgba(168, 85, 247, 0.6), 0 0 240px rgba(168, 85, 247, 0.45), 0 0 300px rgba(168, 85, 247, 0.3), 0 0 360px rgba(168, 85, 247, 0.15);
    }
}

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

/* ===========================
   RESPONSIVE / MOBILE STYLES
   =========================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Cards and grids */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    /* Profile layouts */
    .profile-header-content {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }
    
    /* Tournament cards */
    .tournament-card {
        padding: 1rem !important;
    }
    
    /* Player cards grid */
    .player-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    /* Base typography scaling */
    html {
        font-size: 14px;
    }
    
    body {
        overflow-x: hidden;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        max-width: 100%;
    }
    
    /* Navbar mobile fixes */
    .navbar {
        padding: 0.5rem 0.75rem;
    }
    
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    .navbar-collapse {
        background: #111111;
        padding: 1rem;
        border-radius: 12px;
        margin-top: 0.5rem;
        border: 1px solid #2b2b2b;
    }
    
    .dropdown-menu {
        position: static !important;
        width: 100% !important;
        margin-top: 0.5rem !important;
        border-radius: 8px !important;
    }
    
    /* Headers and titles */
    h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    /* Cards */
    .card {
        border-radius: 12px !important;
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    /* Stats grids - single column on mobile */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    
    /* Player grid - single column */
    .player-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Flex layouts stack vertically */
    .d-flex.flex-wrap {
        gap: 0.5rem !important;
    }
    
    /* Buttons - full width on mobile */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group-mobile .btn {
        width: 100%;
    }
    
    /* Tables - horizontal scroll */
    .table-responsive {
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Form controls */
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
    }
    
    /* Modal fixes */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* Banner/header images */
    .category-banner,
    .format-banner,
    .profile-banner {
        height: 180px !important;
        border-radius: 12px !important;
    }
    
    .category-header,
    .format-header,
    .profile-header {
        bottom: 1rem !important;
        left: 1rem !important;
        right: 1rem !important;
    }
    
    .category-header h1,
    .format-header h1,
    .profile-header h1 {
        font-size: 1.5rem !important;
    }
    
    /* Profile pages */
    .profile-picture {
        width: 80px !important;
        height: 80px !important;
    }
    
    .profile-details {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    img,
    svg,
    video,
    canvas {
        max-width: 100%;
        height: auto;
    }

    .btn,
    .form-control,
    .form-select,
    .alert,
    .dropdown-menu,
    .navbar-collapse,
    .modal-content,
    .table-responsive,
    .list-group-item {
        border-radius: 14px !important;
    }

    .btn {
        border-radius: 12px !important;
    }

    .badge {
        border-radius: 999px !important;
    }

    /* Profile hero layout fixes */
    .profile-hero-card {
        border-radius: 20px !important;
    }

    .profile-banner {
        border-radius: 20px !important;
    }

    .profile-info-box {
        margin: 0.75rem !important;
        padding: 1rem !important;
        border-radius: 18px !important;
    }

    .profile-hero-content {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .profile-hero-avatar > div {
        width: 96px !important;
        height: 96px !important;
        border-radius: 16px !important;
    }

    .profile-hero-avatar img {
        border-radius: 14px !important;
    }

    .profile-hero-avatar span {
        font-size: 2.4rem !important;
    }

    .profile-hero-details h1 {
        font-size: 1.5rem !important;
    }

    .profile-hero-meta {
        font-size: 0.8rem !important;
        row-gap: 0.35rem !important;
    }

    .profile-hero-body {
        padding: 0 1rem 1.5rem !important;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
        padding: 0.75rem !important;
    }

    #profile-actions {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    #profile-actions .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .profile-banner-actions {
        top: 0.5rem !important;
        right: 0.5rem !important;
        gap: 0.35rem !important;
        flex-wrap: wrap !important;
        max-width: calc(100% - 1rem);
        justify-content: flex-end;
    }

    .live-indicator {
        top: 70px !important;
        right: 12px !important;
        padding: 4px 10px !important;
        font-size: 0.65rem !important;
        border-radius: 999px !important;
    }

    .spectator-badge {
        top: 104px !important;
        right: 12px !important;
        padding: 4px 10px !important;
        font-size: 0.65rem !important;
        border-radius: 999px !important;
    }
    
    /* Tournament view */
    .bracket-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1rem;
    }
    
    /* Theme selector - scrollable */
    .theme-selector {
        overflow-x: auto;
        justify-content: flex-start !important;
        padding: 0.5rem !important;
        gap: 0.35rem !important;
    }
    
    .theme-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px;
        flex-shrink: 0;
        font-size: 0.9rem !important;
    }
    
    /* Filter buttons - wrap and scroll */
    .filter-buttons {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-buttons .btn,
    .filter-buttons a {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 0.75rem !important;
        padding: 0.4rem 0.75rem !important;
    }
    
    /* Leaderboard / player list */
    .leaderboard-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    
    /* Badge sizing */
    .badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    /* Stat cards - compact */
    .stat-card {
        padding: 0.75rem !important;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem !important;
    }
    
    .stat-card .stat-label {
        font-size: 0.65rem !important;
    }
    
    /* Achievement cards */
    .achievement-card {
        padding: 0.75rem !important;
    }
    
    .achievement-icon {
        font-size: 2rem !important;
    }
    
    /* Notifications dropdown */
    .notifications-dropdown-menu {
        min-width: 280px !important;
        max-width: 320px !important;
        right: -50px !important;
    }
    
    /* Tournament match cards */
    .match-card {
        padding: 0.75rem !important;
    }
    
    .match-player {
        font-size: 0.85rem !important;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .page-link {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.8rem !important;
    }
    
    /* Two-column layouts become single */
    .row > [class*="col-lg-"],
    .row > [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Hide desktop-only elements */
    .d-desktop-only {
        display: none !important;
    }
    
    /* Top players grid */
    [style*="grid-template-columns: repeat(auto-fill, minmax(320px"] {
        grid-template-columns: 1fr !important;
    }
}

/* Small mobile (up to 480px) */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    h1 {
        font-size: 1.3rem !important;
    }
    
    .card-body {
        padding: 0.75rem !important;
    }
    
    /* Very compact stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stat-card {
        padding: 0.5rem !important;
    }
    
    .stat-card .stat-value {
        font-size: 1.25rem !important;
    }
    
    /* Banner even smaller */
    .category-banner,
    .format-banner,
    .profile-banner {
        height: 150px !important;
    }
    
    /* Profile picture smaller */
    .profile-picture {
        width: 60px !important;
        height: 60px !important;
    }

    .profile-hero-avatar > div {
        width: 80px !important;
        height: 80px !important;
        border-radius: 14px !important;
    }

    .profile-hero-details h1 {
        font-size: 1.3rem !important;
    }

    .profile-stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Icons smaller */
    .category-icon,
    .format-icon {
        width: 50px !important;
        height: 50px !important;
    }
    
    /* Modal more compact */
    .modal-body {
        padding: 0.75rem;
    }
    
    .modal-header,
    .modal-footer {
        padding: 0.75rem;
    }
}

/* Landscape mobile fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-body {
        max-height: 60vh;
    }
    
    .category-banner,
    .format-banner,
    .profile-banner {
        height: 120px !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    /* Remove hover effects on touch */
    .card:hover,
    .tournament-card:hover,
    .stat-card:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
    
    /* Better tap feedback */
    .btn:active,
    .card:active,
    a:active {
        opacity: 0.8;
    }
}

/* High contrast / accessibility */
@media (prefers-contrast: high) {
    :root {
        --bs-border-color: #ffffff;
    }
    
    .card,
    .btn {
        border-width: 2px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .snowflake,
    .heart,
    .leaf,
    .petal,
    .bubble,
    .glow-particle,
    .effect-container {
        display: none !important;
    }
}

/* Print styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .navbar,
    .theme-selector,
    .btn,
    .effect-container,
    .modal {
        display: none !important;
    }
    
    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
}

/* Additional Mobile Fixes */
@media (max-width: 768px) {
    /* Fix inline flex containers (exclude game boards and specific layouts) */
    [style*="display: flex"][style*="gap:"]:not(.game-board):not(.monopoly-board):not(.dice-container):not(.action-buttons) {
        flex-wrap: wrap !important;
    }
    
    /* Fix inline grids (exclude game boards like monopoly, profile card previews) */
    [style*="grid-template-columns:"]:not(.game-board):not(.monopoly-board):not([style*="repeat(11"]):not([style*="repeat(2, 1fr)"]) {
        grid-template-columns: 1fr !important;
    }
    
    /* Theme selector buttons */
    .theme-selector,
    .theme-btn {
        min-width: 36px !important;
        min-height: 36px !important;
        font-size: 0.9rem !important;
    }
    
    /* Tournament cards */
    .tournament-card-modern {
        margin-bottom: 0.75rem;
    }
    
    /* Filter buttons row */
    [style*="flex-wrap: wrap"][style*="gap"] {
        gap: 0.5rem !important;
    }
    
    /* Section padding */
    section {
        padding: 0.75rem 0 !important;
    }
    
    /* Hero/banner text */
    [style*="font-size: 3rem"],
    [style*="font-size: 2.5rem"] {
        font-size: 1.75rem !important;
    }
    
    [style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }
    
    /* Fixed position elements */
    .effect-container {
        pointer-events: none;
    }
    
    /* Row gaps */
    .row.g-4 {
        --bs-gutter-y: 1rem;
        --bs-gutter-x: 0.75rem;
    }
    
    /* Recent Activity / Match cards */
    [style*="display: flex"][style*="align-items: center"][style*="gap: 1rem"] {
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
    }
    
    /* Score displays */
    [style*="font-size: 0.85rem"] {
        font-size: 0.75rem !important;
    }
    
    /* Breadcrumbs */
    nav[aria-label="breadcrumb"] {
        font-size: 0.8rem;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Tablet-specific fixes */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Two-column layout for cards */
    .row .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Slightly smaller text */
    h1 {
        font-size: 1.75rem !important;
    }
    
    /* Sidebar adjustments */
    .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1.5rem;
    }
}
