/* =====================================================
   EkiTili — Batyr / Steppe design system
   Tokens, typography, shared utilities (chunk btn, sticker,
   chip, ornaments, animations). See `design-handoff/` for
   the source of truth on visual style.
   ===================================================== */
:root {
    /* Brand palette */
    --secondary: #bf983a;
    --secondary-deep: #7a4a1c;
    --page: #f9f6f2;
    --ink: #3d2817;
    --ink-soft: #6b5842;
    --teal: #2d6a7a;
    --teal-deep: #1d4a56;
    --coral: #d15f4a;
    --coral-deep: #9a3f2e;
    --leaf: #6b8e3d;
    --leaf-deep: #4a6628;
    --cream: #f9f6f2;
    --cream-2: #f0e9dc;
    --cream-3: #e4d9c2;
    --gold-soft: #e8c572;

    /* Aliases for legacy code (old --xxx-color tokens) */
    --primary-color: var(--teal);
    --secondary-color: var(--secondary);
    --accent-color: var(--gold-soft);
    --dark-color: var(--secondary-deep);
    --light-color: var(--cream);
    --danger-color: var(--coral);

    /* Radii */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 32px;

    /* Shadows / motion */
    --shadow: 0 4px 0 rgba(122,74,28,0.18);
    --shadow-chunk: 0 4px 0 var(--secondary-deep);
    --shadow-card: 0 6px 0 rgba(122,74,28,0.15);
    --motion: 180ms cubic-bezier(.2,.8,.2,1);

    /* SRS design tokens (kept for legacy screens) */
    --srs-surface: var(--cream);
    --srs-surface-2: var(--cream-2);
    --srs-border: var(--cream-3);
    --srs-text: var(--ink);
    --srs-muted: var(--ink-soft);
    --srs-success: var(--leaf-deep);
    --srs-success-soft: #eaefd9;
    --srs-warning: var(--secondary);
    --srs-warning-soft: #fff6e0;
    --srs-danger-soft: #fdebe6;
    --srs-radius-sm: var(--r-sm);
    --srs-radius-md: var(--r-md);
    --srs-radius-lg: var(--r-lg);
    --srs-radius-pill: 999px;
    --srs-elev-1: 0 2px 0 rgba(122,74,28,0.15);
    --srs-elev-2: 0 4px 0 rgba(122,74,28,0.25);
    --srs-focus: 0 0 0 3px rgba(191,152,58,.35);
    --srs-motion: var(--motion);
}

/* ---------- Base typography & body ---------- */
* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html { font-family: 'Manrope', system-ui, -apple-system, sans-serif; }

.h-display {
    font-family: 'Fredoka', 'Manrope', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--secondary-deep);
}
.h-ornament {
    font-family: 'Fredoka', 'Manrope', system-ui, sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--secondary-deep);
    opacity: 0.75;
}

/* ---------- Shared chunk button ---------- */
.btn-chunk {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 22px;
    background: var(--secondary);
    color: var(--cream);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: var(--r-md);
    box-shadow: 0 4px 0 var(--secondary-deep);
    border: 2px solid var(--secondary-deep);
    cursor: pointer;
    transition: transform 0.06s, box-shadow 0.06s, filter 0.12s;
}
.btn-chunk:hover { filter: brightness(1.04); }
.btn-chunk:active,
.btn-chunk.is-pressed { transform: translateY(3px); box-shadow: 0 1px 0 var(--secondary-deep); }
.btn-chunk:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-chunk.teal  { background: var(--teal);  box-shadow: 0 4px 0 var(--teal-deep);  border-color: var(--teal-deep); }
.btn-chunk.coral { background: var(--coral); box-shadow: 0 4px 0 var(--coral-deep); border-color: var(--coral-deep); }
.btn-chunk.leaf  { background: var(--leaf);  box-shadow: 0 4px 0 var(--leaf-deep);  border-color: var(--leaf-deep); }
.btn-chunk.ghost {
    background: var(--cream); color: var(--secondary-deep);
    border-color: var(--secondary-deep); box-shadow: 0 4px 0 var(--secondary-deep);
}
.btn-chunk.sm { padding: 9px 14px; font-size: 13px; }

/* ---------- Sticker (card with chunky shadow) ---------- */
.sticker {
    background: var(--cream);
    border: 3px solid var(--secondary-deep);
    border-radius: var(--r-lg);
    box-shadow: 0 5px 0 var(--secondary-deep);
}

/* ---------- Chip ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    background: var(--cream-2);
    border: 2px solid var(--secondary-deep);
    border-radius: 999px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: var(--secondary-deep);
}
.chip.gold  { background: var(--secondary); color: var(--cream); }
.chip.teal  { background: var(--teal);  color: var(--cream); border-color: var(--teal-deep); }
.chip.coral { background: var(--coral); color: var(--cream); border-color: var(--coral-deep); }
.chip.leaf  { background: var(--leaf);  color: var(--cream); border-color: var(--leaf-deep); }

/* ---------- Felt-like dot texture ---------- */
.felt {
    background-image: radial-gradient(circle at 1px 1px, rgba(122,74,28,0.07) 1px, transparent 0);
    background-size: 6px 6px;
}

/* ---------- Mascot shadow / drop-shadow helper ---------- */
.mascot-shadow { filter: drop-shadow(0 4px 0 rgba(122,74,28,0.35)); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(122,74,28,0.25); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Animations used across screens ---------- */
@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}
.bob { animation: bob 2.4s ease-in-out infinite; }

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(191,152,58,0.55); }
    100% { box-shadow: 0 0 0 14px rgba(191,152,58,0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-3px); }
    75%      { transform: translateX(3px); }
}
.shake { animation: shake 0.35s; }

@keyframes float-up {
    0%   { transform: translate(-50%, 0) scale(0.7); opacity: 0; }
    20%  { transform: translate(-50%, -10px) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50px) scale(1); opacity: 0; }
}

@keyframes card-arrive {
    0%   { transform: translateY(40px) scale(0.6); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* =====================================================
   SRS Session Layout
   ===================================================== */
.srs-session {
    max-width: 520px;
    margin: 0 auto;
    padding: 12px 16px 100px;
}

.srs-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    color: var(--srs-muted);
}
.srs-progress-count { white-space: nowrap; font-weight: 600; }
.srs-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--srs-border);
    border-radius: var(--srs-radius-pill);
    overflow: hidden;
}
.srs-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--srs-radius-pill);
    transition: width var(--srs-motion);
}
.srs-progress-goal { white-space: nowrap; }

/* =====================================================
   SRS Card
   ===================================================== */
.srs-card {
    background: var(--srs-surface);
    border: 1.5px solid var(--srs-border);
    border-radius: var(--srs-radius-lg);
    padding: 28px 22px 22px;
    box-shadow: var(--srs-elev-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transition: border-color var(--srs-motion), box-shadow var(--srs-motion);
}
.srs-card.is-exact { border-color: var(--srs-success); box-shadow: var(--srs-elev-2), 0 0 0 4px var(--srs-success-soft); }
.srs-card.is-near  { border-color: var(--srs-warning); box-shadow: var(--srs-elev-2), 0 0 0 4px var(--srs-warning-soft); }
.srs-card.is-wrong { border-color: var(--danger-color); box-shadow: var(--srs-elev-2), 0 0 0 4px var(--srs-danger-soft); }

.srs-card-dir-label {
    align-self: flex-end;
    font-size: 0.75rem;
    color: var(--srs-muted);
    background: var(--srs-surface-2);
    padding: 2px 8px;
    border-radius: var(--srs-radius-pill);
    font-weight: 600;
}

.srs-card-word {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--srs-text);
    letter-spacing: 0.02em;
    text-align: center;
}

.srs-card-phonetic {
    color: var(--srs-muted);
    font-size: 1rem;
    font-style: italic;
}

/* =====================================================
   Audio button
   ===================================================== */
.srs-audio-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--srs-border);
    background: var(--srs-surface);
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--primary-color);
    transition: transform 100ms ease, box-shadow 100ms ease, background var(--srs-motion);
    flex-shrink: 0;
}
.srs-audio-btn:hover { background: var(--srs-surface-2); box-shadow: var(--srs-elev-1); }
.srs-audio-btn:active { transform: scale(0.94); }
.srs-audio-btn.is-playing { animation: pulse 600ms infinite; color: var(--secondary-color); }
.srs-audio-btn-sm { width: 34px; height: 34px; font-size: 0.85rem; }

/* =====================================================
   KZ chip-bar
   ===================================================== */
.srs-kz-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
}
.srs-kz-chips::-webkit-scrollbar { display: none; }

.srs-chip {
    flex: 0 0 auto;
    min-width: 44px;
    height: 44px;
    border: 1.5px solid var(--srs-border);
    background: var(--srs-surface-2);
    border-radius: var(--srs-radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--srs-text);
    cursor: pointer;
    transition: transform 80ms ease, background var(--srs-motion);
}
.srs-chip:active { transform: scale(0.92); background: var(--primary-color); color: #fff; }

/* =====================================================
   Input & actions
   ===================================================== */
.srs-input-wrap { width: 100%; }
.srs-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--srs-border);
    border-radius: var(--srs-radius-md);
    font-size: 1.1rem;
    background: var(--srs-surface);
    color: var(--srs-text);
    transition: border-color var(--srs-motion), box-shadow var(--srs-motion);
}
.srs-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--srs-focus);
}
.srs-input:disabled { background: var(--srs-surface-2); color: var(--srs-muted); }

.srs-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}
.srs-btn-primary {
    flex: 2;
    padding: 14px 16px;
    border: none;
    border-radius: var(--srs-radius-md);
    background: var(--primary-color);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: filter 100ms ease, transform 80ms ease;
}
.srs-btn-primary:hover { filter: brightness(1.06); }
.srs-btn-primary:active { transform: scale(0.98); }

.srs-btn-secondary {
    flex: 1;
    padding: 14px 16px;
    border: 1.5px solid var(--srs-border);
    background: var(--srs-surface);
    color: var(--srs-text);
    border-radius: var(--srs-radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--srs-motion);
}
.srs-btn-secondary:hover { background: var(--srs-surface-2); }

/* =====================================================
   Feedback
   ===================================================== */
.srs-feedback-area { width: 100%; }
.srs-feedback {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--srs-radius-md);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeIn 180ms ease;
}
.srs-feedback.is-exact { background: var(--srs-success-soft); color: #1f6f3f; }
.srs-feedback.is-near  { background: var(--srs-warning-soft); color: #8a5a14; }
.srs-feedback.is-wrong { background: var(--srs-danger-soft); color: #8b2a22; }
.srs-feedback-icon { font-size: 1.3rem; }
.srs-feedback-body { flex: 1; }
.srs-feedback-title { font-weight: 700; margin-bottom: 2px; }
.srs-feedback-desc { font-size: 0.95rem; }

/* =====================================================
   Empty / complete state
   ===================================================== */
.srs-empty {
    text-align: center;
    padding: 48px 24px;
}
.srs-empty-illustration { font-size: 4rem; margin-bottom: 12px; }
.srs-empty-title { font-size: 1.3rem; font-weight: 700; color: var(--srs-text); margin-bottom: 8px; }
.srs-empty-sub { color: var(--srs-muted); margin-bottom: 20px; }
.srs-empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.srs-extra-btn {
    padding: 10px 18px;
    border: 1.5px solid var(--srs-border);
    background: var(--srs-surface);
    border-radius: var(--srs-radius-pill);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background var(--srs-motion);
}
.srs-extra-btn:hover { background: var(--srs-surface-2); }

/* =====================================================
   Mode tabs
   ===================================================== */
.srs-mode-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px 4px;
    max-width: 520px;
    margin: 0 auto;
}

/* =====================================================
   Library
   ===================================================== */
.srs-library { padding: 0 4px; }
.srs-lib-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 8px;
    max-width: 520px;
    margin: 0 auto;
}
.srs-lib-header-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.srs-lib-search {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--srs-border);
    border-radius: var(--srs-radius-md);
    font-size: 0.95rem;
    background: var(--srs-surface);
}
.srs-lib-search:focus { outline: none; border-color: var(--primary-color); box-shadow: var(--srs-focus); }
.srs-lib-counter {
    padding: 6px 12px;
    background: var(--srs-surface);
    border: 1.5px solid var(--srs-border);
    border-radius: var(--srs-radius-pill);
    color: var(--srs-muted);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}
.srs-lib-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.srs-lib-filter-btn {
    padding: 6px 14px;
    border-radius: var(--srs-radius-pill);
    border: 1.5px solid var(--srs-border);
    background: var(--srs-surface);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--srs-muted);
    cursor: pointer;
    transition: background var(--srs-motion), color var(--srs-motion);
}
.srs-lib-filter-btn.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

.srs-lib-table {
    max-width: 520px;
    margin: 0 auto;
    border-radius: var(--srs-radius-md);
    overflow: hidden;
    background: var(--srs-surface);
    box-shadow: var(--srs-elev-1);
    margin-bottom: 80px;
}
.lib-row {
    display: grid;
    grid-template-columns: 1.3fr 1.3fr 1.4fr 0.7fr 0.4fr;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--srs-border);
    font-size: 1rem;
}
.lib-row:last-child { border-bottom: none; }
.lib-header {
    font-weight: 700;
    color: var(--primary-color);
    background: #f5f8ff;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lib-kz { font-weight: 600; }
.lib-phonetic { color: var(--srs-muted); font-style: italic; font-size: 0.88rem; }
.lib-alt { color: var(--srs-muted); font-size: 0.85rem; }
.lib-srs {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #fff;
    text-align: center;
    line-height: 24px;
    font-weight: 700;
    font-size: 0.88rem;
}
.lib-srs-ru { margin-left: 3px; opacity: 0.85; }
.srs-lib-empty { text-align: center; padding: 32px 16px; color: var(--srs-muted); }

.srs-lib-batch {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.srs-lib-batch:empty { display: none; }
.srs-lib-batch-btn {
    padding: 8px 16px;
    border-radius: var(--srs-radius-pill);
    border: 1.5px solid var(--primary-color);
    background: var(--srs-surface);
    color: var(--primary-color);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--srs-motion), color var(--srs-motion);
}
.srs-lib-batch-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.srs-lib-available-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--srs-radius-pill);
    background: #e8f5e9;
    color: #2a9d5f;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.lib-add-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.srs-lib-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--srs-radius-pill);
    border: 1.5px solid var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: filter var(--srs-motion), transform var(--srs-motion);
}
.srs-lib-add-btn:hover { filter: brightness(1.08); }
.srs-lib-add-btn:active { transform: scale(0.96); }
.srs-lib-add-btn i { font-size: 0.72rem; }

