/* ============ Dizayn tokenlari ============ */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e4e7ec;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --muted: #475467;
  --faint: #8a94a6;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff4ff;
  --accent-text: #1d4ed8;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --warn-border: #fec84b;
  --junior: #475467;
  --middle: #1d4ed8;
  --senior: #6941c6;
  --code-bg: #f6f8fa;
  --code-border: #e4e7ec;
  --code-text: #1f2328;
  --tok-kw: #cf222e;
  --tok-str: #0a3069;
  --tok-num: #0550ae;
  --tok-com: #6e7781;
  --tok-fn: #8250df;
  --radius: 8px;
  --radius-sm: 6px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d1117; --surface: #161b22; --surface-2: #1c2129; --surface-3: #262c36; --border: #2a313c; --border-strong: #3d4450;
    --text: #e6edf3; --muted: #9da7b3; --faint: #6e7681; --accent: #4c8dff; --accent-hover: #6ea2ff; --accent-soft: #15223b; --accent-text: #6ea2ff;
    --ok: #3fb950; --ok-soft: #12261b; --bad: #f85149; --bad-soft: #2d1517; --warn: #d29922; --warn-soft: #272115; --warn-border: #6b5217;
    --junior: #9da7b3; --middle: #6ea2ff; --senior: #b59cf0;
    --code-bg: #0d1117; --code-border: #2a313c; --code-text: #e6edf3;
    --tok-kw: #ff7b72; --tok-str: #a5d6ff; --tok-num: #79c0ff; --tok-com: #8b949e; --tok-fn: #d2a8ff;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0d1117; --surface: #161b22; --surface-2: #1c2129; --surface-3: #262c36; --border: #2a313c; --border-strong: #3d4450;
  --text: #e6edf3; --muted: #9da7b3; --faint: #6e7681; --accent: #4c8dff; --accent-hover: #6ea2ff; --accent-soft: #15223b; --accent-text: #6ea2ff;
  --ok: #3fb950; --ok-soft: #12261b; --bad: #f85149; --bad-soft: #2d1517; --warn: #d29922; --warn-soft: #272115; --warn-border: #6b5217;
  --junior: #9da7b3; --middle: #6ea2ff; --senior: #b59cf0;
  --code-bg: #0d1117; --code-border: #2a313c; --code-text: #e6edf3;
  --tok-kw: #ff7b72; --tok-str: #a5d6ff; --tok-num: #79c0ff; --tok-com: #8b949e; --tok-fn: #d2a8ff;
  color-scheme: dark;
}

