/* =========================================================================
   Ommaviy test (quiz) — yorqin, tushunarli, sodda (ADR-145, #214)
   -------------------------------------------------------------------------
   Foydalanuvchi: «juda ko'rkam, tushunarli, sodda va yorqin». Namuna — shisha
   (glass) kartochkalar, binafsha→pushti gradient, katta bosiladigan variantlar.

   Bu sahifa **dashboard emas**: o'zining ranglari (`--q-*`). Faqat shrift
   `tokens.css` dan. Holat ranglari (to'g'ri — yashil, xato — qizil) har doim
   bir xil, chunki ular **ma'no** beradi.
   ========================================================================= */

:root {
  --q-ink: #ffffff;
  --q-ink-soft: rgba(255, 255, 255, 0.82);
  --q-glass: rgba(255, 255, 255, 0.13);
  --q-glass-strong: rgba(255, 255, 255, 0.2);
  --q-line: rgba(255, 255, 255, 0.3);
  --q-navy: #17114a;
  --q-ok-1: #14a85a;
  --q-ok-2: #5eead4;
  --q-bad-1: #e11d48;
  --q-bad-2: #fb7185;
  --q-gold: #fcd34d;
  --q-radius: 22px;
}

* { box-sizing: border-box; }

.q-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans, "IBM Plex Sans", system-ui, sans-serif);
  color: var(--q-ink);
  background:
    linear-gradient(140deg, #0a1f55 0%, #3426b8 38%, #8a1fd0 68%, #f0449a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Yumshoq yorug'lik dog'lari — sahifaga chuqurlik beradi.
   ⚠️ `filter: blur()` EMAS, radial-gradient: katta blur telefonda har kadrda qayta chiziladi va
   arzon qurilmalarni sekinlashtiradi; gradient esa bir marta chiziladi va bir xil ko'rinadi. */
.q-blob { position: fixed; z-index: 0; border-radius: 50%; pointer-events: none; }
.q-blob--1 { width: 620px; height: 620px; top: -240px; left: -220px; background: radial-gradient(circle, rgba(6, 200, 255, 0.55), transparent 68%); }
.q-blob--2 { width: 640px; height: 640px; bottom: -260px; left: 4%; background: radial-gradient(circle, rgba(94, 234, 212, 0.3), transparent 68%); }
.q-blob--3 { width: 680px; height: 680px; bottom: -280px; right: -240px; background: radial-gradient(circle, rgba(255, 79, 163, 0.55), transparent 68%); }

.q-wrap {
  position: relative;
  z-index: 1;
  width: min(100%, 580px);
  margin: 0 auto;
  padding: 14px 14px calc(36px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-screen { display: flex; flex-direction: column; gap: 12px; }
.q-screen[hidden] { display: none; }

.q-card {
  background: var(--q-glass);
  border: 1px solid var(--q-line);
  border-radius: var(--q-radius);
  box-shadow: 0 10px 34px rgba(18, 8, 70, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 16px 18px;
}

/* ---- Tepa: brend ----------------------------------------------------- */
.q-brand { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 20px; }
.q-brand__logo {
  display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 14px; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #22d3ee, #6366f1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.q-brand__logo .icon { width: 24px; height: 24px; }
.q-brand__text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.q-brand__name { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.95rem; }
.q-brand__sub { font-size: 0.78rem; color: var(--q-ink-soft); }

.q-icon-btn {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--q-line); background: var(--q-glass); color: #fff; font-size: 1.2rem;
}
.q-icon-btn:focus-visible, .q-btn:focus-visible, .q-option:focus-visible, .q-input:focus-visible,
.q-level:focus-visible, .q-step input:focus-visible + span {
  outline: 3px solid #fff; outline-offset: 2px;
}
.q-sound-off { display: none; }
.q-icon-btn[aria-pressed="false"] .q-sound-on { display: none; }
.q-icon-btn[aria-pressed="false"] .q-sound-off { display: inline; }

/* ---- Sarlavha -------------------------------------------------------- */
.q-hero { text-align: center; padding: 22px 18px 20px; }
.q-chip {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--q-line); background: var(--q-glass-strong);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.q-title { margin: 14px 0 6px; font-size: clamp(1.9rem, 8vw, 2.7rem); line-height: 1.08; font-weight: 800; }
.q-title--sm { font-size: 1.7rem; margin: 6px 0 4px; }
.q-grad {
  background: linear-gradient(90deg, #fff 0%, #a5f3fc 55%, #67e8f9 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.q-lead { margin: 0; color: var(--q-ink-soft); font-size: 0.98rem; line-height: 1.5; }

/* ---- Boshlash: sonlar va qoidalar ------------------------------------ */
.q-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.q-stat { text-align: center; padding: 14px 6px; border-radius: 20px; }
.q-stat b { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.q-stat span { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--q-ink-soft); }

.q-rules { display: grid; gap: 12px; padding: 16px; }
.q-rules p { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; margin: 0; align-items: center; }
.q-rules b { font-size: 0.98rem; }
.q-rules small { grid-column: 2; color: var(--q-ink-soft); font-size: 0.82rem; }
.q-rule {
  grid-row: 1 / 3; display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 14px; font-size: 1.4rem; background: var(--q-glass-strong);
}

.q-form { display: flex; flex-direction: column; gap: 12px; }
.q-label { margin: 0; font-size: 0.86rem; font-weight: 700; }
.q-label small { font-weight: 400; color: var(--q-ink-soft); }
.q-input {
  width: 100%; padding: 14px 16px; font: inherit; font-size: 1.05rem; font-weight: 600; color: #fff;
  border-radius: 16px; border: 1px solid var(--q-line); background: rgba(255, 255, 255, 0.22);
}
.q-input::placeholder { color: rgba(255, 255, 255, 0.65); font-weight: 400; }

/* Ochiq lid formasi (L-4): tuzoq maydon ko'rinmaydi (odam to'ldirmaydi), xato matni, ko'p qatorli maydon. */
.q-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.q-error {
  margin: 0; padding: 12px 14px; border-radius: 14px; font-weight: 700;
  background: rgba(225, 29, 72, 0.35); border: 1px solid var(--q-bad-2);
}
.q-textarea { resize: vertical; font-weight: 400; }

.q-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.q-step { position: relative; flex: 1 1 auto; }
.q-step input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.q-step span {
  display: block; text-align: center; padding: 12px 14px; border-radius: 14px; min-width: 62px;
  font-weight: 700; border: 1px solid var(--q-line); background: var(--q-glass); cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.q-step input:checked + span {
  background: linear-gradient(135deg, #fff, #c7f9ff); color: var(--q-navy); border-color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); transform: translateY(-1px);
}

/* ---- Tugmalar -------------------------------------------------------- */
.q-btn {
  display: block; width: 100%; padding: 16px 18px; border-radius: 20px; border: 1px solid transparent;
  font: inherit; font-size: 1.05rem; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.q-btn--primary {
  color: var(--q-navy);
  background: linear-gradient(120deg, #ffffff 0%, #bff5ff 55%, #e1d4ff 100%);
  box-shadow: 0 10px 26px rgba(10, 5, 60, 0.35);
}
.q-btn--primary:hover:not(:disabled) { transform: translateY(-2px); }
.q-btn--primary:active:not(:disabled) { transform: translateY(0); }
.q-btn--primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.q-btn--ghost { color: #fff; background: var(--q-glass); border-color: var(--q-line); }

.q-foot { text-align: center; margin: 4px 0 0; font-size: 0.86rem; color: var(--q-ink-soft); }
.q-foot a { color: #fff; }

.q-empty { text-align: center; display: grid; gap: 10px; }
.q-empty__title { margin: 0; font-weight: 800; font-size: 1.1rem; }
.q-empty p { margin: 0; color: var(--q-ink-soft); }

/* ---- Test jarayoni ---------------------------------------------------- */
.q-status { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 18px; }
.q-status__right { display: inline-flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.q-streak { color: var(--q-gold); font-weight: 700; }
.q-score { font-weight: 700; }

.q-progress { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.q-progress > span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #fff); transition: width 0.35s ease;
}

.q-question { font-size: clamp(1.25rem, 5.4vw, 1.65rem); font-weight: 800; line-height: 1.3; padding: 22px 20px; overflow-wrap: anywhere; }
.q-question mark {
  background: none; color: #a5f3fc; padding: 0 4px; border-bottom: 3px solid #5eead4; border-radius: 2px;
}
/* Arab kabi o'ngdan-chapga matn (#218): `dir="auto"` birinchi kuchli belgidan yo'nalishni oladi, `plaintext`
   har qatorga alohida, `start` — yo'nalishga qarab o'ng yoki chap. Nemis va boshqa chapdan-o'ngga
   tillar o'zgarmaydi (ular `auto` da LTR bo'ladi). */
.q-bidi { display: block; unicode-bidi: plaintext; text-align: start; }
.q-question small { display: block; margin-bottom: 6px; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--q-ink-soft); font-weight: 600; }

.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-option {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px 16px; min-height: 62px; border-radius: 20px; font: inherit; font-size: 1.12rem; font-weight: 700; color: #fff;
  border: 1px solid var(--q-line); background: rgba(255, 255, 255, 0.17); cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.q-option:hover:not(:disabled) { transform: translateY(-2px); background: var(--q-glass-strong); }
.q-option__key {
  display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  font-size: 0.95rem; font-weight: 800; background: rgba(255, 255, 255, 0.28);
}
.q-option__text { flex: 1 1 auto; overflow-wrap: anywhere; }
.q-option:disabled { cursor: default; }

/* To'g'ri — yashil; xato — qizil; qolganlari xiralashadi. Rang yolg'iz emas: belgi ham bor. */
.q-option.is-correct {
  background: linear-gradient(120deg, var(--q-ok-1), var(--q-ok-2)); border-color: #bbf7d0; color: #05261a;
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.45), 0 12px 28px rgba(5, 40, 30, 0.35);
}
.q-option.is-correct .q-option__key { background: rgba(255, 255, 255, 0.7); color: #05261a; }
.q-option.is-correct .q-option__text::after { content: "  ✓"; font-weight: 900; }
.q-option.is-wrong {
  background: linear-gradient(120deg, var(--q-bad-1), var(--q-bad-2)); border-color: #fecdd3;
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.45); animation: q-shake 0.4s ease;
}
.q-option.is-wrong .q-option__text::after { content: "  ✗"; font-weight: 900; }
.q-option.is-dim { opacity: 0.5; }
.q-option.is-pop { animation: q-pop 0.4s ease; }

@keyframes q-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes q-pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }

.q-note { padding: 12px 16px; font-size: 0.95rem; line-height: 1.45; }
.q-note[hidden] { display: none; }
.q-note b { color: var(--q-gold); }
.q-hint { margin: 2px 0 0; text-align: center; font-size: 0.78rem; color: var(--q-ink-soft); }
.q-hint kbd { padding: 1px 6px; border-radius: 6px; border: 1px solid var(--q-line); background: var(--q-glass); font: inherit; }

/* ---- Natija ---------------------------------------------------------- */
.q-final { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 18px; }
.q-ring { position: relative; width: 168px; height: 168px; }
.q-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.q-ring circle { fill: none; stroke-width: 11; }
.q-ring__bg { stroke: rgba(255, 255, 255, 0.2); }
.q-ring__fg {
  stroke: url(#q-grad); stroke: #5eead4; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.q-ring.is-gold .q-ring__fg { stroke: var(--q-gold); }
.q-ring.is-low .q-ring__fg { stroke: #fda4af; }
.q-ring__text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.q-ring__text b { font-size: 2.3rem; font-weight: 800; line-height: 1; }
.q-ring__text span { font-size: 0.85rem; color: var(--q-ink-soft); }
.q-final__stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.q-pill { padding: 7px 14px; border-radius: 999px; font-size: 0.88rem; border: 1px solid var(--q-line); background: var(--q-glass-strong); }
.q-pill--ok { background: rgba(20, 168, 90, 0.35); }
.q-pill--bad { background: rgba(225, 29, 72, 0.35); }

.q-review summary { cursor: pointer; font-weight: 800; list-style: none; }
.q-review summary::-webkit-details-marker { display: none; }
.q-review summary::after { content: "  ▾"; }
.q-review[open] summary::after { content: "  ▴"; }
.q-review__item { padding: 12px 0; border-top: 1px solid var(--q-line); }
.q-review__item:first-child { border-top: 0; }
.q-review__q { margin: 0 0 6px; font-weight: 700; }
.q-review__a { margin: 2px 0; font-size: 0.92rem; }
.q-review__a.is-bad { color: #fecdd3; text-decoration: line-through; }
.q-review__a.is-ok { color: #bbf7d0; font-weight: 700; }
.q-review__e { margin: 4px 0 0; font-size: 0.86rem; color: var(--q-ink-soft); }

.q-offer { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.q-offer__title { margin: 0; font-size: 1.15rem; font-weight: 800; line-height: 1.3; }
.q-offer__text { margin: 0; color: var(--q-ink-soft); font-size: 0.95rem; }
.q-offer__links { display: grid; gap: 10px; }
@media (min-width: 560px) { .q-offer__links { grid-auto-flow: column; grid-auto-columns: 1fr; } }
.q-actions { display: grid; gap: 10px; }

/* Konfetti — butun ekran, bosishni to'smaydi. */
#q-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* ---- Fan va daraja tanlash (/test/) ----------------------------------- */
.q-subject { display: flex; flex-direction: column; gap: 12px; }
.q-subject__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.q-subject__name { margin: 0; font-size: 1.3rem; font-weight: 800; }
.q-subject__count { font-size: 0.82rem; color: var(--q-ink-soft); }
.q-soon { font-size: 0.78rem; padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--q-line); color: var(--q-ink-soft); }
.q-levels { display: flex; flex-wrap: wrap; gap: 8px; }
.q-level {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 11px 18px; border-radius: 14px;
  font-weight: 800; color: #fff; text-decoration: none; border: 1px solid var(--q-line); background: var(--q-glass-strong);
  transition: transform 0.12s ease, background 0.12s ease;
}
.q-level small { font-weight: 500; opacity: 0.8; font-size: 0.74rem; }
.q-level:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.3); }
.q-level--all { background: linear-gradient(120deg, #fff, #c7f9ff); color: var(--q-navy); border-color: #fff; }

@media (min-width: 640px) {
  .q-wrap { padding-top: 28px; }
  .q-actions { grid-template-columns: 2fr 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .q-option.is-wrong, .q-option.is-pop { animation: none; }
  .q-progress > span, .q-ring__fg { transition: none; }
  #q-fx { display: none; }
}