@media (max-width: 600px) {
    .srs-card-word { font-size: 1.7rem; }
    .lib-row { grid-template-columns: 1fr 1fr 0 0.6fr 0.4fr; }
    .lib-row .lib-phonetic, .lib-row .lib-phonetic ~ * { display: none; }
    .srs-lib-add-btn { padding: 5px 9px; font-size: 0.76rem; }
    .srs-lib-add-btn span { display: none; }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
}

body {
    background: #ebe3d3;
    color: var(--ink);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(191,152,58,0.08) 0, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(45,106,122,0.06) 0, transparent 40%);
}
button { font-family: inherit; cursor: pointer; }

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    margin: 0;
    background: var(--page);
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.profile-icon {
    width: 35px;
    height: 35px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    transition: box-shadow 0.2s, background 0.2s;
}

.profile-icon:hover {
    box-shadow: 0 2px 8px rgba(66,133,244,0.13);
    background: #f0f4fa;
}

main {
    flex: 1;
    padding: 20px;
}

.dashboard {
    margin-bottom: 30px;
}

.progress-summary {
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.daily-goal {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.progress-bar {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    width: 70%;
    margin: 0 15px;
    position: relative;
}

.greeting {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.module-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}

.module-card:active {
    transform: scale(0.98);
}

.module-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.module-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.module-desc {
    font-size: 0.8rem;
    color: #777;
}

.lesson-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.lesson-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 15px;
    font-size: 1.2rem;
}

.lesson-icon.complete {
    background-color: var(--secondary-color);
    color: white;
}

.lesson-icon.incomplete {
    background-color: #e0e0e0;
    color: #999;
}

.lesson-icon.locked {
    background-color: #ccc;
    color: #777;
}

.lesson-info {
    flex: 1;
}

.lesson-title {
    font-weight: 600;
    margin-bottom: 3px;
}

.lesson-desc {
    font-size: 0.8rem;
    color: #777;
}

.locked .lesson-title, .locked .lesson-desc {
    color: #aaa;
}

.flashcards-section {
    margin-bottom: 30px;
}

.flashcard-categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 0;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

.category-pill {
    padding: 8px 15px;
    background-color: white;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

.category-pill.active {
    background-color: var(--primary-color);
    color: white;
}

.flashcard {
    background: white;
    border-radius: 10px;
    padding: 30px 20px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.card-front {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.card-phonetic {
    color: #777;
    margin-bottom: 20px;
}

.flip-btn {
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
}

.feedback-btns {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.correct-btn, .incorrect-btn {
    padding: 10px 25px;
    border-radius: 5px;
    font-weight: 600;
    border: none;
    color: white;
    cursor: pointer;
}

.correct-btn {
    background-color: var(--secondary-color);
}

.incorrect-btn {
    background-color: var(--danger-color);
}

.stats-section {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 22px 16px 16px 16px;
    margin: 0 auto 20px auto;
    max-width: 500px;
}

.stat-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.stat-circle-progress {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.circle-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 1.1em;
    color: var(--primary-color);
    font-weight: 600;
}

.stat-streak {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 0;
    margin-top: 0;
}

.streak-label {
    font-size: 1.1em;
    color: #ff9800;
    font-weight: 600;
}

.streak-value {
    font-size: 2.1em;
    font-weight: bold;
    color: #ff9800;
    margin: 2px 0 2px 0;
    transition: color 0.2s, opacity 0.2s;
}

.streak-value.streak-inactive {
    color: #bbb;
    opacity: 0.75;
}

.streak-desc {
    font-size: 0.95em;
    color: #888;
}

.streak-week {
    display: flex;
    gap: 7px;
    margin-top: 8px;
    justify-content: center;
}

.streak-day {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.streak-day.active {
    background: #ff9800;
    color: #fff;
}

.streak-day.today {
    border: 2.5px solid #b66d00;
}

.stat-activity {
    margin: 18px 0 18px 0;
}

.activity-label {
    font-size: 1em;
    color: #4285f4;
    margin-bottom: 6px;
}

.stat-categories {
    margin-bottom: 18px;
}

.cat-label {
    font-size: 1em;
    color: #4285f4;
    margin-bottom: 6px;
}

.cat-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cat-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-bar-title {
    width: 90px;
    font-size: 0.98em;
    color: #333;
}

.cat-bar {
    flex: 1;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    position: relative;
}

.cat-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: var(--primary-color);
    transition: width 0.7s;
}

.cat-bar-value {
    width: 38px;
    text-align: right;
    font-size: 0.97em;
    color: #4285f4;
}

.stat-achievements {
    margin-top: 18px;
}

.ach-label {
    font-size: 1em;
    color: #4285f4;
    margin-bottom: 6px;
}

.ach-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: #888;
    font-size: 0.98em;
}

@media (max-width: 600px) {
    .stats-section {
        padding: 10px 2vw 10px 2vw;
    }
    .stat-main {
        flex-direction: column;
        align-items: center;
        gap: 18px;
    }
    .stat-streak {
        margin-left: 0;
    }
}

.nav-bar {
    background-color: white;
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    bottom: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    color: #777;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.3rem;
    margin-bottom: 3px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animated {
    animation: fadeIn 0.3s ease-out;
}

/* Tabs */
.tab-content > div {
    display: none;
}

.tab-content > div.active {
    display: block;
}

/* Interactive elements */
[data-tab-target] {
    cursor: pointer;
}

/* Модальное окно результатов */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: background 0.3s;
}
.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 32px 20px 20px 20px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.15);
    text-align: center;
    max-width: 90vw;
    width: 350px;
    animation: fadeInModal 0.3s;
}
@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
#results-stats {
    margin: 18px 0 24px 0;
    font-size: 1.1em;
}
#restart-btn, #close-modal-btn {
    margin: 0 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
#close-modal-btn {
    background: #aaa;
}
#restart-btn:hover {
    background: var(--secondary-color);
}
#close-modal-btn:hover {
    background: #888;
}
@media (max-width: 500px) {
    .modal-content {
        width: 95vw;
        padding: 18px 5vw 18px 5vw;
    }
}

/* Путь уроков (Duolingo-style) */
.lessons-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin: 30px 0 40px 0;
}
.lesson-level {
    display: flex;
    align-items: center;
    margin: 0 0 32px 0;
    position: relative;
    cursor: pointer;
    transition: transform 0.15s;
}
.lesson-level:last-child { margin-bottom: 0; }
.lesson-level .level-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 18px;
    border: 3px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: background 0.2s, border 0.2s, color 0.2s;
}
.lesson-level.completed .level-circle {
    background: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}
.lesson-level.active .level-circle {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    animation: pulse 1.2s infinite alternate;
}
@keyframes pulse {
    from { box-shadow: 0 0 0 0 rgba(66,133,244,0.2); }
    to { box-shadow: 0 0 0 8px rgba(66,133,244,0.08); }
}
.lesson-level.locked .level-circle {
    background: #eee;
    color: #bbb;
    border-color: #ccc;
}
.lesson-level .level-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}
.lesson-level.locked .level-title {
    color: #bbb;
}
.lesson-level.completed .level-title {
    color: var(--secondary-color);
}
.lesson-level.active .level-title {
    color: var(--primary-color);
}
.lesson-level:active:not(.locked) {
    transform: scale(0.97);
}

/* Страница урока */
#tab-lessons .lesson-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    overflow-y: auto;
    box-shadow: 0 0 32px rgba(0,0,0,0.10);
    z-index: 1;
    padding: 0;
    margin: 0;
    display: block;
}
.lesson-page .lesson-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 12px;
    color: var(--primary-color);
}
.lesson-page .lesson-theory {
    font-size: 1.05rem;
    margin-bottom: 18px;
    color: #333;
}
.lesson-page .lesson-tasks {
    margin-top: 10px;
}
.back-to-path {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    cursor: pointer;
    transition: color 0.2s;
}
.back-to-path:hover {
    color: var(--secondary-color);
}
@media (max-width: 600px) {
    .lesson-page {
        padding: 10px 2vw 10px 2vw;
    }
    .lessons-path {
        margin: 18px 0 24px 0;
    }
    .lesson-level .level-title {
        font-size: 1rem;
    }
}

/* Блок задания в уроке */
.lesson-step-block {
    background: #f8faff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(66,133,244,0.07);
    padding: 22px 16px 18px 16px;
    margin: 18px 0 18px 0;
    font-size: 1.12rem;
    color: #222;
    min-height: 80px;
    transition: box-shadow 0.2s;
}
.lesson-step-block .task-q {
    font-weight: 600;
    margin-bottom: 14px;
    font-size: 1.08em;
}

/* Кнопки навигации */
.lesson-nav-block {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin: 24px 0 0 0;
}
.lesson-nav-btn {
    min-width: 60px;
    padding: 12px 0 !important;
    font-size: 1.25em;
    background: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(66,133,244,0.08);
    font-weight: 700;
    transition: background 0.18s, color 0.18s;
}
.lesson-nav-btn:disabled {
    background: #e0e0e0;
    color: #aaa;
    cursor: default;
}

#lesson-complete-modal.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: background 0.3s;
}
#lesson-complete-modal .modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 32px 20px 20px 20px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.15);
    text-align: center;
    max-width: 90vw;
    width: 350px;
    animation: fadeInModal 0.3s;
}
#lesson-complete-modal button {
    margin-top: 12px;
    padding: 10px 22px;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
#lesson-complete-modal button:hover {
    background: var(--secondary-color);
}

.stat-leaderboard {
    margin-top: 24px;
    background: #f8faff;
    border-radius: 12px;
    padding: 18px 12px 10px 12px;
    box-shadow: 0 2px 10px rgba(66,133,244,0.07);
}
.leaderboard-label {
    font-size: 1.1em;
    color: #4285f4;
    font-weight: 600;
    margin-bottom: 10px;
}
.leaderboard-block {
    margin-bottom: 12px;
}
.leaderboard-title {
    font-size: 1em;
    color: #333;
    font-weight: 600;
    margin-bottom: 6px;
}
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.leaderboard-item {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(66,133,244,0.04);
    padding: 7px 12px;
    font-size: 1em;
    font-weight: 500;
    color: #333;
    gap: 10px;
}
.leaderboard-place {
    width: 28px;
    text-align: center;
    font-size: 1.1em;
    font-weight: 700;
}
.leaderboard-place.top1 { color: #ffd700; }
.leaderboard-place.top2 { color: #b0b0b0; }
.leaderboard-place.top3 { color: #cd7f32; }
.leaderboard-name {
    flex: 1;
    font-weight: 600;
}
.leaderboard-points {
    color: #4285f4;
    font-weight: 700;
    font-size: 1em;
    margin-left: 8px;
}
@media (max-width: 600px) {
    .stat-leaderboard {
        padding: 10px 2vw 10px 2vw;
    }
    .leaderboard-item {
        font-size: 0.97em;
        padding: 6px 7px;
    }
}

.leaderboard-user {
    margin-top: 18px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(66,133,244,0.04);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.05em;
    font-weight: 600;
    color: #333;
}
.leaderboard-user-label {
    color: #f9f6f2;
    font-weight: 500;
}
.leaderboard-user-place {
    color: #4285f4;
    font-weight: 700;
    font-size: 1.1em;
}
.leaderboard-user-points {
    color: #ff9800;
    font-weight: 700;
    font-size: 1.1em;
    margin-left: 8px;
}
@media (max-width: 600px) {
    .leaderboard-user {
        font-size: 0.98em;
        padding: 8px 6px;
    }
}

.leaderboard-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(66,133,244,0.04);
}

.profile-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 20px 20px;
    max-width: 350px;
    margin: 0 auto;
}
.profile-avatar-large {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(66,133,244,0.08);
}
.profile-nickname {
    font-size: 1.2em;
    font-weight: 700;
    color: #4285f4;
    margin-bottom: 18px;
}
.profile-progress-block {
    width: 100%;
    margin-bottom: 18px;
}
.profile-progress-label {
    font-size: 1em;
    color: #888;
    margin-bottom: 4px;
}
.profile-progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    margin-bottom: 4px;
    overflow: hidden;
}
.profile-progress-fill {
    height: 100%;
    background: #4285f4;
    border-radius: 6px;
    width: 0%;
    transition: width 0.7s;
}
.profile-progress-percent {
    font-size: 1em;
    color: #4285f4;
    font-weight: 600;
    text-align: right;
}
.profile-about-label {
    font-size: 1em;
    color: #888;
    margin-bottom: 2px;
    align-self: flex-start;
}
.profile-about {
    font-size: 1.05em;
    color: #333;
    background: #f8faff;
    border-radius: 8px;
    padding: 10px 12px;
    width: 100%;
    margin-bottom: 18px;
    min-height: 40px;
}
#closeProfileModal {
    margin-top: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: #fff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
#closeProfileModal:hover {
    background: var(--secondary-color);
}
@media (max-width: 600px) {
    .profile-modal-content {
        max-width: 98vw;
        padding: 18px 2vw 18px 2vw;
    }
}

