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

body {
    font-family: 'Rubik', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.header + .container { padding-bottom: 80px; }

/* ═══════════════════════════════════════════════
   ПЕРЕМЕННЫЕ — LIGHT (по умолчанию)
   ═══════════════════════════════════════════════ */
:root {
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-hover: #f5f7fa;
    --bg-subtle: #e3f2fd;
    --text: #333333;
    --text-sub: #888888;
    --text-muted: #aaaaaa;
    --border: #e0e0e0;
    --border-light: #bbdefb;
    --border-soft: #f0f0f0;
    --accent: #2196f3;
    --accent-dark: #1976d2;
    --accent-light: #bbdefb;
    --accent-lighter: #e3f2fd;
    --accent-shadow: rgba(33, 150, 243, 0.3);
}

/* DARK */
body[data-theme="dark"] {
    --bg: #0f0f0f;
    --bg-card: #1e1e1e;
    --bg-header: #1a1a1a;
    --bg-hover: #2a2a2a;
    --bg-subtle: #1a2a3d;
    --text: #e0e0e0;
    --text-sub: #888888;
    --text-muted: #666666;
    --border: #2a2a2a;
    --border-light: #2a2a2a;
    --border-soft: #2a2a2a;
    --accent: #2196f3;
    --accent-dark: #1976d2;
    --accent-light: #2a2a2a;
    --accent-lighter: #1a2a3d;
    --accent-shadow: rgba(33, 150, 243, 0.4);
}

/* SEPIA */
body[data-theme="sepia"] {
    --bg: #f4ecd8;
    --bg-card: #fbf6e9;
    --bg-header: #fbf6e9;
    --bg-hover: #efe5cc;
    --bg-subtle: #e8d9b8;
    --text: #4a3b2a;
    --text-sub: #8a7a63;
    --text-muted: #a8977c;
    --border: #d9c8a5;
    --border-light: #d9c8a5;
    --border-soft: #e8d9b8;
    --accent: #8d6e3a;
    --accent-dark: #6f5528;
    --accent-light: #d9c8a5;
    --accent-lighter: #efe5cc;
    --accent-shadow: rgba(141, 110, 58, 0.35);
}

/* NEON */
body[data-theme="neon"] {
    --bg: #0a0a14;
    --bg-card: #14142a;
    --bg-header: #14142a;
    --bg-hover: #1e1e3c;
    --bg-subtle: #1e1e3c;
    --text: #e8e8ff;
    --text-sub: #8888aa;
    --text-muted: #555577;
    --border: #2a2a4a;
    --border-light: #3a2a5a;
    --border-soft: #2a2a4a;
    --accent: #ff2d95;
    --accent-dark: #d81b60;
    --accent-light: #3a1a3a;
    --accent-lighter: #1e0f2a;
    --accent-shadow: rgba(255, 45, 149, 0.5);
}

/* FOREST */
body[data-theme="forest"] {
    --bg: #0f1a14;
    --bg-card: #1a2b22;
    --bg-header: #1a2b22;
    --bg-hover: #243a2e;
    --bg-subtle: #243a2e;
    --text: #d8e8dd;
    --text-sub: #7a9988;
    --text-muted: #556b5c;
    --border: #2a3d30;
    --border-light: #2a3d30;
    --border-soft: #2a3d30;
    --accent: #4ade80;
    --accent-dark: #22c55e;
    --accent-light: #1a3d28;
    --accent-lighter: #1a2b22;
    --accent-shadow: rgba(74, 222, 128, 0.4);
}

/* ─── ПРОГРЕСС-БАР СКРОЛЛА ─── */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    width: 0%;
    z-index: 9999;
    transition: width 0.1s ease;
    box-shadow: 0 0 8px var(--accent-shadow);
}

/* ─── АНИМАЦИИ ─── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.card { animation: fadeInUp 0.4s ease both; }
.card:nth-child(1) { animation-delay: 0.03s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.09s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.15s; }
.card:nth-child(6) { animation-delay: 0.18s; }
.card:nth-child(7) { animation-delay: 0.21s; }
.card:nth-child(8) { animation-delay: 0.24s; }
.card:nth-child(9) { animation-delay: 0.27s; }

li { animation: fadeInUp 0.35s ease both; }
li:nth-child(1) { animation-delay: 0.02s; }
li:nth-child(2) { animation-delay: 0.04s; }
li:nth-child(3) { animation-delay: 0.06s; }
li:nth-child(4) { animation-delay: 0.08s; }
li:nth-child(5) { animation-delay: 0.10s; }
li:nth-child(6) { animation-delay: 0.12s; }
li:nth-child(7) { animation-delay: 0.14s; }
li:nth-child(8) { animation-delay: 0.16s; }

.ach-card, .ach-mini, .grammar-card, .dialogue-card, .friend-item { animation: scaleIn 0.35s ease both; }

.btn, .btn-outline, .today-btn {
    transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
}
.btn:active, .btn-outline:active {
    transform: scale(0.97);
}

/* ─── ШАПКА ─── */
.header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    margin-bottom: 40px;
    transition: background 0.3s, border-color 0.3s;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 8px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 30px;
    font-weight: 900;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}
