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

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    background-color: #231e3f;
    background-image: radial-gradient(ellipse at 50% 40%,
            rgba(115, 99, 218, 0.25) 0%,
            #231e3f 60%);

    font-family: 'Lilita One', cursive;
    min-height: 100vh;
    color: #fff;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 95%;
    margin: 0 auto;
    padding: 10px;
    flex-grow: 1;
}

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* --- Header & Navigation --- */
.top-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 25px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 98vw;
    height: 5vw;
    min-height: 50px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
}

.nav-center-title {
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 0;
    color: #fff;
    text-align: center;
}

.author-credit {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: normal;
    display: block;
    text-align: center;
    margin: -2px auto 0;
    width: fit-content;
}

.nav-links-right {
    position: relative;
    display: flex;
    align-items: center;
}

.discord-link {
    display: flex;
    align-items: center;
    gap: 0;
    background-color: rgba(88, 101, 242, 0.8);
    padding: 8px 10px;
    border-radius: 15px;
    border: 1px solid rgba(88, 101, 242, 1);
    color: #fff;
    text-decoration: none;
    font-size: clamp(0.9rem, 1.2vw, 1.0rem);
    margin-right: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
}

.discord-link span {
    max-width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.discord-link:hover {
    background-color: rgba(88, 101, 242, 1);
    gap: 8px;
    padding: 8px 12px;
}

.discord-link:hover span {
    max-width: 200px;
    opacity: 1;
}

.discord-link i {
    font-size: 1.2rem;
}

.bmc-link {
    display: flex;
    align-items: center;
    gap: 0;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.9) 0%, rgba(255, 152, 0, 0.9) 100%);
    padding: 8px 10px;
    border-radius: 15px;
    border: none;
    color: #fff;
    text-decoration: none;
    font-size: clamp(0.9rem, 1.2vw, 1.0rem);
    margin-right: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
}

.bmc-link span {
    max-width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.bmc-link:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 1) 0%, rgba(255, 152, 0, 1) 100%);
    gap: 8px;
    padding: 8px 12px;
}

.bmc-link:hover span {
    max-width: 200px;
    opacity: 1;
}

.bmc-icon {
    width: 1.2rem;
    height: 1.2rem;
    filter: invert(1);
}

/* --- Language Selector --- */
#languageSelector {
    cursor: pointer;
    position: relative;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    transition: background-color 0.2s ease;
    color: #fff;
    font-size: 1rem;
}

.language-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.lang-flag {
    width: 24px;
    height: auto;
    border-radius: 4px;
    vertical-align: middle;
}

#selectedLanguage {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 10px;
}

#languageDropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: #2c2c2c;
    border-radius: 10px;
    overflow: hidden;
    z-index: 1001;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#languageSelector.open #languageDropdown {
    display: block;
}

/* --- Burger Menu & Off-canvas Panel --- */
.burger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 2.2rem;
    height: 2.2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 2010;
    position: relative;
}

.burger-menu span {
    width: 2.2rem;
    height: 0.25rem;
    background: #fff;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* --- Toolbar --- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 18px 25px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 20;
}

.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 10px 16px;
    flex-grow: 1;
    max-width: 420px;
}

.search-group i {
    color: rgba(255, 255, 255, 0.5);
}

.search-group input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
}

.search-group input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

/* --- Refresh button --- */
.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    color: #fff;
    background: rgba(115, 99, 218, 0.6);
    border: 1px solid rgba(115, 99, 218, 1);
    border-radius: 14px;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.refresh-btn:hover {
    background: rgba(115, 99, 218, 0.85);
}

.refresh-btn.spinning i {
    animation: spin 0.9s linear infinite;
}

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

.load-more-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.custom-select-trigger .fa-chevron-down {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 10px;
}

/* --- Tier checkboxes (featured / standard) --- */
.tier-checks {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tier-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    transition: border-color 0.25s ease, color 0.25s ease;
    user-select: none;
}