/* ============ Asos ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
code, pre, kbd, .mono { font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.87rem; }
.tiny { font-size: 0.77rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 32px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ============ Header ============ */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 1.05rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; background: var(--text); color: var(--surface); font: 600 13px var(--mono); }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); }
.nav-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 0.72rem; font-weight: 600; display: inline-grid; place-items: center; background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-border); }
.nav-count.neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-box input { width: 170px; height: 34px; padding: 0 10px 0 32px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.88rem; }
.search-box input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.icon-btn { position: relative; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; background: var(--accent); color: #fff; font-size: 0.66rem; font-weight: 600; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 2px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text); font-weight: 500; font-size: 0.87rem; white-space: nowrap; }
.user-chip:hover { text-decoration: none; background: var(--surface-2); }
.user-chip .pts { color: var(--muted); }

/* ============ Tugmalar ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; font-size: 0.9rem; cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.btn-ok.on, .btn-ok:hover { background: var(--ok-soft); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 0.84rem; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 0.8rem; gap: 5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 0.95rem; }
.btn-block { width: 100%; }
.link-btn { border: none; background: none; padding: 0; color: var(--accent-text); cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ============ Kartalar va belgilar ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-flat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card.pad-lg { padding: 28px 32px; }
.card-link { display: block; color: inherit; transition: border-color 0.12s; }
.card-link:hover { text-decoration: none; border-color: var(--border-strong); }
.card-link:hover h3 { color: var(--accent-text); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 36px 0 12px; }
.section-title h2 { margin: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; }
.panel-body { padding: 4px 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 500; font-size: 0.85rem; cursor: pointer; }
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .count { font-size: 0.76rem; opacity: 0.75; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 4px; font-size: 0.75rem; font-weight: 500; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.tag-bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.tag-accent { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.lv { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; border: 1px solid currentColor; background: transparent; }
.lv-junior { color: var(--junior); }
.lv-middle { color: var(--middle); }
.lv-senior { color: var(--senior); }
.dot-status { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); display: inline-block; flex: none; }
.dot-status.ok { background: var(--ok); }

.lang-mark { --c: var(--muted); width: 36px; height: 36px; flex: none; border-radius: var(--radius-sm); display: grid; place-items: center; font: 600 0.72rem var(--mono); color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border)); }
.lang-mark.lg { width: 52px; height: 52px; font-size: 0.9rem; }

.avatar { --size: 28px; width: var(--size); height: var(--size); flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: calc(var(--size) * 0.42); text-transform: uppercase; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }
.user-link { font-weight: 500; color: var(--text); }

.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width 0.3s ease; }
.progress.ok > span { background: var(--ok); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.skeleton { border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.loading-page { padding: 40px 0; display: grid; gap: 14px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.sticky { position: sticky; top: 76px; }

/* ============ Formalar ============ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 500; font-size: 0.87rem; }
.hint { font-size: 0.8rem; color: var(--faint); }
.input, .select, .textarea { width: 100%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); font: inherit; padding: 8px 11px; }
.input, .select { height: 38px; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.textarea.code { font-family: var(--mono); font-size: 0.86rem; background: var(--surface-2); font-variant-ligatures: none; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.form-error { color: var(--bad); font-size: 0.87rem; min-height: 1.2em; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--border); flex-wrap: wrap; }
.seg button, .seg a { border: none; background: transparent; padding: 5px 12px; border-radius: 4px; font-weight: 500; font-size: 0.86rem; color: var(--muted); cursor: pointer; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg .active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.88rem; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ============ Bosh sahifa ============ */
.intro { padding: 40px 0 8px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: end; }
.intro h1 { font-size: 2rem; max-width: 640px; margin-bottom: 10px; }
.intro p { color: var(--muted); font-size: 1.02rem; max-width: 600px; }
.eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 10px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.kpis > div { padding: 14px 16px; }
.kpis > div:nth-child(odd) { border-right: 1px solid var(--border); }
.kpis > div:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
.kpis b { display: block; font-size: 1.35rem; font-weight: 600; }
.kpis span { font-size: 0.8rem; color: var(--muted); }

.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.87rem; align-items: baseline; }
.activity li:last-child { border: none; }
.activity .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lang-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: inherit; }
.lang-row:last-child { border-bottom: none; }
.lang-row:hover { background: var(--surface-2); text-decoration: none; }
.lang-row .meta { display: flex; gap: 16px; font-size: 0.82rem; color: var(--muted); }
.lang-row .meta b { color: var(--text); font-weight: 600; }

/* ============ Hamjamiyat savollari ============ */
.cq { display: flex; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: inherit; }
.cq:last-child { border-bottom: none; }
.cq:hover { background: var(--surface-2); text-decoration: none; }
.cq-stats { display: flex; gap: 8px; flex: none; }
.cq-stat { text-align: center; width: 58px; padding: 5px 0; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 0.72rem; color: var(--muted); line-height: 1.2; }
.cq-stat b { display: block; font-size: 0.98rem; color: var(--text); font-weight: 600; }
.cq-stat.zero { border-color: var(--warn-border); background: var(--warn-soft); color: var(--warn); }
.cq-stat.zero b { color: var(--warn); }
.cq-stat.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: var(--ok-soft); color: var(--ok); }
.cq-stat.done b { color: var(--ok); }
.cq-body { flex: 1; min-width: 0; }
.cq-text { font-weight: 500; margin-bottom: 6px; overflow-wrap: anywhere; }
.cq-text code { font-size: 0.85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.cq-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 0.8rem; color: var(--muted); }

.open-panel { border-color: var(--warn-border); }
.open-panel .panel-head { background: var(--warn-soft); border-bottom-color: var(--warn-border); border-radius: var(--radius) var(--radius) 0 0; }

