/* ============================================
   TIEBREAK NEWS — Premium Design System
   Aesthetic: Editorial sports magazine — dark
   header, clean cards, strong typography
   ============================================ */

/* ===== DESIGN TOKENS ===== */
:root {
    --court-dark:   #0d1f16;
    --court-mid:    #122a1c;
    --court-base:   #1a3828;
    --court-accent: #23d16b;
    --court-muted:  #3aba73;
    --court-light:  #d4f0e1;

    --clay:   #e8531e;
    --clay-bg:#fff3ee;
    --grass:  #2d9c52;
    --hard:   #2c6fc4;
    --indoor: #7c5cbf;

    --live-red:   #f02b2b;
    --live-bg:    #fff0f0;
    --final-bg:   #f0f4f0;
    --final-col:  #2e5c40;
    --upcoming-bg:#f0f4ff;
    --upcoming-col:#3a5278;

    --surface:    #f6f9f7;
    --card-bg:    #ffffff;
    --card-border:#e6ede8;
    --text-primary:  #111b16;
    --text-secondary:#4e6259;
    --text-muted:    #8a9e92;

    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  20px;
    --radius-xl:  28px;
    --radius-pill:100px;

    --shadow-xs: 0 1px 3px rgba(0,0,0,.06);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 6px 20px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 16px 48px rgba(0,0,0,.12);

    --font-body:    'DM Sans', sans-serif;
    --font-display: 'Fraunces', serif;
    --font-mono:    'DM Mono', monospace;

    --transition: 0.18s cubic-bezier(.4,0,.2,1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-primary);
    padding-bottom: 74px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(160deg, var(--court-dark) 0%, var(--court-base) 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 24px rgba(0,0,0,.25);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    max-width: 640px;
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--court-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--court-dark);
    box-shadow: 0 4px 12px rgba(35,209,107,.35);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #fff;
}

.brand-name em {
    font-style: italic;
    color: var(--court-accent);
}

.brand-tagline {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.45);
    margin-top: 1px;
}

/* Live indicator */
.header-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(240,43,43,.18);
    border: 1px solid rgba(240,43,43,.4);
    color: #ff6b6b;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .08em;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ===== CONTENT ===== */
.content {
    max-width: 640px;
    margin: 0 auto;
    padding: 18px 14px 24px;
}

/* ===== TABS ===== */
.tab { display: none; }
.tab.active { display: block; animation: fadeUp .22s ease; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== TAB HEADER ===== */
.tab-header {
    margin-bottom: 18px;
}

.tab-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab-title i {
    color: var(--court-muted);
    font-size: 1.2rem;
}

.tab-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
    margin-left: 32px;
}

/* ===== DATE NAVIGATOR ===== */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    padding: 6px 8px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    gap: 8px;
}

.date-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: var(--surface);
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.date-btn:hover {
    background: var(--court-light);
    color: var(--court-dark);
}

.date-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.date-display input[type="date"] {
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: center;
    cursor: pointer;
    padding: 2px 0;
    outline: none;
    width: 100%;
}

.date-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ===== CONTROLS ROW ===== */
.controls-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== TOUR DROPDOWN ===== */
.tour-filter-wrapper {
    flex-shrink: 0;
}

.custom-select {
    position: relative;
    display: inline-block;
}

.select-trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
    white-space: nowrap;
}

.select-trigger:hover {
    background: var(--court-light);
    border-color: var(--court-muted);
}

.select-trigger > i:first-child {
    color: var(--court-muted);
    font-size: 0.75rem;
}

.select-arrow {
    font-size: 0.7rem !important;
    color: var(--text-muted) !important;
    transition: transform var(--transition);
}

.custom-select.open .select-arrow {
    transform: rotate(180deg);
}

.select-options {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 175px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    animation: dropIn .18s ease;
}

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

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.select-option {
    padding: 11px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background var(--transition);
}

.select-option i { color: var(--court-muted); width: 16px; font-size: 0.8rem; }

.select-option:hover {
    background: var(--surface);
    color: var(--text-primary);
}

/* ===== FILTERS ===== */
.filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.status-filters {
    flex-wrap: nowrap;
}

