:root {
    --red: #e10600;
    --ink: #15151e;
}

html {
    background: #101015;
}

body {
    position: relative;
    min-height: 100vh;
    box-sizing: border-box;
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 1.6rem 1rem 1rem;
    color: #1a1a1a;
    background-color: #121218;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        repeating-linear-gradient(115deg, transparent 0 120px, rgba(255, 255, 255, 0.012) 120px 122px),
        radial-gradient(ellipse 70% 45% at 10% -5%, rgba(225, 6, 0, 0.28), transparent 70%),
        radial-gradient(ellipse 50% 35% at 100% 0%, rgba(255, 255, 255, 0.07), transparent 70%),
        radial-gradient(ellipse 80% 50% at 50% 110%, rgba(225, 6, 0, 0.08), transparent 70%),
        linear-gradient(180deg, #1c1c24 0%, #131319 55%, #0d0d11 100%);
    background-attachment: fixed;
}

body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(225, 6, 0, 0.9) 30%, rgba(225, 6, 0, 0.9) 70%, transparent);
    box-shadow: 0 0 12px rgba(225, 6, 0, 0.6);
}

.card-grid {
    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
    align-items: start;
}

.card {
    --accent: var(--red);
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: card-in 0.4s ease both;
    transition: transform 0.2s, box-shadow 0.2s;
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
    }
}

.card.wide {
    max-width: 760px;
    margin: 1rem auto;
}

