/* ==========================================================================
   EssentialGame.uz — "Mozaika" dizayni
   Samarqand koshinlari: lojuvard, firuza, za'faron. Unit mozaikasi asosiy element.
   ========================================================================== */

:root {
    --lapis-950: #081537;
    --lapis-900: #0c1b4a;
    --lapis-700: #173a9e;
    --lapis-600: #1f4fd8;
    --lapis-100: #dce6ff;
    --lapis-50: #eef3ff;
    --firuza-600: #0b8a84;
    --firuza-500: #14b8b0;
    --firuza-100: #d3f5f2;
    --saffron-500: #ffb800;
    --saffron-600: #e09f00;
    --saffron-100: #fff1c7;
    --anor-600: #d92d45;
    --anor-100: #ffe0e4;

    --bg: #e9f0f8;
    --surface: #ffffff;
    --surface-2: #f3f7fc;
    --line: #c8d6e6;
    --text: #0c1b4a;
    --muted: #4d5f86;
    --accent: var(--lapis-600);
    --accent-soft: var(--lapis-50);
    --ink-on-accent: #ffffff;
    --grout: #c8d6e6;

    --font-display: "Lexend", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: "Source Sans 3", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --radius: 10px;
    --radius-lg: 14px;
    --gap: 24px;
}

body.dark-mode {
    --bg: #071030;
    --surface: #0f1d49;
    --surface-2: #142457;
    --line: #2a3d80;
    --text: #e8eeff;
    --muted: #a3b5e3;
    --accent: #7aa0ff;
    --accent-soft: #1b2f73;
    --ink-on-accent: #071030;
    --grout: #2a3d80;
    --firuza-100: #0f4a52;
    --anor-100: #4a1a30;
    --saffron-100: #4a3a0d;
    --lapis-50: #1b2f73;
    --lapis-100: #25408f;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
    outline: 3px solid var(--saffron-500);
    outline-offset: 2px;
}

h1, h2, h3, h4, p { margin: 0; }

/* ---------------------------------- Header ---------------------------------- */
.site-header {
    display: grid;
    grid-template-columns: auto minmax(220px, 420px) 1fr;
    align-items: center;
    gap: 20px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}
.brand-img { width: 44px; height: 44px; display: block; }
.brand-name {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 500;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.brand-name b { font-weight: 800; }

.search-wrap { position: relative; }
#word-search-input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 16px;
}
#word-search-input::placeholder { color: var(--muted); opacity: 1; }
#word-search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--lapis-100); }

