:root {
    --tier-int-gold-bg:     #fff8e0;
    --tier-int-gold-text:   #6b4d00;
    --tier-int-gold-bar:    #d4a000;

    --tier-int-silver-bg:   #e8e8f0;
    --tier-int-silver-text: #3a3a5c;
    --tier-int-silver-bar:  #9d9dbb;

    --tier-int-bronze-bg:   #fdf0e0;
    --tier-int-bronze-text: #7a4a10;
    --tier-int-bronze-bar:  #d4813a;

    --tier-nat-gold-bg:     #fdf8e0;
    --tier-nat-gold-text:   #6b5a00;
    --tier-nat-gold-bar:    #d4b800;

    --tier-nat-silver-bg:   #eef2f8;
    --tier-nat-silver-text: #2a4060;
    --tier-nat-silver-bar:  #6090c0;

    --tier-nat-bronze-bg:   #f8efea;
    --tier-nat-bronze-text: #6a3520;
    --tier-nat-bronze-bar:  #c07050;

    --tier-regional-bg:     #eaf4ea;
    --tier-regional-text:   #1a4a1a;
    --tier-regional-bar:    #4a9a4a;

    --podium-1: #d4af37;
    --podium-2: #a8a9ad;
    --podium-3: #cd7f32;
}

/* ── Hero ── */

.ratings-hero {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--secondary-color) 60%, #1a0a28 100%);
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ratings-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 80px,
        rgba(150, 90, 164, 0.04) 80px,
        rgba(150, 90, 164, 0.04) 81px
    );
}

.ratings-hero h1 {
    font-size: clamp(36px, 6vw, 72px);
    color: var(--white);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    position: relative;
}

.ratings-hero p {
    color: rgba(255, 255, 255, 0.65);
    font-size: 16px;
    margin-bottom: 0;
    position: relative;
}

.ratings-hero .updated-badge {
    display: inline-block;
    margin-top: 16px;
    padding: 4px 14px;
    border: 1px solid rgba(150, 90, 164, 0.5);
    border-radius: 20px;
    font-size: 12px;
    color: var(--primary-bright);
    letter-spacing: 0.05em;
    position: relative;
}

/* ── Controls bar ── */

.ratings-controls {
    background: var(--off-white);
    border-bottom: 1px solid var(--light-gray);
    padding: 20px 0;
    position: sticky;
    top: 70px;
    z-index: 50;
}

.controls-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.search-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--mid-gray);
    border-radius: var(--border-radius);
    font-family: var(--main-font);
    font-size: 14px;
    color: var(--dark-blue);
    background: var(--white);
    transition: border-color 0.2s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--mid-gray);
    background: var(--white);
    font-size: 13px;
    font-family: var(--main-font);
    color: var(--gray);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pill:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.results-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--gray);
    white-space: nowrap;
}

/* ── Main content ── */

.ratings-section {
    padding: 40px 0 80px;
}

/* ── Podium ── */

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin-bottom: 48px;
}

.podium-card {
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius-lg);
    padding: 24px 20px 20px;
    text-align: center;
    box-shadow: var(--box-shadow);
    flex: 1;
    max-width: 220px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.podium-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow-strong);
}

.podium-card.p1 {
    order: 2;
    padding-top: 32px;
    border-top: 3px solid var(--podium-1);
}

.podium-card.p2 {
    order: 1;
    border-top: 3px solid var(--podium-2);
}

.podium-card.p3 {
    order: 3;
    border-top: 3px solid var(--podium-3);
}

.podium-medal {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    margin: 0 auto 12px;
}

.p1 .podium-medal { background: var(--podium-1); color: #fff; }
.p2 .podium-medal { background: var(--podium-2); color: #fff; }
.p3 .podium-medal { background: var(--podium-3); color: #fff; }

.podium-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--dark-blue);
    margin-bottom: 6px;
}

.podium-points {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* ── Table ── */

.table-wrap {
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.ratings-table {
    width: 100%;
    border-collapse: collapse;
}

.ratings-table thead {
    background: var(--dark-blue);
    color: var(--white);
}

.ratings-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ratings-table th.col-rank   { width: 60px; text-align: center; }
.ratings-table th.col-points { width: 110px; text-align: right; }
.ratings-table th.col-change { width: 70px; text-align: center; }
.ratings-table th.col-bar    { width: 140px; }

.ratings-table td {
    padding: 13px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--light-gray);
    vertical-align: middle;
}

.ratings-table tbody tr:last-child td {
    border-bottom: none;
}

.ratings-table tbody tr {
    transition: background 0.15s;
}

.ratings-table tbody tr:hover {
    background: var(--off-white);
}

.col-rank {
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--gray);
}

.rank-num.top3 {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.rank-1 { background: var(--podium-1); }
.rank-2 { background: var(--podium-2); }
.rank-3 { background: var(--podium-3); }

.driver-name {
    font-weight: 600;
    color: var(--dark-blue);
}

.col-points {
    text-align: right;
    font-weight: 700;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.col-change {
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.change-up      { color: #4caf50; font-weight: 600; }
.change-down    { color: #f44336; font-weight: 600; }
.change-neutral { color: var(--gray); }
.change-new {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: var(--primary-color);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
}

.licence-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.points-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.points-bar-track {
    flex: 1;
    height: 6px;
    background: var(--light-gray);
    border-radius: 3px;
    overflow: hidden;
}

.points-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.state-message {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray);
    font-size: 15px;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .podium { gap: 8px; }
    .podium-card { padding: 16px 12px; }
    .podium-name { font-size: 13px; }
    .podium-points { font-size: 18px; }

    .col-bar { display: none; }
    .ratings-table th.col-bar { display: none; }

    .controls-inner { gap: 8px; }
    .results-count { width: 100%; }
}

@media (max-width: 520px) {
    .col-licence { display: none; }
    .col-change  { display: none; }
    .ratings-table th.col-change { display: none; }
}