/* ============ Maqola ============ */
.md { font-size: 0.98rem; line-height: 1.72; overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md h2 { font-size: 1.25rem; margin: 1.8em 0 0.6em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 1.05rem; margin: 1.5em 0 0.5em; }
.md h4 { margin: 1.2em 0 0.4em; }
.md p, .md ul, .md ol, .md table, .md blockquote, .md pre { margin: 0 0 1.1em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: 0.25em 0; }
.md code { font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
.md pre code { background: none; border: none; padding: 0; font-size: inherit; }
.md blockquote { margin-left: 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--muted); }
.md blockquote p:last-child { margin: 0; }
.md table { width: 100%; border-collapse: collapse; font-size: 0.9rem; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md.compact { font-size: 0.93rem; line-height: 1.62; }
.md.compact p:last-child, .md.compact ul:last-child, .md.compact pre:last-child { margin-bottom: 0; }

.code { position: relative; background: var(--code-bg); color: var(--code-text); border: 1px solid var(--code-border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; font: 0.85rem/1.62 var(--mono); tab-size: 4; font-variant-ligatures: none; }
.code .lang-tag { position: absolute; top: 6px; right: 10px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); font-family: var(--font); }
.tok-kw { color: var(--tok-kw); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-fn { color: var(--tok-fn); }

.toc a { display: block; padding: 4px 10px; border-left: 2px solid var(--border); color: var(--muted); font-size: 0.87rem; }
.toc a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.85rem; color: var(--faint); margin: 24px 0 12px; }
.breadcrumb a { color: var(--muted); }
.page-head { margin: 28px 0 20px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--muted); max-width: 680px; margin: 0; }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--muted); }