.search-results {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(8, 21, 55, 0.18);
}
.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
}
.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: var(--accent-soft); }
.search-item-word { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.search-item-uz { font-size: 14px; color: var(--muted); }
.search-item-loc { font-size: 13px; color: var(--muted); white-space: nowrap; }

.stats {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}
.stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 12px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.stat svg { flex: none; }
.stat-streak svg { color: var(--anor-600); }
.stat-score svg { color: var(--lapis-600); }
body.dark-mode .stat-score svg { color: var(--accent); }
.stat-progress svg { color: var(--firuza-600); }
body.dark-mode .stat-progress svg { color: var(--firuza-500); }
.stat-rank { font-weight: 500; color: var(--muted); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn .ic-off, .icon-btn .ic-sun { display: none; }
.icon-btn.is-off .ic-on { display: none; }
.icon-btn.is-off .ic-off { display: block; }
body.dark-mode .icon-btn .ic-moon { display: none; }
body.dark-mode .icon-btn .ic-sun { display: block; }

.noscript { padding: 12px 24px; background: var(--saffron-100); text-align: center; }

/* ----------------------------------- Kitoblar ----------------------------------- */
.books {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}
.books-bar {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 4px;
}
.book-btn {
    --band: var(--lapis-600);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 58px;
    padding: 6px 4px 5px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-bottom: 6px solid var(--band);
    border-radius: 8px 8px 4px 4px;
    color: var(--text);
    transition: transform 0.12s ease, background-color 0.12s ease;
}
.book-btn[data-band="b"] { --band: var(--firuza-500); }
.book-btn[data-band="c"] { --band: var(--saffron-500); }
.book-btn[data-band="x"] { --band: var(--anor-600); }
.book-btn:hover { transform: translateY(-2px); }
.book-btn.soon { opacity: 0.5; border-bottom-style: dashed; cursor: pointer; }
.book-btn.soon:hover { transform: none; }
.books-note { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.35; }
.books-note[hidden] { display: none; }
.book-btn .bk-n { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.15; }
.book-btn .bk-l { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.book-btn.active { background: var(--lapis-900); border-color: var(--lapis-900); border-bottom-color: var(--band); color: #fff; transform: translateY(-2px); }
.book-btn.active .bk-l { color: #dce6ff; }
body.dark-mode .book-btn.active { background: var(--lapis-600); border-color: var(--lapis-600); border-bottom-color: var(--band); }

/* ----------------------------------- Asosiy joylashuv ----------------------------------- */
.main-container {
    display: grid;
    grid-template-columns: 308px minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
    max-width: 1280px;
    margin: 20px auto 0;
    padding: 0 24px;
}

/* ----------------------------------- Unit mozaikasi ----------------------------------- */
.sidebar-units {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
}
.units-toggle { display: none; order: 0; }
.book-title {
    order: 1;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.book-title small { display: block; font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.book-summary-box { order: 2; font-size: 15px; color: var(--muted); line-height: 1.35; }
.book-summary-box strong { color: var(--text); font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-right: 4px; }
.book-summary-box .bs-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.book-summary-box .bs-bar i { display: block; height: 100%; background: var(--firuza-500); }

.unit-grid {
    order: 3;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: 3px;
    padding: 3px;
    background: var(--grout);
    border-radius: 8px;
}
.unit-btn {
    position: relative;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.12s ease;
}
.unit-btn b { font-weight: 800; font-size: 15px; }
.unit-btn:hover { background: var(--lapis-100); }
body.dark-mode .unit-btn:hover { background: var(--lapis-100); }
.unit-btn.completed {
    background-color: var(--firuza-500);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='%230c1b4a' stroke-width='1.4'%3E%3Cpath d='M1.5 5.2 4 7.5 8.5 2.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 9px 9px;
    background-position: right 4px top 4px;
    color: #0c1b4a;
    font-weight: 600;
}
.unit-btn.completed:hover { background-color: #3fd0c9; }
/* Qisman bajarilgan unit: pastida progress chizig'i (bo'limlarning ulushi) */
.unit-btn.partial {
    background-image: linear-gradient(var(--firuza-500), var(--firuza-500));
    background-repeat: no-repeat;
    background-size: var(--p, 0%) 3px;
    background-position: left bottom;
}
.unit-btn.active {
    background: var(--saffron-500);
    background-image: none;
    color: #0c1b4a;
    font-weight: 600;
    box-shadow: 0 0 0 2px var(--lapis-900);
    z-index: 1;
}
body.dark-mode .unit-btn.active { box-shadow: 0 0 0 2px #e8eeff; }
.unit-btn.active.partial { background-image: linear-gradient(var(--lapis-900), var(--lapis-900)); background-size: var(--p, 0%) 3px; background-repeat: no-repeat; background-position: left bottom; }
.units-hint { order: 4; font-size: 14px; color: var(--muted); }

/* ----------------------------------- O'yin maydoni ----------------------------------- */
.game-area {
    min-width: 0;
    min-height: 540px;
    padding: 8px 24px 28px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
}

.mode-tabs {
    display: flex;
    gap: 2px;
    margin: 0 -8px;
    overflow-x: auto;
    border-bottom: 2px solid var(--line);
    scrollbar-width: none;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab {
    flex: none;
    padding: 14px 16px 12px;
    background: none;
    border: 0;
    border-bottom: 4px solid transparent;
    margin-bottom: -2px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--saffron-500); }
.mode-tab.done::after {
    content: '';
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-left: 6px;
    vertical-align: -1px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='%2314b8b0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 5.2 4 7.5 8.5 2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.game-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 16px;
    margin-top: 22px;
}
#current-unit-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; font-family: var(--font-display); letter-spacing: -0.02em; }
#current-unit-title .ut-unit { font-size: 32px; font-weight: 700; line-height: 1.1; }
#current-unit-title .ut-book { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
#current-unit-title .ut-name { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.round-badge { font-family: var(--font-display); font-size: 14px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 15 bo'lakli progress chizig'i */
.progress-bar-wrap {
    position: relative;
    height: 10px;
    margin: 14px 0 24px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0;
    background: var(--firuza-500);
    transition: width 0.3s ease;
}
.progress-bar-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / 15 - 3px), var(--surface) calc(100% / 15 - 3px), var(--surface) calc(100% / 15));
}

#learn-mode-area, #match-mode-area, #quiz-mode-area, #exercises-mode-area { flex-direction: column; }

/* ----------------------------------- Umumiy tugmalar ----------------------------------- */
.next-round-btn, .fc-nav-btn, .fc-play-btn, .share-tg-btn, .story-btn {
    min-height: 46px;
    padding: 0 20px;
    border-radius: var(--radius);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    border: 2px solid var(--line);
    background: var(--surface);
    color: var(--text);
    transition: transform 0.1s ease, border-color 0.12s ease;
}
.fc-nav-btn:hover, .fc-play-btn:hover, .share-tg-btn:hover, .story-btn:hover { border-color: var(--accent); }
.next-round-btn:active, .fc-nav-btn:active, .fc-play-btn:active { transform: translateY(1px); }
.next-round-btn {
    background: var(--saffron-500);
    border-color: var(--saffron-500);
    color: #0c1b4a;
    font-weight: 700;
}
.next-round-btn:hover { background: #ffc633; border-color: #ffc633; }
.fc-nav-btn.primary { background: var(--lapis-600); border-color: var(--lapis-600); color: #fff; }
body.dark-mode .fc-nav-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ink-on-accent); }
.fc-nav-btn.primary:hover { background: var(--lapis-700); border-color: var(--lapis-700); }

/* Karnay tugmalari: matndagi emoji yashiriladi, o'rniga chiziqli belgi */
.speak-btn, .speak-btn-large {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 0;
    line-height: 0;
    color: var(--accent);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 8px;
}
.speak-btn-large { width: 48px; height: 48px; }
.speak-btn::before, .speak-btn-large::before {
    content: "";
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9z'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9v6h4l5 4V5L8 9z'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12'/%3E%3C/svg%3E") center / contain no-repeat;
}
.speak-btn:hover, .speak-btn-large:hover { border-color: var(--accent); }

/* So'z belgi katakchasi: emoji yoki so'z turkumi rangidagi harf */
.wtile { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; font-size: 20px; line-height: 1; background: var(--lapis-50); border: 1px solid var(--line); font-family: var(--font-display); }
.wtile-letter { font-weight: 700; font-size: 18px; color: var(--lapis-700); background: var(--lapis-100); border-color: transparent; }
.wtile-v.wtile-letter { color: var(--firuza-600); background: var(--firuza-100); }
.wtile-adj.wtile-letter { color: #8a5a00; background: var(--saffron-100); }
.wtile-adv.wtile-letter { color: var(--anor-600); background: var(--anor-100); }
.wtile-pron.wtile-letter, .wtile-prep.wtile-letter, .wtile-conj.wtile-letter, .wtile-det.wtile-letter, .wtile-num.wtile-letter, .wtile-interj.wtile-letter { color: var(--muted); background: var(--surface-2, #eef1f7); }
.wtile-multi { white-space: nowrap; width: auto; min-width: 34px; padding: 0 7px; font-size: 17px; letter-spacing: 1px; }
.flashcard-icon, .quiz-icon { margin-bottom: 8px; }
.flashcard-icon .wtile, .quiz-icon .wtile { width: 56px; height: 56px; border-radius: 16px; font-size: 32px; }
.flashcard-icon .wtile-letter, .quiz-icon .wtile-letter { font-size: 28px; }
.flashcard-icon .wtile-multi, .quiz-icon .wtile-multi { width: auto; min-width: 56px; padding: 0 14px; font-size: 30px; }
.ex-prompt-icon { display: none; } /* mashqda emoji javobni oshkor qiladi */
body.dark-mode .wtile { background: var(--accent-soft); }
body.dark-mode .wtile-letter { background: rgba(122,160,255,.18); color: var(--accent); }
@media (max-width: 760px) { .card .wtile-multi { width: auto; padding: 0 5px; font-size: 14px; } .card .wtile { width: 28px; height: 28px; font-size: 16px; border-radius: 8px; } .card .wtile-letter { font-size: 15px; } }

.pos-badge {
    display: inline-block;
    padding: 0 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 13px;
    font-style: italic;
    font-weight: 400;
    line-height: 1.5;
    color: var(--muted);
}

/* ----------------------------------- 1. O'rganish ----------------------------------- */
.flashcard-box { width: 100%; max-width: 760px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.flashcard-word-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.flashcard-word-row h3 {
    font-family: var(--font-display);
    font-size: clamp(44px, 9vw, 72px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    overflow-wrap: anywhere;
}
.flashcard-tr { margin-top: 6px; font-size: 22px; color: var(--muted); }
.flashcard-meaning, .flashcard-syn, .flashcard-example {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 2px solid var(--line);
}
.fc-label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 700; color: var(--muted); }
.flashcard-meaning p { font-family: var(--font-display); font-size: clamp(24px, 4vw, 32px); font-weight: 600; letter-spacing: -0.01em; color: var(--accent); line-height: 1.25; }
.flashcard-syn p { font-size: 19px; }
.fc-ex-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fc-ex-all {
    flex: none;
    min-height: 36px;
    padding: 4px 14px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}
.fc-ex-all:hover { border-color: var(--accent); }
.fc-ex-all.playing, .fc-ex-all.on { color: var(--ink-on-accent, #fff); background: var(--accent); border-color: var(--accent); }
.fc-ex-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.fc-ex-hint { margin-top: 4px; font-size: 14px; color: var(--muted); }
.fc-ex-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; counter-reset: fcex; }
.fc-ex-item {
    counter-increment: fcex;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 8px;
    border-radius: 10px;
    transition: background .15s;
}
.fc-ex-item::before {
    content: counter(fcex);
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.fc-ex-text { flex: 1; min-width: 0; }
.fc-ex-text[role="button"] { cursor: pointer; border-radius: 6px; }
.fc-ex-text[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fc-ex-en { font-size: 20px; line-height: 1.45; font-style: italic; overflow-wrap: anywhere; }
.fc-ex-uz { display: none; margin-top: 2px; font-size: 16px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.fc-ex-item.open .fc-ex-uz { display: block; }
.fc-ex-item .speak-btn { width: 34px; height: 34px; border-width: 1px; }
.fc-ex-item .speak-btn::before { width: 18px; height: 18px; }
.fc-ex-item.speaking { background: var(--accent-soft); }
.fc-ex-item.speaking::before { color: var(--ink-on-accent, #fff); background: var(--accent); border-color: var(--accent); }
mark.ex-w { background: transparent; color: var(--accent); font-style: normal; font-weight: 700; }
.flashcard-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.flashcard-nav .fc-play-btn { margin-left: auto; }

/* ----------------------------------- 2. Juftini top ----------------------------------- */
/* Ikkala ustun bitta panjarada: har bir qatordagi ikki karta bir xil balandlikda turadi */
.cards-container { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 10px; }
.cards-container > div, .word-list { display: contents; }
.column-title { grid-row: 1; margin-bottom: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.cards-container > div:nth-child(1) .column-title, #eng-list .card { grid-column: 1; }
.cards-container > div:nth-child(2) .column-title, #uzb-list .card { grid-column: 2; }
#eng-list .card:nth-child(1), #uzb-list .card:nth-child(1) { grid-row: 2; }
#eng-list .card:nth-child(2), #uzb-list .card:nth-child(2) { grid-row: 3; }
#eng-list .card:nth-child(3), #uzb-list .card:nth-child(3) { grid-row: 4; }
#eng-list .card:nth-child(4), #uzb-list .card:nth-child(4) { grid-row: 5; }
#eng-list .card:nth-child(5), #uzb-list .card:nth-child(5) { grid-row: 6; }

.card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 68px;
    padding: 12px 14px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.12s ease, background-color 0.12s ease, transform 0.12s ease;
}
#eng-list .card { border-left: 8px solid var(--lapis-600); }
body.dark-mode #eng-list .card { border-left-color: var(--accent); }
.card:hover { border-color: var(--accent); }
.card.selected { border-color: var(--accent); background: var(--accent-soft); transform: translateX(3px); }
#uzb-list .card.selected { transform: translateX(-3px); }
.card.correct { border-color: var(--firuza-500); background: var(--firuza-100); }
.card.wrong { border-color: var(--anor-600); background: var(--anor-100); animation: shake 0.3s ease; }
.card.vanish { animation: vanish 0.35s ease forwards; pointer-events: none; }

.card-main-info { min-width: 0; }
.card-word-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.card-sub-meta { margin-top: 2px; font-size: 15px; line-height: 1.35; color: var(--muted); }
.card-syn-tag { color: var(--muted); }
.card-uz-text { font-size: 19px; font-weight: 600; line-height: 1.3; }

/* ----------------------------------- 3. Test ----------------------------------- */
.quiz-box { width: 100%; max-width: 720px; }
.quiz-question-card { padding-bottom: 18px; border-bottom: 2px solid var(--line); }
.quiz-main-word { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; font-family: var(--font-display); font-size: clamp(40px, 8vw, 64px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.quiz-meta { margin-top: 6px; font-size: 19px; color: var(--muted); }
.quiz-subtitle { margin: 18px 0 12px; font-size: 15px; font-weight: 700; color: var(--muted); }
.quiz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ----------------------------------- 4. Mashqlar ----------------------------------- */
.ex-subtabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.ex-subtab {
    min-height: 40px;
    padding: 0 14px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
}
.ex-subtab:hover { border-color: var(--accent); color: var(--text); }
.ex-subtab.done::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 7px;
    vertical-align: -1px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='%2314b8b0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 5.2 4 7.5 8.5 2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ex-subtab.active { background: var(--lapis-900); border-color: var(--lapis-900); color: #fff; }
body.dark-mode .ex-subtab.active { background: var(--accent); border-color: var(--accent); color: var(--ink-on-accent); }

.ex-card-box { width: 100%; max-width: 760px; }
.ex-instruction { font-size: 15px; font-weight: 700; color: var(--muted); }
.ex-prompt-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; }
.ex-prompt-text { font-family: var(--font-display); font-size: clamp(22px, 4.2vw, 32px); font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; max-width: 34ch; }
.ex-prompt-text small { font-family: var(--font-body); font-size: 18px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.ex-hint-uz { margin-top: 8px; font-size: 16px; color: var(--muted); }
.ex-blank { display: inline-block; min-width: 90px; border-bottom: 4px solid var(--saffron-500); color: transparent; text-align: center; }
.ex-options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.ex-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 10px 14px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    text-align: left;
    font-size: 19px;
    font-weight: 600;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.ex-option-btn:hover { border-color: var(--accent); }
.ex-opt-letter {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
}
.ex-option-btn.correct { border-color: var(--firuza-500); background: var(--firuza-100); }
.ex-option-btn.correct .ex-opt-letter { background: var(--firuza-500); color: #0c1b4a; }
.ex-option-btn.wrong { border-color: var(--anor-600); background: var(--anor-100); animation: shake 0.3s ease; }

/* ----------------------------------- 5. Hikoya ----------------------------------- */
.reading-container { display: grid; gap: 28px; max-width: 760px; }
.story-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.story-header h3 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.story-actions { display: flex; gap: 8px; }
.story-btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
.word-inspector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    margin: 14px 0 18px;
    padding: 10px 14px;
    background: var(--accent-soft);
    border-left: 6px solid var(--accent);
    border-radius: 4px 10px 10px 4px;
    font-size: 17px;
}
.story-content p { max-width: 62ch; margin-bottom: 14px; font-size: 20px; line-height: 1.7; }
.story-word {
    padding: 0 2px;
    border-bottom: 2px dotted var(--accent);
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    border-radius: 2px;
}
.story-word:hover { background: var(--saffron-100); }
.story-uz-box { margin-top: 14px; padding: 14px 16px; background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--radius); white-space: pre-line; font-size: 16px; line-height: 1.6; }
.rc-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; padding-top: 22px; border-top: 2px solid var(--line); }
.rc-header h4 { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.rc-score-badge { font-family: var(--font-display); font-size: 14px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.rc-questions-list { display: grid; gap: 14px; margin-top: 14px; }
.rc-q-card { padding: 14px 16px; background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--radius); }
.rc-q-title { font-size: 18px; font-weight: 600; line-height: 1.35; }
.rc-q-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.rc-opt-btn { min-height: 44px; padding: 8px 12px; background: var(--surface); border: 2px solid var(--line); border-radius: 8px; text-align: left; font-size: 17px; font-weight: 600; }
.rc-opt-btn:hover { border-color: var(--accent); }
.rc-opt-btn.correct { border-color: var(--firuza-500); background: var(--firuza-100); }
.rc-opt-btn.wrong { border-color: var(--anor-600); background: var(--anor-100); animation: shake 0.3s ease; }

/* ----------------------------------- Bosqich tugadi ----------------------------------- */
.cleared-box { padding: 36px 8px 12px; text-align: center; }
.stars-row { display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.star { width: 58px; height: 58px; fill: var(--saffron-500); stroke: var(--lapis-900); stroke-width: 1.2; stroke-linejoin: round; animation: star-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
body.dark-mode .star { stroke: #e8eeff; }
.star.s1 { animation-delay: 0s; }
.star.s2 { width: 74px; height: 74px; animation-delay: 0.14s; }
.star.s3 { animation-delay: 0.28s; }

/* Bayram qahramoni (js/celebrate.js): tepada 3 ta yulduz, pastda sakrayotgan qahramon */
.celebrate-slot, .celebrate { display: flex; flex-direction: column; align-items: center; }
.celebrate { --m-line: var(--lapis-900); }
body.dark-mode .celebrate { --m-line: #e8eeff; }
.celebrate .stars-row { align-items: center; gap: 8px; margin-bottom: 2px; }
.celebrate .star { width: 38px; height: 38px; animation: star-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both, star-twinkle 1.7s ease-in-out infinite; }
.celebrate .star.s2 { width: 50px; height: 50px; }
.celebrate .star.s1 { animation-delay: 0s, 0.9s; }
.celebrate .star.s2 { animation-delay: 0.14s, 1.1s; }
.celebrate .star.s3 { animation-delay: 0.28s, 1.3s; }
.m-fig { width: 150px; height: auto; overflow: visible; transform-origin: 50% 100%; animation: m-pop 0.7s cubic-bezier(0.2, 1.3, 0.4, 1) 0.15s both; }
.rc-result-emoji .m-fig { width: 130px; }
.m-shadow { fill: rgba(12, 27, 74, 0.16); transform-box: fill-box; transform-origin: center; animation: m-shadow 0.8s ease-in-out 0.85s infinite; }
body.dark-mode .m-shadow { fill: rgba(0, 0, 0, 0.35); }
.m-hop { transform-box: fill-box; transform-origin: 50% 100%; animation: m-hop 0.8s ease-in-out 0.85s infinite; }
.m-arm { animation-duration: 0.4s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate; animation-delay: 0.85s; }
.m-arm-l { animation-name: m-wave-l; }
.m-arm-r { animation-name: m-wave-r; }
.m-eye { transform-box: fill-box; transform-origin: center; animation: m-blink 3.2s ease-in-out 1.5s infinite; }
.m-glow { animation: m-glow 0.7s ease-in-out infinite alternate; }

@keyframes m-pop { 0% { opacity: 0; transform: translateY(34px) scale(0.35); } 60% { opacity: 1; transform: translateY(-6px) scale(1.07); } 100% { opacity: 1; transform: none; } }
@keyframes m-hop { 0%, 100% { transform: translateY(0) scale(1.05, 0.93); } 50% { transform: translateY(-15px) scale(0.97, 1.05); } }
@keyframes m-shadow { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.68); opacity: 0.55; } }
@keyframes m-wave-l { from { transform: rotate(-14deg); } to { transform: rotate(12deg); } }
@keyframes m-wave-r { from { transform: rotate(14deg); } to { transform: rotate(-12deg); } }
@keyframes m-blink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.1); } }
@keyframes m-glow { from { opacity: 0.45; } to { opacity: 1; } }
@keyframes star-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.14) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) {
    .m-fig, .m-shadow, .m-hop, .m-arm, .m-eye, .m-glow, .celebrate .star { animation: none !important; }
}
.cleared-box h3 { margin-top: 18px; font-family: var(--font-display); font-size: clamp(22px, 4vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.cleared-sub { margin-top: 8px; font-size: 18px; color: var(--muted); }
.cleared-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }

/* ----------------------------------- Ball effekti ----------------------------------- */
.floating-point {
    position: fixed;
    z-index: 60;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--firuza-600);
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
}
body.dark-mode .floating-point { color: var(--firuza-500); }

@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-48px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes vanish { to { opacity: 0; transform: scale(0.92); } }
@keyframes star-in { from { opacity: 0; transform: scale(0.2) rotate(-60deg); } to { opacity: 1; transform: scale(1) rotate(0); } }

/* ----------------------------------- Rejimlar haqida ----------------------------------- */
.how { max-width: 1280px; margin: 48px auto 0; padding: 0 24px; }
.how h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.how-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; margin: 16px 0 0; }
.how-list > div { padding: 14px 0; border-top: 2px solid var(--line); }
.how-list dt { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.how-list dd { margin: 4px 0 0; color: var(--muted); font-size: 16px; max-width: 40ch; }

/* ----------------------------------- Footer ----------------------------------- */
.site-footer { margin-top: 48px; border-top: 2px solid var(--line); }
.footer-content { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 28px; max-width: 1280px; margin: 0 auto; padding: 20px 24px 28px; font-size: 15px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.footer-links a:hover { color: var(--accent); }

/* Yuqori qator: qidiruv ikkinchi qatorga tushadi (statistika + til tugmasi sig'ishi uchun) */
@media (max-width: 1100px) {
    .site-header { grid-template-columns: 1fr auto; row-gap: 12px; }
    .search-wrap { grid-column: 1 / -1; grid-row: 2; }
}
@media (min-width: 1101px) and (max-width: 1240px) {
    .site-header { grid-template-columns: auto minmax(200px, 300px) 1fr; }
}

/* ----------------------------------- Planshet ----------------------------------- */
@media (max-width: 1000px) {
    .main-container { grid-template-columns: 1fr; }
    .sidebar-units { position: static; }
    .how-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ----------------------------------- Telefon ----------------------------------- */
@media (max-width: 640px) {
    body { font-size: 16px; }
    .site-header { padding: 12px 16px; }
    .stats { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; }
    .stat-rank { display: none; }
    .search-wrap { grid-row: 2; }
    .brand-name { font-size: 19px; }

    .books { padding: 0; }
    .books-bar { display: flex; gap: 4px; padding: 6px 16px 4px; overflow-x: auto; scrollbar-width: none; }
    .books-bar::-webkit-scrollbar { display: none; }
    .books-note { margin: 6px 16px 0; }
    .book-btn { flex: none; width: 58px; }

    .main-container { padding: 0 12px; margin-top: 14px; gap: 14px; }

    .sidebar-units { padding: 12px; gap: 10px; }
    .units-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        min-height: 48px;
        padding: 0 4px;
        background: none;
        border: 0;
        font-family: var(--font-display);
        font-size: 17px;
        font-weight: 600;
        text-align: left;
    }
    .units-toggle b { font-weight: 800; color: var(--accent); }
    .units-toggle-hint { font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--accent); }
    .sidebar-units:not(.open) .book-title,
    .sidebar-units:not(.open) .book-summary-box,
    .sidebar-units:not(.open) .unit-grid,
    .sidebar-units:not(.open) .units-hint, .sidebar-units:not(.open) .units-backup { display: none; }
    .sidebar-units.open .units-toggle-hint { visibility: hidden; }
    .unit-btn { font-size: 14px; min-height: 44px; }

    .game-area { padding: 4px 14px 22px; min-height: 0; }
    .mode-tabs { margin: 0 -6px; }
    .mode-tab { padding: 12px 12px 10px; }
    #current-unit-title .ut-unit { font-size: 26px; }
    #current-unit-title .ut-name { display: none; }

    .cards-container { gap: 8px; }
    .card { padding: 8px 8px 8px 10px; min-height: 72px; gap: 6px; }
    .card-word-line { font-size: 17px; gap: 2px 6px; }
    .card-sub-meta { font-size: 13px; }
    .card-syn-tag { display: none; }
    .card-uz-text { font-size: 16px; }
    #eng-list .card { border-left-width: 6px; }
    .card .speak-btn { width: 30px; height: 30px; border-width: 1px; }
    .card .speak-btn::before { width: 16px; height: 16px; }
    .quiz-options .card { min-height: 60px; }

    .quiz-options, .ex-options-grid, .rc-q-options { grid-template-columns: 1fr; }
    .flashcard-nav .fc-play-btn { margin-left: 0; width: 100%; order: 3; }
    .flashcard-nav .fc-nav-btn { flex: 1; }
    .fc-ex-header { flex-wrap: wrap; }
    .fc-ex-item { gap: 10px; padding: 6px 4px; }
    .fc-ex-en { font-size: 18px; }
    .fc-ex-uz { font-size: 15px; }
    .fc-ex-tools { justify-content: flex-start; }
    .story-content p { font-size: 19px; }
    .how-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Eshitib yozing mashqi */
.ex-type-form { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
.ex-type-input { flex: 1 1 220px; min-width: 0; padding: 14px 16px; font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 12px; outline: none; }
.ex-type-input:focus { border-color: var(--accent); }
.ex-type-input.correct { border-color: var(--firuza-500); background: var(--firuza-100); color: #0c1b4a; }
.ex-type-input.wrong { border-color: var(--anor-600); background: var(--anor-100); color: #0c1b4a; animation: shake 0.3s ease; }
.ex-type-feedback { grid-column: 1 / -1; min-height: 26px; margin-top: 4px; font-size: 16px; font-weight: 600; color: var(--muted); }
.ex-type-form .next-round-btn { margin: 0; flex: 0 0 auto; }
@media (max-width: 760px) { .ex-type-input { flex: 1 1 100%; } .ex-type-form .next-round-btn { flex: 1 1 100%; width: 100%; } }
.ex-type-form, .ex-type-input, .ex-type-form .next-round-btn { box-sizing: border-box; max-width: 100%; }
.ex-type-form { min-width: 0; }
@media (max-width: 760px) { .ex-options-grid { grid-template-columns: minmax(0, 1fr); } }

/* Hikoyani to'ldiring */
.ex-card-box.cloze-mode .ex-prompt-box, .ex-card-box.cloze-mode .ex-hint-uz { display: none; }
.cloze-wrap { grid-column: 1 / -1; min-width: 0; }
.cloze-bank { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 14px; }
.cloze-chip { font-family: var(--font-display); font-size: 16px; font-weight: 600; padding: 7px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; }
.cloze-chip small { font-family: var(--font-body); font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.cloze-chip:hover:not(:disabled) { border-color: var(--accent); }
.cloze-chip.used { opacity: .35; text-decoration: line-through; cursor: default; }
.cloze-chip.wrong { border-color: var(--anor-600); background: var(--anor-100); color: #0c1b4a; animation: shake 0.3s ease; }
.cloze-title { margin: 18px 0 4px; font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.cloze-text p { font-size: 18px; line-height: 2.2; margin: 0 0 10px; max-width: 70ch; }
.cloze-blank { display: inline-block; min-width: 86px; padding: 0 8px; margin: 0 2px; font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.6; text-align: center; color: var(--muted); background: var(--surface); border: 0; border-bottom: 3px solid var(--line); border-radius: 6px 6px 0 0; cursor: pointer; }
.cloze-blank.active { border-bottom-color: var(--saffron-500); background: var(--saffron-100); color: #0c1b4a; }
.cloze-blank.correct { border-bottom-color: var(--firuza-500); background: var(--firuza-100); color: #0c1b4a; cursor: default; }
.cloze-blank.wrong { border-bottom-color: var(--anor-600); background: var(--anor-100); animation: shake 0.3s ease; }
.cloze-done { margin-top: 8px; padding: 14px 16px; background: var(--firuza-100); border-radius: 12px; color: #0c1b4a; font-weight: 700; }
.cloze-done details { margin: 10px 0; font-weight: 400; }
.cloze-uz { white-space: pre-line; margin-top: 8px; }
.cloze-done .next-round-btn { margin-top: 6px; }
body.dark-mode .cloze-done, body.dark-mode .rc-result { color: var(--text); }

/* Ma'noga moslang va Tabiiy davomi */
.mx-wrap { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 10px 14px; align-items: start; }
.mx-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mx-item { text-align: left; width: 100%; }
.mx-word { font-weight: 700; }
.mx-word small { font-size: 12px; font-weight: 400; color: var(--muted); }
.ex-option-btn.selected { border-color: var(--accent); background: var(--accent-soft); }
.ex-option-btn:disabled { cursor: default; }
.nat-wrap { grid-column: 1 / -1; }
.nat-stem { font-family: var(--font-display); font-size: clamp(22px, 4.2vw, 30px); font-weight: 600; line-height: 1.45; margin-bottom: 18px; }
.nat-opts { display: grid; gap: 10px; }
@media (max-width: 760px) { .mx-wrap { grid-template-columns: minmax(0, 1fr); } }

/* Hikoyani to'ldiring: matn Hikoya bo'limidagidek ko'rinadi, bo'sh joylar sal bilinib turadi */
.cloze-title { margin: 20px 0 8px; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.cloze-text p { max-width: 62ch; margin: 0 0 14px; font-size: 20px; line-height: 1.7; }
.cloze-blank { display: inline; min-width: 0; margin: 0; padding: 0 1.6em; font-family: inherit; font-size: inherit; font-weight: 400; line-height: inherit; color: var(--muted); background: transparent; border: 0; border-bottom: 2px dotted var(--muted); border-radius: 2px; cursor: pointer; }
.cloze-blank:hover { background: var(--saffron-100); }
.cloze-blank.active { background: var(--saffron-100); color: var(--text); border-bottom: 2px dotted var(--accent); }
.cloze-blank.correct { padding: 0 2px; color: var(--accent); font-weight: 600; background: transparent; border-bottom: 2px dotted var(--accent); cursor: default; }
.cloze-blank.wrong { background: var(--anor-100); border-bottom-color: var(--anor-600); }

/* Hikoya: unit so'zlari oddiy matn bo'lib ko'rinadi (urg'u hikoyaga), faqat bosilganda ma'nosi chiqadi */
.story-word { padding: 0; border-bottom: 0; color: inherit; font-weight: inherit; border-radius: 3px; }
.story-word:hover { background: var(--saffron-100); }

/* Unit so'zlari matnda bilinar-bilinmas boshqa rangda */
.story-word { color: #16307a; color: color-mix(in srgb, var(--accent) 38%, var(--text)); }
body.dark-mode .story-word { color: #cfdcff; color: color-mix(in srgb, var(--accent) 30%, var(--text)); }

/* Matn bo'yicha savollar: bitta-bitta */
.rc-steps { display: flex; gap: 6px; margin-top: 14px; }
.rc-step { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.rc-step.now { background: var(--accent); }
.rc-step.done { background: var(--firuza-500); }
.rc-q-big { margin-top: 14px; padding: 22px clamp(16px, 3vw, 26px); background: var(--surface-2); border: 2px solid var(--line); border-radius: 16px; }
.rc-q-num { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rc-q-big .rc-q-title { margin-top: 8px; font-family: var(--font-display); font-size: clamp(21px, 3.4vw, 26px); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.rc-q-big .rc-q-options { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 18px; }
.rc-q-big .rc-opt-btn { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; font-size: 18px; border-radius: 12px; }
.rc-opt-letter { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-family: var(--font-display); font-size: 14px; font-weight: 700; text-transform: uppercase; }
.rc-opt-btn.correct .rc-opt-letter { background: var(--firuza-500); color: #0c1b4a; }
.rc-opt-btn.wrong .rc-opt-letter { background: var(--anor-600); color: #fff; }
.rc-opt-btn:disabled { cursor: default; }
.rc-opt-btn.wrong { opacity: .75; }
.rc-q-fb { min-height: 28px; margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 16px; font-weight: 600; color: var(--muted); }
.rc-ok { color: var(--firuza-600); font-weight: 700; }
.rc-next { margin: 0; }
.rc-result { margin-top: 14px; padding: 28px 18px; text-align: center; background: var(--firuza-100); border: 2px solid var(--firuza-500); border-radius: 16px; color: #0c1b4a; }
.rc-result-emoji { font-size: 44px; line-height: 1; }
.rc-result-title { margin-top: 10px; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.rc-result-sub { margin: 6px 0 16px; font-size: 17px; }

/* ---- Matn savollari: To'g'ri/Noto'g'ri, gapni top, tartibga sol ---- */
.rc-q-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rc-kind { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.rc-tf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.rc-tf-btn { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 68px; padding: 10px 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; font-family: var(--font-display); font-size: 20px; font-weight: 700; text-align: left; }
.rc-tf-btn small { display: block; margin-top: 2px; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--muted); }
.rc-tf-ico { font-size: 26px; line-height: 1; }
.rc-tf-btn:hover:not(:disabled) { border-color: var(--accent); }
.rc-tf-btn.correct { border-color: var(--firuza-500); background: var(--firuza-100); }
.rc-tf-btn.wrong { border-color: var(--anor-600); background: var(--anor-100); opacity: .75; animation: shake 0.3s ease; }
.rc-tf-btn:disabled { cursor: default; }
.rc-find .rc-opt-btn { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; font-size: 17px; font-weight: 500; line-height: 1.4; }
.rc-find .rc-opt-letter { margin-top: 1px; }
.rc-order-hint { margin-top: 14px; font-size: 15px; color: var(--muted); }
.rc-order { display: grid; gap: 10px; margin-top: 10px; }
.rc-ord-btn { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; text-align: left; font-size: 18px; font-weight: 600; }
.rc-ord-n { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 2px dashed var(--line); color: var(--muted); font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.rc-ord-btn:hover:not(:disabled) { border-color: var(--accent); }
.rc-ord-btn.correct { border-color: var(--firuza-500); background: var(--firuza-100); }
.rc-ord-btn.correct .rc-ord-n { background: var(--firuza-500); border: 2px solid var(--firuza-500); color: #0c1b4a; }
.rc-ord-btn.wrong { border-color: var(--anor-600); background: var(--anor-100); animation: shake 0.3s ease; }
.rc-ord-btn:disabled { cursor: default; }
@media (max-width: 560px) {
    .rc-tf-btn { min-height: 60px; font-size: 18px; padding: 8px 10px; }
    .rc-tf-ico { font-size: 22px; }
}

/* ----------------------------------- 7. Takrorlash va xatolar daftari ----------------------------------- */
.tab-badge { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--anor-600); color: #fff; font-family: var(--font-display); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; vertical-align: 1px; }
.tab-badge[hidden] { display: none; }

.rv-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 0; padding: 10px 12px 10px 16px; background: var(--saffron-100); border: 2px solid var(--saffron-500); border-radius: var(--radius); color: #5a3d00; font-size: 16px; font-weight: 600; }
body.dark-mode .rv-banner { background: #3a2f0c; border-color: var(--saffron-600); color: #ffe39a; }
.rv-banner-btn { flex: none; min-height: 38px; padding: 0 16px; background: var(--saffron-500); border: 2px solid var(--saffron-500); border-radius: var(--radius); font-family: var(--font-display); font-size: 15px; font-weight: 700; color: #0c1b4a; }
.rv-banner-btn:hover { background: #ffc633; border-color: #ffc633; }

.fc-hard { min-height: 40px; padding: 0 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--muted); }
.fc-hard:hover { border-color: var(--saffron-600); color: var(--text); }
.fc-hard.on { background: var(--saffron-100); border-color: var(--saffron-500); color: #5a3d00; }
body.dark-mode .fc-hard.on { background: #3a2f0c; border-color: var(--saffron-600); color: #ffe39a; }

#review-mode-area { width: 100%; }
.rv-box { width: 100%; max-width: 720px; }
.rv-title { margin: 20px 0 6px; font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.rv-lead { margin: 0 0 16px; max-width: 62ch; font-size: 16px; line-height: 1.5; color: var(--muted); }
.rv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.rv-stat { padding: 12px 14px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); }
.rv-stat b { display: block; font-family: var(--font-display); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rv-stat span { font-size: 14px; line-height: 1.3; color: var(--muted); }
.rv-stat.due b { color: var(--anor-600); }
body.dark-mode .rv-stat.due b { color: #ff8da1; }
.rv-empty { margin: 0 0 18px; padding: 16px 18px; background: var(--surface-2); border: 2px dashed var(--line); border-radius: var(--radius); font-size: 16px; line-height: 1.5; color: var(--muted); }
.rv-start { margin-bottom: 8px; }
.rv-h { margin: 26px 0 10px; font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.rv-words { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rv-word { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); }
.rv-w-main { flex: 1; min-width: 0; }
.rv-w-en { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.3; }
.rv-w-uz { font-size: 16px; line-height: 1.35; color: var(--muted); }
.rv-miss { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--anor-100); color: var(--anor-600); font-size: 13px; font-weight: 700; line-height: 20px; vertical-align: 2px; }
body.dark-mode .rv-miss { color: #ff8da1; }
.rv-flag { color: var(--saffron-600); }
.rv-word .speak-btn { width: 34px; height: 34px; border-width: 1px; }
.rv-word .speak-btn::before { width: 18px; height: 18px; }
.rv-link { flex: none; min-height: 34px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text); }
.rv-link:hover { border-color: var(--accent); color: var(--accent); }

.rv-top { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rv-exit { background: none; border: 0; font-size: 15px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.rv-exit:hover { color: var(--accent); }
.rv-bar { height: 8px; margin-bottom: 18px; background: var(--line); border-radius: 999px; overflow: hidden; }
.rv-bar i { display: block; height: 100%; background: var(--firuza-500); border-radius: 999px; transition: width 0.25s ease; }
.rv-done { padding: 12px 0 8px; }
.rv-done .fc-nav-btn { margin-top: 8px; }

@media (max-width: 640px) {
    .rv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rv-banner { font-size: 15px; }
    .rv-link { display: none; }
}

/* ----------------------------------- 8. Telefonga o'rnatish ----------------------------------- */
.install-btn { display: none; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; background: var(--saffron-500); border: 2px solid var(--saffron-500); border-radius: var(--radius); font-family: var(--font-display); font-size: 15px; font-weight: 700; color: #0c1b4a; white-space: nowrap; }
.install-btn.show { display: inline-flex; }
.install-btn:hover { background: #ffc633; border-color: #ffc633; }
.ios-tip { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(8, 21, 55, 0.55); }
.ios-tip[hidden] { display: none; }
.ios-tip-card { width: 100%; max-width: 420px; padding: 22px 20px 20px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-lg); color: var(--text); }
.ios-tip-card h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 20px; }
.ios-tip-card ol { margin: 0 0 18px; padding-left: 22px; font-size: 16px; line-height: 1.55; }
.ios-tip-card li + li { margin-top: 6px; }
.ios-tip-close { width: 100%; }
@media (min-width: 640px) { .ios-tip { align-items: center; } }
/* Katta ekranda faqat ikonka: sarlavha bir qatorda qolsin */
@media (min-width: 900px) { .install-btn { width: 40px; padding: 0; justify-content: center; } .install-btn span { display: none; } }

/* ----------------------------------- 9. Xato topdingizmi? ----------------------------------- */
.footer-link-btn { padding: 0; background: none; border: 0; font: inherit; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.footer-link-btn:hover { color: var(--accent); }
.fc-report { display: block; margin: 18px 0 0; padding: 0; background: none; border: 0; font-size: 15px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.fc-report:hover { color: var(--accent); }
.units-backup { order: 5; align-self: flex-start; margin: 2px 0 0; padding: 0; background: none; border: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.units-backup:hover { color: var(--accent); }
.fb-dialog { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(8, 21, 55, 0.55); overflow-y: auto; }
.fb-dialog[hidden] { display: none; }
.fb-card { width: 100%; max-width: 460px; padding: 22px 20px 20px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-lg); color: var(--text); }
.fb-card h3 { margin: 0 0 14px; font-family: var(--font-display); font-size: 20px; line-height: 1.3; }
.fb-types { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fb-type { min-height: 40px; padding: 0 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--muted); }
.fb-type:hover { border-color: var(--accent); color: var(--text); }
.fb-type.on { background: var(--lapis-900); border-color: var(--lapis-900); color: #fff; }
body.dark-mode .fb-type.on { background: var(--accent); border-color: var(--accent); color: var(--ink-on-accent); }
.fb-label { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 700; color: var(--muted); }
.fb-text { width: 100%; padding: 10px 12px; background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 16px; color: var(--text); resize: vertical; }
.fb-text:focus { outline: none; border-color: var(--accent); }
.fb-note { margin: 10px 0 16px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.fb-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.fb-actions .next-round-btn { flex: 1 1 200px; }
.bk-stats { margin: 0 0 2px; font-size: 16px; line-height: 1.5; }
.bk-last { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.bk-confirm { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--radius); }
.bk-confirm[hidden], .bk-msg[hidden] { display: none; }
.bk-confirm p { margin: 0 0 12px; font-size: 15px; line-height: 1.5; }
.bk-msg { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius); font-size: 14.5px; line-height: 1.5; background: var(--surface-2); border: 2px solid var(--line); }
.bk-msg.ok { background: var(--firuza-100); border-color: var(--firuza-500); color: var(--lapis-900); }
.bk-msg.err { background: var(--anor-100); border-color: var(--anor-600); color: var(--lapis-900); }
.bk-close { margin-top: 14px; }
.rv-backup-note { margin: -6px 0 16px; font-size: 14.5px; }
.rv-backup-btn { padding: 0; background: none; border: 0; font: inherit; font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (min-width: 640px) { .fb-dialog { align-items: center; } }


/* Hikoya audiosi: gap-gap belgilash, tezlik, matnsiz tinglash */
.story-actions { flex-wrap: wrap; }
.story-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.story-sent { cursor: pointer; border-radius: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background 0.15s ease; }
.story-sent.speaking { background: var(--saffron-100); }
.story-content.is-blind p { filter: blur(7px); -webkit-user-select: none; user-select: none; transition: filter 0.2s ease; }
@media (prefers-reduced-motion: reduce) {
    .story-sent, .story-content.is-blind p { transition: none; }
}

/* Daraja aniqlash testi */
.units-placement { margin-top: 6px; }
.pt-banner { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
body.dark-mode .pt-banner { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.pt-banner .rv-banner-btn { background: var(--accent); border-color: var(--accent); color: var(--ink-on-accent); }
.pt-banner .rv-banner-btn:hover { filter: brightness(1.1); background: var(--accent); border-color: var(--accent); }
.pt-banner-x { flex: none; width: 34px; height: 34px; padding: 0; background: transparent; border: 0; border-radius: 8px; font-size: 16px; color: var(--muted); cursor: pointer; }
.pt-banner-x:hover { background: var(--surface); color: var(--text); }
.pt-dialog .pt-card { margin: auto; max-width: 560px; }
.pt-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.pt-quit { width: 34px; height: 34px; padding: 0; background: transparent; border: 0; border-radius: 8px; font-size: 16px; color: var(--muted); cursor: pointer; }
.pt-quit:hover { background: var(--surface-2); color: var(--text); }
.pt-bar, .pt-meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.pt-bar i, .pt-meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.25s ease; }
.pt-word { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 20px 0 4px; }
.pt-word b { font-family: var(--font-display); font-size: 34px; line-height: 1.15; }
.pt-ask { margin: 0 0 14px; font-size: 15px; color: var(--muted); }
.pt-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pt-opt { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); font-family: inherit; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--text); cursor: pointer; }
.pt-opt:hover { border-color: var(--accent); }
.pt-opt.picked, .pt-idk.picked { border-color: var(--accent); background: var(--accent-soft); }
.pt-k { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pt-idk { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; margin-top: 10px; background: transparent; border: 2px dashed var(--line); border-radius: var(--radius); font-family: inherit; font-size: 16px; font-weight: 700; color: var(--muted); cursor: pointer; }
.pt-idk:hover { border-color: var(--accent); color: var(--text); }
.pt-score { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 10px; }
.pt-score b { font-family: var(--font-display); font-size: 46px; line-height: 1; }
.pt-score span { font-size: 17px; color: var(--muted); }
.pt-level { margin: 14px 0 8px; font-size: 16px; line-height: 1.5; }
.pt-start { margin: 14px 0; padding: 12px 14px; background: var(--surface-2); border: 2px solid var(--line); border-radius: var(--radius); }
.pt-start p { margin: 0 0 10px; font-size: 16px; line-height: 1.5; }
.pt-start p:last-child { margin-bottom: 0; }
.pt-units { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 14px 0 8px; }
.pt-unit { min-height: 36px; padding: 0; border: 2px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; }
.pt-unit.ok { background: var(--firuza-100); border-color: var(--firuza-500); }
.pt-unit.no { background: var(--anor-100); border-color: var(--anor-600); }
.pt-unit:hover { filter: brightness(0.96); }
.pt-legend { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.pt-sw { display: inline-block; width: 12px; height: 12px; margin: 0 2px 0 6px; vertical-align: -1px; border: 2px solid; border-radius: 3px; }
.pt-sw.ok { background: var(--firuza-100); border-color: var(--firuza-500); }
.pt-sw.no { background: var(--anor-100); border-color: var(--anor-600); }
.pt-miss { margin: 0 0 16px; }
.pt-miss summary { cursor: pointer; font-weight: 700; }
.pt-miss ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.pt-miss li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 15px; line-height: 1.4; }
.pt-miss li small { color: var(--muted); }
.pt-miss .speak-btn { width: 32px; height: 32px; }
.pt-end .fc-nav-btn, .pt-end .next-round-btn { flex: 1 1 200px; }
.pt-end .fc-nav-btn[disabled] { opacity: 0.7; cursor: default; }
@media (max-width: 480px) {
    .pt-opts { grid-template-columns: 1fr; }
    .pt-units { grid-template-columns: repeat(8, 1fr); }
    .pt-word b { font-size: 30px; }
}

/* Ma'no tili tugmasi (UZ / RU) */
.lang-btn { width: auto; min-width: 44px; padding: 0 10px; font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Yuqori qator (rank, seriya, ball, progress, til, ovoz, mavzu) tor ekranlarda ham bitta qatorga sig'sin */
@media (max-width: 1240px) {
    .stats { gap: 6px; }
    .stat { padding: 0 8px; gap: 5px; font-size: 14px; }
    .lang-btn { width: auto; min-width: 40px; padding: 0 8px; }
}
@media (max-width: 780px) {
    .stat-rank { display: none; }
}
@media (max-width: 380px) {
    .stats { gap: 5px; }
    .stat { padding: 0 6px; gap: 4px; }
}
