/* ===== O'quvchi ilovasi (telefon birinchi) ===== */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: 0 20px; }
.app.has-nav { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.content { padding-bottom: 24px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.strong { font-weight: 700; }

.avatar {
  width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; background: var(--accent-soft); color: var(--accent-strong); }
.avatar.xl { width: 72px; height: 72px; border-radius: 22px; font-size: 26px; }

.top { display: flex; align-items: center; gap: 12px; padding: 18px 0 18px; }
.top-name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* pastki menyu */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 6px max(12px, calc(50% - 268px)) calc(10px + env(safe-area-inset-bottom, 0px));
}
.tabbtn {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; min-height: 56px;
  background: none; border: none; color: var(--ink-faint); font-size: 11.5px; font-weight: 600; cursor: pointer; border-radius: 12px;
}
.tabbtn.on { color: var(--accent-strong); font-weight: 700; }
.tab-ico { position: relative; display: inline-flex; }
.tab-dot {
  position: absolute; top: -6px; left: 15px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad-strong); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ===== Kirish ===== */
.login-wrap { max-width: 440px; margin: 0 auto; padding: 7vh 20px 40px; display: flex; flex-direction: column; gap: 22px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-mark {
  width: 48px; height: 48px; border-radius: 15px; background: var(--deep); color: var(--mint);
  font-family: var(--display); font-weight: 700; font-size: 22px; display: flex; align-items: center; justify-content: center;
}
.login-name { font-family: var(--display); font-weight: 600; font-size: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 22px; }
.code-input { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; min-height: 56px; }
.name-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.name-btn {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; min-height: 56px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); font-size: 16px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.name-btn:hover { border-color: var(--accent); }
.name-btn svg { color: var(--ink-faint); }

/* ===== Bosh sahifa ===== */
.hero { background: var(--deep); color: var(--deep-ink); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hero-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--mint); }
.hero-tag { font-size: 12px; font-weight: 600; background: rgb(255 255 255 / 0.12); padding: 5px 10px; border-radius: 999px; text-align: right; }
.hero-title { font-family: var(--display); font-size: 21px; font-weight: 600; line-height: 1.25; }
.hero-meta { font-size: 13.5px; color: var(--deep-soft); line-height: 1.5; }
.hero .btn { margin-top: 4px; }

.mistake-card {
  display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer; color: var(--ink);
  background: var(--bad-soft); border: 1px solid transparent; border-radius: 18px; padding: 14px 16px; font-size: 15px; line-height: 1.35;
}
.mistake-card:hover { border-color: var(--bad); }
.mistake-num {
  min-width: 48px; height: 48px; padding: 0 8px; border-radius: 14px; background: var(--bad-strong); color: #fff;
  font-family: var(--display); font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center;
}

.progress-head { display: flex; align-items: center; gap: 16px; }
.ring-text { font-family: var(--display); font-weight: 700; font-size: 16px; fill: var(--ink); }
.topic-list { display: flex; flex-direction: column; gap: 10px; }
.topic {
  display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px 16px; width: 100%;
}
.topic:hover { border-color: var(--accent); }
.topic.going { border: 1.5px solid var(--accent); }
.topic > svg { color: var(--ink-faint); flex-shrink: 0; }
.topic.going > svg { color: var(--accent-strong); }
.topic-badge {
  width: 48px; height: 48px; border-radius: 14px; background: var(--surface-2); color: var(--ink-faint); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.topic-badge.mid { background: var(--accent-soft); color: var(--accent-strong); }
.topic-badge.done { background: var(--accent); color: var(--accent-ink); }
.topic-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.topic-title { font-weight: 700; font-size: 15.5px; line-height: 1.3; }

.big-num { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1.1; }
.big-num .muted { font-family: var(--font); font-size: 16px; font-weight: 500; }

/* ===== Natijalar ===== */

.cert { border-radius: 18px; padding: 18px; background: var(--gold-soft); border: 1.5px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.cert-top { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.cert-big { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1.1; }
.cert-mid { font-size: 20px; font-weight: 700; }
.cert-grade { font-family: var(--display); font-size: 30px; font-weight: 700; color: var(--gold); line-height: 1.1; }
.cert-rows { display: flex; flex-direction: column; font-size: 14px; }
.cert-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed color-mix(in srgb, var(--gold) 35%, transparent); }
.cert-rows > div:last-child { border-bottom: none; }
.cert-rows .sep { margin-top: 6px; }

.list-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: none; }

/* ===== Test ishlash ===== */
.runner { display: flex; flex-direction: column; gap: 16px; padding-top: 14px; padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
.runner.with-sheet { padding-bottom: 300px; }
.run-top { display: flex; align-items: center; gap: 14px; }
.segs { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; }
.seg { height: 7px; border-radius: 4px; background: var(--surface-3); border: none; padding: 0; cursor: pointer; min-width: 0; }
.seg.ok { background: var(--accent); }
.seg.no { background: var(--bad-strong); }
.seg.half { background: var(--warn); }
.seg.cur { outline: 2px solid var(--ink); outline-offset: 1px; }
.run-score { text-align: center; }

.qcard { display: flex; flex-direction: column; gap: 14px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; min-height: 58px; padding: 12px 16px;
  border: 1.5px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 500; cursor: pointer; line-height: 1.4;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; }
.opt-l {
  width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.opt-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt.chosen { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 600; }
.opt.chosen .opt-l { background: var(--accent); color: var(--accent-ink); }
.opt.right { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 600; }
.opt.right .opt-l { background: var(--accent); color: var(--accent-ink); }
.opt.wrong { border: 2px solid var(--bad-strong); background: var(--bad-soft); font-weight: 600; }
.opt.wrong .opt-l { background: var(--bad-strong); color: #fff; }
.opt.dim { color: var(--ink-faint); }

.num-input { font-family: var(--display); font-size: 20px; font-weight: 600; min-height: 56px; max-width: 280px; }
.num-input.ok { border-color: var(--accent); background: var(--accent-soft); }
.num-input.no { border-color: var(--bad-strong); background: var(--bad-soft); }
.num-input:disabled { color: var(--ink); opacity: 1; }
.part { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.part-q { display: flex; gap: 8px; font-size: 16px; line-height: 1.45; }
.part-l { font-weight: 800; }
.part-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.part-row .num-input { flex: 1 1 160px; }
.part-row .btn { min-height: 56px; }
.verdict { font-weight: 700; font-size: 14px; }
.verdict.ok { color: var(--good); }
.verdict.no { color: var(--bad); }

/* pastdagi harakat paneli: asosiy tugma doim shu yerda */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 10px; align-items: center;
  padding: 12px max(20px, calc(50% - 260px)) calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 28%);
}
.done .actionbar, .stack-lg > .actionbar { position: static; padding: 4px 0 0; background: none; width: 100%; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  border-radius: 26px 26px 0 0; border-top: 2px solid; display: flex; flex-direction: column; gap: 14px;
  padding: 20px max(20px, calc(50% - 260px)) calc(20px + env(safe-area-inset-bottom, 0px));
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { transform: translateY(30px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet.ok { background: var(--accent-soft); border-color: var(--accent); }
.sheet.no { background: var(--bad-soft); border-color: var(--bad-strong); color: var(--bad-ink); }
.sheet-head { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; line-height: 1.5; }
.sheet-ico { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.sheet.ok .sheet-ico { background: var(--accent); }
.sheet.no .sheet-ico { background: var(--bad-strong); }
.sheet-title { font-family: var(--display); font-size: 17px; font-weight: 600; }
.sheet.ok .sheet-title { color: var(--accent-strong); }
.sheet.no .sheet-title { color: var(--bad); }
.sheet-note { font-family: var(--font); font-size: 13px; font-weight: 600; opacity: 0.85; }
.sheet-why { opacity: 0.9; }

/* aprobatsiya */
.exam-top {
  position: sticky; top: calc(8px + env(safe-area-inset-top, 0px)); z-index: 20;
  display: flex; align-items: center; gap: 12px; background: var(--deep); color: var(--deep-ink);
  border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow);
}
.exam-title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.exam-save { font-size: 12px; color: var(--mint); display: flex; align-items: center; gap: 4px; }
.exam-save.err { color: #FFB4AA; font-weight: 700; }
.timer { font-family: var(--display); font-size: 20px; font-weight: 600; padding: 6px 12px; border-radius: 10px; background: var(--deep-ink); color: var(--deep); }
.timer.low { background: var(--bad-strong); color: #fff; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.qn { height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 13px; cursor: pointer; color: var(--ink-soft); }
.qn.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.qn.half { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.qn.cur { outline: 2.5px solid var(--ink); outline-offset: 1px; }
.end-link { align-self: center; }

/* yakun */
.done { padding-top: 8vh; }
.done-mark { width: 76px; height: 76px; border-radius: 24px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.result { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-top: 16px; }
.result-pct { font-family: var(--display); font-size: 56px; font-weight: 700; line-height: 1; }
.result.pass .result-pct { color: var(--accent); }
.result.fail .result-pct { color: var(--warn); }
.review { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.review:first-child { border-top: none; }
.review .chip { white-space: normal; }
