/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes highlight {
    0%, 100% {
        background: rgba(255, 255, 255, 0.1);
    }
    50% {
        background: rgba(74, 222, 128, 0.2);
    }
}

:root {
    --grid-row-height: 120px;
}

/* Base styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Abel', sans-serif;
    background-color: #1a1a2e;
    line-height: 1.2;
}

.page-wrapper {
    width: 100%;
    max-width: 920px;
    margin: 20px auto;
    padding: 10px;
}

/* Container */
.container {
    margin: 0 auto;
    width: 920px;
    padding: 8px;
    background-clip: padding-box;
    border: 5px solid rgba(0, 3, 80, 0.8);
    border-radius: 10px;
    background: linear-gradient(135deg,
    rgba(14, 10, 79, 0.92) 0%,
    rgba(35, 69, 153, 0.95) 50%,
    rgba(53, 106, 160, 0.9) 100%);
    animation: fadeIn 0.6s ease-out;
}

.container.narrow {
    width: 470px;
}

/* Header */
.header {
    font-family: 'Exo', sans-serif;
    font-size: 2.4em;
    color: #fff;
    margin-bottom: 1em;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header.narrow-header {
    font-size: 1.8em;
}

.title {
    margin: 0 0 5px 0;
    font-size: 3rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.subtitle {
    margin: 0;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: normal;
    letter-spacing: 1px;
}

/* Progress bar */
.progress-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 0.1s linear;
}

/* Season mode - Grid layout */
.wrapper {
    display: grid;
    grid-gap: 15px;
    grid-template-columns: repeat(2, 445px);
    grid-auto-rows: var(--grid-row-height);
}

:root {
    --grid-row-height: 120px;
}

.wrapper.narrow {
    grid-row-gap: 10px;
    grid-template-columns: repeat(1, 445px);
    grid-auto-rows: 50px;
    margin-top: 10px;
}

.gridbox {
    border-radius: 5px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    width: 97%;
    align-self: start;
}

.gridbox:nth-child(even) {
    align-self: end;
}

.wrapper.narrow .gridbox:nth-child(even) {
    align-self: start;
}

.driverdata {
    display: flex;
    width: 100%;
}

.narrow-driverdata {
    height: 50px;
}

.rank {
    font-family: 'Aldrich', sans-serif;
    border-radius: 3px 0 0 3px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-shadow: -1px -1px 0 rgba(0,0,0,0.3);
    font-weight: bold;
    color: #FFFFFF;
    background-color: #82bbd1;
    background-image: linear-gradient(to bottom,#82bbd1,#100169);
    width: 70px;
    font-size: 2.2em;
    padding: 10px;
    text-align: center;
    box-shadow: 3px 0 2px #888;
    z-index: 1;
    gap: 4px;
}

.rank > small:first-of-type {
    font-size: 0.9rem;
    font-family: 'Aldrich', sans-serif;
    font-weight: normal;
}

.rank > small:last-of-type {
    font-size: 1rem;
    font-family: 'Aldrich', sans-serif;
    font-weight: bold;
}

.drivername {
    font-family: 'Abel', sans-serif;
    font-size: 1.7em;
    text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.2);
    color: #100169;
    flex-wrap: nowrap;
    background-size: 20%, 100%;
    background-repeat: no-repeat, repeat-y;
    background-position: top right, left;
    background-image: linear-gradient(to bottom, #f2f9fe, #f2f5f6), linear-gradient(to bottom, #f2f9fe, #f2f5f6);
    padding: 0.35em 0.5em;
    flex: 1;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.drivername > small {
    font-size: 0.7em;
    font-weight: normal;
}

.narrow-drivername {
    padding: 0.2em 0.4em;
    font-size: 1.4em;
}

.drivernumber {
    font-size: 1em;
    padding-left: 0.4em;
}

.drivernumber ~ small {
    font-size: 0.47em;
    display: block;
    font-weight: normal;
    line-height: 1.3;
}

.header > small {
    font-size: 0.5em;
}

/* Prediction mode - List layout */
.standings-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.driver-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: slideIn 0.6s ease-out backwards;
    transition: all 0.3s ease;
    line-height: 1.3;
    min-height: 52px;
}

.driver-row.highlighted {
    animation: highlight 1.5s ease-in-out 1;
}

.driver-row:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(3px);
}

.position {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.4s ease;
}

.position-number {
    font-size: 20px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.driver-info {
    flex: 1;
}

.driver-name {
    font-size: 19px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.points-info {
    display: flex;
    gap: 10px;
    align-items: center;
}

.points {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.4s ease;
}

.race-points {
    font-size: 1.1rem;
    color: #4ade80;
    font-weight: bold;
}

.change {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
    font-weight: bold;
}

.change-icon {
    font-size: 20px;
}

.change-value {
    font-size: 16px;
    margin-top: 1px;
}

.position-up {
    color: #4ade80;
}

.position-down {
    color: #f87171;
}

.position-same {
    color: rgba(255, 255, 255, 0.7);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 2em;
    color: white;
    font-size: 1.5em;
}