.filter {
    padding: 7px 13px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.filter:hover {
    background: var(--court-light);
    border-color: var(--court-muted);
    color: var(--court-dark);
}

.filter.active {
    background: var(--court-dark);
    border-color: var(--court-dark);
    color: #fff;
}

.mini-dot {
    width: 5px;
    height: 5px;
    background: var(--live-red);
    border-radius: 50%;
    display: inline-block;
}

.filter.active .mini-dot { background: #ff8080; }

/* ===== MATCH CARDS ===== */
.match-group {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.match-group:hover { box-shadow: var(--shadow-md); }

.match-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    background: linear-gradient(135deg, #f9fdfb 0%, #f2f7f4 100%);
    border-bottom: 1px solid var(--card-border);
    gap: 8px;
}

.match-group-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.match-group-name i { color: var(--court-muted); font-size: 0.75rem; flex-shrink: 0; }
.match-group-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.category-pill {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.category-pill.atp    { background: #e8f4fe; color: #1a5f9e; }
.category-pill.wta    { background: #fce8f6; color: #9c1a78; }
.category-pill.challenger { background: #fef0e8; color: #9c4a1a; }
.category-pill.itf    { background: #eef0fe; color: #3a4a9c; }
.category-pill.uts    { background: #f4fce8; color: #4a9c1a; }
.category-pill.default { background: var(--surface); color: var(--text-muted); }

/* ===== MATCH ITEM ===== */
.match-item {
    padding: 13px 16px;
    border-bottom: 1px solid #f3f7f4;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.match-item:last-child { border-bottom: none; }
.match-item:hover { background: #f9fdfb; }

.players-container { flex: 1; min-width: 0; }

.player-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.player-row:hover { background: #eef5f0; }

.player-flag { font-size: 1.1rem; width: 28px; flex-shrink: 0; line-height: 1; }

.player-name {
    font-size: 0.9rem;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.player-score {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    background: #eef2ef;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    min-width: 52px;
    text-align: center;
    color: var(--text-primary);
    letter-spacing: .04em;
}

.match-status {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 70px;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.live-badge {
    background: var(--live-red);
    color: #fff;
    animation: pulseRed 1.4s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(240,43,43,.4);
}

@keyframes pulseRed {
    0%,100% { box-shadow: 0 2px 8px rgba(240,43,43,.4); }
    50%      { box-shadow: 0 2px 16px rgba(240,43,43,.7); }
}

.completed-badge {
    background: var(--final-bg);
    color: var(--final-col);
    border: 1px solid #d0e8d8;
}

.upcoming-badge {
    background: var(--upcoming-bg);
    color: var(--upcoming-col);
    border: 1px solid #d0daee;
}

/* ===== SCORE TABLE ===== */
.score-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 14px 0;
    font-size: 0.85rem;
}

.score-table thead th {
    padding: 9px 12px;
    background: var(--court-dark);
    color: rgba(255,255,255,.7);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: center;
}

.score-table thead th:first-child { text-align: left; }

.score-table tbody td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    font-family: var(--font-mono);
    font-weight: 500;
}

.score-table tbody tr:last-child td { border-bottom: none; }

.score-table .player-name-cell {
    text-align: left;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    background: #fafdf9;
    width: 45%;
}

/* ===== DETAIL PAGES ===== */
.detail {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
}

.detail h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    padding: 7px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 18px;
    transition: all var(--transition);
}

.back-btn:hover {
    background: var(--court-light);
    border-color: var(--court-muted);
    color: var(--court-dark);
}

.detail-meta {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-top: 14px;
    border: 1px solid var(--card-border);
}

.detail-meta p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-meta p:last-child { margin-bottom: 0; }
.detail-meta p strong { color: var(--text-primary); }
.detail-meta p i { color: var(--court-muted); width: 16px; }

/* ===== NEWS ===== */
.news-list { display: flex; flex-direction: column; gap: 0; }

.news-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--court-light);
}

.news-img-wrap {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
    aspect-ratio: 16/8;
    background: var(--surface);
}

.news-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.news-item:hover .news-img { transform: scale(1.03); }

.news-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.news-meta-item {
    font-size: 0.68rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-source-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--surface);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
}

/* ===== TOURNAMENT CALENDAR ===== */
.calendar-section { margin-bottom: 24px; }

.section-header {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 0 9px;
    margin-bottom: 2px;
    border-bottom: 2px solid var(--card-border);
    color: var(--text-primary);
}

.section-header .section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    flex: 1;
}

.section-header i { color: var(--court-muted); font-size: 0.9rem; }

.section-header.live-header { border-bottom-color: var(--live-red); }
.section-header.live-header i,
.section-header.live-header .section-title { color: var(--live-red); }

.collapsible-header {
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    padding: 10px 4px 9px;
}

.collapsible-header:hover { background: var(--surface); }

.chevron-icon { transition: transform var(--transition); font-size: 0.75rem !important; }
.chevron-icon.open { transform: rotate(90deg); }

.tournament-count {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}

.tournaments-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.month-content.collapsed { display: none; }

/* ===== TOURNAMENT CARD ===== */
.tournament-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.tournament-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.tournament-card.grand-slam {
    border-left-color: #f5c518;
    background: linear-gradient(135deg, #fffdf0 0%, #fff 100%);
}

.tournament-card.masters-1000 { border-left-color: var(--court-muted); }
.tournament-card.atp-500      { border-left-color: var(--hard); }
.tournament-card.atp-250      { border-left-color: var(--indoor); }
.tournament-card.live-card    { border-left-color: var(--live-red); }

.tournament-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.tournament-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.35;
}

.tournament-details { display: flex; flex-direction: column; gap: 6px; }

.tournament-info-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.77rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.tournament-info-row i {
    width: 16px;
    font-size: 0.78rem;
    color: var(--court-muted);
    flex-shrink: 0;
}

.tournament-info-row.champion i { color: #f5c518; }
.tournament-info-row.champion { font-weight: 600; color: var(--text-primary); }

.separator { color: var(--card-border); }

.t-category-badge {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-muted);
}

/* ===== TOURNAMENT STATUS BADGES ===== */
.t-live-badge {
    font-size: 0.63rem;
    font-weight: 700;
    background: var(--live-red);
    color: #fff;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    animation: pulseRed 1.4s infinite;
    flex-shrink: 0;
}

.t-finished-badge {
    font-size: 0.63rem;
    font-weight: 700;
    background: var(--final-bg);
    color: var(--final-col);
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    border: 1px solid #cce0d0;
    flex-shrink: 0;
}

.t-upcoming-badge {
    font-size: 0.63rem;
    font-weight: 700;
    background: var(--upcoming-bg);
    color: var(--upcoming-col);
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    border: 1px solid #c8d4e8;
    flex-shrink: 0;
}

/* ===== RANKINGS ===== */
.ranking-filters-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 16px;
    padding-bottom: 2px;
}

.ranking-filters-wrapper::-webkit-scrollbar { display: none; }

.ranking-filters {
    flex-wrap: nowrap;
    gap: 6px;
    min-width: max-content;
    margin-bottom: 0;
}

#rankingContainer { min-height: 300px; }

.rank-list {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.rank-header-row {
    display: grid;
    grid-template-columns: 52px 1fr 90px 56px;
    padding: 9px 16px;
    background: var(--court-dark);
    color: rgba(255,255,255,.55);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.rank-row {
    display: grid;
    grid-template-columns: 52px 1fr 90px 56px;
    align-items: center;
    padding: 11px 16px;
    border-bottom: 1px solid #f0f5f2;
    transition: background var(--transition);
}

.rank-row:last-child { border-bottom: none; }
.rank-row:hover { background: #f9fdfb; }

/* Top 3 highlight */
.rank-row.top1 { background: linear-gradient(90deg, #fffbde 0%, #fff 100%); }
.rank-row.top2 { background: linear-gradient(90deg, #f4f4f4 0%, #fff 100%); }
.rank-row.top3 { background: linear-gradient(90deg, #fff0e6 0%, #fff 100%); }

.rank-num {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--court-base);
}

.rank-row.top1 .rank-num { color: #c9a800; }
.rank-row.top2 .rank-num { color: #7a7a7a; }
.rank-row.top3 .rank-num { color: #b8601a; }

.rank-name {
    font-weight: 600;
    font-size: 0.87rem;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
}

.rank-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-points {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--court-base);
    text-align: right;
}

.rank-movement {
    font-size: 0.7rem;
    font-weight: 700;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.movement-up   { color: #1a8c3c; }
.movement-down { color: #c62828; }
.movement-steady { color: var(--text-muted); }

/* ===== LOADER & EMPTY ===== */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--court-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.loader-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--card-border);
    border-top-color: var(--court-muted);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

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

.empty-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.empty-msg i {
    font-size: 2.4rem;
    opacity: 0.35;
    display: block;
}

#rankingLoader {
    padding: 20px;
    text-align: center;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 9px 0 calc(9px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    color: var(--text-muted);
    transition: color var(--transition);
    flex: 1;
    padding: 4px 0;
    min-width: 0;
}

.nav-item i { font-size: 1.25rem; transition: transform var(--transition); }
.nav-item span { font-size: 0.65rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.nav-item.active { color: var(--court-dark); }
.nav-item.active i { transform: scale(1.1); }

.nav-item:hover:not(.active) { color: var(--court-muted); }

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--court-muted); border-radius: 10px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .content { padding: 14px 10px 20px; }
    
    .brand-name { font-size: 1.15rem; }
    .brand-tagline { display: none; }

    .controls-row { gap: 7px; }
    
    .player-name { font-size: 0.83rem; }
    .player-flag { font-size: 1rem; width: 24px; }
    .player-score { font-size: 0.75rem; min-width: 42px; padding: 2px 7px; }

    .match-status { min-width: 62px; }
    .status-badge { font-size: 0.58rem; padding: 3px 7px; }

    .rank-row { grid-template-columns: 44px 1fr 72px 50px; gap: 6px; padding: 10px 12px; }
    .rank-num { font-size: 0.9rem; }
    .rank-name { font-size: 0.8rem; }
    .rank-points { font-size: 0.72rem; }

    .tab-title { font-size: 1.25rem; }

    .tournament-name { font-size: 0.88rem; }
    .tournament-info-row { font-size: 0.72rem; }

    .match-item { padding: 11px 12px; }
    .match-group-header { padding: 10px 12px 8px; }
}

@media (max-width: 360px) {
    .ranking-filters .filter { padding: 5px 9px; font-size: 0.68rem; }
    .status-filters .filter { padding: 6px 9px; font-size: 0.7rem; }
}

/* ========== NEWS DIALOG WITH IFRAME (SIMPLE VERSION) ========== */
.news-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.news-dialog {
    background: white;
    width: 100%;
    max-width: 900px;
    border-radius: 24px 24px 0 0;
    height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

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

.news-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eef2ef;
    background: white;
    border-radius: 24px 24px 0 0;
    flex-shrink: 0;
}

.news-dialog-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.news-dialog-header-left i {
    color: #2c9c5c;
    font-size: 1.1rem;
}

.news-dialog-source {
    font-weight: 600;
    color: #1a2e2a;
    font-size: 0.85rem;
}

.news-dialog-date {
    font-size: 0.75rem;
    color: #7e9a8a;
}

.news-dialog-date i {
    margin-right: 4px;
    font-size: 0.7rem;
}

.news-dialog-close {
    background: #eef2ef;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #5a6e62;
}

.news-dialog-close:hover {
    background: #e0e8e4;
    transform: scale(1.05);
}

.news-dialog-title-section {
    padding: 16px 20px;
    background: #f9fbf9;
    border-bottom: 1px solid #eef2ef;
    flex-shrink: 0;
}

.news-dialog-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a2e2a;
    margin: 0;
    line-height: 1.3;
}

/* Iframe Container */
.iframe-container {
    position: relative;
    flex: 1;
    background: #f5f5f5;
    min-height: 0;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.iframe-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #eef2ef;
    border-top-color: #1f7843;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Action Buttons */
.iframe-actions {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #eef2ef;
    flex-shrink: 0;
}

.iframe-open-btn,
.iframe-copy-btn,
.iframe-share-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.iframe-open-btn {
    background: #1f7843;
    color: white;
    border: none;
}

.iframe-open-btn:hover {
    background: #166a3a;
}

.iframe-copy-btn,
.iframe-share-btn {
    background: #eef2ef;
    border: none;
    color: #2c5e44;
}

.iframe-copy-btn:hover,
.iframe-share-btn:hover {
    background: #e0e8e4;
}

/* Toast notification */
.news-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1a2e2a;
    color: white;
    padding: 12px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.news-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.news-toast i {
    color: #4caf50;
}

/* News item styles */
.news-img-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e8f0ec, #d4e2db);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c9c5c;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.news-content {
    flex: 1;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .news-dialog {
        border-radius: 24px;
        margin: 20px auto;
        height: 85vh;
        max-width: 1000px;
    }
    
    .news-dialog-overlay {
        align-items: center;
    }
}

@media (max-width: 480px) {
    .news-dialog-title {
        font-size: 1rem;
    }
    
    .news-dialog-header-left {
        gap: 8px;
    }
    
    .news-dialog-source {
        font-size: 0.75rem;
    }
    
    .iframe-actions {
        gap: 8px;
        padding: 10px 16px;
    }
    
    .iframe-open-btn,
    .iframe-copy-btn,
    .iframe-share-btn {
        padding: 8px 12px;
        font-size: 0.7rem;
    }
}

/* ============================================
   ADSENSE STYLES — Premium & Non-Intrusive
   Optimized for mobile, desktop, and user experience
   ============================================ */

/* Ad Container Base */
.ad-container {
    width: 100%;
    text-align: center;
    margin: 16px 0;
    padding: 8px 0;
    background: transparent;
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    position: relative;
}

/* Ad Label (discreet, transparent) */
.ad-label {
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.03);
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    margin-bottom: 8px;
    backdrop-filter: blur(2px);
}

/* Ad Banner Base */
.ad-banner {
    display: block;
    margin: 0 auto;
    min-height: 90px;
    background: linear-gradient(135deg, #f8faf8 0%, #f0f4f0 100%);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
}

/* Ad Banner Hover Effect (subtle) */
.ad-banner:hover {
    background: linear-gradient(135deg, #f0f4f0 0%, #e8ece8 100%);
}

/* Top Banner Ad */
.ad-top {
    margin-top: 0;
    margin-bottom: 8px;
    padding: 4px 0 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ad-top .ad-banner {
    min-height: 90px;
    max-width: 1200px;
    margin: 0 auto;
}

/* In-Content Ad (appears between matches) */
.ad-incontent {
    margin: 20px 0;
    padding: 12px 0;
    background: rgba(35, 209, 107, 0.02);
    border-radius: var(--radius-xl);
    border: 1px dashed rgba(35, 209, 107, 0.2);
}

.ad-incontent .ad-banner {
    min-height: 100px;
}

/* Tournaments Tab Ad */
.ad-tournaments {
    margin: 8px 0 20px;
    padding: 8px 0;
}

.ad-tournaments .ad-banner {
    min-height: 90px;
}

/* Rankings Tab Ad */
.ad-rankings {
    margin: 8px 0 20px;
    padding: 8px 0;
}

.ad-rankings .ad-banner {
    min-height: 90px;
}

/* Bottom Banner Ad */
.ad-bottom {
    margin: 8px 0 16px;
    padding: 8px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: none;
}

.ad-bottom .ad-banner {
    min-height: 90px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Sticky Ad (optional - for desktop) */
@media (min-width: 1024px) {
    .ad-sticky {
        position: sticky;
        top: 80px;
        margin: 0;
        padding: 12px 0;
    }
    
    .ad-sticky .ad-banner {
        min-height: 250px;
        width: 100%;
    }
}

/* Ad Between Match Groups */
.ad-between-matches {
    margin: 16px 0;
    padding: 12px 0;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-lg);
}

/* Compact Ad for Mobile */
@media (max-width: 768px) {
    .ad-container {
        margin: 12px 0;
        padding: 4px 0;
    }
    
    .ad-banner {
        min-height: 80px;
    }
    
    .ad-label {
        font-size: 0.55rem;
        margin-bottom: 4px;
    }
    
    .ad-top .ad-banner,
    .ad-bottom .ad-banner {
        min-height: 70px;
    }
    
    .ad-incontent .ad-banner {
        min-height: 80px;
    }
    
    .ad-rankings .ad-banner,
    .ad-tournaments .ad-banner {
        min-height: 70px;
    }
}

/* For very small screens */
@media (max-width: 480px) {
    .ad-banner {
        min-height: 60px;
    }
    
    .ad-label {
        font-size: 0.5rem;
    }
    
    .ad-container {
        margin: 8px 0;
    }
}

/* Dark Mode Support (if user prefers dark theme) */
@media (prefers-color-scheme: dark) {
    .ad-label {
        color: #a0b8a8;
        background: rgba(255, 255, 255, 0.05);
    }
    
    .ad-banner {
        background: linear-gradient(135deg, #1a2a22 0%, #122018 100%);
    }
    
    .ad-banner:hover {
        background: linear-gradient(135deg, #1e3028 0%, #16251d 100%);
    }
    
    .ad-incontent {
        background: rgba(35, 209, 107, 0.05);
        border-color: rgba(35, 209, 107, 0.15);
    }
}

/* Print styles - hide ads when printing */
@media print {
    .ad-container,
    .adsbygoogle,
    [class*="ad-"] {
        display: none !important;
    }
}

/* Accessibility: Reduce motion if preferred */
@media (prefers-reduced-motion: reduce) {
    .ad-container,
    .ad-banner {
        transition: none;
    }
}

/* Ad Container Animation (subtle fade-in) */
.ad-container {
    animation: adFadeIn 0.3s ease-out;
}

@keyframes adFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Ad Grid for Multiple Ads */
.ad-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin: 20px 0;
}

.ad-grid .ad-container {
    flex: 1;
    min-width: 250px;
    margin: 0;
}

@media (max-width: 600px) {
    .ad-grid {
        flex-direction: column;
        gap: 12px;
    }
    
    .ad-grid .ad-container {
        width: 100%;
    }
}

/* Lazy Load Ad Placeholder */
.ad-placeholder {
    min-height: 90px;
    background: linear-gradient(90deg, #f0f4f0 25%, #fafdfa 50%, #f0f4f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

/* Ad Between Match Items (discreet separator) */
.match-ad-separator {
    margin: 12px 0;
    text-align: center;
}

.match-ad-separator .ad-label {
    background: transparent;
    font-size: 0.55rem;
}

/* Floating Ad (for desktop - optional, use sparingly) */
.ad-floating {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 300px;
    z-index: 90;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
}

.ad-floating .ad-banner {
    min-height: 250px;
}

.ad-floating .close-floating {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    background: var(--court-dark);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    border: 2px solid white;
    z-index: 10;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .ad-floating {
        display: none;
    }
}

/* Ad Performance Indicator (for debugging - remove in production) */
.ad-performance {
    position: absolute;
    bottom: 0;
    right: 0;
    font-size: 0.5rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    display: none;
}

/* Ensure ads don't break layout on any device */
.adsbygoogle {
    display: block;
    width: 100%;
}

/* Respect user privacy - GDPR compliant styling */
.ad-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
    padding: 16px;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.ad-consent-banner.show {
    transform: translateY(0);
}

.ad-consent-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.ad-consent-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.ad-consent-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.ad-consent-btn {
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.ad-consent-btn.accept {
    background: var(--court-accent);
    color: var(--court-dark);
}

.ad-consent-btn.accept:hover {
    background: #2cdd78;
}

.ad-consent-btn.reject {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
}

.ad-consent-btn.reject:hover {
    background: var(--surface);
}

/* Empty ad state (when no ad is served) */
.ad-container:empty {
    display: none;
}

/* Responsive Ad Container for different viewports */
@media (min-width: 768px) and (max-width: 1023px) {
    .ad-banner {
        min-height: 90px;
    }
}

@media (min-width: 1024px) {
    .ad-banner {
        min-height: 90px;
    }
    
    .ad-top .ad-banner,
    .ad-bottom .ad-banner {
        min-height: 90px;
    }
}