.tier-check:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.tier-check input {
    accent-color: #f1c40f;
    width: 15px;
    height: 15px;
    cursor: pointer;
    margin: 0;
}

/* --- Custom dropdowns (bsdraft style, dark variant) --- */
.custom-select-container {
    position: relative;
    font-family: inherit;
}

.custom-select-trigger {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-options-wrapper {
    display: none;
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    z-index: 10;
    background: #2c2c2c;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    max-height: 300px;
    overflow-y: auto;
    backdrop-filter: blur(5px);
}

.custom-select-container.open .custom-options-wrapper {
    display: block;
}

.custom-option {
    padding: 10px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s ease;
}

.custom-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.toolbar .custom-select-container {
    width: auto;
    min-width: 170px;
    font-family: inherit;
}

.toolbar .custom-select-trigger {
    padding: 10px 16px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.25s ease, transform 0.15s ease;
}

.toolbar .custom-select-trigger:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.5);
}

.toolbar .custom-options-wrapper {
    background: #2b2550;
    border-radius: 14px;
    max-height: 280px;
}

.toolbar .custom-option {
    color: #fff;
    font-size: 0.95rem;
}

.toolbar .custom-option.selected {
    color: #f1c40f;
}

/* --- Rank info button & tooltip --- */
.info-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.info-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.info-btn:hover,
.info-btn:focus-visible {
    color: #f1c40f;
    border-color: rgba(241, 196, 15, 0.6);
}

.info-tooltip {
    position: absolute;
    top: calc(100% + 12px);
    right: -8px;
    width: 300px;
    background: rgba(20, 16, 40, 0.97);
    border: 1px solid rgba(241, 196, 15, 0.35);
    border-radius: 14px;
    padding: 14px 16px;
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-family: 'Lilita One', cursive;
}

.info-wrap:hover .info-tooltip,
.info-wrap:focus-within .info-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.info-tooltip strong {
    display: block;
    color: #f1c40f;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.info-tooltip strong + p {
    margin-bottom: 10px;
}

.info-tooltip p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0;
}

/* --- Refresh button --- */
.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    color: #fff;
    background: rgba(115, 99, 218, 0.6);
    border: 1px solid rgba(115, 99, 218, 1);
    border-radius: 14px;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.refresh-btn:hover {
    background: rgba(115, 99, 218, 0.85);
}

.refresh-btn.spinning i {
    animation: spin 0.9s linear infinite;
}

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

.load-more-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

/* Breathing room between a section's cards and its "show more" button */
.tournaments-grid + .load-more-wrapper {
    margin-top: 20px;
}

.loading-indicator {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    padding: 20px;
}

/* --- Tournament sections & grid --- */
.status-section {
    margin-bottom: 36px;
}

.section-title {
    font-size: 1.7rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.live-dot {
    color: #ff4d4d;
    animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.55;
        transform: scale(1.15);
    }
}

.tournaments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tournament-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.tournament-card:hover {
    transform: translateY(-4px);
    border-color: rgba(241, 196, 15, 0.6);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.35);
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Slight dimming only - keep thumbnails readable */
    filter: brightness(0.92);
}

.card-media::after {
    content: '';
    position: absolute;
    inset: 0;
    /* Dark only at the bottom so the title stays readable,
       the top stays clear for the status badge */
    background: linear-gradient(to top,
            rgba(15, 12, 30, 0.85) 0%,
            rgba(15, 12, 30, 0.35) 40%,
            rgba(15, 12, 30, 0) 70%);
}

.status-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    text-shadow: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}

.status-badge.live {
    background: #e5484d;
    color: #fff;
    border-color: #ff8a8d;
}

.status-badge.upcoming {
    background: #f1c40f;
    color: #231e3f;
    border-color: #ffe27a;
}

.status-badge.completed {
    background: rgba(20, 16, 40, 0.85);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
}

.prize-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    font-size: 0.78rem;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #ffd54a;
    border: 1px solid rgba(255, 213, 74, 0.4);
}

