/* Layout: admin — chap yon panel + ish maydoni; o'quvchi — markazlashgan ustun, tepada to'q yashil salomlashuv bandi;
   imtihon — savol kartasi + o'ngda javob varaqasi (OMR), yuqorida progress chizig'i; kalkulyator — o'ngdan chiquvchi panel */
:root {
  /* "Biomatematika uslubi" asosida: paper fon, ink matn, brand (chuqur moviy-yashil), leaf faqat shakl */
  --bg: #F1ECE1;
  --surface: #FAF7F0;
  --surface-2: #F2EEE4;
  --ink: #0D2B2B;
  --muted: #55666A;
  --line: #D9D3C5;
  --accent: #0F7C67;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3F1E6;
  --leaf: #3FA66B;
  --amber: #F7A444;
  --dark: #13262B;
  --dark-2: #1F383E;
  --dark-ink: #FAF7F0;
  --ok: #24703F;
  --ok-soft: #E3F1E6;
  --bad: #B0362A;
  --bad-soft: #F8E3DD;
  --warn: #8A5A00;
  --warn-soft: #FBEBCF;
  --shadow: 0 0 0 1px var(--line);
  --f-display: "Montserrat", "Inter", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 14px;
  --r-sm: 12px;
  --q-size: 20px;
  --hero: #0C6152;
  --hero-2: #0A4A47;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1719; --surface: #132327; --surface-2: #1A2E33; --ink: #E8EFEC; --muted: #9DB1AF;
    --line: #2A4348; --accent: #5BBFA6; --accent-ink: #062320; --accent-soft: #163B37; --leaf: #4DB57A;
    --dark: #0A1416; --dark-2: #1A2E33; --dark-ink: #E8EFEC; --ok: #62C48E; --ok-soft: #153826; --bad: #F08070;
    --bad-soft: #3A1E19; --warn: #E8B45C; --warn-soft: #3A2D15; --hero: #0F3E3B; --hero-2: #0B302E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1719; --surface: #132327; --surface-2: #1A2E33; --ink: #E8EFEC; --muted: #9DB1AF;
  --line: #2A4348; --accent: #5BBFA6; --accent-ink: #062320; --accent-soft: #163B37; --leaf: #4DB57A;
  --dark: #0A1416; --dark-2: #1A2E33; --dark-ink: #E8EFEC; --ok: #62C48E; --ok-soft: #153826; --bad: #F08070;
  --bad-soft: #3A1E19; --warn: #E8B45C; --warn-soft: #3A2D15; --hero: #0F3E3B; --hero-2: #0B302E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16.5px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
h1, h2, h3 { margin: 0; text-wrap: balance; line-height: 1.2; }
h1 { font: 800 clamp(26px, 3.4vw, 36px)/1.15 var(--f-display); letter-spacing: -.015em; }
h2 { font: 700 21px/1.3 var(--f-display); letter-spacing: -.005em; }
h3 { font: 700 17px/1.35 var(--f-display); }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }

/* ---------- tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: var(--r-sm); font-size: 15.5px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background-color .12s, border-color .12s, transform .05s;
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.dark { background: var(--dark); border-color: var(--dark); color: var(--dark-ink); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14.5px; }
.btn.block { width: 100%; }
.icon-btn { width: 42px; min-height: 42px; padding: 0; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- forma ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 11px 14px; font-size: 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); outline: none;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- kartochka ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.raised { box-shadow: var(--shadow); border-color: transparent; }
.panel-dark { background: var(--dark); color: var(--dark-ink); border-radius: var(--r); padding: 22px; }
.panel-dark .muted { color: color-mix(in srgb, var(--dark-ink) 72%, transparent); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* ---------- jadval ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--f-mono); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- toast / modal ---------- */
#toasts { position: fixed; z-index: 120; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--dark); color: var(--dark-ink); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: rise .18s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(10, 22, 25, .55); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.modal { background: var(--surface); border-radius: 18px; width: min(720px, 100%); padding: 24px; border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; margin-block: auto; animation: rise .16s ease-out; }
.modal.narrow { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- demo banner ---------- */
.demo-bar { background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.demo-bar .btn { min-height: 28px; font-size: 12.5px; transition: none; }

/* ---------- auth ---------- */
.auth { max-width: 460px; margin: 0 auto; padding-block: 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 14px; }
.auth-hero { background: var(--hero); color: var(--dark-ink); border-radius: 22px; padding: 26px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.auth-hero .eyebrow { color: color-mix(in srgb, var(--accent) 50%, var(--dark-ink)); }
.auth-hero h1 { max-width: 15ch; }
.sheet-art { position: absolute; right: -10px; bottom: -14px; display: grid; grid-template-columns: repeat(5, 18px); gap: 7px; opacity: .22; pointer-events: none; }
.sheet-art span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--dark-ink); }
.sheet-art span.f { background: var(--dark-ink); }
.waiting { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: sp .8s linear infinite; flex: none; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- o'quvchi qismi ---------- */
.shell { max-width: 1040px; margin: 0 auto; padding-block: 18px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; }
.topbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.brand { display: flex; align-items: center; gap: 10px; font: 800 17px/1.1 var(--f-display); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 40px; height: 40px; display: block; flex: none; }
.brand-mark svg, .auth-logo svg { width: 100%; height: 100%; display: block; }

.hello { background: var(--hero); color: #FAF7F0; border-radius: 18px; padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; position: relative; overflow: hidden; }
.hello .eyebrow, .auth-hero .eyebrow { color: #BFE3CF !important; }
.hello p { color: #DCEAE3; max-width: 56ch; }
.hello-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.hstat { background: var(--hero-2); border-radius: 14px; padding: 10px 14px; min-width: 110px; }
.hstat .k { font-size: 13px; color: #C9DDD4; }
.hstat .v { font: 700 22px/1.2 var(--f-mono); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .hello { grid-template-columns: 1fr; } }

.test-card { display: flex; flex-direction: column; gap: 14px; }
.test-top { display: flex; gap: 14px; align-items: flex-start; }
.subj-mark { width: 46px; height: 46px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; font: 700 18px var(--f-display); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); }
.facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.vtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vtile { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 14px 16px; min-height: 64px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s, background-color .12s, transform .08s; }
.vtile:hover { border-color: var(--accent); }
.vtile:active { transform: translateY(1px); }
.vtile:disabled { opacity: .5; cursor: not-allowed; }
.vtile .vn { font: 700 17px var(--f-display); }
.vtile .vs { font-size: 13.5px !important; }
.vtile .vs { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.vtile.done { background: var(--ok-soft); border-color: transparent; }
.vtile.done .vs { color: var(--ok); }
.vtile.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vtile.active .vs { color: var(--accent-ink); opacity: .85; }
.rules { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.rules li { display: flex; gap: 10px; }
.rules li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex: none; background: var(--accent); }
.sk { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- imtihon ---------- */
.exam-wrap { max-width: 1240px; }
.exam { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .exam { grid-template-columns: 1fr; } }
.exam-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.exam-head-in { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px 10px 16px; }
.exam-head-in > .grow { flex: 1 1 240px; }
@media (max-width: 640px) {
  .exam-head-in { padding: 8px 10px 8px 12px; }
  .exam-head-in .calc-lbl { display: none; }
  .timer { font-size: 17px; padding: 3px 9px; }
}
.progress { height: 4px; background: var(--surface-2); }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.timer { font: 700 22px var(--f-mono); font-variant-numeric: tabular-nums; padding: 4px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.timer.low { background: var(--bad-soft); color: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.fontsz { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.fontsz button { border: 0; background: var(--surface); min-height: 40px; width: 44px; cursor: pointer; font-weight: 700; }
.fontsz button + button { border-left: 1px solid var(--line); }
.fontsz button:hover { background: var(--surface-2); }
.q-card { display: flex; flex-direction: column; gap: 18px; padding: clamp(18px, 3vw, 30px); }
.q-meta { display: flex; align-items: baseline; gap: 8px; }
.q-big { font: 700 34px/1 var(--f-mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.q-of { font-weight: 600; color: var(--muted); }
.q-text { font-size: var(--q-size); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 500; max-width: 72ch; }
.q-img { max-width: 100%; max-height: 440px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); align-self: flex-start; cursor: zoom-in; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 14px 18px; min-height: 60px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .1s, background-color .1s; width: 100%; font-size: calc(var(--q-size) - 1.5px); line-height: 1.5; -webkit-tap-highlight-color: transparent; }
.opt:hover { border-color: var(--accent); }
.opt .bubble { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; font: 700 14px var(--f-mono); flex: none; color: var(--muted); }
.opt .txt { padding-top: 5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .bubble { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.q-nav { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 900px) {
  .q-nav { position: sticky; bottom: 0; z-index: 15; margin: 0 calc(-1 * clamp(18px, 3vw, 30px)) calc(-1 * clamp(18px, 3vw, 30px)); padding: 12px clamp(18px, 3vw, 30px) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
}
/* javob varaqasi (OMR) */
.sheet-card { position: sticky; top: calc(96px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 116px); }
@media (max-width: 900px) { .sheet-card { position: static; max-height: none; } }
.omr { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.omr-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 8px; cursor: pointer; border: 0; background: none; width: 100%; }
.omr-row:hover { background: var(--surface-2); }
.omr-row.cur { background: var(--accent-soft); }
.omr-row .n { width: 28px; text-align: right; font: 600 13px var(--f-mono); color: var(--muted); }
.omr-row.miss .n { color: var(--bad); }
.omr-row .b { width: 23px; height: 23px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font: 600 10px var(--f-mono); color: var(--muted); }
.omr-row .b.f { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 900px) {
  .omr { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
  .omr-row { justify-content: center; padding: 8px 0; border: 1.5px solid var(--line); border-radius: 10px; }
  .omr-row .b { display: none; }
  .omr-row .n { width: auto; text-align: center; font-size: 13px; }
  .omr-row:not(.miss) { background: var(--accent-soft); border-color: transparent; }
  .omr-row:not(.miss) .n { color: var(--accent); }
  .omr-row.cur { border-color: var(--accent); }
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; background: var(--accent); }
.legend span.m::before { background: var(--bad); }
.save-state { font-size: 12.5px; color: var(--muted); }
.save-state.err { color: var(--bad); font-weight: 600; }

/* ---------- natija ---------- */
.score-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; }
@media (max-width: 560px) { .score-hero { grid-template-columns: 1fr; } }
.ring { width: 132px; height: 132px; }
.ring text { font-family: var(--f-mono); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.stat .v { font: 700 26px var(--f-mono); font-variant-numeric: tabular-nums; }
.stat.ok .v { color: var(--ok); } .stat.bad .v { color: var(--bad); }
.review { display: flex; flex-direction: column; gap: 12px; }
.rv { border: 1px solid var(--line); border-left: 4px solid var(--bad); border-radius: 12px; padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.rv.ok { border-left-color: var(--ok); }
.rv .q-text { font-size: calc(var(--q-size) - 2px); }
.ans-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 16px; }
.ans-line .lbl { font-weight: 700; min-width: 132px; }
.ans-line.bad .val { color: var(--bad); font-weight: 600; }
.ans-line.ok .val { color: var(--ok); font-weight: 600; }
.explain { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 16px; }

/* ---------- kalkulyator ---------- */
.calc-drawer { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .2s ease; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); }
.calc-drawer.open { transform: none; }
@media (max-width: 640px) {
  .calc-drawer { top: auto; left: 0; width: 100%; height: min(78vh, 640px); border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; transform: translateY(105%); padding-left: env(safe-area-inset-left, 0px); }
  .calc-drawer.open { transform: none; }
}
.calc-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 18px; font-family: var(--f-display); font-size: 17px; }
.calc-tabs { display: flex; gap: 4px; padding: 0 12px 10px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.calc-tabs button { border: 0; background: none; padding: 7px 11px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.calc-tabs button.on { background: var(--accent-soft); color: var(--accent); }
.calc-body { overflow-y: auto; padding: 14px 18px 24px; flex: 1; }
.calc-display { font: 600 22px var(--f-mono); text-align: right; min-height: 54px; }
.calc-result { text-align: right; font: 700 20px var(--f-mono); color: var(--accent); min-height: 28px; overflow-wrap: anywhere; }
.calc-result.err { color: var(--bad); font: 600 13px var(--f-body); }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.calc-key { min-height: 54px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font: 600 18px var(--f-body); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.calc-key:hover { border-color: var(--accent); }
.calc-key:active { transform: translateY(1px); }
.calc-key.op { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.calc-key.fn { color: var(--bad); }
.calc-key.eq { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.calc-hist { display: flex; flex-direction: column; gap: 4px; }
.calc-hist-item { text-align: right; border: 0; background: none; font: 500 13px var(--f-mono); color: var(--muted); cursor: pointer; padding: 2px 0; overflow-wrap: anywhere; }
.calc-out { min-height: 8px; }
.calc-out.err { color: var(--bad); font-weight: 600; font-size: 14px; }
.calc-res { font-size: 14px; border: 1px solid var(--line); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.calc-res th { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); width: 55%; }
.calc-res td { font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-res th, .calc-res td { padding: 8px 12px; }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 4px 8px 18px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 46px; border-radius: 10px; font-size: 15.5px; color: var(--ink); text-decoration: none; font-weight: 600; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.on { background: var(--accent); color: var(--accent-ink); }
.nav-item .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.side .bottom { margin-top: auto; }
.main { padding-block: 22px 48px; padding-left: max(16px, min(32px, 3vw)); padding-right: max(16px, env(safe-area-inset-right, 0px), min(32px, 3vw)); display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .side { display: none; }
  .mobile-nav { display: flex; gap: 6px; overflow-x: auto; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
  .mobile-nav .nav-item { flex: none; padding: 8px 12px; font-size: 14px; }
  .main { padding-left: max(16px, env(safe-area-inset-left, 0px)); }
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .k { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font: 700 26px var(--f-mono); font-variant-numeric: tabular-nums; }
.tests-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.toolbar .field { min-width: 200px; flex: 1; }
.qlist { display: flex; flex-direction: column; gap: 10px; }
.qrow { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; content-visibility: auto; contain-intrinsic-size: auto 110px; }
@media (max-width: 560px) { .qrow { grid-template-columns: minmax(0, 1fr) auto; } .qrow .thumb { display: none; } }
.thumb { width: 72px; height: 72px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); object-fit: cover; display: grid; place-items: center; color: var(--muted); }
.qrow .qt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mini-opts { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.mini-opts span { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font: 600 11px var(--f-mono); color: var(--muted); }
.mini-opts span.c { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 14px; min-height: 38px; border-radius: 7px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.ans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.ans-cell { border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; background: var(--surface); }
.ans-cell .n { font: 600 11px var(--f-mono); color: var(--muted); }
.ans-cell .l { font: 700 16px var(--f-mono); color: var(--accent); }
.var-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.var-chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; min-width: 44px; height: 42px; font-weight: 700; cursor: pointer; font-family: var(--f-mono); }
.var-chip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.dropzone { border: 2px dashed var(--line); border-radius: var(--r); padding: 20px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.img-preview { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.loading { display: flex; justify-content: center; padding: 40px; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
.calc-drawer.calc-small { width: min(360px, 100vw); }
@media (max-width: 640px) { .calc-drawer.calc-small { width: 100%; height: auto; max-height: 80vh; } }

/* ---------- ma'lumotnoma ---------- */
.ref-drawer { width: min(980px, 100vw); }
@media (max-width: 640px) { .ref-drawer { height: 88vh; } }
.pt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.pt-grid { display: grid; grid-template-columns: repeat(18, minmax(44px, 1fr)); grid-template-rows: repeat(7, auto) 10px auto auto; gap: 3px; min-width: 820px; }
.pt-cell { border: 1px solid var(--line); border-radius: 6px; padding: 3px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 0; cursor: pointer; background: var(--surface); line-height: 1.1; color: var(--ink); }
.pt-cell .z { font: 600 9.5px var(--f-mono); color: var(--muted); align-self: flex-start; padding-left: 2px; }
.pt-cell .s { font: 700 15px var(--f-body); }
.pt-cell .m { font: 500 9.5px var(--f-mono); color: var(--muted); }
.pt-cell.b-s { background: var(--bad-soft); }
.pt-cell.b-p { background: var(--warn-soft); }
.pt-cell.b-d { background: var(--accent-soft); }
.pt-cell.b-f { background: var(--surface-2); }
.pt-cell:hover, .pt-cell.on { outline: 2px solid var(--accent); outline-offset: -1px; }
.pt-cell.dim { opacity: .25; }
.pt-ph { cursor: default; font: 600 10px var(--f-mono); color: var(--muted); justify-content: center; }
.pt-info { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); min-height: 72px; }
.pt-big { width: 58px; height: 58px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; position: relative; flex: none; }
.pt-sym { font: 700 24px var(--f-display); }
.pt-z { position: absolute; top: 3px; left: 6px; font: 600 10px var(--f-mono); }
.act-row { display: flex; gap: 4px; min-width: max-content; }
.act-cell { padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.act-cell.h { background: var(--dark); color: var(--dark-ink); }
.gc-table { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 520px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gc-table th, .gc-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-transform: none; letter-spacing: 0; }
.gc-table thead th { text-align: center; font: 700 14px var(--f-mono); color: var(--accent); }
.gc-table .gc-b, .gc-table .gc-b3 { text-align: center; font: 700 15px var(--f-mono); color: var(--accent); background: var(--surface-2); width: 36px; }
.gc-table tr.grp td, .gc-table tr.grp th { border-top: 2px solid var(--line); }
.gc-table td { white-space: nowrap; }
.gc-table td.stop { color: var(--bad); font-weight: 700; }
.gc-table td.start { color: var(--ok); font-weight: 700; }
.gc-table td.hit { background: var(--accent); color: var(--accent-ink); }
.aa-table { min-width: 460px; }

/* ---------- fanlar, profil, rivojlanish ---------- */
.var-chip.wide { padding: 0 14px; font-family: var(--f-body); }
.var-chip.off { background: var(--surface-2); color: var(--muted); text-decoration: line-through; border-style: dashed; }
.subject-block { gap: 14px; }
.subject-head { display: flex; align-items: center; gap: 12px; padding-top: 6px; }
.type-head { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 2px 2px 0; }
.profile-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.profile-link:hover { border-color: var(--accent); }
.stat-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 760px) { .stat-row-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chart-wrap { width: 100%; overflow-x: auto; }
svg.chart { width: 100%; min-width: 420px; height: auto; display: block; font-family: var(--f-body); }
svg.spark { width: 80px; height: 24px; flex: none; }
.up { color: var(--ok); font-weight: 700; } .down { color: var(--bad); font-weight: 700; }
.topics { display: flex; flex-direction: column; gap: 10px; }
.topic { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 52px; gap: 12px; align-items: center; }
@media (max-width: 560px) { .topic { grid-template-columns: minmax(0, 1fr) 52px; } .topic .bar { grid-column: 1 / -1; grid-row: 2; } }
.topic-name { display: flex; flex-direction: column; min-width: 0; }
.topic-name > span:first-child { font-weight: 600; overflow-wrap: anywhere; }
.topic-pct { text-align: right; font-family: var(--f-mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; }
.bar > i.ok { background: var(--ok); } .bar > i.warn { background: var(--warn); } .bar > i.bad { background: var(--bad); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .bubble { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .bubble { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt:disabled { cursor: default; opacity: 1; }
.access-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.cat-row { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .hide-sm { display: none; } }

.linkish { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.linkish:hover { color: var(--accent); text-decoration: underline; }

/* ---------- ixcham profil: yig'iladigan bo'limlar ---------- */
.profile-head { display: flex; flex-direction: column; gap: 2px; padding: 2px 2px 0; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-stat { display: flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.mini-stat .v { font: 700 16px var(--f-mono); font-variant-numeric: tabular-nums; }
.mini-stat .k { font-size: 13.5px; color: var(--muted); }
.mini-stat.ok .v { color: var(--ok); } .mini-stat.bad .v { color: var(--bad); }
.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.fold-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 15px 18px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink); min-height: 52px; font: inherit; }
.fold-head:hover { background: var(--surface-2); }
.fold-title { font: 700 16.5px var(--f-display); white-space: nowrap; }
.fold-sum { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 14.5px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.fold-sum > span { overflow: hidden; text-overflow: ellipsis; }
.fold-sum b { color: var(--ink); }
.fold-chev { display: grid; place-items: center; color: var(--muted); transition: transform .18s ease; flex: none; }
.fold.open .fold-chev { transform: rotate(90deg); }
.fold.open .fold-head { border-bottom: 1px solid var(--line); }
.fold-body { padding: 14px 16px 16px; }
.fold-body .card.mistake { box-shadow: none; }
@media (max-width: 560px) { .fold-sum .spark { display: none; } .fold-head { padding: 12px 14px; gap: 10px; } .fold-title { font-size: 15px; } }
.fold + .fold, .stack > .fold:last-child { margin-top: 0; }
.mistake { padding: 14px 16px; gap: 10px; }
.mistake .opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mistake .opt { padding: 9px 12px; font-size: 15px; }
.mistake .opt .bubble { width: 28px; height: 28px; font-size: 12px; }
@media (max-width: 640px) { .mistake .opts { grid-template-columns: 1fr; } }

/* ---------- imtihon: bloklar va "keyinroq qaytaman" ---------- */
.sec-pill { background: var(--surface-2); color: var(--ink); }
.flag-btn.on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.omr-sec { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); padding: 10px 6px 4px; border-top: 1px solid var(--line); }
.omr-sec:first-child { border-top: 0; padding-top: 2px; }
.omr-row.flag { background: var(--warn-soft); }
.omr-row.flag .n { color: var(--warn); font-weight: 800; }

.flag-info { align-items: center; }

/* ---------- natija: toifa taxmini, bloklar ---------- */
.level { border-radius: 14px; padding: 14px 16px; display: grid; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.level.ok { background: var(--ok-soft); border-color: transparent; }
.level.warn { background: var(--warn-soft); border-color: transparent; }
.level.bad { background: var(--bad-soft); border-color: transparent; }
.lv-k { font-size: 13px; color: var(--muted); }
.lv-v { font: 800 26px/1.15 var(--f-display); color: var(--ink); }
.level.ok .lv-v { color: var(--ok); } .level.warn .lv-v { color: var(--warn); } .level.bad .lv-v { color: var(--bad); }
.lv-next { font-size: 14.5px; }
.secs { display: grid; gap: 8px; }
.sec-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(60px, 1fr) auto; gap: 12px; align-items: center; }
.sec-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .sec-row { grid-template-columns: 1fr auto; } .sec-row .bar { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- yechim ---------- */
.solution { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; padding: 10px 14px; }
.sol-title { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 16px; line-height: 1.55; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.report-btn { color: var(--muted); }
.report-btn:hover { color: var(--bad); border-color: var(--bad); }

/* ---------- bosh sahifa: reja ---------- */
.plan { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; border-left: 4px solid var(--accent); }
.plan-main { font-size: 14.5px; }
.plan-big { font: 600 22px/1.2 var(--f-display); }
.plan-big b { color: var(--accent); }
@media (max-width: 720px) { .plan { grid-template-columns: 1fr; } }
.new-pill { margin-left: 8px; vertical-align: middle; font-family: var(--f-body, inherit); }

/* ---------- admin ---------- */
.qrow.sus { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
.mini-opts.wide { display: grid; gap: 4px; font-size: 14px; }
.mini-opts.wide > div { padding: 4px 8px; border-radius: 8px; }
.mini-opts.wide > .c { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.omr-sec { grid-column: 1 / -1; }
.legend span.fl::before { background: var(--warn); }
@media (max-width: 900px) { .omr-row.flag { border-color: var(--warn); background: var(--warn-soft); }  }


/* ================= 2-dizayn: o'qituvchilar uchun ================= */
/* motiv: plus-to'r va bitta katta doira (hujayra) — faqat qahramon panellarda */
.hello, .auth-hero { isolation: isolate; }
.hello::before, .auth-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M12 9v6M9 12h6' stroke='%23FAF7F0' stroke-opacity='.22' stroke-width='1.2'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000 85%); mask-image: linear-gradient(90deg, transparent 35%, #000 85%);
}
.hello::after, .auth-hero::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; width: 260px; height: 260px; border-radius: 50%;
  right: -80px; top: -110px; border: 28px solid var(--leaf); opacity: .35;
}
.auth-hero .sheet-art { display: none; }
.hello h1, .auth-hero h1 { color: #FFFFFF; }
.panel-dark { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.toast { box-shadow: none; }
.card.raised { box-shadow: none; border-color: var(--line); }

/* o'quvchi: yuqori panel va telefon uchun pastki menyu */
.topbar { padding: 10px 12px 10px 16px; gap: 8px; }
.topnav { display: flex; gap: 4px; align-items: center; }
.topnav a, .topnav button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 0; background: none; color: var(--ink); font-weight: 600; font-size: 15.5px; text-decoration: none; cursor: pointer; }
.topnav a:hover, .topnav button:hover { background: var(--surface-2); }
.topnav a.on { background: var(--accent-soft); color: var(--accent); }
.who { font-size: 14.5px; color: var(--muted); font-weight: 600; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar { display: none; }
@media (max-width: 720px) {
  .topnav, .who { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border: 0; background: none; border-radius: 10px; color: var(--muted); font: 600 12.5px var(--f-body); text-decoration: none; cursor: pointer; }
  .tabbar a.on { color: var(--accent); background: var(--accent-soft); }
  .tabbar svg.i { width: 22px; height: 22px; }
  .shell:has(> .tabbar) { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  #toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* bosh sahifa: "davom ettirish" va qoidalar */
.resume { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 2px solid var(--accent); background: var(--accent-soft); }
.resume .grow b { font: 700 18px var(--f-display); display: block; }
.hello { padding-bottom: 24px; }
.hello h1 { font-size: clamp(24px, 3vw, 32px); }

/* imtihon: telefonda "varaq" tugmasi */
.sheet-jump { display: none; }
@media (max-width: 900px) { .sheet-jump { display: inline-flex; } }
.exam-head-in .timer { margin-inline: 4px; }
.q-card .row .pill.sec-pill { font-size: 13px; }

/* raqamlar — doim mono */
.facts b, .plan-big b, .counter-num { font-family: var(--f-mono); font-weight: 700; }
.badge { font-family: var(--f-mono); }

/* telefonda imtihon sarlavhasi: 1-qator nom + taymer, 2-qator asboblar + yakunlash */
@media (max-width: 640px) {
  .exam-head-in > .grow { order: 0; flex: 1 1 200px; }
  .exam-head-in > .timer { order: 1; }
  .exam-head-in > :not(.grow):not(.timer) { order: 2; }
  .exam-head-in > .btn.dark { margin-left: auto; }
}
.hstat .v, .kpi .v, .stat .v, .q-big, .mini-stat .v { letter-spacing: -.03em; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.q-top { flex-wrap: nowrap; }
.q-top .sec-pill { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .fontsz button { width: 40px; }
  .exam-head-in { gap: 8px; }
  .exam-head-in > .btn.dark { padding: 0 14px; }
}
@media (max-width: 420px) { .exam-head-in > .btn.dark svg { display: none; } }
.q-meta { flex: none; white-space: nowrap; }

/* mavzular — fan bo'yicha guruhlar */
.topic-group { display: flex; flex-direction: column; gap: 10px; }
.topic-group + .topic-group { border-top: 1px solid var(--line); padding-top: 14px; }
.topic-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topic-group-head h3 { margin-right: auto; }
.subj-mark.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }

/* natija kartasi */
.card-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.card-cta-ic { width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.card-cta .grow b { font: 700 17px var(--f-display); }
.card-prev { display: flex; justify-content: center; background: var(--surface-2); border-radius: 12px; padding: 14px; }
.card-prev canvas { width: 100%; max-width: 420px; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.card-prev.story canvas { max-width: 270px; }
.diploma-prev canvas { max-width: 760px; }
.diploma-cta .card-cta-ic { background: var(--amber); color: var(--ink); }
/* namuna va tekshirish */
.sample-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); border: 2px solid var(--accent); }
.sample-link:hover { background: var(--accent-soft); }
.sample-link svg.i { color: var(--accent); }
.verify-ok { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 700; }

/* ---------- admin: Bugun, test sahifasi, yorliqlar ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; min-height: 46px; border: 0; background: none; border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--muted); font: 600 15.5px var(--f-body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a.on, .tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab-n { font: 700 12.5px var(--f-mono); padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tabs .on .tab-n { background: var(--accent-soft); color: var(--accent); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; align-self: flex-start; }
.back-link:hover { color: var(--accent); }
.page-head.sub h2 { font-size: 19px; }
.title-link { color: inherit; text-decoration: none; }
.title-link:hover { color: var(--accent); text-decoration: underline; }
.todo { display: flex; flex-direction: column; gap: 8px; }
.todo-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.todo-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); display: grid; place-items: center; flex: none; }
.kpi.link { text-decoration: none; color: inherit; }
.kpi.link:hover { border-color: var(--accent); }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 24px; }
.fact-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fact-row b { text-align: right; }
.save-bar { position: sticky; bottom: 12px; z-index: 5; }
.forgot, .contact-foot { text-align: center; }
.contact-foot { margin: 0; }
.install-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; } .install-card[hidden] { display: none; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.creator { text-align: center; font-size: 13.5px; color: var(--muted); margin: 4px 0 0; }
.creator b { color: var(--ink); font-weight: 600; }
.side-creator { text-align: left; padding: 10px 14px 0; font-size: 12.5px; line-height: 1.5; }
.side { overflow-y: auto; }

/* ---------- Profil (soddalashtirilgan) ---------- */
.pf-status { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.pf-k { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); }
.pf-big { font-family: Montserrat, sans-serif; font-size: 56px; font-weight: 800; line-height: 1.05; letter-spacing: -.01em; margin: 4px 0 6px; }
.pf-big.ok { color: var(--leaf); } .pf-big.warn { color: #C9821A; } .pf-big.bad { color: #C2453A; }
.pf-trend { margin-top: 8px; font-weight: 700; font-size: 15px; } .pf-trend span { font-weight: 400; color: var(--muted); }
.pf-trend.ok { color: var(--leaf); } .pf-trend.bad { color: #C2453A; }
.pf-level { border-radius: 14px; padding: 16px 18px; min-width: 230px; max-width: 300px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.pf-level.ok { border-color: color-mix(in srgb, var(--leaf) 55%, var(--line)); } .pf-level.warn { border-color: color-mix(in srgb, #F2A93B 60%, var(--line)); } .pf-level.bad { border-color: color-mix(in srgb, #C2453A 45%, var(--line)); }
.pf-lv { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 21px; }
.pf-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; } .pf-title h3 { margin: 0; }
.pf-mk { display: flex; align-items: center; gap: 16px; }
.pf-mk-n { font-family: Montserrat, sans-serif; font-size: 40px; font-weight: 800; color: var(--accent); min-width: 56px; text-align: center; }
.pf-list { display: flex; flex-direction: column; }
.pf-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.pf-row:first-child { border-top: 0; } .pf-row:hover .pf-row-t { color: var(--accent); }
.pf-row > .stack { flex: 1; } .pf-row-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-chev { color: var(--muted); display: inline-flex; }
.pf-more { margin-top: 14px; }
@media (max-width: 640px) {
  .pf-status { grid-template-columns: 1fr; } .pf-level { max-width: none; min-width: 0; }
  .pf-big { font-size: 46px; } .pf-mk { flex-wrap: wrap; } .pf-mk .btn { width: 100%; }
}

/* ---------- FK Academy: logotip va ruxsat manzillari ---------- */
.auth-hero { flex-direction: row; align-items: center; gap: 18px; }
.auth-hero-text { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.auth-tag { margin: 0; color: #CFE8DD; font-size: 15px; }
.auth-logo { width: 132px; height: 132px; flex: none; border-radius: 50%; background: #fff; padding: 5px; box-shadow: 0 0 0 4px rgba(255,255,255,.18); }
.auth-hero::after { display: none; }
.reg-access { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.reg-access-list { display: flex; flex-direction: column; gap: 6px; }
.reg-access-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; align-items: baseline; font-size: 15.5px; }
.reg-access-row span { font-weight: 600; }
.reg-access-row a { font-weight: 700; color: var(--accent); overflow-wrap: anywhere; padding: 6px 0; }
@media (max-width: 640px) { .auth-logo { width: 84px; height: 84px; padding: 3px; } .auth-hero { gap: 12px; } }

/* ---------- sinov natijalari bo'yicha tuzatishlar (v12) ---------- */
#toasts { pointer-events: none; }
.show-sm { display: none; }
@media (max-width: 640px) { .show-sm { display: inline; } }
@media (hover: none) and (pointer: coarse) { .kbd-hint { display: none; } }
.pill.wrap { white-space: normal; line-height: 1.4; padding-block: 6px; border-radius: 12px; }
/* kirish qahramon paneli: sarlavha logotip ostiga kirmasin */
.auth-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.auth-hero h1 { font-size: clamp(24px, 4.2vw, 34px); line-height: 1.12; max-width: none; overflow-wrap: break-word; }
.auth-logo { width: 116px; height: 116px; }
@media (max-width: 640px) { .auth-hero h1 { font-size: clamp(22px, 6.6vw, 28px); } .auth-logo { width: 76px; height: 76px; } }
.sample-link { order: 0; }
/* bosh sahifa: uzun tavsif 2 qator */
.desc-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.desc-clamp.open { display: block; -webkit-line-clamp: unset; }
/* imtihon: telefonda hech narsa ekrandan chiqmasin */
.exam > *, .q-card, .q-card > * { min-width: 0; }
.q-top { flex-wrap: wrap; row-gap: 8px; }
.q-fig { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.q-img { max-height: 300px; }
.zoom-box { overflow: auto; max-height: 70vh; border-radius: 12px; border: 1px solid var(--line); background: #fff; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.zoom-img { display: block; width: 100%; max-width: none; cursor: zoom-in; }
.head-break { display: none; }
.tool-btn { gap: 6px; }
.ref-drawer { width: min(640px, 100vw); }
@media (max-width: 640px) {
  .exam-head-in { gap: 6px 8px; padding: 8px 10px; }
  .exam-title .eyebrow { display: none; }
  .exam-title-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .exam-wrap .exam-head-in > .exam-title { order: 0; flex: 1 1 0; min-width: 0; }
  .exam-wrap .exam-head-in > .timer { order: 1; margin: 0; }
  .exam-wrap .exam-head-in > .btn.dark { order: 2; margin-left: 0; }
  .exam-wrap .exam-head-in > .head-break { display: block; order: 3; flex-basis: 100%; height: 0; }
  .exam-wrap .exam-head-in > .fontsz, .exam-wrap .exam-head-in > .tool-btn { order: 4; }
  .exam-wrap .exam-head-in > .fontsz button { width: 38px; }
  .exam-wrap .exam-head-in > .btn.dark { padding: 0 12px; }
  .exam-wrap .exam-head-in > .timer { font-size: 18px; padding: 4px 8px; }
  .exam-wrap .exam-head-in > .tool-btn { padding: 0 8px; min-width: 0; flex: 1 1 0; justify-content: center; min-height: 40px; font-size: 14px; }
  .q-card { gap: 14px; }
  .q-nav { flex-wrap: nowrap; gap: 8px; padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .q-nav .btn { min-height: 46px; padding: 0 14px; }
  .q-nav .btn.primary, .q-nav .btn.dark { flex: 1 1 auto; justify-content: center; }
  .q-img { max-height: none; width: 100%; }
}
/* natija */
.review-head { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 640px) {
  .card-cta > .btn, .resume > .btn { width: 100%; justify-content: center; }
  .card-cta .grow, .resume .grow { flex: 1 1 200px; min-width: 0; }
  .card-prev.story canvas { max-height: 52vh; width: auto; }
}
.card-prev.story canvas { max-height: 56vh; width: auto; }
/* admin */
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); color: var(--ink); gap: 12px; flex-wrap: wrap; }
.notice.warn .i { color: var(--warn); }
.qrow .mini-opts.wide { font-size: 13.5px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
@media (max-width: 900px) {
  .mobile-nav { flex-wrap: wrap; overflow: visible; position: static; }
  .mobile-nav .nav-item { padding: 9px 12px; min-height: 42px; }
  .cat-row { flex-wrap: wrap; }
  .cat-row > .grow { flex: 1 1 100%; }
}
@media (max-width: 720px) {
  .table-wrap.cards-sm { border: 0; background: none; overflow: visible; }
  .table-wrap.cards-sm table, .table-wrap.cards-sm tbody, .table-wrap.cards-sm tr, .table-wrap.cards-sm td { display: block; width: 100%; }
  .table-wrap.cards-sm thead { display: none; }
  .table-wrap.cards-sm tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
  .table-wrap.cards-sm td { border: 0; padding: 4px 0; display: flex; gap: 10px; justify-content: space-between; align-items: center; text-align: right; }
  .table-wrap.cards-sm td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 13.5px; font-weight: 600; text-align: left; }
  .table-wrap.cards-sm td.act-cell { padding-top: 10px; }
  .table-wrap.cards-sm .act-row { width: 100%; flex-wrap: nowrap; }
  .table-wrap.cards-sm .act-row .btn { flex: 1; justify-content: center; min-height: 44px; }
}
/* mayda yozuvlar biroz kattaroq */
.omr-sec { font-size: 12px; }
@media (max-width: 720px) { .tabbar a, .tabbar button { font-size: 13.5px; } }

/* kalkulyator va ma'lumotnoma kompyuterda taymer va "Yakunlash"ni yopmasin */
@media (min-width: 641px) {
  .calc-drawer { top: calc(84px + env(safe-area-inset-top, 0px)); bottom: 16px; right: 16px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
}

/* foizlardagi vergul monospace shriftda "16, 7" bo'lib ko'rinmasin */
.hstat .v, .stat .v, .kpi .v { font-family: var(--f-display); font-weight: 800; letter-spacing: -.01em; }

/* sarlavhada so'z bo'linmasin: shrift matn ustunining kengligiga moslashadi ("Attestatsiyaga" bitta qatorga sig'adi) */
.auth-hero-text { container-type: inline-size; }
.auth-hero h1 { overflow-wrap: normal; word-break: normal; hyphens: manual; font-size: clamp(20px, 10.6cqi, 34px); }