.logo-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.logo:hover .logo-icon {
    transform: scale(1.05);
}
.logo span { color: var(--text); }
.nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 6px;
    border-top: 1px solid var(--border-soft);
    margin-top: 4px;
}
.nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}
.nav a:hover { color: var(--accent); }
.login-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
}

/* ─── ЗАГОЛОВОК ─── */
h1 {
    font-size: 32px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 10px;
}
h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 15px;
}
.subtitle {
    color: var(--text-sub);
    font-size: 15px;
    margin-bottom: 25px;
}

/* ─── HERO ─── */
.hero {
    text-align: center;
    margin-bottom: 30px;
}
.hero h1 {
    font-size: 38px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 12px;
}
.hero p {
    color: var(--text-sub);
    font-size: 16px;
    margin-bottom: 20px;
}
.quote {
    background: var(--bg-card);
    border: 1px solid var(--accent-light);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: 25px 30px;
    margin: 0 auto;
    text-align: center;
    transition: background 0.3s, border-color 0.3s;
}
.quote-text {
    font-size: 17px;
    font-style: italic;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 12px;
}
.quote-author {
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}

/* ─── КНОПКИ ─── */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 14px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }

.btn-outline {
    display: inline-block;
    background: var(--bg-card);
    color: var(--accent);
    padding: 12px 26px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border: 2px solid var(--accent);
    cursor: pointer;
}
.btn-outline:hover {
    background: var(--accent);
    color: #fff;
}

/* ─── ФОРМА ─── */
.form {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}
.form input, .form select {
    flex: 1;
    min-width: 150px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--accent-light);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-family: 'Rubik', sans-serif;
    outline: none;
    transition: border 0.2s;
}
.form input:focus, .form select:focus { border-color: var(--accent); }
.form input::placeholder { color: var(--text-muted); }

/* ─── ПОИСК ─── */
.search { margin-bottom: 25px; }
.search input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--accent-light);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-family: 'Rubik', sans-serif;
    outline: none;
}
.search input:focus { border-color: var(--accent); }

/* ─── СПИСОК ─── */
ul { list-style: none; }
li {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 16px 20px;
    margin: 10px 0;
    border-radius: 12px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: box-shadow 0.2s, transform 0.1s, background 0.2s, border-color 0.2s;
}
li:hover {
    box-shadow: 0 4px 20px var(--accent-shadow);
    transform: translateY(-2px);
    background: var(--bg-hover);
}
.word-text { color: var(--text); font-weight: 500; }
.word-text::before {
    content: "→ ";
    color: var(--accent);
    font-weight: bold;
}
.word-section {
    font-size: 12px;
    color: var(--text-sub);
    background: var(--bg-subtle);
    padding: 3px 10px;
    border-radius: 6px;
    margin-left: 10px;
}

/* ─── ДЕЙСТВИЯ ─── */
.actions { display: flex; gap: 8px; }
.actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}
.actions button:hover {
    color: var(--accent);
    background: var(--bg-hover);
}
.actions .delete-btn:hover { color: #f44336; }

/* ─── КАРТОЧКИ ─── */
.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}
.card {
    background: var(--bg-card);
    border: 2px solid var(--accent-light);
    border-radius: 12px;
    padding: 25px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
}
.card:hover {
    box-shadow: 0 4px 20px var(--accent-shadow);
    transform: translateY(-3px);
    border-color: var(--accent);
    background: var(--bg-hover);
}
.card-emoji { font-size: 32px; margin-bottom: 10px; }
.card-title { font-size: 17px; font-weight: 700; margin-bottom: 5px; color: var(--text); }
.card-count { font-size: 14px; color: var(--text-sub); }

/* ─── EXTRA ─── */
.extra {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 30px;
}
.extra a {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    border: 2px solid var(--accent);
    color: var(--accent);
    background: var(--bg-card);
}
.extra a:hover {
    background: var(--accent);
    color: #fff;
}

/* ─── МОДАЛЬНОЕ ОКНО ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 14px;
    max-width: 500px;
    width: 100%;
    border-left: 4px solid var(--accent);
    color: var(--text);
}
.modal h2 {
    color: var(--accent);
    margin-bottom: 15px;
    font-size: 22px;
}
.modal p {
    color: var(--text-sub);
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 15px;
}

/* ─── ПУСТО ─── */
.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 16px;
}

/* ─── МЕНЮ ПОЛЬЗОВАТЕЛЯ ─── */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 5px 10px;
    border-radius: 20px;
    transition: background 0.2s;
}
.user-menu:hover { background: var(--bg-hover); }
.avatar {
    width: 38px;
    height: 38px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    transition: background 0.3s;
}
.username {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 150px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 100;
}
.user-dropdown.active { display: block; }
.user-dropdown a {
    display: block;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}