.card-title {
    font-size: 1.05rem;
    line-height: 1.25;
    padding: 12px 16px 4px;
    z-index: 2;
}

.card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 16px 0;
}

.tag {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.75);
}

.tag-featured {
    background: rgba(241, 196, 15, 0.14);
    border-color: rgba(241, 196, 15, 0.45);
    color: #f1c40f;
}

.tag-standard {
    background: rgba(115, 99, 218, 0.16);
    border-color: rgba(115, 99, 218, 0.5);
    color: #b9b0ef;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px 16px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.88rem;
    margin-top: auto;
}

.card-footer .views {
    display: flex;
    align-items: center;
    gap: 6px;
}

.empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 40px 20px;
    font-size: 1.1rem;
}

.empty-state i {
    font-size: 2.6rem;
    display: block;
    margin-bottom: 12px;
    color: rgba(241, 196, 15, 0.6);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(6px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #2b2550;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    width: min(720px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    scrollbar-width: thin;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 20px;
    font-size: 2.2rem;
    color: #fff;
    cursor: pointer;
    z-index: 5;
    transition: color 0.25s ease, transform 0.25s ease;
}

.modal-close:hover {
    color: #f1c40f;
    transform: scale(1.1);
}

.modal-hero {
    position: relative;
    aspect-ratio: 16 / 7;
    min-height: 180px;
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.modal-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(35, 30, 63, 0.96) 10%, rgba(35, 30, 63, 0.35) 70%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 20px 24px;
    gap: 6px;
}

.modal-hero-overlay .status-badge {
    position: static;
}

.modal-hero-overlay h2 {
    font-size: 1.6rem;
    line-height: 1.2;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.modal-hero-overlay p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
}

.modal-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.bracket-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    background: rgba(115, 99, 218, 0.7);
    border: 1px solid rgba(115, 99, 218, 1);
    border-radius: 12px;
    padding: 8px 14px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.25s ease;
}

.bracket-btn:hover {
    background: rgba(115, 99, 218, 1);
}

.bracket-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.bracket-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* --- Modal tabs --- */
.modal-tabs {
    display: flex;
    gap: 6px;
    padding: 14px 24px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-tab {
    font-family: inherit;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.55);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 8px 18px 10px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.modal-tab:hover {
    color: #fff;
}

.modal-tab.active {
    color: #f1c40f;
    border-bottom-color: #f1c40f;
}

.details-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.detail-row {
    display: flex;
    gap: 14px;
    padding: 7px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.detail-label {
    width: 130px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.55);
    font-family: 'Lilita One', cursive;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-value {
    color: #fff;
    font-family: 'Lilita One', cursive;
}

.details-description {
    font-family: 'Lilita One', cursive;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    white-space: pre-line;
}

/* Sanitized description keeps basic formatting */
.details-description b,
.details-description strong {
    color: #f1c40f;
}

.details-description a {
    color: #79b0ff;
}

.details-description ul,
.details-description ol {
    margin: 8px 0 8px 22px;
}

.modal-body {
    padding: 22px 24px 28px;
}

.modal-body h3 {
    margin-bottom: 14px;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.standings-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.standings-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 16px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

.standings-list li .rank {
    width: 44px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
}

.standings-list li.rank-1 .rank {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #3a2c00;
}

.standings-list li.rank-2 .rank {
    background: linear-gradient(135deg, #e8e8e8, #b0b0b0);
    color: #333;
}

.standings-list li.rank-3 .rank {
    background: linear-gradient(135deg, #cd7f32, #a05a20);
    color: #fff;
}

.standings-list li .name {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.standings-list li.unranked {
    opacity: 0.65;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 20px 10px 30px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}

footer a {
    color: inherit;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .author-credit {
        font-size: 0.8rem;
    }

    .nav-links-right .bmc-link,
    .nav-links-right .discord-link span {
        display: none;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-group {
        max-width: none;
        width: 100%;
    }
}