.card.wide:hover {
    transform: none;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    color: #fff;
    background:
        linear-gradient(115deg, transparent 72%, var(--accent) 72%, var(--accent) 76%, transparent 76%),
        linear-gradient(115deg, var(--ink) 0%, #2b2b38 100%);
    border-bottom: 3px solid var(--accent);
}

.card-badge {
    flex-shrink: 0;
    font-style: italic;
    font-weight: 900;
    font-size: 1.15rem;
    background: var(--accent);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    transform: skewX(-10deg);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.card-title {
    min-width: 0;
    overflow-wrap: anywhere;
}

.card-title h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.card-title small {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
}

.card-body span {
    color: #666;
}

.card-foot {
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    background: #f4f4f6;
    border-top: 1px solid #ececf0;
    border-left: 4px solid var(--accent);
}

.tag {
    align-self: flex-start;
    margin-top: 0.4rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff !important;
    background: var(--red);
}

.rows {
    list-style: none;
    margin: 0;
    padding: 0 0 0.35rem;
}

.row {
    display: grid;
    grid-template-columns: minmax(2rem, auto) 1fr auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 0.9rem 0.4rem 0.7rem;
    border-left: 4px solid var(--team, #ccc);
    font-size: 0.9rem;
    transition: background 0.15s;
}

.row:nth-child(even) {
    background: #f6f6f8;
}

.row:hover {
    background: #fff0ef;
}

.pos {
    font-weight: 800;
    text-align: center;
    border-radius: 5px;
    padding: 0.1rem 0.3rem;
    background: #ececf0;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
}

.pos.p1 { background: linear-gradient(135deg, #ffe680, #d4a017); color: #4a3700; }
.pos.p2 { background: linear-gradient(135deg, #f5f5f5, #a9a9b3); color: #2f2f2f; }
.pos.p3 { background: linear-gradient(135deg, #f3b57f, #b5651d); color: #3b1e00; }

.who {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-wrap: anywhere;
}

.who small {
    color: #777;
    font-size: 0.75rem;
}

.value {
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    color: #333;
    text-align: right;
    white-space: nowrap;
}

.value.dnf {
    color: var(--red);
    font-weight: 700;
}

.driver-link {
    all: unset;
    cursor: pointer;
    font-weight: 600;
}

.driver-link:hover {
    color: var(--red);
    text-decoration: underline;
}

.driver-link:focus-visible,
.driver-card:focus-visible {
    outline: 3px solid rgba(225, 6, 0, 0.5);
    outline-offset: 2px;
}

.trophy {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.95em;
    cursor: help;
    filter: drop-shadow(0 0 4px rgba(255, 200, 0, 0.8));
    animation: trophy-shine 2.4s ease-in-out infinite;
}

@keyframes trophy-shine {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50%      { transform: rotate(-8deg) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .trophy { animation: none; }
}

.track-map {
    position: relative;
    box-sizing: border-box;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1rem 1.3rem;
    overflow: hidden;
    background: radial-gradient(circle at 50% 40%, #fff, #eceef2);
    border-bottom: 1px solid #ececf0;
}

.track-map svg,
.track-map img {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.track-map img {
    object-fit: contain;
    mix-blend-mode: multiply;
}

.track-base,
.track-line {
    fill: none;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.track-base {
    stroke: var(--ink);
    stroke-width: 7px;
}

.track-line {
    stroke: var(--accent);
    stroke-width: 3px;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: lap 6s linear infinite;
}

@keyframes lap {
    from { stroke-dashoffset: 1; }
    to   { stroke-dashoffset: -1; }
}

.track-start {
    fill: #fff;
    stroke: var(--ink);
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
}

.map-note {
    position: absolute;
    right: 0.6rem;
    bottom: 0.35rem;
    font-size: 0.65rem;
    color: #999;
}

.no-map {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #999;
}

.no-map span:first-child {
    font-size: 1.6rem;
    opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
    .track-line {
        animation: none;
        stroke-dashoffset: 0;
    }
}

.dotd-chip {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    vertical-align: middle;
    color: #fff;
    background: linear-gradient(135deg, #8e2de2, #4a00e0);
    text-decoration: none;
}

.row.vote {
    background: linear-gradient(90deg, rgba(142, 45, 226, 0.14) var(--share), transparent var(--share));
}

.row.vote:nth-child(even) {
    background:
        linear-gradient(90deg, rgba(142, 45, 226, 0.14) var(--share), transparent var(--share)),
        #f6f6f8;
}

.driver-card {
    cursor: pointer;
}

.driver-card .card-badge {
    font-size: 1.6rem;
    min-width: 2.2rem;
    text-align: center;
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    text-align: center;
    padding: 0.8rem 0.5rem;
}

.stat-strip div + div {
    border-left: 1px solid #ececf0;
}

.stat-strip b {
    display: block;
    font-size: 1.35rem;
    font-weight: 900;
    font-style: italic;
}

.stat-strip span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
}

.state {
    max-width: 480px;
    margin: 2.5rem auto;
    padding: 2rem 1.5rem;
    text-align: center;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: card-in 0.3s ease both;
}

.state h3 {
    margin: 0.75rem 0 0.4rem;
}

.state p {
    margin: 0;
    color: #666;
    line-height: 1.45;
}

.state-icon {
    font-size: 2.6rem;
}

.state-empty {
    position: relative;
    overflow: hidden;
    padding-top: 2.6rem;
}

.state-empty::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 16px;
    background: repeating-conic-gradient(#1a1a1a 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}

.state-error {
    border-top: 5px solid var(--red);
}

.spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto;
    border: 4px solid #ececf0;
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.small {
    width: 18px;
    height: 18px;
    border-width: 3px;
    margin: 0;
}

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

#driver-dialog {
    --accent: var(--red);
    width: min(460px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: none;
    border-radius: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

#driver-dialog.wide {
    width: min(600px, calc(100vw - 2rem));
}

.track-map.large {
    height: 240px;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    border: 1px solid #ececf0;
}

.schedule {
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ececf0;
}

.schedule li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.45rem 0.75rem;
    font-size: 0.88rem;
}

.schedule li:nth-child(even) {
    background: #f6f6f8;
}

.schedule li span:last-child {
    color: #555;
    font-variant-numeric: tabular-nums;
}

.schedule li.is-race {
    font-weight: 800;
    background: #fff0ef;
    border-left: 4px solid var(--red);
}

#driver-dialog .rows {
    border: 1px solid #ececf0;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
}

.dialog-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
}

.small-note {
    margin: 1rem 0 0;
    font-size: 0.82rem;
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:focus-visible {
    outline: 3px solid rgba(225, 6, 0, 0.5);
    outline-offset: 2px;
}

.card-body .card-hint {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--red);
    opacity: 0;
    transition: opacity 0.2s;
}

.card.clickable:hover .card-hint,
.card.clickable:focus-visible .card-hint {
    opacity: 1;
}

#driver-dialog::backdrop {
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(3px);
}

.dialog-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.4rem 3rem 1.2rem 1.4rem;
    color: #fff;
    background:
        linear-gradient(115deg, transparent 70%, var(--accent) 70%, var(--accent) 75%, transparent 75%),
        linear-gradient(115deg, var(--ink), #2b2b38);
    border-bottom: 4px solid var(--accent);
}

.dialog-head h2 {
    margin: 0;
    font-size: 1.4rem;
}

.dialog-head small {
    color: rgba(255, 255, 255, 0.7);
}

.driver-number {
    font-size: 2.6rem;
    font-weight: 900;
    font-style: italic;
    color: var(--accent);
    line-height: 1;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.dialog-close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.dialog-close:hover {
    background: var(--red);
}

.dialog-body {
    padding: 1rem 1.4rem 1.4rem;
}

.dialog-body h4 {
    margin: 1.1rem 0 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--red);
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 0;
}

.facts div {
    background: #f4f4f6;
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
}

.facts dt {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
}

.facts dd {
    margin: 0.1rem 0 0;
    font-weight: 700;
}

.dialog-loading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
    color: #666;
}

.muted {
    color: #888;
}

.wiki-link {
    display: inline-block;
    margin-top: 1.1rem;
    font-weight: 700;
    color: var(--red);
    text-decoration: none;
}

.wiki-link:hover {
    text-decoration: underline;
}

.button-grid {
    position: relative;
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem 1.25rem 1.4rem;
    border-radius: 12px;
    background: linear-gradient(115deg, #15151e, #2b2b38);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.button-grid::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 8px;
    border-radius: 0 0 12px 12px;
    background: repeating-conic-gradient(#fff 0 25%, #15151e 0 50%) 0 0 / 8px 8px;
}

.fancy-select {
    position: relative;
}

.fancy-trigger {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 270px;
    padding: 0.4rem 0.9rem 0.4rem 0.6rem;
    font: inherit;
    text-align: left;
    color: #fff;
    background: #22222d;
    border: 2px solid #3a3a48;
    border-left: 5px solid var(--red);
    border-radius: 4px;
    transform: skewX(-8deg);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.fancy-trigger:hover {
    background: #282834;
    border-color: #5a5a6e;
    border-left-color: var(--red);
}

.fancy-trigger:focus-visible,
.fancy-select.open .fancy-trigger {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.3);
}

.fancy-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 7px;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.15s, transform 0.15s;
}

.fancy-trigger .fancy-icon {
    background: var(--red);
    box-shadow: 0 0 10px rgba(225, 6, 0, 0.45);
}

.fancy-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.fancy-text b {
    font-size: 0.95rem;
}

.fancy-trigger .fancy-text small {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ff6b63;
}

.fancy-chevron {
    flex-shrink: 0;
    width: 12px;
    height: 8px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e10600' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    transition: transform 0.2s;
}

.fancy-select.open .fancy-chevron {
    transform: rotate(180deg);
}

.fancy-panel {
    position: absolute;
    top: calc(100% + 0.7rem);
    left: 50%;
    translate: -50% 0;
    z-index: 20;
    box-sizing: border-box;
    width: min(440px, calc(100vw - 2rem));
    max-height: min(70vh, 580px);
    overflow-y: auto;
    padding: 0.5rem;
    background: #1b1b24;
    border: 1px solid #3a3a48;
    border-top: 3px solid var(--red);
    border-radius: 12px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
    scrollbar-color: #3a3a48 transparent;
    animation: panel-in 0.18s ease-out;
}

@keyframes panel-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.fancy-group + .fancy-group {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid #2c2c38;
}

.fancy-group-label {
    padding: 0.4rem 0.6rem 0.3rem;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ff6b63;
}

.fancy-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    border-left: 3px solid transparent;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.12s;
}

.fancy-option:hover,
.fancy-option:focus {
    outline: none;
    background: #2a2a36;
}

.fancy-option:hover .fancy-icon,
.fancy-option:focus .fancy-icon {
    transform: scale(1.08);
}

.fancy-option:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(225, 6, 0, 0.6);
}

.fancy-option small {
    margin-top: 0.1rem;
    font-size: 0.76rem;
    color: #9a9aab;
}

.fancy-option[aria-selected="true"] {
    background: linear-gradient(90deg, rgba(225, 6, 0, 0.25), rgba(225, 6, 0, 0.04));
    border-left-color: var(--red);
}

.fancy-option[aria-selected="true"] .fancy-icon {
    background: var(--red);
}

.fancy-check {
    flex-shrink: 0;
    font-weight: 900;
    color: var(--red);
    opacity: 0;
}

.fancy-option[aria-selected="true"] .fancy-check {
    opacity: 1;
}

.season-stepper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.season-picker .fancy-trigger {
    min-width: 150px;
    padding: 0.4rem 0.9rem;
}

.fancy-year {
    font-size: 1.35rem !important;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.year-step {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.6rem;
    padding: 0;
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
    color: #fff;
    background: #22222d;
    border: 2px solid #3a3a48;
    border-radius: 4px;
    transform: skewX(-8deg);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.year-step:hover:not(:disabled) {
    background: var(--red);
    border-color: var(--red);
}

.year-step:focus-visible {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.3);
}

.year-step:disabled {
    color: #555566;
    cursor: not-allowed;
}

.season-picker .fancy-panel {
    width: min(360px, calc(100vw - 2rem));
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.3rem;
    padding: 0 0.3rem 0.3rem;
}

.year-chip {
    position: relative;
    padding: 0.45rem 0;
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #d8d8e0;
    background: #24242f;
    border: 1px solid #30303d;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, transform 0.12s, border-color 0.12s;
}

.year-chip:hover,
.year-chip:focus {
    outline: none;
    color: #fff;
    background: #33333f;
    border-color: #5a5a6e;
    transform: translateY(-1px);
}

.year-chip:focus-visible {
    box-shadow: 0 0 0 2px rgba(225, 6, 0, 0.7);
}

.year-chip[aria-selected="true"] {
    color: #fff;
    background: linear-gradient(180deg, #ff1e14, #c00500);
    border-color: #ff1e14;
    box-shadow: 0 0 10px rgba(225, 6, 0, 0.45);
}

.year-chip.is-current::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2ee86b;
    box-shadow: 0 0 6px #2ee86b;
}

@media (prefers-reduced-motion: reduce) {
    .fancy-panel { animation: none; }
}

.search-button {
    position: relative;
    overflow: hidden;
    min-width: 9rem;
    background: linear-gradient(180deg, #ff1e14, #c00500);
    color: #fff;
    border: none;
    padding: 0.65rem 1.6rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 4px;
    transform: skewX(-8deg);
    box-shadow: 0 2px 6px rgba(225, 6, 0, 0.35);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.search-button::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s;
}

.search-button:hover::before {
    left: 130%;
}

.search-button:hover {
    filter: brightness(1.08);
    transform: skewX(-8deg) translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.45);
}

.search-button:active {
    transform: skewX(-8deg) translateY(1px);
    box-shadow: 0 1px 3px rgba(225, 6, 0, 0.35);
}

.search-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

.search-button:disabled {
    cursor: progress;
    filter: none;
    transform: skewX(-8deg);
    background: #15151e;
    box-shadow: inset 0 0 0 2px #3a3a48;
}

.search-button:disabled::before {
    display: none;
}

.lights {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.lights i {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: #3a0000;
    animation: light-on 2s infinite;
}

.lights i:nth-child(2) { animation-delay: 0.3s; }
.lights i:nth-child(3) { animation-delay: 0.6s; }
.lights i:nth-child(4) { animation-delay: 0.9s; }
.lights i:nth-child(5) { animation-delay: 1.2s; }

@keyframes light-on {
    0%, 10%   { background: #3a0000; box-shadow: none; }
    15%, 80%  { background: #ff1e14; box-shadow: 0 0 8px #ff1e14; }
    85%, 100% { background: #3a0000; box-shadow: none; }
}

.search-button.loading .search-label {
    visibility: hidden;
}

.search-button.loading .lights {
    display: flex;
}

.category-select, .season-select {
    appearance: none;
    background-color: #22222d;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e10600' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding: 0.65rem 2.5rem 0.65rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    border: 2px solid #3a3a48;
    border-left: 5px solid #e10600;
    border-radius: 4px;
    transform: skewX(-8deg);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.category-select option, .season-select option,
.category-select optgroup {
    background: #22222d;
    color: #fff;
}

.category-select optgroup {
    color: #ff6b63;
    font-style: normal;
}

.category-select {
    min-width: 230px;
}

.category-select:hover, .season-select:hover {
    border-color: #5a5a6e;
    border-left-color: #e10600;
}

.category-select:focus, .season-select:focus {
    outline: none;
    border-color: #e10600;
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.3);
}

@media (hover: none) {
    .card-body .card-hint {
        opacity: 1;
    }
}

@media (max-width: 640px) {
    body {
        padding: 1.2rem 0.75rem 0.75rem;
    }

    .button-grid {
        gap: 0.65rem;
        padding: 0.85rem 0.85rem 1.3rem;
    }

    .season-stepper,
    .category-picker,
    .search-button {
        width: 100%;
    }

    .season-picker {
        flex: 1;
    }

    .season-picker .fancy-trigger,
    .category-picker .fancy-trigger {
        width: 100%;
        min-width: 0;
    }

    .year-step {
        width: 2.8rem;
        height: 2.9rem;
    }

    .search-button {
        padding: 0.8rem 1rem;
    }

    .card-grid {
        gap: 0.9rem;
    }

    .card-head {
        padding: 0.75rem 0.85rem;
    }

    .card-title h3 {
        font-size: 0.98rem;
    }

    .row {
        gap: 0.5rem;
        padding-right: 0.6rem;
        font-size: 0.86rem;
    }

    .value {
        font-size: 0.78rem;
    }

    .stat-strip b {
        font-size: 1.15rem;
    }

    #driver-dialog,
    #driver-dialog.wide {
        width: calc(100vw - 1rem);
        max-height: calc(100dvh - 1rem);
    }

    .dialog-head {
        padding: 1.1rem 3rem 1rem 1rem;
    }

    .dialog-head h2 {
        font-size: 1.15rem;
    }

    .driver-number {
        font-size: 2rem;
    }

    .dialog-body {
        padding: 0.8rem 1rem 1.1rem;
    }

    .track-map.large {
        height: 190px;
    }
}

@media (max-width: 400px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .row .value {
        white-space: normal;
        text-align: right;
    }

    .facts {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card, .state {
        animation: none;
    }
    .card:hover {
        transform: none;
    }
}

.card.chart-card {
    max-width: 980px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin: 0;
    padding: 0.9rem 1rem 0.2rem;
    list-style: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    font-size: 0.82rem;
    color: #0b0b0b;
    cursor: default;
}

.legend-item:hover,
.legend-item:focus {
    outline: none;
    background: #f0efec;
}

.legend-item small {
    color: #52514e;
    font-variant-numeric: tabular-nums;
}

.legend-item.other {
    color: #898781;
}

.legend-key {
    width: 16px;
    height: 3px;
    border-radius: 2px;
}

.chart-plot {
    position: relative;
    padding: 0 0.5rem;
}

.chart-svg {
    display: block;
    overflow: visible;
    touch-action: pan-y;
}

.chart-svg:focus {
    outline: none;
}

.chart-svg:focus-visible {
    outline: 2px solid rgba(225, 6, 0, 0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

.grid-line {
    stroke: #e1e0d9;
    stroke-width: 1;
}

.axis-base {
    stroke: #c3c2b7;
    stroke-width: 1;
}

.axis-label {
    font-size: 11px;
    fill: #898781;
    font-variant-numeric: tabular-nums;
}

.series-line,
.other-line {
    fill: none;
    stroke-linejoin: round;
    stroke-linecap: round;
    transition: opacity 0.15s;
}

.series-line {
    stroke-width: 2;
}

.other-line {
    stroke: #c9c8c0;
    stroke-width: 1.25;
    opacity: 0.7;
}

.chart-svg.dimmed .series-line:not(.active),
.chart-svg.dimmed .other-line {
    opacity: 0.12;
}

.chart-svg.dimmed .series-line.active {
    stroke-width: 3;
}

.crosshair {
    stroke: #898781;
    stroke-width: 1;
}

.hover-dot {
    stroke: #fff;
    stroke-width: 2;
}

.chart-tooltip {
    position: absolute;
    z-index: 2;
    min-width: 150px;
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
    background: #fff;
    border: 1px solid rgba(11, 11, 11, 0.1);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.tooltip-title {
    margin-bottom: 0.3rem;
    font-weight: 700;
    color: #52514e;
}

.tooltip-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.08rem 0;
    color: #52514e;
}

.tooltip-row strong {
    min-width: 2.2rem;
    color: #0b0b0b;
    font-variant-numeric: tabular-nums;
}

.tooltip-key {
    width: 12px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.chart-note {
    margin: 0.3rem 1rem 0;
    font-size: 0.8rem;
    color: #52514e;
}

.chart-details {
    padding: 0.6rem 1rem 1rem;
}

.chart-details summary {
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--red);
}

.chart-table {
    margin-top: 0.6rem;
    overflow-x: auto;
}

.chart-table table {
    border-collapse: collapse;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chart-table th,
.chart-table td {
    padding: 0.3rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid #ececf0;
}

.chart-table th:nth-child(-n + 2),
.chart-table td:nth-child(-n + 2) {
    text-align: left;
}

.chart-table th {
    color: #52514e;
}

@media (max-width: 640px) {
    .chart-legend {
        padding: 0.75rem 0.75rem 0.2rem;
        gap: 0.2rem 0.6rem;
    }

    .chart-plot {
        padding: 0 0.25rem;
    }
}

.search-box {
    position: relative;
}

.search-box input {
    box-sizing: border-box;
    width: 240px;
    padding: 0.7rem 0.9rem 0.7rem 2.3rem;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: #22222d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5' fill='none' stroke='%23e10600' stroke-width='2'/%3E%3Cpath d='M11 11l4 4' stroke='%23e10600' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0.8rem center;
    border: 2px solid #3a3a48;
    border-left: 5px solid var(--red);
    border-radius: 4px;
    transform: skewX(-8deg);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box input::placeholder {
    color: #8a8a9a;
    font-weight: 500;
}

.search-box input:hover {
    border-color: #5a5a6e;
    border-left-color: var(--red);
}

.search-box input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.3);
}

.search-results {
    position: absolute;
    top: calc(100% + 0.7rem);
    left: 50%;
    translate: -50% 0;
    z-index: 20;
    box-sizing: border-box;
    width: min(380px, calc(100vw - 2rem));
    padding: 0.4rem;
    background: #1b1b24;
    border: 1px solid #3a3a48;
    border-top: 3px solid var(--red);
    border-radius: 12px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
    animation: panel-in 0.18s ease-out;
}

.search-hit {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
}

.search-hit.active {
    background: #2a2a36;
}

.search-hit small {
    margin-top: 0.1rem;
    font-size: 0.76rem;
    color: #9a9aab;
}

.search-tag {
    flex-shrink: 0;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c9c9d6;
    background: #2f2f3c;
}

.search-tag.team {
    color: #fff;
    background: var(--team);
}

.search-empty {
    padding: 0.7rem;
    text-align: center;
    color: #9a9aab;
}

.card.flash {
    animation: flash 1.6s ease-out;
}

@keyframes flash {
    0%, 40% { box-shadow: 0 0 0 4px var(--red), 0 0 30px rgba(225, 6, 0, 0.7); }
    100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
}

.records-note {
    grid-column: 1 / -1;
    margin: 0.25rem 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: #9a9aab;
}

@media (max-width: 640px) {
    .search-box,
    .search-box input {
        width: 100%;
    }
}

.site-footer {
    margin-top: 2.5rem;
    padding: 1.2rem 1rem 0.6rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer p {
    margin: 0;
}

.copyright {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #d8d8e0;
}

.credits {
    margin-top: 0.35rem !important;
    font-size: 0.72rem;
    color: #7a7a8a;
}
