@import url('https://fonts.googleapis.com/css2?family=Jura:wght@400;600;700&display=swap');

:root {
    --bg-color: #2b2b2b;
    --card-bg: #3a3a3a;
    --text-color: #f1f1f1;
    --border-color: #444;
    --primary-color: #e10600; /* F1 Red */
    --higher-bg: #3a3a3a;
    --lower-bg: #3a3a3a;
    --correct-bg: #2e8b57;
    --hover-bg: #4a4a4a;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Jura', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #e58d19;
    margin-bottom: 20px;
}

h1 {
    margin: 0 0 20px 0;
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stats-header {
    display: flex;
    justify-content: space-around;
    font-size: 1.1rem;
    color: #ddd;
}

main {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin-bottom: 30px;
}

#driver-input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: none;
    border-radius: 5px;
    background-color: #fff;
    color: #333;
    font-family: 'Jura', sans-serif;
    font-weight: 600;
}

#driver-input:focus {
    outline: 2px solid var(--primary-color);
}

.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: #fff;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    color: #333;
    border-bottom: 1px solid #d4d4d4;
    font-weight: 600;
}

.autocomplete-items div:hover {
    background-color: #e9e9e9;
}

.game-board {
    width: 100%;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.board-header {
    display: grid;
    grid-template-columns: 80px repeat(8, 1fr);
    gap: 5px;
    text-align: center;
    font-weight: 700;
}

.board-header .col {
    background-color: #ffffff;
    color: #000;
    padding: 10px 5px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.board-header .driver-col {
    font-size: 1.1rem;
}

#guesses-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.guess-row {
    display: grid;
    grid-template-columns: 80px repeat(8, 1fr);
    gap: 5px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

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

.guess-cell {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    font-size: 1.1rem;
    font-weight: 700;
    position: relative;
    color: #fff;
    min-height: 60px;
}

.driver-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    background-color: #555;
}

.guess-cell.correct {
    background-color: var(--correct-bg);
}

.arrow {
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.hidden {
    display: none !important;
}

#win-message {
    margin-top: 30px;
    text-align: center;
    background-color: rgba(46, 139, 87, 0.2);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--correct-bg);
}

#play-again-btn {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 1.1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Jura', sans-serif;
    font-weight: 700;
    transition: background-color 0.2s;
}

#play-again-btn:hover {
    background-color: #b30000;
}

@media (max-width: 600px) {
    .board-header, .guess-row {
        grid-template-columns: 60px repeat(8, 1fr);
        font-size: 0.8rem;
    }
    .guess-cell {
        padding: 5px 2px;
        font-size: 0.8rem;
        min-height: 50px;
    }
    .board-header .col {
        font-size: 0.7rem;
        padding: 5px 2px;
    }
}