/* --- Batyr-style bottom navigation --- */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: var(--cream);
    border-top: 3px solid var(--secondary-deep);
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: clamp(4px, 4vw, 60px);
    padding: 8px clamp(8px, 4vw, 40px) max(22px, env(safe-area-inset-bottom, 22px));
    z-index: 2000;
}
.nav-item {
    flex: 1 0 auto;
    min-width: 64px;
    max-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 6px 8px;
    color: var(--ink-soft);
    cursor: pointer;
    position: relative;
    background: none;
    border: none;
    transition: color 0.15s;
}
.nav-item.active {
    color: var(--secondary-deep);
    background: none;
}
.nav-item.active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    width: 22px;
    height: 4px;
    background: var(--secondary);
    border-radius: 2px;
}
.nav-icon {
    font-size: 22px;
    line-height: 1;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: grayscale(0.6) opacity(0.6);
    transition: filter 0.15s, transform 0.15s;
}
.nav-item.active .nav-icon {
    filter: none;
    transform: translateY(-2px);
}
.nav-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: none;
}

/* --- Fullscreen tab sections --- */
.main-tabs {
    padding: 0;
    margin: 0;
    position: relative;
    min-height: 100vh;
    background: var(--page);
}
.tab-section {
    display: none;
    flex-direction: column;
    min-height: calc(100vh - 84px);
    margin: 0 auto;
    padding-bottom: 100px;
    padding-top: 0;
    background: var(--page);
    animation: fadeIn 0.3s;
}
.tab-section.active {
    display: flex;
}

/* --- Крупные элементы, скругления, тени --- */
.lessons-path, .lesson-page, .flashcards-section, .stat-leaderboard, .profile-section, .stats-section {
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--shadow);
    margin: 18px 12px 0 12px;
    padding: 18px 10px 18px 10px;
}

.flashcard {
    min-height: 120px;
    border-radius: 18px;
    box-shadow: var(--shadow);
    background: var(--light-color);
    margin: 18px 0 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    transition: box-shadow 0.2s;
}

.feedback-btns {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 10px;
}
.correct-btn, .incorrect-btn {
    flex: 1;
    font-size: 1.1em;
    border-radius: 14px;
    padding: 12px 0;
    box-shadow: var(--shadow);
    border: none;
    margin: 0 2px;
    font-weight: 600;
}

/* --- Мобильная адаптация --- */
@media (max-width: 600px) {
    .main-tabs, .tab-section {
        min-height: 100vh;
        max-width: 100vw;
        padding: 0;
    }
    .bottom-nav {
        height: 68px;
        font-size: 1em;
        border-radius: 0;
        max-width: 100vw;
    }
    .tab-section {
        margin: 0;
        border-radius: 0;
        padding-bottom: 80px;
    }
    .lessons-path, .lesson-page, .flashcards-section, .stat-leaderboard, .profile-section, .stats-section {
        margin: 12px 4px 0 4px;
        border-radius: 18px;
        padding: 12px 4px 12px 4px;
    }
}

/* --- Скрыть старый header, если вдруг остался --- */
header { display: none !important; }

/* --- Кнопки режима карточек --- */
.flashcard-mode-btn {
    padding: 7px 18px;
    border-radius: 18px;
    border: none;
    margin: 0 4px 10px 0;
    background: #eee;
    color: #4285f4;
    font-weight: 600;
    font-size: 1em;
    transition: background 0.18s, color 0.18s;
    cursor: pointer;
}
.flashcard-mode-btn.active {
    background: #4285f4;
    color: #fff;
}
.flashcard-mode-btn:active {
    background: #2a6ad7;
}

@media (max-width: 600px) {
    .flashcard-mode-btn { font-size: 0.97em; padding: 6px 10px; }
}

/* --- lesson-content-block: основной блок урока --- */
.lesson-content-block {
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--shadow);
    margin: 24px auto 0 auto;
    padding: 22px 16px 18px 16px;
    max-width: 500px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    z-index: auto;
}
.lesson-content {
    width: 100%;
}

/* lesson-page поверх, но не выше .bottom-nav */
#tab-lessons .lesson-page {
    z-index: 1000;
}
.bottom-nav {
    z-index: 2000;
}

