:root {
    --bg: #0e0e13;
    --card: rgba(255, 255, 255, 0.04);
    --text: #f2f2f6;
    --muted: #a4a7b3;
    --accent1: #6a5acd;
    --accent2: #8a2be2;
    --success: #30c48d;
    --error: #ff6b6b;
}

* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    background: radial-gradient(1200px 600px at 10% -10%, #2a2755 0%, transparent 60%),
        radial-gradient(1200px 600px at 110% 10%, #3b1c6d 0%, transparent 60%), var(--bg);
    color: var(--text);
    font:
        16px/1.5 system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Arial,
        sans-serif;
    background-repeat: no-repeat;
}

.container {
    max-width: 960px;
    margin: 24px auto;
    padding: 0 16px;
}
.header h1 {
    margin: 8px 0 4px;
    letter-spacing: 0.5px;
}
.sub {
    margin: 0 0 18px;
    color: var(--muted);
}

.userbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}
.userbar .toggle {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--muted);
}

.card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 18px;
    margin: 16px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    animation: fadein 0.25s ease;
}
@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.btn {
    appearance: none;
    background: linear-gradient(135deg, var(--accent1), var(--accent2));
    color: white;
    border: 0;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition:
        transform 0.06s ease-in-out,
        opacity 0.2s;
    box-shadow: 0 8px 18px rgba(102, 51, 204, 0.35);
}
.btn:hover {
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0);
    opacity: 0.9;
}

.btn.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text);
}

.btn.outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: var(--text);
}

input[type="text"],
input[type="password"],
select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.q {
    padding: 12px;
    border-radius: 12px;
    background: var(--card);
    margin: 12px 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.options {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.opt {
    background: rgba(255, 255, 255, 0.06);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    text-align: center;
}
.opt.selected {
    outline: 2px solid rgba(255, 255, 255, 0.3);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}
.meta {
    color: var(--muted);
    font-size: 13px;
}

.result {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    margin-top: 12px;
}
.ok {
    color: var(--success);
}
.bad {
    color: var(--error);
}

.footer {
    margin: 16px 0;
    color: var(--muted);
}
.footer a {
    color: var(--muted);
}
.footer a:hover {
    color: var(--text);
}

.word {
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 12px;
    border-radius: 10px;
    margin: 6px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.word.needs-review {
    border: 1px solid var(--error);
    background: rgba(255, 107, 107, 0.08);
}
.word .warn {
    color: var(--error);
    font-weight: 600;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-size: 14px;
}
.timer {
    font-weight: 600;
    color: var(--muted);
    margin: 6px 0 10px;
}
.search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.limit-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.limit-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.limit-btn {
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s ease;
}

.limit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.limit-btn.active {
    background: linear-gradient(135deg, var(--accent1), var(--accent2));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.4);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.page-btn {
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
}
.page-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}
.page-btn.active {
    background: linear-gradient(135deg, var(--accent1), var(--accent2));
    color: #fff;
    border-color: transparent;
}

/* кнопки наверх/вниз */
.scroll-btn {
    position: fixed;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent1), var(--accent2));
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition:
        opacity 0.3s,
        transform 0.2s;
    z-index: 999;
}
#scroll-top {
    bottom: 80px;
}
#scroll-bottom {
    bottom: 20px;
}
.scroll-btn:hover {
    transform: translateY(-2px);
}

/* ---------- Fade transitions for content ---------- */
.fade-container {
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.35s ease,
        transform 0.35s ease;
    will-change: opacity, transform;
}
.fade-container.fade-active {
    opacity: 1;
    transform: translateY(0);
}

.fade-container {
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.35s ease,
        transform 0.35s ease;
    will-change: opacity, transform;
}

.fade-container.fade-active {
    opacity: 1;
    transform: translateY(0);
}

/* При частичном обновлении (внутренний fade) */
#dict-area,
#stats-area {
    transition: opacity 0.35s ease;
    will-change: opacity;
}

#stats-area table tbody tr > td:not(:first-child) {
    text-align: center;
}

.timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.cancel-btn {
    padding: 4px 10px;
    font-size: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn.small {
    padding: 4px 10px;
    font-size: 13px;
}

/* позиционирование кнопки-глазика */
.error-details {
    position: relative;
    padding-right: 40px;
}

.eye-toggle {
    position: absolute;
    right: 8px;
    top: 2px;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.85;
    transition:
        transform 0.2s ease,
        filter 0.2s ease,
        opacity 0.2s ease;
    user-select: none;
}
.eye-toggle:hover {
    opacity: 1;
    transform: scale(1.08);
}
.eye-toggle.active {
    transform: scale(1.16);
    filter: drop-shadow(0 0 6px rgba(228, 224, 235, 0.9));
}

/* КЛЮЧЕВАЯ ЧАСТЬ: блюрим все переводы, когда <ul> в состоянии is-blurred */
.error-details ul.wrong-list.is-blurred .blur-block {
    /* inline-элементам иногда нужен inline-block для стабильного blur */
    display: inline-block;
    filter: blur(6px) !important;
    opacity: 0.35 !important;
    transition:
        filter 0.25s ease,
        opacity 0.25s ease;
    will-change: filter, opacity;
}

.dict-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.dict-right-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dict-eye-toggle {
    cursor: pointer;
    font-size: 20px;
    opacity: .85;
    user-select: none;
    transition: transform .2s ease, filter .2s ease, opacity .2s ease;
}

.dict-eye-toggle:hover {
    opacity: 1;
    transform: scale(1.12);
}

.dict-eye-toggle.active {
    transform: scale(1.18);
    filter: drop-shadow(0 0 6px rgba(150,80,255,.7));
}

/* Блюр словаря */
.dict-list-blurred .dict-ru {
    filter: blur(6px) !important;
    opacity: .3 !important;
    transition: filter .25s ease, opacity .25s ease;
}

/* update */
.update-title {
    margin-top: 0;
    color: #ff0000;
    font-size: 20px;
}

.update-content {
    list-style: decimal;
}

/* Grammar styling */

#grammar-area h2 {
    margin-bottom: 20px;
}

.grammar-block {
    background: rgba(255,255,255,0.04);
    padding: 18px;
    border-radius: 14px;
    margin-bottom: 28px;
    box-shadow: 0 0 12px rgba(0,0,0,0.25);
}

.grammar-block h3 {
    margin-top: 0;
    color: var(--accent);
}

.g-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    margin-bottom: 12px;
}

.g-table th,
.g-table td {
    border: 1px solid rgba(255,255,255,0.15);
    padding: 8px 10px;
}

.formula {
    background: rgba(128,70,255,0.16);
    padding: 12px;
    border-radius: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    line-height: 1.55;
    font-family: monospace;
}

.accent {
    color: #b483ff;
}

/* Примеры EN + RU */

.g-examples {
    list-style: disc;
    padding-left: 20px;
    margin-top: 8px;
}

.g-examples li {
    margin-bottom: 6px;
}

.g-ex-en {
    font-weight: 500;
}

.g-ex-ru {
    font-size: 0.9em;
    color: rgba(255,255,255,0.75);
}