*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --color-bg: #f6f6f6;
    --color-card: #ffffff;
    --color-card-excluded: #e8e8e8;
    --color-text: #111111;
    --color-text-muted: #555555;
    --color-primary: #111111;
    --color-primary-hover: #2b2b2b;
    --color-border: #d9d9d9;
    --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.06);
    --shadow-button: 0 8px 22px rgba(0, 0, 0, 0.12);
    --font-stack: "Helvetica Neue", Arial, sans-serif;
}

html { font-size: 16px; }

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-stack);
    background: radial-gradient(circle at 20% 20%, #fcfcfc 0%, #f1f1f1 45%, #f6f6f6 100%);
    color: var(--color-text);
    letter-spacing: 0.02em;
    min-height: 100vh;
}

.container {
    max-width: 620px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

header { text-align: center; margin-bottom: 1.75rem; }

h1 {
    margin: 0 0 0.35rem;
    font-size: 2.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.subtitle {
    margin: 0;
    font-size: 1.05rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.controls { text-align: center; margin-bottom: 1.75rem; }

.btn-primary {
    display: inline-block;
    padding: 0.85rem 2.2rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #111111, #2d2d2d);
    border: 1px solid #0f0f0f;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: var(--shadow-button);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    min-height: 48px;
    min-width: 180px;
}

.btn-primary:hover { background: linear-gradient(135deg, #1a1a1a, #333333); }
.btn-primary:focus { outline: 3px solid #000000; outline-offset: 3px; }
.btn-primary:active { transform: translateY(1px); }

.btn-view-all {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 150ms ease;
    z-index: 100;
}

.btn-view-all:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: rgba(17, 17, 17, 0.03);
}

.btn-view-all:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-view-all:active {
    transform: scale(0.98);
}

.word-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
}

@media (min-width: 600px) {
    .word-grid { grid-template-columns: 1fr 1fr; gap: 1.1rem; }
    h1 { font-size: 2.3rem; }
}

.word-card {
    position: relative;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.1rem 1.35rem;
    text-align: center;
    box-shadow: var(--shadow-card);
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.word-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,0.08); }

.state-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 150ms ease, transform 150ms ease;
}

.state-btn:hover {
    opacity: 0.7;
    transform: scale(1.1);
}

.state-btn:focus {
    outline: none;
    opacity: 0.7;
}

.icon {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--color-text);
    stroke-width: 1.5;
}

.icon-star {
    fill: none;
    stroke: var(--color-text);
    stroke-width: 1.5;
}

.icon-eye-slash {
    fill: none;
    stroke: var(--color-text);
    stroke-width: 1.5;
    color: var(--color-text);
}

.word-card.is-favorite {
    background: var(--color-card);
}

.word-card.is-favorite .state-btn {
    opacity: 1;
}

.word-card.is-favorite .icon-star {
    fill: #f5a623;
    stroke: #f5a623;
}

.word-card.is-hidden {
    background: var(--color-card-excluded);
    opacity: 0.7;
    border: 2px dashed var(--color-border);
}

.word-card.is-hidden .state-btn {
    opacity: 1;
}

.word-card.is-hidden .icon-eye-slash {
    fill: #555555;
    stroke: #555555;
    color: #555555;
}

.word-card.is-hidden .word-text {
    color: #ffffff;
    text-decoration: line-through;
}

.word-text {
    font-size: 1.55rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
    letter-spacing: 0.03em;
}

@media (min-width: 600px) { .word-text { font-size: 1.9rem; } }

@media (prefers-reduced-motion: reduce) {
    .btn-primary:active { transform: none; }
    .word-card { transition: none; }
    .favorite-btn { transition: none; }
    .exclude-btn { transition: none; }
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-card-excluded: #2a2a2a;
    }
}
