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

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    min-width: 280px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 212, 77, 0.14), transparent 28rem),
        #f3f5fb;
}

button,
input,
a {
    font: inherit;
}

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

.words-page {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 18px 14px 48px;
}

.words-header {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid rgba(218, 223, 234, 0.9);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 32px rgba(29, 44, 81, 0.08);
}

.words-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

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

.learn-link {
    padding: 8px 12px;
    border-radius: 999px;
    background: #f0f3f9;
    color: #525e73;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.words-intro {
    max-width: 650px;
}

.words-eyebrow {
    margin: 0 0 5px;
    color: #9a7410;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.words-intro h1 {
    margin: 0;
    font-size: clamp(32px, 8vw, 48px);
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.words-intro > p:last-child {
    margin: 10px 0 0;
    color: #687186;
    font-size: 16px;
    line-height: 1.45;
}

.search-area {
    margin-top: 22px;
}

.search-label {
    display: block;
    margin: 0 0 8px 3px;
    color: #566176;
    font-size: 13px;
    font-weight: 700;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 620px;
    padding: 0 15px;
    border: 2px solid #dfe4ed;
    border-radius: 17px;
    background: #fff;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-field:focus-within {
    border-color: #d4aa24;
    box-shadow: 0 0 0 4px rgba(255, 212, 77, 0.22);
}

.search-field input {
    width: 100%;
    min-width: 0;
    padding: 14px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #222;
    font-size: 16px;
}

.search-field input::placeholder {
    color: #98a0af;
}

.search-field input:disabled {
    cursor: wait;
}

.words-count {
    min-height: 18px;
    margin: 9px 0 0 3px;
    color: #7b8496;
    font-size: 13px;
    font-weight: 700;
}

.catalog-state,
.empty-state {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px;
    border: 1px solid #e1e5ed;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 8px 26px rgba(29, 44, 81, 0.06);
    color: #606a7d;
    text-align: center;
}

.catalog-state p,
.empty-state p {
    margin: 0;
}

.catalog-state--error {
    color: #7b4545;
}

.state-icon,
.empty-state > span {
    font-size: 40px;
}

.retry-button {
    margin-top: 8px;
    padding: 12px 18px;
    border: 0;
    border-radius: 15px;
    background: #ffd44d;
    box-shadow: 0 6px 16px rgba(188, 142, 0, 0.14);
    color: #222;
    cursor: pointer;
    font-weight: 800;
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.word-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e2e6ee;
    border-radius: 19px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(29, 44, 81, 0.06);
}

.word-card__image-frame {
    aspect-ratio: 1 / 1;
    margin: 7px 7px 0;
    overflow: hidden;
    border-radius: 14px;
    background: #f2f3f5;
}

.word-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.word-card__content {
    padding: 10px 11px 13px;
}

.word-card__heading {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.word-card h2 {
    min-width: 0;
    flex: 1;
    margin: 2px 0 0;
    font-size: clamp(17px, 5vw, 21px);
    letter-spacing: -0.02em;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.word-card__translation {
    min-height: 34px;
    margin: 5px 0 0;
    color: #687186;
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.word-audio-button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff0b5;
    color: #222;
    cursor: pointer;
    font-size: 16px;
    transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.word-audio-button:hover:not(:disabled) {
    background: #ffe586;
    transform: translateY(-1px);
}

.word-audio-button--playing {
    background: #ffd44d;
    box-shadow: 0 0 0 4px rgba(255, 212, 77, 0.24);
}

.word-audio-button:disabled {
    cursor: default;
    filter: grayscale(1);
    opacity: 0.42;
}

.retry-button:focus-visible,
.word-audio-button:focus-visible,
.words-brand:focus-visible,
.learn-link:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

.empty-state {
    margin-top: 0;
}

.empty-state strong {
    color: #343b49;
    font-size: 20px;
}

.audio-status {
    position: fixed;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 580px) {
    .words-page {
        padding: 24px 20px 56px;
    }

    .words-header {
        padding: 26px 28px;
    }

    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
        gap: 15px;
    }
}

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

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