:root {
    color-scheme: light;
    font-family: Arial, sans-serif;
    background: #f3f5fb;
    color: #222;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: #f3f5fb;
}

button,
a {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.trainer-card {
    width: 100%;
    max-width: 500px;
    min-height: 420px;
    padding: 24px;
    overflow: hidden;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 10px 35px rgba(29, 44, 81, 0.12);
    text-align: center;
}

.card-header {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.brand {
    color: #222;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-decoration: none;
}

.progress-label,
.direction-label {
    color: #8a91a3;
    font-size: 14px;
    font-weight: 700;
}

.direction-label {
    min-height: 18px;
    margin: 0 0 14px;
}

.state-message {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    color: #667085;
    font-size: 18px;
}

.state-message p {
    margin: 0;
}

.state-message--error {
    color: #813a3a;
}

.prompt-view,
.answer-view {
    animation: card-in 180ms ease-out;
}

.word-image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0 0 22px;
    border-radius: 24px;
    background: #f0f0f0;
    object-fit: cover;
}

.prompt-image {
    margin-bottom: 24px;
}

.prompt-word {
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
    color: #222;
    font-size: clamp(38px, 10vw, 58px);
    font-weight: 800;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.question {
    margin: 0 0 22px;
    color: #3f4654;
    font-size: 24px;
    line-height: 1.25;
}

.primary-button,
.secondary-button,
.audio-button,
.rating-button {
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.primary-button,
.secondary-button {
    width: 100%;
    padding: 16px 18px;
    font-size: 18px;
}

.primary-button {
    background: #ffd44d;
    color: #222;
    box-shadow: 0 8px 20px rgba(188, 142, 0, 0.16);
}

.secondary-button {
    max-width: 280px;
    background: #e8edf7;
    color: #222;
}

.show-answer-button {
    margin-top: 2px;
}

.audio-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 22px 0 0;
}

.audio-button {
    padding: 15px 12px;
    background: #ffd44d;
    color: #222;
    font-size: 17px;
}

.audio-button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.8);
    opacity: 0.5;
}

.audio-status {
    min-height: 18px;
    margin: 8px 0 10px;
    color: #8a91a3;
    font-size: 13px;
}

.word {
    margin-bottom: 8px;
    color: #222;
    font-size: clamp(38px, 10vw, 48px);
    font-weight: 800;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.transcription {
    min-height: 26px;
    margin-bottom: 10px;
    color: #777;
    font-size: 21px;
}

.translation {
    margin-bottom: 14px;
    color: #444;
    font-size: 29px;
    font-weight: 600;
    line-height: 1.2;
}

.meta {
    min-height: 18px;
    color: #999;
    font-size: 14px;
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.rating-button {
    min-height: 66px;
    padding: 11px 8px;
    color: #2f3440;
    font-size: 15px;
    line-height: 1.2;
}

.rating-button span {
    display: block;
    margin-bottom: 4px;
    font-size: 20px;
}

.rating-button--unknown {
    background: #ffe5e5;
}

.rating-button--almost {
    background: #fff0c7;
}

.rating-button--known {
    background: #dff5e8;
}

.summary {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: card-in 220ms ease-out;
}

.summary-icon {
    margin-bottom: 10px;
    font-size: 50px;
}

.summary h1 {
    margin: 0 0 8px;
    font-size: 38px;
}

.summary-count {
    margin: 0 0 24px;
    color: #777;
    font-size: 18px;
}

.summary-results {
    display: grid;
    gap: 10px;
    margin: 0 0 26px;
}

.summary-results div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: #f6f7fb;
    border-radius: 15px;
}

.summary-results dt {
    font-weight: 700;
}

.summary-results dd {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

button:hover:not(:disabled) {
    filter: brightness(0.98);
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

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

@media (max-width: 520px) {
    .app-shell {
        align-items: flex-start;
        padding: 0;
    }

    .trainer-card {
        min-height: 100vh;
        padding: 18px;
        border-radius: 0;
        box-shadow: none;
    }

    .rating-buttons {
        gap: 7px;
    }

    .rating-button {
        padding-inline: 5px;
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