/* --- Duolingo-style lesson full UX (шире, без нижнего меню) --- */
.lesson-duo-container {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-bottom: 110px;
    background: #f5f8ff;
}
.lesson-duo-content {
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 2px 16px rgba(66,133,244,0.08);
    padding: 48px 32px 38px 32px;
    margin-top: 24px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lesson-title {
    font-size: 1.45em;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 18px;
    margin-top: 0;
}
.lesson-theory-block {
    font-size: 1.13em;
    color: #222;
    margin-bottom: 18px;
    margin-top: 0;
}
.lesson-step-block {
    background: #f8faff;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(66,133,244,0.07);
    padding: 22px 10px 18px 10px;
    margin: 0 auto 18px auto;
    font-size: 1.13em;
    color: #222;
    min-width: 220px;
    max-width: 340px;
    text-align: center;
}
.lesson-newwords-title {
    font-size: 1.13em;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 12px;
    margin-top: 10px;
}
.lesson-newword {
    font-size: 1.08em;
    margin-bottom: 7px;
}
.task-q {
    font-weight: 700;
    margin-bottom: 18px;
    font-size: 1.09em;
}
.task-opt-btn {
    border-radius: 12px !important;
    padding: 16px 0 !important;
    font-size: 1.13em;
    font-weight: 700;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    color: #333;
    margin-bottom: 14px;
    width: 100%;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
    transition: background 0.18s, color 0.18s, border 0.18s, box-shadow 0.18s;
    box-shadow: 0 1px 4px rgba(66,133,244,0.04);
    cursor: pointer;
    display: block;
}
.task-opt-btn:disabled {
    opacity: 0.7;
    cursor: default;
}
.task-opt-btn.selected {
    border: 2px solid var(--primary-color);
}
.lesson-duo-next-btn {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto 32px auto;
    max-width: 700px;
    width: 96vw;
    border-radius: 18px;
    padding: 24px 0;
    font-size: 1.22em;
    font-weight: 800;
    background: #aaa !important;
    color: #fff !important;
    border: none;
    box-shadow: none !important;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    z-index: 1200;
    letter-spacing: 0.01em;
}
.lesson-duo-next-btn:disabled {
    background: #e0e0e0;
    color: #aaaaaab9;
    cursor: default;
    box-shadow: none;
}
.lesson-duo-next-btn:not(:disabled):not(.success) {
    background: #1e7c7c !important;
    color: #fff !important;
    box-shadow: 0 4px 24px rgba(30,124,124,0.13) !important;
}
.lesson-duo-feedback {
    position: absolute;
    left: 50%;
    bottom: 90px;
    top: auto;
    transform: translateX(-50%);
    min-width: 200px;
    max-width: 380px;
    text-align: center;
    font-size: 1.25em;
    font-weight: 800;
    border-radius: 18px;
    padding: 22px 32px 22px 32px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.13);
    opacity: 0;
    pointer-events: none;
    z-index: 1500;
    transition: opacity 0.5s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.lesson-duo-feedback.correct {
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
}
.lesson-duo-feedback.incorrect {
    background: linear-gradient(90deg, #ff5858 0%, #f857a6 100%);
    color: #fff;
}
.lesson-duo-feedback .feedback-icon {
    font-size: 1.6em;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
    color: #fff;
    text-shadow: 0 2px 8px #2a6ad7;
}

@media (max-width: 600px) {
    .lesson-duo-content { max-width: 99vw; padding: 18px 2vw 18px 2vw; }
    .lesson-duo-next-btn { max-width: 99vw; font-size: 1.07em; padding: 14px 0; }
    .lesson-duo-feedback {
        max-width: 99vw;
        padding: 14px 2vw;
        font-size: 1.08em;
    }
}
/* Скрыть нижнее меню, если открыт урок */
#tab-lessons .lesson-page~.bottom-nav,
.lesson-page~.bottom-nav {
    display: none !important;
}

body.lesson-open .bottom-nav {
  display: none !important;
}

/* --- Duolingo-style feedback --- */
.lesson-duo-feedback {
  position: absolute;
  left: 50%;
  top: 13%;
  transform: translate(-50%, 0);
  min-width: 200px;
  max-width: 380px;
  text-align: center;
  font-size: 1.25em;
  font-weight: 800;
  border-radius: 18px;
  padding: 22px 32px 22px 32px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.13);
  opacity: 0;
  pointer-events: none;
  z-index: 1500;
  transition: opacity 0.5s, background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.lesson-duo-feedback.correct {
  background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
  color: #fff;
}
.lesson-duo-feedback.incorrect {
  background: linear-gradient(90deg, #ff5858 0%, #f857a6 100%);
  color: #fff;
}
.lesson-duo-feedback .feedback-icon {
  font-size: 1.6em;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
@media (max-width: 600px) {
  .lesson-duo-feedback {
    max-width: 99vw;
    padding: 14px 2vw;
    font-size: 1.08em;
  }
}

.lesson-duo-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  background: #1e7c7c;
  box-shadow: 0 2px 16px rgba(66,133,244,0.07);
  z-index: 1100;
  padding: 22px 0 12px 0;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}
.lesson-duo-header .lesson-title {
  font-size: 1.45em;
  font-weight: 800;
  color: #fff;
  margin: 0;
  padding: 0;
}

/* Удаляю .lesson-duo-feedback */
.lesson-duo-feedback, .lesson-duo-feedback.correct, .lesson-duo-feedback.incorrect { display: none !important; }

/* Сдвигаем основной контент вниз на высоту header */
.app-container > main,
.app-container > .main-tabs {
  margin-top: 62px;
}

body, .main-tabs, .tab-section {
  background: var(--light-color) !important;
}

/* Кнопки, акценты, карточки */
.flashcard-mode-btn.active, .lesson-duo-next-btn, .lesson-nav-btn, .correct-btn {
  background: var(--primary-color) !important;
  color: #fff !important;
}
.flashcard-mode-btn, .lesson-duo-content, .lesson-step-block {
  border-color: var(--primary-color) !important;
}
.flashcard-mode-btn.active, .lesson-duo-next-btn.success {
  background: #5fa2a3 !important;
  color: #fff !important;
}
.lesson-duo-next-btn.success {
  box-shadow: 0 4px 24px rgba(110,192,134,0.18);
}
.lesson-duo-next-btn:disabled {
  background: #aaa !important;
  color: #fff !important;
}
/* Акцентные элементы */
.lesson-newwords-title, .cat-label, .leaderboard-label, .ach-label {
  color: var(--secondary-color) !important;
}

.task-opt-btn.selected, .task-opt-btn[disabled][style*='background: var(--secondary-color)'] {
  background: #1e7c7c !important;
  color: #fff !important;
  font-weight: 800;
  border-color: #1e7c7c !important;
}

.app-header {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  height: auto;
  background: var(--secondary);
  border-bottom: 3px solid var(--secondary-deep);
  color: var(--cream);
  font-family: 'Fredoka', 'Manrope', sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  box-shadow: 0 4px 0 rgba(122,74,28,0.18);
  user-select: none;
  padding: 18px 16px 16px;
  margin-bottom: 0;
  margin-top: 0;
  width: 100%;
}
body.lesson-open .app-header { display: none !important; }

.app-container > main,
.app-container > .main-tabs {
  margin-top: 0 !important;
}

.lesson-duo-next-btn {
  background: #aaa !important;
  color: #fff !important;
  box-shadow: none !important;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.lesson-duo-next-btn:not(:disabled):not(.success) {
  background: #1e7c7c !important;
  color: #fff !important;
  box-shadow: 0 4px 24px rgba(30,124,124,0.13) !important;
}
.lesson-duo-next-btn.success {
  background: #5fa2a3;
  color: #fff !important;
  box-shadow: 0 4px 24px rgba(110,192,134,0.18);
}

.app-logo {
  height: 48px;
  width: auto;
  display: block;
  object-fit: contain;
  margin: 0 auto;
  max-width: 90vw;
}

.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.profile-avatar-large {
  margin-left: auto;
  margin-right: auto;
}
.profile-nickname {
  margin-left: auto;
  margin-right: auto;
}
.profile-progress-block {
  margin-left: auto;
  margin-right: auto;
}
.profile-about-label {
  align-self: center;
}
.profile-about {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* --- Модальные окна регистрации и входа --- */
.auth-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    /* убрали blur для плавности */
    display: grid;
    place-items: center;
    z-index: 99999;
    animation: fadeInModalOverlay 0.18s ease-out;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Анимация появления overlay */
@keyframes fadeInModalOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 28px 24px 24px 24px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    max-width: 90vw;
    width: 420px;
    position: relative;
    animation: fadeInModalContent 0.18s ease-out;
    margin: 0 auto;
    max-height: 90vh;
    overflow-y: auto;
}

/* Анимация появления содержимого модального окна */
@keyframes fadeInModalContent {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #888;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.auth-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.auth-modal-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 24px;
    text-align: center;
}

.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-group label {
    display: block;
    font-size: 0.95em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.auth-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.auth-password-wrapper {
    position: relative;
}

.auth-password-wrapper input {
    padding-right: 42px;
}

.auth-eye-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.auth-eye-btn:hover {
    background: #f0f0f0;
    color: #444;
}

.auth-form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-error-message {
    color: var(--danger-color);
    font-size: 0.9em;
    margin-bottom: 16px;
    min-height: 20px;
    text-align: center;
    display: none;
}

.auth-error-message.show {
    display: block;
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 16px;
}

.auth-submit-btn:hover {
    background: var(--secondary-color);
}

.auth-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.auth-switch {
    text-align: center;
    font-size: 0.95em;
    color: #666;
    margin-top: 8px;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

@media (max-width: 500px) {
    .auth-modal {
        align-items: center;
        justify-content: center;
        place-items: center;
    }
    
    .auth-modal-content {
        width: 100%;
        max-width: 420px;
        padding: 28px 20px 24px 20px;
        border-radius: 20px;
        margin: auto;
        max-height: 90vh;
    }
    
    .auth-modal-title {
        font-size: 1.5em;
    }
}

@supports (height: 100dvh) {
    .auth-modal {
        height: 100dvh;
        min-height: 100dvh;
    }
}

/* Кнопка выхода */
.logout-btn {
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--danger-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #c62828;
}

.login-btn {
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: #136060;
}

/* Модалка подтверждения выхода */
.confirm-modal-content {
    background: #fff;
    border-radius: 18px;
    padding: 22px 20px 18px 20px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    width: 360px;
    max-width: 90vw;
    text-align: center;
    animation: fadeInModalContent 0.18s ease-out;
}

.confirm-title {
    font-size: 1.35em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.confirm-text {
    font-size: 0.98em;
    color: #444;
    margin-bottom: 18px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-actions .logout-btn,
.confirm-actions .login-btn {
    flex: 1;
}

/* Стили для теста */
.test-header {
    text-align: center;
    margin-bottom: 20px;
}

.test-header h2 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

#test-progress {
    color: #666;
    font-size: 0.9em;
}

.test-content {
    min-height: 200px;
    text-align: center;
}

.test-question {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: 8px;
    color: var(--dark-color);
    text-align: center;
}

.test-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.test-options .task-opt-btn {
    width: 100%;
    padding: 15px;
    text-align: center;
}

.test-results {
    text-align: center;
    padding: 20px;
}

.test-results h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

#test-score {
    margin: 20px 0;
}

.test-button {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.test-button:hover {
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* Крестик для закрытия теста */
#test-modal .modal-content {
    position: relative;
}

#test-modal .auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}
/* =====================================================
   Battle Styles
   ===================================================== */
.battle-container {
    padding: 8px;
    width: 100%;
    height: calc(100dvh - 130px);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* --- Лобби --- */
.battle-lobby {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 8px;
}
.battle-title {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.battle-subtitle {
    font-size: 0.9rem;
    color: #64748b;
    text-align: center;
}
.lobby-avatar-preview {
    width: 120px;
}
.battle-find-btn {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 20px rgba(37,99,235,0.3);
}
.battle-find-btn:active { transform: scale(0.96); }
.battle-rules {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    font-size: 0.82rem;
    line-height: 1.5;
    width: 100%;
    max-width: 380px;
}
.rules-title { font-weight: 700; margin-bottom: 6px; }
.battle-rules ul { padding-left: 18px; margin: 0; }
.battle-rules li { margin-bottom: 4px; }

/* --- Поиск соперника --- */
.battle-searching {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    height: 100%;
}
.searching-spinner {
    width: 56px; height: 56px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.battle-cancel-btn {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Арена --- */
.battle-arena {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 6px;
}
.arena-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    flex-shrink: 0;
}
.arena-batyr { flex: 1; max-width: 110px; }
.arena-vs {
    font-size: 1rem;
    font-weight: 900;
    color: #94a3b8;
    align-self: center;
    padding: 0 2px;
}

/* --- Батыр --- */
.batyr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: relative;
}
.batyr-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.batyr-svg { width: 64px; height: auto; }
.batyr-hp-bar {
    width: 100%;
    height: 7px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.batyr-hp-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.4s ease;
}
.batyr-hp-text {
    font-size: 0.6rem;
    color: #64748b;
    font-weight: 600;
}

/* Анимации батыра */
.batyr--hit {
    animation: batyrHit 0.4s ease;
}
.batyr--attack {
    animation: batyrAttack 0.5s ease;
}
.batyr--defeated {
    opacity: 0.4;
    filter: grayscale(1);
    transition: opacity 0.8s, filter 0.8s;
}
@keyframes batyrHit {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
@keyframes batyrAttack {
    0% { transform: translateX(0); }
    40% { transform: translateX(20px) scale(1.05); }
    100% { transform: translateX(0) scale(1); }
}
.batyr--right .batyr--attack,
.batyr--right.batyr--attack {
    animation-name: batyrAttackRight;
}
@keyframes batyrAttackRight {
    0% { transform: translateX(0); }
    40% { transform: translateX(-20px) scale(1.05); }
    100% { transform: translateX(0) scale(1); }
}

/* Урон float */
.damage-float {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    font-weight: 900;
    color: #ef4444;
    animation: floatUp 1s ease forwards;
    pointer-events: none;
    z-index: 10;
}
.damage-float--crit {
    font-size: 1.8rem;
    color: #f59e0b;
    text-shadow: 0 0 8px rgba(245,158,11,0.5);
}
@keyframes floatUp {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px); }
}

/* --- Центральная зона --- */
.arena-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 0;
}
#arena-turn-info {
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    text-align: center;
    padding: 6px 12px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 340px;
}
.turn-info--correct { color: #16a34a !important; }
.turn-info--wrong { color: #ef4444 !important; }

/* --- Карты атаки --- */
.attack-cards {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.attack-card {
    width: 95px;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.attack-card:hover, .attack-card:active {
    border-color: #2563eb;
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.2);
}
.attack-card-svg {
    width: 54px; height: 54px;
    margin: 0 auto 6px;
}
.attack-card-svg svg { width: 100%; height: 100%; }
.attack-card-word {
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
}

/* --- Фаза защиты --- */
.defend-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}
.defend-incoming-card {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 3px solid #f59e0b;
    border-radius: 14px;
    padding: 12px;
    text-align: center;
    animation: cardFlyIn 0.4s ease;
}
.defend-card-svg {
    width: 60px; height: 60px;
    margin: 0 auto 6px;
}
.defend-card-svg svg { width: 100%; height: 100%; }
.defend-hint {
    font-size: 0.95rem;
    font-weight: 600;
    color: #b45309;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #fbbf24;
}
.defend-card-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: #92400e;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
}
.defend-card-word {
    font-size: 1.1rem;
    font-weight: 800;
    color: #92400e;
}
@keyframes cardFlyIn {
    0% { opacity: 0; transform: translateY(-30px) scale(0.8); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Таймер */
.defend-timer {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.defend-timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
    border-radius: 4px;
    width: 100%;
}

/* Варианты ответа */
.defend-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}
.defend-option-btn {
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 14px 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    min-height: 48px;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.defend-option-btn:active { transform: scale(0.96); }
.defend-option-btn:hover { border-color: #2563eb; background: #eff6ff; }
.defend-option--selected { border-color: #2563eb; background: #dbeafe; }
.defend-option-btn:disabled { opacity: 0.6; cursor: default; }

/* Ожидание */
.waiting-phase {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}
.waiting-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Комбо-бар --- */
.arena-combo-bar {
    text-align: center;
    min-height: 24px;
    flex-shrink: 0;
}
.combo-active {
    font-size: 0.9rem;
    font-weight: 800;
    color: #f59e0b;
    animation: comboPulse 0.6s ease infinite alternate;
}
.combo-building {
    font-size: 0.8rem;
    color: #94a3b8;
}
@keyframes comboPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* --- Результат --- */
.battle-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 100%;
    padding: 20px;
}
.result-title {
    font-size: 2rem;
    font-weight: 900;
}
.battle-result--win .result-title { color: #16a34a; }
.battle-result--lose .result-title { color: #ef4444; }
.result-icon { font-size: 3rem; }
.result-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 280px;
}
.result-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}
.result-stat-label { color: #64748b; }
.result-stat-value { font-weight: 700; color: #334155; }


/* Achievement Styles */
.ach-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ach-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    width: 90px;
    text-align: center;
}

.ach-item-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.ach-item-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
    line-height: 1.2;
}

/* Achievement Notification Toast */
.achievement-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: white;
    padding: 15px 20px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2000;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 280px;
}

.achievement-notification.show {
    transform: translateX(-50%) translateY(0);
}

.achievement-notification .ach-icon {
    font-size: 2rem;
}

.achievement-notification .ach-text {
    flex: 1;
}

.achievement-notification .ach-title {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.achievement-notification .ach-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color, #4CAF50);
}

/* =====================================================
   Меню игр
   ===================================================== */
.games-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    gap: 1rem;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}
.games-menu-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}
.games-menu-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.games-menu-icon-btn {
    flex: 0 0 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    border-radius: 10px;
    font-size: 1.3rem;
    color: #f1f5f9;
}
.games-menu-main-btn {
    flex: 1;
    height: 48px;
    background: #1e293b;
    color: #f8fafc;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}
.games-menu-main-btn:active {
    background: #334155;
}
.games-menu-main-btn--training {
    background: #312e81;
}
.games-menu-main-btn--training:active {
    background: #3730a3;
}
.games-menu-rules-btn {
    flex: 0 0 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1.1rem;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s;
}
.games-menu-rules-btn:active {
    background: #e2e8f0;
}

/* =====================================================
   Модалка правил
   ===================================================== */
.games-rules-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.games-rules-modal-inner {
    background: #fff;
    border-radius: 16px 16px 12px 12px;
    padding: 1.5rem 1.25rem;
    width: 100%;
    max-width: 480px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}
.games-rules-modal-inner h3 {
    margin: 0 0 0.75rem;
    font-size: 1.2rem;
    color: #1e293b;
}
.games-rules-modal-inner ul {
    padding-left: 1.25rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.5;
}
.games-rules-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

/* =====================================================
   Тренировка — арена
   ===================================================== */
.training-arena {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    gap: 0.75rem;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}
.training-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
}
.training-hp-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
}
.training-hp-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}
.training-hp-bar-bg {
    height: 10px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}
.training-hp-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease, background 0.4s ease;
}
.training-turn-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}
.training-timer-info {
    font-size: 0.85rem;
    color: #475569;
    align-self: flex-start;
}

/* =====================================================
   Фидбэк тренировки
   ===================================================== */
.training-feedback {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    animation: fadeInUp 0.2s ease;
}
.training-feedback--correct { background: #dcfce7; color: #166534; }
.training-feedback--crit    { background: #fef9c3; color: #713f12; font-size: 1rem; }
.training-feedback--wrong   { background: #fee2e2; color: #991b1b; }

/* =====================================================
   Результат тренировки — дополнительный стиль
   ===================================================== */
.result-stat--highlight .result-stat-value {
    color: #7c3aed;
    font-size: 1.1rem;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Offline banner */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #e74c3c;
    color: #fff;
    text-align: center;
    padding: 10px 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.retry-btn {
    background: #fff;
    color: #e74c3c;
    border: none;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.retry-btn:hover {
    background: #f8f8f8;
}

/* =====================================================
   Step 2 — Lessons "Path" screen (batyr journey)
   Overrides the legacy .lessons-path card layout.
   ===================================================== */
.lessons-path.path-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--page);
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    width: 100%;
    overflow: visible;
}

/* Full-bleed steppe canvas. The background layer stretches the
   entire .lessons-path width; an inner 360-wide layer pins the
   winding dashed path, lesson nodes and the mascot.
   min-height makes sure the steppe fills the viewport even with
   few lessons; with more lessons the JS bumps the explicit height. */
.path-canvas {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, #f6eecf 0%, #efe2bf 40%, #e8d4a3 100%);
    overflow: hidden;
}
.path-bg-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.path-bg-hills {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.path-canvas-inner {
    position: relative;
    margin: 0 auto;
    z-index: 1;
}
.path-bg-line {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.path-scatter {
    position: absolute;
    pointer-events: none;
    opacity: 0.85;
    transform: translate(-50%, 0);
}

/* Lesson nodes */
.path-node {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 0;
    height: 0;
}
.path-node-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3.5px solid var(--secondary-deep);
    background: var(--cream-2);
    color: var(--secondary-deep);
    box-shadow: 0 5px 0 var(--secondary-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 26px;
    cursor: pointer;
    position: absolute;
    left: -32px;
    top: -32px;
    transition: transform 0.08s, box-shadow 0.08s;
}
.path-node-btn:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 2px 0 var(--secondary-deep);
}
.path-node-btn:disabled { cursor: not-allowed; }
.path-node-icon { display: inline-block; line-height: 1; }
.path-node-label {
    position: absolute;
    left: 50%;
    top: 38px;
    transform: translateX(-50%);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 11px;
    color: var(--secondary-deep);
    background: rgba(249,246,242,0.85);
    padding: 2px 8px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
}

.path-node--done .path-node-btn {
    background: var(--leaf);
    color: var(--cream);
    border-color: var(--leaf-deep);
    box-shadow: 0 5px 0 var(--leaf-deep);
}
.path-node--done .path-node-label { color: var(--leaf-deep); }

.path-node--current .path-node-btn {
    background: var(--secondary);
    color: var(--cream);
    border-color: var(--secondary-deep);
    animation: pulse-ring 1.6s ease-out infinite;
}
.path-node--current .path-node-label { color: var(--secondary-deep); font-weight: 700; }

.path-node--locked .path-node-btn {
    background: var(--cream-3);
    color: rgba(122,74,28,0.55);
    border-color: rgba(122,74,28,0.45);
    box-shadow: 0 4px 0 rgba(122,74,28,0.35);
}
.path-node--locked .path-node-label {
    color: rgba(61,40,23,0.5);
    background: rgba(249,246,242,0.6);
}

/* "НАЧАТЬ" pill above the current node */
.path-tooltip {
    position: absolute;
    left: 50%;
    top: -78px;
    transform: translateX(-50%);
    background: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 10px;
    padding: 5px 12px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--secondary-deep);
    box-shadow: 0 3px 0 var(--secondary-deep);
    white-space: nowrap;
    letter-spacing: 0.05em;
}
.path-tooltip-arrow {
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: var(--cream);
    border-right: 2.5px solid var(--secondary-deep);
    border-bottom: 2.5px solid var(--secondary-deep);
}

/* Batyr mascot bobbing near the current node */
.path-mascot {
    position: absolute;
    width: 64px;
    z-index: 3;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.path-mascot img {
    width: 100%;
    height: auto;
    display: block;
}

/* Bottom chunky "Пройти тест" button */
.path-test-btn.btn-chunk {
    margin: 14px auto 26px;
    width: calc(100% - 32px);
    max-width: 320px;
}

/* =====================================================
   Step 3 — Lesson screen (theory → MCQ → new words)
   Dressed with the .lesson-screen modifier so the legacy
   .lesson-duo-* rules don't get applied alongside.
   ===================================================== */
.lesson-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: var(--page);
    overflow: hidden;
    transition: background 0.25s;
}
.lesson-screen.feedback-ok    { background: #eaefd9; }
.lesson-screen.feedback-bad   { background: #fdebe6; }

/* Topbar: close · progress · hearts */
.lesson-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px 10px;
    background: var(--page);
}
.lesson-screen.feedback-ok  .lesson-topbar { background: #eaefd9; }
.lesson-screen.feedback-bad .lesson-topbar { background: #fdebe6; }

.lesson-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 20px;
    line-height: 1;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lesson-close:hover { color: var(--secondary-deep); }

.lesson-progress-track {
    flex: 1;
    height: 14px;
    background: var(--cream-3);
    border: 2px solid var(--secondary-deep);
    border-radius: 10px;
    overflow: hidden;
}
.lesson-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--secondary);
    border-right: 2px solid var(--secondary-deep);
    transition: width 0.3s ease;
}

.lesson-hearts {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    color: var(--coral-deep);
}
.lesson-hearts-icon { font-size: 18px; }

/* Body */
.lesson-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px 22px 22px;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.lesson-prompt {
    margin-bottom: 18px;
}
.lesson-prompt .h-ornament {
    display: block;
}
.lesson-prompt-title.h-display {
    font-size: 24px;
    margin-top: 6px;
    line-height: 1.2;
    color: var(--secondary-deep);
}

/* Theory block — sticker card */
.lesson-theory.sticker {
    padding: 18px 18px;
    background: linear-gradient(180deg, #fff6e0 0%, var(--cream) 100%);
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
}
.lesson-theory.sticker b {
    color: var(--secondary-deep);
    font-weight: 700;
}

/* Options grid */
.lesson-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.lesson-option.task-opt-btn {
    /* Reset legacy task-opt-btn rules */
    padding: 14px !important;
    margin: 0 !important;
    max-width: none !important;
    width: auto !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
    text-align: left;
    background: var(--cream);
    border: 2.5px solid var(--cream-3);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--cream-3);
    cursor: pointer;
    transition: transform 0.06s, box-shadow 0.06s, border-color 0.18s, background 0.18s;
    font-family: 'Manrope', sans-serif;
}
.lesson-option:hover:not(:disabled):not(.is-correct):not(.is-wrong) {
    border-color: var(--secondary-deep);
    box-shadow: 0 4px 0 var(--secondary-deep);
}
.lesson-option:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 currentColor;
}
.lesson-option-letter {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid currentColor;
    color: var(--secondary-deep);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.lesson-option-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--secondary-deep);
    line-height: 1.2;
}
.lesson-option.is-correct {
    background: #eaefd9;
    border-color: var(--leaf-deep);
    box-shadow: 0 4px 0 var(--leaf-deep);
}
.lesson-option.is-correct .lesson-option-letter,
.lesson-option.is-correct .lesson-option-label {
    color: var(--leaf-deep);
}
.lesson-option.is-wrong {
    background: #fdebe6;
    border-color: var(--coral-deep);
    box-shadow: 0 4px 0 var(--coral-deep);
    opacity: 0.85;
}
.lesson-option.is-wrong .lesson-option-letter,
.lesson-option.is-wrong .lesson-option-label {
    color: var(--coral-deep);
}
.lesson-option:disabled {
    cursor: default;
}

/* Words list (step 3) */
.lesson-words.sticker {
    padding: 4px 6px;
    background: var(--cream);
}
.lesson-word {
    padding: 12px 14px;
    border-bottom: 1px dashed rgba(122,74,28,0.25);
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}
.lesson-word:last-child { border-bottom: none; }
.lesson-word-kz {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--secondary-deep);
}
.lesson-word-ru {
    font-family: 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 15px;
    color: var(--ink);
}
.lesson-word-phonetic {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-style: italic;
    font-size: 13px;
    color: var(--ink-soft);
}
.lesson-words-placeholder {
    padding: 18px;
    text-align: center;
    color: var(--ink-soft);
    font-style: italic;
}

/* Bottom action button — fills the bottom dock */
.lesson-bottom {
    flex-shrink: 0;
    padding: 14px 18px 18px;
    background: var(--page);
    border-top: 2px solid var(--cream-3);
    transition: background 0.25s, border-color 0.25s;
}
.lesson-screen.feedback-ok  .lesson-bottom { background: #eaefd9; border-top-color: rgba(74,102,40,0.18); }
.lesson-screen.feedback-bad .lesson-bottom { background: #fdebe6; border-top-color: rgba(154,63,46,0.18); }

.lesson-action-btn.btn-chunk {
    /* Override legacy .lesson-duo-next-btn rules that this class no longer inherits */
    position: static !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 420px !important;
    padding: 14px 22px !important;
    background: var(--secondary) !important;
    color: var(--cream) !important;
    border: 2px solid var(--secondary-deep) !important;
    border-radius: var(--r-md) !important;
    box-shadow: 0 4px 0 var(--secondary-deep) !important;
    font-size: 16px !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    z-index: auto !important;
    display: block;
}
.lesson-action-btn.btn-chunk:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--cream-3) !important;
    color: var(--ink-soft) !important;
    border-color: var(--cream-3) !important;
    box-shadow: 0 4px 0 rgba(122,74,28,0.2) !important;
}
.lesson-action-btn.btn-chunk.leaf {
    background: var(--leaf) !important;
    border-color: var(--leaf-deep) !important;
    box-shadow: 0 4px 0 var(--leaf-deep) !important;
}
.lesson-action-btn.btn-chunk.coral {
    background: var(--coral) !important;
    border-color: var(--coral-deep) !important;
    box-shadow: 0 4px 0 var(--coral-deep) !important;
}
.lesson-action-btn.btn-chunk.teal {
    background: var(--teal) !important;
    border-color: var(--teal-deep) !important;
    box-shadow: 0 4px 0 var(--teal-deep) !important;
}

/* Soft inline note inside theory cards */
.lesson-theory .t-soft { color: var(--ink-soft); font-weight: 500; font-size: 0.92em; }

/* Hearts low warning */
.lesson-hearts.is-low { animation: heartPulse 0.9s ease-in-out infinite; }
@keyframes heartPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Selected (pre-check) state for choice options */
.lesson-option.is-selected {
    border-color: var(--secondary-deep);
    box-shadow: 0 4px 0 var(--secondary-deep);
    background: #fff6e0;
}

/* Solution banner (shown on a wrong answer) */
.lesson-solution {
    margin: 0 auto 12px;
    max-width: 420px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    background: #fdebe6;
    border: 2px solid var(--coral-deep);
    color: var(--coral-deep);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
}

/* ---------- Match pairs ---------- */
.lesson-match {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.lesson-match-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.lesson-match-tile {
    padding: 14px 12px;
    border-radius: 14px;
    background: var(--cream);
    border: 2.5px solid var(--cream-3);
    box-shadow: 0 4px 0 var(--cream-3);
    cursor: pointer;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--secondary-deep);
    transition: transform 0.06s, box-shadow 0.06s, border-color 0.15s, background 0.15s, opacity 0.2s;
}
.lesson-match-tile:hover:not(.is-done) {
    border-color: var(--secondary-deep);
    box-shadow: 0 4px 0 var(--secondary-deep);
}
.lesson-match-tile.is-picked {
    border-color: var(--secondary-deep);
    box-shadow: 0 4px 0 var(--secondary-deep);
    background: #fff6e0;
    transform: translateY(1px);
}
.lesson-match-tile.is-done {
    background: #eaefd9;
    border-color: var(--leaf-deep);
    box-shadow: none;
    color: var(--leaf-deep);
    opacity: 0.55;
    cursor: default;
}
.lesson-match-tile.is-bad {
    background: #fdebe6;
    border-color: var(--coral-deep);
    box-shadow: 0 4px 0 var(--coral-deep);
    color: var(--coral-deep);
    animation: matchShake 0.4s;
}
@keyframes matchShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ---------- Build a sentence ---------- */
.lesson-build-ru.sticker {
    padding: 14px 16px;
    margin-bottom: 16px;
    background: var(--cream);
    font-family: 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 17px;
    color: var(--ink);
    text-align: center;
}
.lesson-build-line {
    min-height: 58px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    padding: 10px;
    margin-bottom: 18px;
    border-radius: 14px;
    border: 2px dashed rgba(122, 74, 28, 0.4);
    background: rgba(255, 255, 255, 0.4);
    transition: border-color 0.2s, background 0.2s;
}
.lesson-build-line.is-correct { border-style: solid; border-color: var(--leaf-deep); background: #eaefd9; }
.lesson-build-line.is-wrong   { border-style: solid; border-color: var(--coral-deep); background: #fdebe6; }
.lesson-build-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.lesson-tile {
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--cream);
    border: 2.5px solid var(--cream-3);
    box-shadow: 0 4px 0 var(--cream-3);
    cursor: pointer;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: var(--secondary-deep);
    transition: transform 0.06s, box-shadow 0.06s, border-color 0.15s;
    height: fit-content;
}
.lesson-tile:hover:not(:disabled) {
    border-color: var(--secondary-deep);
    box-shadow: 0 4px 0 var(--secondary-deep);
}
.lesson-tile:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--secondary-deep); }
.lesson-tile:disabled { cursor: default; opacity: 0.85; }

/* Mobile tweaks */
@media (max-width: 520px) {
    .lesson-options { grid-template-columns: 1fr; }
    .lesson-prompt-title.h-display { font-size: 20px; }
    .lesson-body { padding: 14px 16px 18px; }
    .lesson-topbar { padding: 12px 14px 8px; gap: 10px; }
}

/* =====================================================
   Step 4 — Cards (Свиток слов) — parchment scroll
   Дизайн-референс: design-handoff/project/screens_cards.jsx
   ===================================================== */
.flashcards-section.cards-screen {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
}

.cards-heading {
    padding: 16px 22px 4px;
    text-align: center;
}
.cards-heading .h-ornament { text-align: center; }
.cards-heading-title.h-display {
    font-size: 22px;
    margin-top: 2px;
    color: var(--secondary-deep);
}

/* Pill tabs */
.cards-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 12px 18px 8px;
    margin: 0;
    background: transparent !important;
    border: none !important;
}
.cards-tab.flashcard-mode-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 9px 16px !important;
    background: var(--cream) !important;
    color: var(--secondary-deep) !important;
    border: 2px solid var(--secondary-deep) !important;
    border-radius: 999px !important;
    box-shadow: 0 2px 0 rgba(122,74,28,0.35) !important;
    font-family: 'Fredoka', 'Manrope', sans-serif !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    letter-spacing: 0.02em;
    margin: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    cursor: pointer;
    transition: transform 0.06s, box-shadow 0.06s;
}
.cards-tab.flashcard-mode-btn.active {
    background: var(--secondary) !important;
    color: var(--cream) !important;
    box-shadow: 0 3px 0 var(--secondary-deep) !important;
}
.cards-tab-icon { font-size: 14px; line-height: 1; }

/* Scroll wrapper */
.cards-scroll {
    position: relative;
    margin: 6px 14px 18px;
    filter: drop-shadow(0 6px 0 rgba(122,74,28,0.18));
    max-width: 640px;
}
@media (min-width: 720px) {
    .cards-scroll { margin: 6px auto 22px; }
}

/* Wooden rods */
.cards-scroll-rod {
    position: relative;
    height: 22px;
    margin: 0 -10px -2px;
    background: linear-gradient(180deg, #b88a4a 0%, #8a5a26 45%, #5e3a14 100%);
    border-radius: 22px;
    border: 2px solid #5e3a14;
}
.cards-scroll-rod--top {
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.25), inset 0 2px 0 rgba(255,255,255,0.18);
}
.cards-scroll-rod--bottom {
    margin: -2px -10px 0;
    box-shadow: inset 0 3px 0 rgba(0,0,0,0.25), inset 0 -2px 0 rgba(255,255,255,0.10);
}
.cards-scroll-rod::before {
    /* wood grain stripes */
    content: '';
    position: absolute;
    inset: 4px 28px;
    background: repeating-linear-gradient(90deg, rgba(0,0,0,0.16) 0 1px, transparent 1px 6px);
    border-radius: 4px;
    opacity: 0.7;
}

/* Endcap circles */
.cards-scroll-cap {
    position: absolute;
    top: -3px;
    width: 26px; height: 28px;
    background: radial-gradient(circle at 35% 35%, #c89a55 0, #8a5a26 60%, #4a2d10 100%);
    border: 2px solid #5e3a14;
    border-radius: 50%;
    box-shadow: inset -2px -2px 0 rgba(0,0,0,0.3);
}
.cards-scroll-cap--left { left: -2px; }
.cards-scroll-cap--right { right: -2px; }
.cards-scroll-cap::before {
    content: '';
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #e0b56e, #7a4a1c);
    border: 1.5px solid #5e3a14;
}

/* Parchment lip below top rod / above bottom rod */
.cards-scroll-lip {
    position: absolute;
    left: 12px;
    right: 12px;
    height: 8px;
    background: linear-gradient(180deg, #efe2c1, #d9c599);
    border-left: 1.5px solid #7a4a1c;
    border-right: 1.5px solid #7a4a1c;
    z-index: -1;
}
.cards-scroll-lip--top {
    bottom: -6px;
    border-bottom: 1.5px solid #7a4a1c;
    border-radius: 0 0 6px 6px;
}
.cards-scroll-lip--bottom {
    top: -6px;
    border-top: 1.5px solid #7a4a1c;
    border-radius: 6px 6px 0 0;
}

/* Parchment body */
.cards-scroll-body {
    position: relative;
    background:
        radial-gradient(ellipse at top, rgba(122,74,28,0.10), transparent 50%),
        radial-gradient(ellipse at bottom, rgba(122,74,28,0.10), transparent 50%),
        linear-gradient(180deg, #f5ecd6 0%, #efe2c1 50%, #f5ecd6 100%);
    border-left: 2.5px solid #7a4a1c;
    border-right: 2.5px solid #7a4a1c;
    padding: 16px 18px 18px;
}
.cards-scroll-body::before {
    /* parchment fibre / stain texture */
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
    background-image:
        radial-gradient(circle at 18% 22%, rgba(122,74,28,0.10) 0, transparent 4%),
        radial-gradient(circle at 78% 70%, rgba(122,74,28,0.08) 0, transparent 5%),
        radial-gradient(circle at 40% 90%, rgba(122,74,28,0.07) 0, transparent 4%),
        repeating-linear-gradient(95deg, rgba(122,74,28,0.025) 0 1px, transparent 1px 7px);
}
.cards-scroll-body > #srs-mode-content {
    position: relative;
    z-index: 1;
}

/* Ram-horn corner ornaments */
.cards-scroll-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    opacity: 0.5;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'><path d='M2 20 Q2 12 10 12 Q14 12 14 8 Q14 4 10 4' stroke='%237a4a1c' stroke-width='1.4' fill='none' stroke-linecap='round'/><circle cx='10' cy='4' r='1.2' fill='%237a4a1c'/></svg>") center/contain no-repeat;
    pointer-events: none;
    z-index: 1;
}
.cards-scroll-corner--tl { top: 6px; left: 6px; }
.cards-scroll-corner--tr { top: 6px; right: 6px; transform: scaleX(-1); }
.cards-scroll-corner--bl { bottom: 6px; left: 6px; transform: scaleY(-1); }
.cards-scroll-corner--br { bottom: 6px; right: 6px; transform: scale(-1, -1); }

/* ---------- Inner: review session, on parchment ---------- */
.cards-scroll-body .srs-session {
    background: transparent;
    padding: 4px 0 0;
    max-width: none;
}

.cards-scroll-body .srs-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 22px;
    margin-bottom: 0;
}
.cards-scroll-body .srs-progress-count,
.cards-scroll-body .srs-progress-goal {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--secondary-deep);
    flex-shrink: 0;
    min-width: 32px;
    text-align: center;
}
.cards-scroll-body .srs-progress-count { text-align: left; }
.cards-scroll-body .srs-progress-goal { text-align: right; }
/* On the parchment the goal duplicates info shown on the profile; hide
   it while the daily-goal UI hasn't been redesigned, freeing the
   right-corner area for the → RU / → KZ direction chip on .srs-card. */