/* ============ Test ============ */
.quiz-wrap { max-width: 780px; margin: 0 auto; padding: 24px 0 60px; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; font-size: 0.87rem; color: var(--muted); }
.quiz-top .progress { flex: 1; }
.timer-text { font: 500 0.88rem var(--mono); min-width: 44px; text-align: right; color: var(--muted); }
.timer-text.warn { color: var(--bad); }
.q-card { padding: 24px 26px; }
.q-text { font-size: 1.08rem; font-weight: 500; line-height: 1.55; margin-bottom: 14px; }
.q-text code { font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
.options { display: grid; gap: 8px; margin-top: 16px; }
.option { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 0.94rem; transition: border-color 0.1s, background 0.1s; }
.option:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.option:disabled { cursor: default; }
.option .key { width: 24px; height: 24px; border-radius: 4px; flex: none; display: grid; place-items: center; font: 600 0.78rem var(--mono); border: 1px solid var(--border); color: var(--muted); background: var(--surface-2); }
.option .opt-text { flex: 1; font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; font-variant-ligatures: none; }
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.correct .key { background: var(--ok); border-color: var(--ok); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong .key { background: var(--bad); border-color: var(--bad); color: #fff; }
.option.dim { opacity: 0.6; }
.explain { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); border-left-width: 3px; background: var(--surface-2); }
.explain.ok { border-left-color: var(--ok); }
.explain.bad { border-left-color: var(--bad); }
.explain-title { font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.explain.ok .explain-title { color: var(--ok); }
.explain.bad .explain-title { color: var(--bad); }

.score-big { font-size: 3rem; font-weight: 600; line-height: 1; margin-bottom: 6px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: var(--radius); margin: 20px 0; }
.result-stats > div { padding: 12px 14px; }
.result-stats > div + div { border-left: 1px solid var(--border); }
.result-stats b { display: block; font-size: 1.2rem; font-weight: 600; }
.result-stats span { font-size: 0.8rem; color: var(--muted); }
.review-item { border: 1px solid var(--border); border-left: 3px solid var(--border-strong); padding: 12px 16px; background: var(--surface); border-radius: var(--radius-sm); }
.review-item.ok { border-left-color: var(--ok); }
.review-item.bad { border-left-color: var(--bad); }

.setup-grid { display: grid; gap: 22px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 500; text-align: left; font-size: 0.9rem; }
.pick:hover { border-color: var(--accent); }
.pick.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pick .lang-mark { width: 28px; height: 28px; font-size: 0.64rem; }
.mode-card { cursor: pointer; }
.mode-card:hover { border-color: var(--border-strong); }
.mode-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* ============ Intervyu ============ */
.flash { min-height: 300px; display: flex; flex-direction: column; }
.flash-q { font-size: 1.12rem; font-weight: 500; line-height: 1.55; }
.flash-answer { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.flash-actions { margin-top: auto; padding-top: 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
kbd { font-size: 0.72rem; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); }

/* ============ Izohlar ============ */
.comments { margin-top: 32px; }
.composer { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; }
.composer:focus-within { border-color: var(--accent); }
.composer.asking { border-color: var(--warn-border); }
.composer textarea { border: none; padding: 4px; min-height: 76px; background: transparent; box-shadow: none !important; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.comment { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.comment.is-q { border-left: 3px solid var(--warn); }
.comment.is-q.resolved { border-left-color: var(--ok); }
.comment.flash-hl { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow 1.5s; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; margin-bottom: 4px; }
.comment-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.vote { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); height: 26px; }
.vote button { border: none; background: transparent; cursor: pointer; width: 24px; height: 24px; color: var(--faint); display: grid; place-items: center; }
.vote button:hover { color: var(--text); }
.vote button.on { color: var(--accent-text); }
.vote b { min-width: 18px; text-align: center; font-size: 0.8rem; font-weight: 600; }
.replies { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; padding-left: 14px; border-left: 2px solid var(--border); }
.reply { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.reply.accepted { background: var(--ok-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 40%, transparent); }

/* ============ Profil va reyting ============ */
.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stat-grid > div { padding: 14px 16px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat-grid > div:nth-child(4n) { border-right: none; }
.stat-grid > div:nth-last-child(-n + 4) { border-bottom: none; }
.stat-grid b { display: block; font-size: 1.25rem; font-weight: 600; }
.stat-grid span { font-size: 0.8rem; color: var(--muted); }
.achievements { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.achievement { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.87rem; }
.achievement .mark { width: 18px; height: 18px; border-radius: 50%; flex: none; margin-top: 2px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; }
.achievement.earned .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.achievement:not(.earned) { color: var(--faint); }
.heatmap { display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column; grid-auto-columns: 11px; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heatmap i { border-radius: 2px; background: var(--surface-3); }
.heatmap i[data-l='1'] { background: color-mix(in srgb, var(--accent) 25%, var(--surface-3)); }
.heatmap i[data-l='2'] { background: color-mix(in srgb, var(--accent) 50%, var(--surface-3)); }
.heatmap i[data-l='3'] { background: color-mix(in srgb, var(--accent) 75%, var(--surface-3)); }
.heatmap i[data-l='4'] { background: var(--accent); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table th { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; background: var(--surface-2); }
.table tr.me td { background: var(--accent-soft); }
.table .r { text-align: right; }

/* ============ Diff va muharrir ============ */
.diff { font: 0.83rem/1.6 var(--mono); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: auto; background: var(--surface); }
.diff div { padding: 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .add { background: var(--ok-soft); color: var(--ok); }
.diff .del { background: var(--bad-soft); color: var(--bad); }
.diff .ctx { color: var(--muted); }
.diff .gap { color: var(--faint); background: var(--surface-2); text-align: center; font-style: italic; }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.editor .textarea { min-height: 520px; font-family: var(--mono); font-size: 0.85rem; font-variant-ligatures: none; }
.editor-preview { min-height: 520px; max-height: 70vh; overflow: auto; }
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }

/* ============ Toast, modal, dropdown ============ */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12); font-size: 0.88rem; }
.toast.question { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--bad); }
.toast.success { border-left-color: var(--ok); }
.toast .t-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .t-close { border: none; background: none; cursor: pointer; color: var(--faint); font-size: 1.1rem; line-height: 1; padding: 0; }
.modal-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(16, 24, 40, 0.5); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 400px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25); position: relative; }
.modal.wide { max-width: 620px; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-width: calc(100vw - 24px); max-height: 440px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16, 24, 40, 0.15); z-index: 60; }
.notif { display: block; padding: 10px 14px; color: var(--text); font-size: 0.87rem; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: none; }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { border-left: 2px solid var(--accent); }

footer.site { margin-top: 64px; padding: 24px 0 36px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; background: var(--surface); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* ============ Moslashuvchanlik ============ */
@media (max-width: 1180px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0 0; gap: 10px 20px; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
  .top-actions { margin-left: auto; }
}
@media (max-width: 1020px) {
  .layout-side, .intro { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor { grid-template-columns: 1fr; }
  .editor .textarea, .editor-preview { min-height: 320px; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .container { padding: 0 16px; }
  .search-box input { width: 140px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .intro h1 { font-size: 1.6rem; }
  .q-card { padding: 18px; }
  .card.pad-lg { padding: 20px; }
  .cq { flex-direction: column; gap: 8px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid > div:nth-child(4n) { border-right: 1px solid var(--border); }
  .stat-grid > div:nth-child(2n) { border-right: none; }
  .achievements { grid-template-columns: 1fr; }
  .lang-row .meta { display: none; }
  .user-chip .uname { display: none; }
  .table .hide-sm { display: none; }
}