.user-dropdown a:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

/* ─── БЛОК «СЕГОДНЯ» ─── */
.today-btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ─── АДАПТИВ ─── */
@media (max-width: 768px) {
    h1 { font-size: 26px; }
    .hero h1 { font-size: 28px; }
    .header-top { flex-direction: column; align-items: flex-start; }
    .header-right { width: 100%; justify-content: space-between; }
    .nav { gap: 12px; font-size: 13px; }
    .form { flex-direction: column; }
    .form input, .form select { min-width: 100%; }
    li { flex-direction: column; align-items: flex-start; gap: 10px; }
    .actions { align-self: flex-end; }
    .cards { grid-template-columns: 1fr; }
    .extra a { min-width: 100%; }
}

/* ─── МОДАЛКА ДОСТИЖЕНИЙ ─── */
.ach-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}
.ach-modal {
    background: var(--bg-card);
    padding: 35px;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    border-top: 4px solid #ffc107;
    animation: scaleIn 0.4s ease;
    color: var(--text);
}
.ach-modal-emoji { font-size: 64px; margin-bottom: 10px; }
.ach-modal h2 { color: var(--text); font-size: 22px; margin-bottom: 20px; }
.ach-modal-list { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.ach-modal-item {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg-subtle);
    padding: 12px 15px;
    border-radius: 10px;
}
.ach-modal-item-emoji { font-size: 28px; }
.ach-modal-item-title { font-weight: 700; color: var(--text); font-size: 15px; }
.ach-modal-item-desc { font-size: 13px; color: var(--text-sub); margin-top: 2px; }

/* ═══════════════════════════════════════════════
   SVG ИКОНКИ
   ═══════════════════════════════════════════════ */

.icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: -0.15em;
    flex-shrink: 0;
    transition: color 0.2s, transform 0.2s;
}

.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-lg {
    width: 28px;
    height: 28px;
}

.icon-xl {
    width: 40px;
    height: 40px;
}

/* Иконка в тексте (акцентный цвет) */
.icon-accent { color: var(--accent); }

/* Иконка в меню */
.nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav a .icon {
    width: 16px;
    height: 16px;
    opacity: 0.85;
    transition: opacity 0.2s, color 0.2s;
}
.nav a:hover .icon {
    opacity: 1;
    color: var(--accent);
}

/* Иконка в заголовке h1, h2 */
h1 .icon, h2 .icon {
    width: 32px;
    height: 32px;
    color: var(--accent);
    vertical-align: -0.15em;
    margin-right: 8px;
}

/* Иконка на карточке */
.card .icon,
.card-emoji .icon {
    width: 36px;
    height: 36px;
    color: var(--accent);
    margin-bottom: 10px;
}

/* Иконка на ачивке */
.ach-mini .icon,
.ach-card .icon {
    width: 32px;
    height: 32px;
    margin-bottom: 6px;
    color: var(--accent);
}
.ach-card.unlocked .icon,
.ach-mini.unlocked .icon {
    color: inherit;
}

/* Иконка на кнопке */
.btn .icon,
.btn-outline .icon {
    width: 18px;
    height: 18px;
    vertical-align: -0.2em;
}

/* Иконки для стрика, слов и т.п. в статистике */
.stat-card .icon,
.stat-mini .icon {
    width: 24px;
    height: 24px;
    color: var(--accent);
    margin-bottom: 6px;
}

/* Иконка галочки в чате */
.checkmarks .icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════
   GRADIENT ИКОНКИ
   ═══════════════════════════════════════════════ */

.icon { width: 20px; height: 20px; vertical-align: -0.15em; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 32px; height: 32px; }
.icon-xl { width: 40px; height: 40px; }

.nav a { display: inline-flex; align-items: center; gap: 6px; }
.nav a .icon { width: 18px; height: 18px; }

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-dropdown a .icon { width: 16px; height: 16px; }

.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    transition: transform 0.2s;
}
.card:hover .card-icon { transform: scale(1.1); }

h1 .icon, h2 .icon {
    width: 32px;
    height: 32px;
    vertical-align: -0.15em;
    margin-right: 8px;
}

.ach-card-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    display: block;
    transition: transform 0.3s;
}
.ach-card:hover .ach-card-icon { transform: scale(1.1); }
.ach-card.locked .ach-card-icon { opacity: 0.4; filter: grayscale(0.8); }

.ach-mini-icon { width: 40px; height: 40px; margin-bottom: 6px; }
.ach-mini.locked .ach-mini-icon { opacity: 0.4; filter: grayscale(0.8); }

.stat-mini .icon, .stat-card .icon {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
}

.btn .icon, .btn-outline .icon { width: 18px; height: 18px; vertical-align: -0.2em; }

.category-title-icon { width: 28px; height: 28px; vertical-align: -0.15em; margin-right: 10px; }