.cards-scroll-body .srs-progress-goal { display: none; }
.cards-scroll-body .srs-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(122,74,28,0.18);
    border: 1px solid rgba(122,74,28,0.25);
    border-radius: 999px;
    overflow: hidden;
}
.cards-scroll-body .srs-progress-bar-fill {
    background: var(--secondary);
    height: 100%;
}

.cards-scroll-body .srs-card {
    position: relative;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 22px 4px 0;
}
.cards-scroll-body .srs-card.is-exact,
.cards-scroll-body .srs-card.is-near,
.cards-scroll-body .srs-card.is-wrong {
    box-shadow: none;
}
.cards-scroll-body .srs-card-dir-label {
    position: absolute;
    top: 0;
    right: 6px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(122,74,28,0.08);
    border: 1px solid rgba(122,74,28,0.4);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 10px;
    color: var(--secondary-deep);
    letter-spacing: 0.06em;
    z-index: 2;
}
.cards-scroll-body .srs-card-word {
    text-align: center;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.cards-scroll-body .srs-card-word-text {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 38px;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.1;
}
.cards-scroll-body .srs-card-phonetic {
    text-align: center;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-style: italic;
    color: var(--ink-soft);
    font-size: 14px;
    margin-top: 4px;
}
.cards-scroll-body .srs-audio-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cream);
    border: 2px solid var(--secondary-deep);
    box-shadow: 0 2px 0 var(--secondary-deep);
    color: var(--secondary-deep);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.cards-scroll-body .srs-audio-btn:hover { background: #fff6e0; }

.cards-scroll-body .srs-kz-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 12px 0 8px;
}
.cards-scroll-body .srs-chip {
    min-width: 32px;
    padding: 6px 10px;
    border: 1.5px solid var(--secondary-deep);
    background: rgba(255,255,255,0.5);
    border-radius: 10px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--secondary-deep);
    cursor: pointer;
}
.cards-scroll-body .srs-chip:active {
    background: var(--secondary);
    color: var(--cream);
}

