* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #c41e3a 0%, #f1bf00 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.site-nav {
    text-align: left;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.site-nav a {
    color: white;
    text-decoration: none;
    opacity: 0.9;
}

.site-nav a:hover {
    text-decoration: underline;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
}

main {
    flex: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
    background: white;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.control {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.control label {
    font-weight: 600;
    color: #486581;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

select {
    /* Without these the select sizes to its longest option ("Pretérito
       pluscuamperfecto de subjuntivo") and overflows the grid column. */
    width: 100%;
    min-width: 0;
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    border: 2px solid #d9e2ec;
    border-radius: 8px;
    background: white;
    color: #1f2933;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

select:hover {
    border-color: #9fb3c8;
}

select:focus {
    outline: none;
    border-color: #c41e3a;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.15);
}

.prompt {
    background: white;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    text-align: center;
}

.prompt-verb {
    font-size: 1.6rem;
    font-weight: 600;
    color: #c41e3a;
    margin-bottom: 0.25rem;
}

.prompt-tense {
    font-size: 1rem;
    color: #486581;
    font-style: italic;
}

.accent-bar {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.accent {
    background: white;
    border: 2px solid #d9e2ec;
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font-size: 1.1rem;
    cursor: pointer;
    color: #1f2933;
    min-width: 2.4rem;
    transition: all 0.12s ease;
}

.accent:hover {
    background: #fef3f5;
    border-color: #c41e3a;
}

.accent:active {
    transform: translateY(1px);
}

.practice {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.practice-row {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 1rem;
    align-items: start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f4f8;
}

.practice-row:last-of-type {
    border-bottom: none;
}

.practice-row label {
    color: #627d98;
    font-weight: 500;
    font-size: 0.95rem;
    padding-top: 0.6rem;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.practice-row input {
    padding: 0.55rem 0.75rem;
    font-size: 1.05rem;
    border: 2px solid #d9e2ec;
    border-radius: 6px;
    background: white;
    color: #1f2933;
    transition: border-color 0.15s ease;
    width: 100%;
}

.practice-row input:focus {
    outline: none;
    border-color: #4098d7;
    box-shadow: 0 0 0 3px rgba(64, 152, 215, 0.15);
}

.practice-row.correct input {
    border-color: #38a169;
    background: #f0fff4;
}

.practice-row.almost input {
    border-color: #d69e2e;
    background: #fffaf0;
}

.practice-row.wrong input {
    border-color: #e53e3e;
    background: #fff5f5;
}

.feedback {
    font-size: 0.92rem;
    min-height: 1.2rem;
    padding-left: 0.25rem;
}

.feedback.correct {
    color: #2f855a;
    font-weight: 600;
}

.feedback.almost {
    color: #b7791f;
}

.feedback.wrong {
    color: #c53030;
}

.feedback .correct-form {
    font-weight: 600;
    margin-left: 0.3rem;
}

.actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.btn {
    padding: 0.65rem 1.2rem;
    font-size: 1rem;
    border: 2px solid #d9e2ec;
    border-radius: 8px;
    background: white;
    color: #1f2933;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.12s ease;
}

.btn:hover {
    background: #f7fafc;
    border-color: #9fb3c8;
}

.btn.primary {
    background: #c41e3a;
    color: white;
    border-color: #c41e3a;
}

.btn.primary:hover {
    background: #a01530;
    border-color: #a01530;
}

.score {
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: #e6f0fa;
    border-radius: 8px;
    text-align: center;
    color: #334e68;
    font-weight: 600;
    font-size: 1.05rem;
}

.score.perfect {
    background: #c6f6d5;
    color: #22543d;
}

.legend {
    background: #e6f0fa;
    border-left: 4px solid #4098d7;
    border-radius: 6px;
    padding: 0.85rem 1.1rem;
    color: #334e68;
    font-size: 0.88rem;
}

.legend kbd {
    background: white;
    border: 1px solid #bcccdc;
    border-radius: 4px;
    padding: 0.05rem 0.4rem;
    font-family: inherit;
    font-size: 0.85rem;
}

footer {
    text-align: center;
    padding: 1.5rem;
    color: #829ab1;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }

    .controls {
        grid-template-columns: 1fr;
    }

    .practice-row {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .practice-row label {
        padding-top: 0;
    }

    .actions {
        justify-content: stretch;
    }

    .actions .btn {
        flex: 1;
    }

    main {
        padding: 1rem 0.75rem;
    }
}