.cards-scroll-body .srs-input-wrap {
    padding: 8px 4px 4px;
}
.cards-scroll-body .srs-input {
    width: 100%;
    padding: 12px 14px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 15px;
    background: rgba(255,255,255,0.5);
    border: 2px solid var(--secondary-deep);
    border-radius: 12px;
    color: var(--ink);
    outline: none;
}
.cards-scroll-body .srs-input:focus {
    box-shadow: 0 0 0 3px rgba(191,152,58,0.25);
}
.cards-scroll-body .srs-card.is-wrong .srs-input { border-color: var(--coral-deep); }
.cards-scroll-body .srs-card.is-exact .srs-input { border-color: var(--leaf-deep); }
.cards-scroll-body .srs-card.is-near  .srs-input { border-color: var(--secondary); }

.cards-scroll-body .srs-actions {
    display: flex;
    gap: 10px;
    padding: 12px 4px 4px;
    margin-top: 0;
}
.cards-scroll-body .srs-btn-primary,
.cards-scroll-body .srs-btn-secondary {
    padding: 12px 14px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border-radius: 12px;
    border-width: 2px;
    border-style: solid;
    cursor: pointer;
    transition: filter 0.12s;
}
.cards-scroll-body .srs-btn-primary {
    flex: 2;
    background: var(--secondary);
    color: var(--cream);
    border-color: var(--secondary-deep);
    box-shadow: 0 3px 0 var(--secondary-deep);
}
.cards-scroll-body .srs-btn-primary:hover { filter: brightness(1.05); }
.cards-scroll-body .srs-btn-secondary {
    flex: 1;
    background: var(--cream);
    color: var(--secondary-deep);
    border-color: var(--secondary-deep);
    box-shadow: 0 3px 0 rgba(122,74,28,0.35);
}

.cards-scroll-body .srs-feedback-area {
    margin-top: 12px;
}
.cards-scroll-body .srs-feedback {
    border-radius: 12px;
    border: 2px solid currentColor;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.45);
}
.cards-scroll-body .srs-feedback.is-exact { color: var(--leaf-deep); background: #eaefd9; }
.cards-scroll-body .srs-feedback.is-near  { color: #8a5a14;          background: #fff6e0; }
.cards-scroll-body .srs-feedback.is-wrong { color: var(--coral-deep); background: #fdebe6; }
.cards-scroll-body .srs-feedback-icon { font-size: 22px; }
.cards-scroll-body .srs-feedback-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 14px;
}
.cards-scroll-body .srs-feedback-desc {
    font-size: 13px;
    color: var(--ink);
}

.cards-scroll-body .srs-empty {
    text-align: center;
    padding: 22px 14px 8px;
}
.cards-scroll-body .srs-empty-illustration { font-size: 38px; margin-bottom: 6px; }
.cards-scroll-body .srs-empty-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--secondary-deep);
    margin-bottom: 6px;
}
.cards-scroll-body .srs-empty-sub {
    color: var(--ink-soft);
    font-size: 13px;
}

/* ---------- Inner: library on parchment ---------- */
.cards-scroll-body .srs-library {
    padding: 4px 0;
}
.cards-scroll-body .srs-lib-header {
    margin-bottom: 8px;
}
.cards-scroll-body .srs-lib-header-top {
    display: flex;
    gap: 8px;
    padding: 4px 4px 10px;
    align-items: center;
}
.cards-scroll-body .srs-lib-search {
    flex: 1;
    padding: 9px 14px 9px 30px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 14px;
    background: rgba(255,255,255,0.5);
    border: 2px solid var(--secondary-deep);
    border-radius: 999px;
    color: var(--ink);
    outline: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><circle cx='8' cy='8' r='5' stroke='%237a4a1c' stroke-width='1.6' fill='none'/><line x1='12' y1='12' x2='17' y2='17' stroke='%237a4a1c' stroke-width='1.6'/></svg>");
    background-repeat: no-repeat;
    background-position: 9px center;
    background-size: 16px 16px;
}
.cards-scroll-body .srs-lib-counter {
    padding: 8px 12px;
    background: rgba(255,255,255,0.5);
    border: 2px solid var(--secondary-deep);
    border-radius: 999px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--secondary-deep);
    white-space: nowrap;
}
.cards-scroll-body .srs-lib-filters {
    display: flex;
    gap: 6px;
    padding: 0 4px 10px;
    flex-wrap: wrap;
}
.cards-scroll-body .srs-lib-filter-btn {
    padding: 6px 12px;
    background: transparent;
    color: var(--secondary-deep);
    border: 2px solid var(--secondary-deep);
    border-radius: 999px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}
.cards-scroll-body .srs-lib-filter-btn.active {
    background: var(--secondary);
    color: var(--cream);
}
.cards-scroll-body .srs-lib-batch {
    display: flex;
    gap: 6px;
    padding: 0 4px 10px;
}
.cards-scroll-body .srs-lib-batch-btn {
    padding: 6px 12px;
    background: var(--teal);
    color: var(--cream);
    border: 2px solid var(--teal-deep);
    border-radius: 999px;
    box-shadow: 0 2px 0 var(--teal-deep);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.cards-scroll-body .srs-lib-table {
    max-height: 320px;
    overflow-y: auto;
    border-top: 1.5px solid rgba(122,74,28,0.5);
    border-bottom: 1.5px solid rgba(122,74,28,0.5);
}
.cards-scroll-body .lib-row {
    display: grid;
    grid-template-columns: 1.1fr 1fr 0.9fr 44px 44px;
    gap: 8px;
    padding: 10px 8px;
    align-items: center;
    border-bottom: 1px dashed rgba(122,74,28,0.3);
}
.cards-scroll-body .lib-row:last-child { border-bottom: none; }
.cards-scroll-body .lib-row.lib-header {
    background: rgba(122,74,28,0.06);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--secondary-deep);
    opacity: 0.75;
    border-bottom-style: solid;
}
.cards-scroll-body .lib-cell.lib-kz {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    color: var(--ink);
    font-size: 15px;
}
.cards-scroll-body .lib-cell {
    font-family: 'Manrope', sans-serif;
    color: var(--ink);
    font-size: 14px;
}
.cards-scroll-body .lib-phonetic {
    font-style: italic;
    color: var(--ink-soft);
    font-size: 12px;
}
.cards-scroll-body .lib-srs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--cream);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 11px;
    border: 2px solid var(--secondary-deep);
}
.cards-scroll-body .lib-add-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}
.cards-scroll-body .srs-lib-add-btn {
    padding: 5px 10px;
    background: var(--leaf);
    color: var(--cream);
    border: 2px solid var(--leaf-deep);
    border-radius: 999px;
    box-shadow: 0 2px 0 var(--leaf-deep);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
}
.cards-scroll-body .srs-lib-available-badge {
    padding: 3px 8px;
    background: var(--gold-soft);
    color: var(--secondary-deep);
    border: 1px solid var(--secondary-deep);
    border-radius: 999px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 10px;
}
.cards-scroll-body .srs-lib-empty {
    text-align: center;
    padding: 22px;
    color: var(--ink-soft);
    font-style: italic;
    font-size: 14px;
}

@media (max-width: 520px) {
    .cards-scroll-body .lib-row {
        grid-template-columns: 1.1fr 1fr 0 38px 38px;
    }
    .cards-scroll-body .lib-row .lib-phonetic,
    .cards-scroll-body .lib-row .lib-phonetic ~ * {
        /* keep, just narrower */
    }
    .cards-scroll-body .srs-card-word-text { font-size: 30px; }
    .cards-scroll-body .srs-lib-search { font-size: 13px; padding-left: 28px; }
}

/* =====================================================
   Step 5 — Battle (Бой) — lobby / arena / result
   Дизайн-референс: design-handoff/project/screens_duel.jsx
   Overrides the legacy .battle-* / .arena-* / .games-menu-*
   rules without changing the underlying gameplay JS.
   ===================================================== */
#tab-games .battle-container {
    padding: 0;
    background: var(--page);
    width: 100%;
    max-width: none;
}

/* ---- Games menu (selecting Тренировка / Дуэль) ---- */
#tab-games .games-menu {
    padding: 16px 18px 20px;
    background: transparent;
    box-shadow: none;
}
#tab-games .games-menu .battle-title {
    display: block;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 22px;
    color: var(--secondary-deep);
    margin: 0 0 14px;
    padding: 6px 0 12px;
    background: none;
    border-bottom: none;
    text-align: center;
    letter-spacing: 0.02em;
    box-shadow: none;
    /* Reset legacy gradient-clipped text trick from .battle-title */
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
}

#tab-games .games-menu-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 6px 0 0;
    padding: 0;
}
#tab-games .games-menu-row {
    background: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 16px;
    box-shadow: 0 5px 0 var(--secondary-deep);
    padding: 14px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
#tab-games .games-menu-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--secondary);
    color: var(--cream);
    border: 2px solid var(--secondary-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
#tab-games .games-menu-row:nth-child(2) .games-menu-icon-btn {
    background: var(--coral);
    border-color: var(--coral-deep);
}
#tab-games .games-menu-main-btn {
    flex: 1;
    padding: 12px 14px;
    background: var(--secondary);
    color: var(--cream);
    border: 2px solid var(--secondary-deep);
    border-radius: 12px;
    box-shadow: 0 3px 0 var(--secondary-deep);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.04em;
    cursor: pointer;
}
#tab-games .games-menu-main-btn--training {
    background: var(--coral);
    border-color: var(--coral-deep);
    box-shadow: 0 3px 0 var(--coral-deep);
}
#tab-games .games-menu-rules-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cream-2);
    border: 2px solid var(--secondary-deep);
    color: var(--secondary-deep);
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---- Lobby ---- */
#tab-games .battle-lobby {
    padding: 0 0 30px;
    background: transparent;
    box-shadow: none;
}
#tab-games .battle-lobby .battle-title {
    display: block;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 22px;
    color: var(--secondary-deep);
    margin: 0 0 4px;
    padding: 12px 22px 6px;
    background: none;
    border-bottom: none;
    text-align: center;
    box-shadow: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
}
#tab-games .battle-subtitle {
    text-align: center;
    color: var(--ink-soft);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 13px;
    padding: 6px 22px 14px;
}
#tab-games .lobby-avatar-preview {
    display: flex;
    justify-content: center;
    padding: 12px 0 18px;
}
#tab-games .battle-find-btn,
#tab-games .battle-cancel-btn {
    display: block;
    margin: 14px auto 18px;
    padding: 14px 26px;
    background: var(--secondary);
    color: var(--cream);
    border: 2px solid var(--secondary-deep);
    border-radius: var(--r-md);
    box-shadow: 0 4px 0 var(--secondary-deep);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    min-width: 220px;
    text-align: center;
}
#tab-games .battle-cancel-btn {
    background: var(--cream);
    color: var(--secondary-deep);
    box-shadow: 0 4px 0 rgba(122,74,28,0.35);
}
#tab-games .battle-rules {
    margin: 12px 18px 0;
    padding: 14px 16px;
    background: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 16px;
    box-shadow: 0 4px 0 var(--secondary-deep);
}
#tab-games .battle-rules .rules-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--secondary-deep);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
#tab-games .battle-rules ul {
    padding-left: 18px;
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.5;
}

/* ---- Searching ---- */
#tab-games .battle-searching {
    padding: 24px 22px 30px;
    text-align: center;
    background: transparent;
    box-shadow: none;
}
#tab-games .battle-searching .battle-title {
    background: none;
    color: var(--secondary-deep);
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0 0 18px;
    font-size: 20px;
}
#tab-games .searching-spinner {
    width: 64px;
    height: 64px;
    border: 5px solid var(--cream-3);
    border-top-color: var(--secondary);
    border-radius: 50%;
    margin: 8px auto 18px;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Arena ---- */
#tab-games .battle-arena {
    padding: 0 0 40px;
    background: var(--page);
    min-height: 70vh;
}
#tab-games .arena-top {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 16px 18px 12px;
    background: var(--secondary);
    border-bottom: 3px solid var(--secondary-deep);
}
#tab-games .arena-vs {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--cream);
    text-shadow: 0 2px 0 var(--secondary-deep);
}
#tab-games .arena-batyr { flex: 1; max-width: 140px; text-align: center; }
#tab-games .batyr-name {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--cream);
    margin-top: 4px;
}
#tab-games .batyr-hp-bar {
    background: rgba(0,0,0,0.25);
    border: 1.5px solid var(--secondary-deep);
    border-radius: 6px;
    overflow: hidden;
    height: 8px;
    margin: 4px auto 2px;
    width: 100px;
}
#tab-games .batyr-hp-fill {
    background: linear-gradient(90deg, var(--leaf), #a8c870);
    height: 100%;
    transition: width 0.3s;
}
#tab-games .batyr-hp-text {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-size: 11px;
    color: var(--cream);
    opacity: 0.9;
}

#tab-games .arena-center {
    padding: 16px 18px;
    background: transparent;
}
#tab-games .arena-turn-info {
    text-align: center;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--secondary-deep);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--cream);
    border: 2px solid var(--secondary-deep);
    border-radius: 999px;
    box-shadow: 0 2px 0 rgba(122,74,28,0.25);
    transition: background 0.18s, color 0.18s;
}
#tab-games .arena-turn-info.turn-info--correct {
    background: #fff;
    color: var(--leaf-deep);
    border-color: var(--leaf);
    box-shadow: 0 2px 0 var(--leaf);
    font-weight: 700;
}
#tab-games .arena-turn-info.turn-info--wrong {
    background: var(--coral);
    color: #fff;
    border-color: var(--coral-deep);
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    font-weight: 700;
}

/* Attack: three cards in hand */
#tab-games .attack-cards {
    display: flex;
    gap: 14px;
    justify-content: center;
    padding: 0 8px;
}
#tab-games .attack-card {
    background: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 18px;
    box-shadow: 0 5px 0 var(--secondary-deep);
    flex: 1 1 0;
    max-width: 140px;
    padding: 16px 10px 14px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.06s, box-shadow 0.06s;
    animation: card-arrive 0.4s ease-out;
}
#tab-games .attack-card:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--secondary-deep); }
#tab-games .attack-card:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--secondary-deep);
}
#tab-games .attack-card-svg {
    width: 70px;
    height: 70px;
    margin: 0 auto 10px;
}
#tab-games .attack-card-word {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--secondary-deep);
}

/* Defend: incoming card + 4 option buttons */
#tab-games .defend-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
#tab-games .defend-incoming-card {
    background: var(--cream);
    border: 2.5px solid var(--coral-deep);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--coral-deep);
    padding: 12px;
    width: 130px;
    text-align: center;
}
#tab-games .defend-card-svg {
    width: 70px;
    height: 70px;
    margin: 0 auto 4px;
}
#tab-games .defend-card-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    color: var(--coral-deep);
    font-size: 15px;
}
#tab-games .defend-timer {
    width: 100%;
    max-width: 320px;
    height: 8px;
    background: var(--cream-3);
    border: 1.5px solid var(--secondary-deep);
    border-radius: 999px;
    overflow: hidden;
}
#tab-games .defend-timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--leaf), var(--secondary), var(--coral));
}
#tab-games .defend-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: 340px;
}
#tab-games .defend-option-btn {
    padding: 12px 12px;
    background: var(--cream);
    color: var(--secondary-deep);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 12px;
    box-shadow: 0 3px 0 var(--secondary-deep);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.06s;
}
#tab-games .defend-option-btn:hover:not(:disabled) {
    background: #fff6e0;
}
#tab-games .defend-option-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--secondary-deep);
}
#tab-games .defend-option-btn.defend-option--selected {
    background: var(--secondary);
    color: var(--cream);
}
#tab-games .defend-option-btn:disabled { opacity: 0.6; cursor: default; }

/* Waiting / spinner */
#tab-games .waiting-phase {
    display: flex;
    justify-content: center;
    padding: 22px 0;
}
#tab-games .waiting-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--cream-3);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

/* Combo bar */
#tab-games .arena-combo-bar {
    text-align: center;
    padding: 4px 18px;
    min-height: 24px;
}
#tab-games .combo-active {
    display: inline-block;
    padding: 4px 12px;
    background: var(--coral);
    color: var(--cream);
    border: 2px solid var(--coral-deep);
    border-radius: 999px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 2px 0 var(--coral-deep);
    animation: pulse-ring 1.2s ease-out infinite;
}
#tab-games .combo-building {
    display: inline-block;
    padding: 3px 10px;
    background: var(--cream);
    color: var(--secondary-deep);
    border: 1.5px solid var(--secondary-deep);
    border-radius: 999px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 11px;
}

/* ---- Result screen ---- */
#tab-games .battle-result {
    padding: 22px 22px 30px;
    text-align: center;
    background: transparent;
    box-shadow: none;
}
#tab-games .result-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: var(--secondary-deep);
    margin: 0 0 6px;
}
#tab-games .battle-result--win .result-title { color: var(--leaf-deep); }
#tab-games .battle-result--lose .result-title { color: var(--coral-deep); }
#tab-games .result-icon { font-size: 56px; margin-bottom: 18px; }
#tab-games .result-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 auto 18px;
    max-width: 320px;
}
#tab-games .result-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--cream);
    border: 2px solid var(--cream-3);
    border-radius: 12px;
}
#tab-games .result-stat-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
#tab-games .result-stat-value {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--secondary-deep);
}

/* ---- Rules modal ---- */
.games-rules-modal {
    position: fixed;
    inset: 0;
    background: rgba(61,40,23,0.45);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.games-rules-modal-inner {
    position: relative;
    background: var(--cream);
    border: 3px solid var(--secondary-deep);
    border-radius: 18px;
    box-shadow: 0 6px 0 var(--secondary-deep);
    padding: 20px 22px 22px;
    max-width: 440px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}
.games-rules-modal-inner h3 {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    color: var(--secondary-deep);
    margin: 0 0 12px;
    font-size: 20px;
}
.games-rules-modal-inner ul {
    margin: 0;
    padding-left: 18px;
    color: var(--ink);
    line-height: 1.55;
    font-size: 14px;
}
.games-rules-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 26px;
    color: var(--ink-soft);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}
.games-rules-modal-close:hover { color: var(--secondary-deep); }

/* Training arena — close button + chunky header */
#tab-games .training-arena {
    padding: 0 0 30px;
    background: linear-gradient(180deg, #f6eecf 0%, #efe2bf 100%);
    min-height: 70vh;
}
#tab-games .training-header {
    position: relative;
    background: var(--coral);
    border-bottom: 3px solid var(--coral-deep);
    padding: 14px 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--cream);
    box-shadow: 0 4px 0 rgba(154,63,46,0.2);
}
#tab-games .training-exit-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0,0,0,0.18);
    color: var(--cream);
    border: 2px solid var(--coral-deep);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#tab-games .training-exit-btn:hover { background: rgba(0,0,0,0.32); }
#tab-games .training-hp-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#tab-games .training-hp-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--cream);
}
#tab-games .training-hp-bar-bg {
    height: 10px;
    background: rgba(0,0,0,0.25);
    border: 1.5px solid var(--coral-deep);
    border-radius: 6px;
    overflow: hidden;
}
#tab-games .training-hp-bar {
    height: 100%;
    transition: width 0.3s;
}
#tab-games .training-turn-label {
    flex-shrink: 0;
    padding: 4px 10px;
    background: rgba(0,0,0,0.18);
    border: 1px solid var(--coral-deep);
    border-radius: 999px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: var(--cream);
}
#tab-games .training-timer-info {
    text-align: center;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    color: var(--secondary-deep);
    font-size: 13px;
    margin: 8px 0 4px;
}
#tab-games .training-arena .defend-phase {
    padding: 14px 18px 4px;
}

/* =====================================================
   Step 6 — Leaderboard (Рейтинг)
   Дизайн-референс: design-handoff/project/screens_board.jsx
   Top-3 идут на подиум, остальные — chunky-список ниже.
   ===================================================== */
#tab-leaderboard .stat-leaderboard {
    background: var(--page);
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 24px 0 14px;
}
#tab-leaderboard .leaderboard-label {
    display: block;
    background: var(--secondary);
    color: var(--cream);
    border-bottom: 3px solid var(--secondary-deep);
    box-shadow: 0 4px 0 rgba(122,74,28,0.18);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 18px 22px 16px;
    margin: 0 0 8px;
    -webkit-text-fill-color: currentColor;
    -webkit-background-clip: border-box;
    background-clip: border-box;
}

#tab-leaderboard .leaderboard-block {
    margin: 0 14px 28px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}
#tab-leaderboard .leaderboard-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--secondary-deep);
    text-align: center;
    margin: 0 0 16px;
}

#tab-leaderboard .leaderboard-list--podium {
    background: transparent;
    padding: 0;
}

/* ---- Podium (top 3) ---- */
.leaderboard-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px 8px;
}
.podium-place {
    flex: 1;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.podium-crown { font-size: 24px; margin-bottom: -4px; }
.podium-avatar-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.podium-medal {
    position: absolute;
    bottom: -8px;
    right: -8px;
    font-size: 24px;
    z-index: 10;
}
.podium-name {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    margin-top: 8px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.podium-points {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--secondary-deep);
}
.podium-bar {
    width: 100%;
    background: var(--secondary);
    border: 2.5px solid var(--secondary-deep);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: var(--cream);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 22px;
    text-shadow: 0 2px 0 var(--secondary-deep);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.podium-place--1 .podium-bar { height: 110px; }
.podium-place--2 .podium-bar { height: 84px; }
.podium-place--3 .podium-bar { height: 64px; }

/* ---- Rest list (places 4+) ---- */
.leaderboard-rest {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 0;
}
#tab-leaderboard .leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--cream);
    color: var(--ink);
    border: 2.5px solid var(--cream-3);
    border-radius: 14px;
}
#tab-leaderboard .leaderboard-place {
    width: 36px;
    text-align: center;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 17px;
    color: var(--secondary-deep);
    flex-shrink: 0;
}
#tab-leaderboard .leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}
#tab-leaderboard .leaderboard-item.is-me {
    background: #fdf3da;
    border-color: var(--secondary);
    box-shadow: 0 3px 0 var(--secondary);
}
#tab-leaderboard .leaderboard-item.is-me .leaderboard-name,
#tab-leaderboard .leaderboard-item.is-me .leaderboard-points {
    color: var(--secondary-deep);
}
.podium-place.is-me .podium-name {
    color: var(--secondary-deep);
    font-weight: 700;
}
#tab-leaderboard .leaderboard-name {
    flex: 1;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#tab-leaderboard .leaderboard-points {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--secondary-deep);
    flex-shrink: 0;
}

#tab-leaderboard .leaderboard-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--ink);
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

/* ---- "You" card pinned at the bottom of the tab ---- */
#tab-leaderboard .leaderboard-user {
    margin: 24px 14px 8px;
    padding: 12px 14px;
    background: var(--secondary);
    color: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--secondary-deep);
    display: flex;
    align-items: center;
    gap: 12px;
}
#tab-leaderboard .leaderboard-user-avatar-wrap {
    flex-shrink: 0;
}
#tab-leaderboard .leaderboard-user-label {
    flex: 1;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
#tab-leaderboard .leaderboard-user-place {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--gold-soft);
    min-width: 40px;
    text-align: center;
}
#tab-leaderboard .leaderboard-user-points {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--cream);
}

/* =====================================================
   Step 7 — Profile + stats (батыр-степь редизайн)
   Дизайн-референс: design-handoff/project/screens_profile.jsx
   ===================================================== */
#tab-profile .profile-section {
    margin: 0;
    padding: 22px 18px 22px;
    background: linear-gradient(180deg, var(--secondary) 0%, #d1a84a 100%);
    border-bottom: 3px solid var(--secondary-deep);
    border-radius: 0;
    box-shadow: 0 4px 0 rgba(122,74,28,0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--cream);
    position: relative;
    overflow: hidden;
}
#tab-profile .profile-section::before {
    /* Subtle steppe-stripe ornament */
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(115deg, transparent 0 30px, rgba(249,246,242,0.05) 30px 31px);
    pointer-events: none;
}
#tab-profile .profile-avatar-large {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--cream);
    color: var(--secondary-deep);
    border: 4px solid var(--secondary-deep);
    box-shadow: 0 4px 0 var(--secondary-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 36px;
    line-height: 1;
    margin: 4px auto 12px;
    position: relative;
    z-index: 1;
}
#tab-profile .profile-nickname {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.01em;
    color: var(--cream);
    margin: 0;
    position: relative;
    z-index: 1;
}
#tab-profile .profile-about-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(249,246,242,0.85);
    margin: 14px 0 4px;
    position: relative;
    z-index: 1;
}
#tab-profile .profile-about {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(249,246,242,0.95);
    max-width: 320px;
    position: relative;
    z-index: 1;
}
#tab-profile .profile-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    justify-content: center;
    position: relative;
    z-index: 1;
}
#tab-profile .profile-actions .login-btn,
#tab-profile .profile-actions .logout-btn {
    padding: 9px 18px;
    background: var(--cream);
    color: var(--secondary-deep);
    border: 2px solid var(--secondary-deep);
    border-radius: 12px;
    box-shadow: 0 3px 0 var(--secondary-deep);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
}
#tab-profile .profile-actions .logout-btn {
    background: var(--coral);
    color: var(--cream);
    border-color: var(--coral-deep);
    box-shadow: 0 3px 0 var(--coral-deep);
}

/* ---- Stats section ---- */
#tab-profile .stats-section {
    margin: 0 auto;
    padding: 16px 14px 30px;
    background: var(--page);
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 560px;
    align-self: center;
}

/* Stats row: circle + streak */
#tab-profile .stat-main {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
#tab-profile .stat-circle-progress,
#tab-profile .stat-streak {
    flex: 1 1 160px;
    background: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 18px;
    box-shadow: 0 4px 0 var(--secondary-deep);
    padding: 14px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
#tab-profile .stat-circle-progress canvas {
    margin: 4px auto;
}
#tab-profile .circle-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    color: var(--secondary-deep);
    font-size: 13px;
    line-height: 1.3;
}
#tab-profile .circle-label > span {
    font-size: 22px;
    font-weight: 700;
}
#tab-profile .streak-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--secondary-deep);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
#tab-profile .streak-value {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 44px;
    line-height: 1;
    color: var(--coral);
    text-shadow: 0 3px 0 var(--coral-deep);
}
#tab-profile .streak-value.streak-inactive {
    color: var(--ink-soft);
    text-shadow: none;
    opacity: 0.6;
}
#tab-profile .streak-desc {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-size: 11px;
    color: var(--ink-soft);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
#tab-profile .streak-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    width: 100%;
    margin-top: 8px;
}
#tab-profile .streak-day {
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--cream-2);
    border: 2px solid var(--cream-3);
    color: var(--ink-soft);
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#tab-profile .streak-day.active {
    background: var(--secondary);
    color: var(--cream);
    border-color: var(--secondary-deep);
    box-shadow: 0 2px 0 var(--secondary-deep);
}
#tab-profile .streak-day.today {
    outline: 2px dashed var(--coral);
    outline-offset: 2px;
}

/* Activity chart card */
#tab-profile .stat-activity,
#tab-profile .stat-categories,
#tab-profile .stat-achievements {
    background: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 18px;
    box-shadow: 0 4px 0 var(--secondary-deep);
    padding: 14px 16px 16px;
}
#tab-profile .activity-label,
#tab-profile .cat-label,
#tab-profile .ach-label {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--secondary-deep);
    opacity: 0.85;
    margin: 0 0 10px;
    text-align: center;
}
#tab-profile .stat-activity canvas {
    display: block;
    margin: 0 auto;
}

/* Category progress bars */
#tab-profile .cat-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#tab-profile .cat-bar-row {
    display: grid;
    grid-template-columns: 1fr 1fr 50px;
    align-items: center;
    gap: 10px;
}
#tab-profile .cat-bar-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
}
#tab-profile .cat-bar {
    height: 12px;
    background: var(--cream-3);
    border: 2px solid var(--secondary-deep);
    border-radius: 10px;
    overflow: hidden;
}
#tab-profile .cat-bar-fill {
    height: 100%;
    background: var(--secondary);
    border-right: 2px solid var(--secondary-deep);
    transition: width 0.4s ease;
}
#tab-profile .cat-bar-value {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: var(--secondary-deep);
    text-align: right;
}

/* Achievements grid */
#tab-profile .ach-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
#tab-profile .ach-item {
    padding: 10px 6px;
    background: var(--cream);
    border: 2.5px solid var(--secondary-deep);
    border-radius: 14px;
    box-shadow: 0 4px 0 var(--secondary-deep);
    text-align: center;
    cursor: pointer;
    transition: transform 0.06s, box-shadow 0.06s;
}
#tab-profile .ach-item:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--secondary-deep);
}
#tab-profile .ach-item-icon { font-size: 30px; line-height: 1; margin-bottom: 4px; }
#tab-profile .ach-item-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 11px;
    color: var(--secondary-deep);
    line-height: 1.2;
}

@media (max-width: 520px) {
    #tab-profile .stat-main { gap: 8px; }
    #tab-profile .stat-circle-progress,
    #tab-profile .stat-streak { flex: 1 1 100%; }
    #tab-profile .ach-list { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================
   Step 8 — Profile hero redesign + BatyrAvatar + Customization
   ===================================================== */

/* Profile hero — centered column */
#tab-profile .profile-section {
    flex-direction: column;
    align-items: center;
    padding: 20px 18px 18px;
}
.profile-avatar-wrap {
    position: relative;
    display: inline-block;
    padding-top: 16px;
    margin: 0 auto 12px;
}
.profile-batyr-avatar-el {
    display: block;
    line-height: 0;
}
.profile-edit-btn {
    position: absolute;
    right: -8px;
    bottom: -4px;
    z-index: 10;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cream);
    color: var(--secondary-deep);
    border: 2.5px solid var(--secondary-deep);
    box-shadow: 0 3px 0 var(--secondary-deep);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.12s;
}
.profile-edit-btn:hover { transform: scale(1.1); }
.profile-hero-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--cream);
    opacity: 0.85;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

/* ---- Customization overlay ---- */
.profile-customization-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: var(--page, #f4f0e8);
    flex-direction: column;
    overflow: hidden;
}
.custom-overlay-header {
    background: var(--secondary-deep, #7a4a1c);
    color: var(--cream, #f9f6f2);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 3px solid #3d2817;
    flex-shrink: 0;
}
.custom-overlay-close {
    color: var(--cream, #f9f6f2);
    background: none;
    border: none;
    font-size: 20px;
    width: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.custom-overlay-title {
    flex: 1;
    font-size: 17px;
    color: var(--cream, #f9f6f2);
}
.custom-overlay-done {
    padding: 7px 16px;
    background: var(--cream, #f9f6f2);
    color: var(--secondary-deep, #7a4a1c);
    border: 2px solid var(--secondary-deep, #7a4a1c);
    border-radius: 10px;
    box-shadow: 0 3px 0 #3d2817;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.custom-overlay-preview {
    background: linear-gradient(180deg, #fff6e0 0%, var(--cream, #f9f6f2) 100%);
    border-bottom: 3px solid var(--secondary-deep, #7a4a1c);
    padding: 20px 12px 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.custom-overlay-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px 40px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.custom-section {
    background: var(--cream, #f9f6f2);
    border: 2.5px solid var(--secondary-deep, #7a4a1c);
    border-radius: 16px;
    box-shadow: 0 4px 0 var(--secondary-deep, #7a4a1c);
    padding: 14px;
}
.custom-section-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--secondary-deep, #7a4a1c);
    text-align: center;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}
/* Mascot grid */
.custom-mascot-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.custom-mascot-btn {
    padding: 8px;
    border-radius: 12px;
    text-align: center;
    background: var(--cream-2, #f4f0e8);
    border: 2.5px solid var(--cream-3, #e8e0d0);
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.custom-mascot-btn.selected {
    background: #fff6e0;
    border-color: var(--secondary-deep, #7a4a1c);
    box-shadow: 0 3px 0 var(--secondary-deep, #7a4a1c);
}
.custom-mascot-btn img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--secondary-deep, #7a4a1c);
    display: block;
    margin: 0 auto 4px;
}
.custom-mascot-btn div {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 11px;
    color: var(--secondary-deep, #7a4a1c);
}
/* Gear row */
.custom-gear-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.custom-gear-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--cream-2, #f4f0e8);
    border: 2px solid var(--cream-3, #e8e0d0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.custom-gear-meta { flex: 1; }
.custom-gear-name {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--secondary-deep, #7a4a1c);
}
.custom-gear-status {
    font-size: 10px;
    font-weight: 700;
    color: var(--ink-soft, #8a7a6a);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.custom-gear-toggle {
    padding: 6px 14px;
    border-radius: 10px;
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    background: var(--cream-2, #f4f0e8);
    color: var(--ink-soft, #8a7a6a);
    border: 2px solid var(--cream-3, #e8e0d0);
    transition: background 0.12s, color 0.12s;
}
.custom-gear-toggle.equipped {
    background: var(--leaf, #6b8e3d);
    color: var(--cream, #f9f6f2);
    border-color: var(--leaf-deep, #3d5520);
    box-shadow: 0 2px 0 var(--leaf-deep, #3d5520);
}
/* Color swatches */
.custom-color-swatches {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}
.custom-color-btn {
    padding: 4px;
    border-radius: 10px;
    background: var(--cream, #f9f6f2);
    border: 2.5px solid var(--cream-3, #e8e0d0);
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.custom-color-btn::after {
    content: '';
    display: block;
    width: 100%;
    height: 26px;
    border-radius: 6px;
    background: var(--swatch);
    border: 2px solid var(--secondary-deep, #7a4a1c);
}
.custom-color-btn.selected {
    border-color: var(--secondary-deep, #7a4a1c);
    box-shadow: 0 3px 0 var(--secondary-deep, #7a4a1c);
}

/* =====================================================
   Lesson AI chat — floating side icon + slide-out panel
   Mounted only while a lesson is open.
   ===================================================== */
.lesson-chat {
    position: fixed;
    right: 18px;
    bottom: 96px;
    z-index: 1100;
    font-family: 'Manrope', system-ui, sans-serif;
}
.lesson-chat-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2.5px solid var(--leaf-deep);
    background: var(--leaf);
    color: #fff;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--leaf-deep), 0 6px 14px rgba(74, 102, 40, .28);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    transition: transform var(--motion), box-shadow var(--motion);
}
.lesson-chat-fab .lesson-chat-fab-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.lesson-chat-fab:hover {
    transform: translateY(-1px);
}
.lesson-chat-fab:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--leaf-deep);
}
.lesson-chat.is-open .lesson-chat-fab {
    opacity: 0;
    pointer-events: none;
}
.lesson-chat-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(360px, calc(100vw - 28px));
    height: min(520px, calc(100vh - 140px));
    background: var(--cream);
    border: 2.5px solid var(--cream-3);
    border-radius: var(--r-lg);
    box-shadow: 0 8px 0 var(--secondary-deep), 0 14px 30px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.lesson-chat-panel[hidden] { display: none; }
.lesson-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--leaf);
    color: #fff;
}
.lesson-chat-title {
    font-family: 'Fredoka', 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.01em;
}
.lesson-chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.lesson-chat-close:hover { background: rgba(255,255,255,.15); }
.lesson-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--cream);
}
.lesson-chat-msg {
    max-width: 86%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.lesson-chat-msg--user {
    align-self: flex-end;
    background: var(--leaf);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.lesson-chat-msg--assistant {
    align-self: flex-start;
    background: var(--cream-2);
    color: var(--ink);
    border-bottom-left-radius: 4px;
}
.lesson-chat-msg.is-typing {
    color: var(--ink-soft);
    font-style: italic;
}
.lesson-chat-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 2px solid var(--cream-3);
    background: var(--cream);
}
.lesson-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--cream-3);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border-color var(--motion);
}
.lesson-chat-input:focus {
    border-color: var(--leaf);
}
.lesson-chat-input:disabled {
    opacity: 0.6;
}
.lesson-chat-send {
    width: 42px;
    border: none;
    border-radius: 12px;
    background: var(--leaf);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 3px 0 var(--leaf-deep);
    transition: transform var(--motion), box-shadow var(--motion);
}
.lesson-chat-send:hover { transform: translateY(-1px); }
.lesson-chat-send:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--leaf-deep);
}
.lesson-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 3px 0 var(--leaf-deep);
}

@media (max-width: 480px) {
    .lesson-chat { right: 14px; bottom: 80px; }
    .lesson-chat-fab { width: 52px; height: 52px; font-size: 24px; }
    .lesson-chat-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 110px);
    }
}


