/* Savol ekrani: maket design/mobil/screens/Test-1..8 (tepa qator, jarayon chizig'i, tur yorlig'i, variantlar, klaviatura, tartiblash, moslashtirish, guruhlash).
   Ranglar style.css va shell.css o'zgaruvchilaridan. Test ichida to'g'ri/xato ko'rsatilmaydi: bolaga ball emas, tashxis kerak. */

#screen-quiz {
  /* ✓ va ✕ belgilari; rangi — fon rangi */
  --m-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E");
  --m-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  --gut: 16px;
  padding: calc(18px + env(safe-area-inset-top)) var(--gut) 0;
  gap: 0;
}
body[data-screen="quiz"] { padding-bottom: 0; }
body[data-screen="quiz"] .sky { background: linear-gradient(180deg, #F4F2FE 0%, #ECE9FC 60%, #E3DEFB 100%); }
body[data-screen="quiz"] .sky-clouds { opacity: .55; }

/* ---------- tepa qism: chiqish, hisoblagich, jarayon chizig'i ---------- */
.q-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.q-count { font-size: 17px; font-weight: 600; color: var(--muted); }
.q-count b { font-weight: 800; color: var(--ink); }
.q-prog { position: relative; height: 8px; border-radius: 999px; background: #DCD6FA; overflow: hidden; }
.q-prog > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, #8E6DFA, #6C3FE0); transition: width .5s ease; animation: m-fill .8s ease-out both; transform-origin: 0 50%; }
.q-chip { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; height: 30px; margin: 18px 0 0; padding: 0 12px; border-radius: 999px; background: #EDE7FD; color: #5B37D6; font-weight: 700; font-size: 14px; box-shadow: 0 6px 14px -10px rgba(60, 40, 150, .5); animation: m-fade-up .4s ease-out both; }
.q-chip .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.q-text { margin: 14px 0 18px; font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: 0; color: var(--ink); overflow-wrap: break-word; animation: m-fade-up .4s ease-out .05s both; }
.q-text.long { font-size: 19px; }
.q-text.xlong { font-size: 18px; line-height: 1.35; }
.q-text:focus { outline: none; }

/* ---------- savolning rasmi ---------- */
.q-visual { display: flex; justify-content: center; margin: -4px 0 16px; background: rgba(255, 255, 255, .82); border-radius: 22px; padding: 14px; box-shadow: var(--glass-sh); }
.vis { width: 100%; display: flex; justify-content: center; }
.vis svg { display: block; width: 100%; max-width: 320px; height: auto; }
.vis.pv { gap: 8px; flex-wrap: wrap; }
.pv-col { display: flex; flex-direction: column; min-width: 0; flex: 1 1 0; max-width: 96px; background: var(--soft); border-radius: 16px; overflow: hidden; text-align: center; }
.pv-h { background: var(--brand-soft); color: var(--ink-2); font-weight: 800; font-size: 15px; padding: 6px 2px; line-height: 1.1; min-height: 42px; display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere; }
.pv-d { font-weight: 800; font-size: 28px; padding: 8px 0; color: var(--ink); }
@media (max-width: 559px) {
  .vis.pv:has(.pv-col:nth-child(5)) .pv-col { flex: 0 0 calc((100% - 16px) / 3); max-width: none; }
  .vis.pv:has(.pv-col:nth-child(7)) .pv-col { flex-basis: calc((100% - 24px) / 4); }
}
@media (max-width: 340px) {
  .pv-h { font-size: 14px; padding-inline: 1px; }
  .q-visual:has(.vis.pv) { padding-inline: 10px; }
  .vis.pv { gap: 6px; }
  .vis.pv:has(.pv-col:nth-child(5)) .pv-col { flex-basis: calc((100% - 12px) / 3); }
  .vis.pv:has(.pv-col:nth-child(7)) .pv-col { flex-basis: calc((100% - 18px) / 4); }
}

/* ---------- javob variantlari (choice) ---------- */
.q-body { display: flex; flex-direction: column; gap: 12px; }
.options { display: flex; flex-direction: column; gap: 16px; }
.opt { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 8px 16px 8px 18px; text-align: left; border: 0; border-radius: 18px; background: rgba(255, 255, 255, .82); box-shadow: var(--glass-sh); font: 800 18px/1.25 var(--font); color: var(--ink); cursor: pointer; transition: background .15s, box-shadow .15s; animation: m-fade-up .4s ease-out both; }
.opt:nth-child(2) { animation-delay: .05s; } .opt:nth-child(3) { animation-delay: .1s; } .opt:nth-child(4) { animation-delay: .15s; } .opt:nth-child(5) { animation-delay: .2s; }
.opt .rad { position: relative; width: 24px; height: 24px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2.5px #B9B3E8; background: rgba(255, 255, 255, .6); }
.opt .t { flex: 1; min-width: 0; overflow-wrap: break-word; }
.opt.on { background: var(--select-bg); box-shadow: inset 0 0 0 2px var(--ring), 0 10px 24px -16px rgba(91, 55, 214, .5); }
.opt.on .rad { background: #6C3FE0; box-shadow: none; }
.opt.on .rad::after { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #fff; }
.opt.pop { animation: m-sel .3s ease-out; }
.opt.long { font-size: 17px; }
@media (hover: hover) { .opt:not(.on):hover { background: #fff; } }

/* ---------- pastki qator: Bilmayman (doira) va Keyingi ---------- */
.q-bottom { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 12px; margin: auto calc(-1 * var(--gut)) 0; padding: 14px var(--gut) calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(244, 242, 254, .96) 62%, rgba(244, 242, 254, 0)); }
.q-bottom .round-btn { box-shadow: 0 10px 22px -12px rgba(60, 40, 150, .55), inset 0 0 0 1px rgba(255, 255, 255, .95); }
.q-bottom .cta { flex: 1; }
.q-deco { position: absolute; right: calc(var(--gut) + 6px); bottom: calc(96px + env(safe-area-inset-bottom)); width: 28%; max-width: 130px; pointer-events: none; z-index: 1; animation: m-float 3.6s ease-in-out infinite alternate; }

/* ---------- javob yozish (input) ---------- */
.in-display { position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: 64px; margin-top: 8px; padding: 8px 56px 8px 24px; background: #fff; border-radius: 18px; box-shadow: inset 0 0 0 2.5px #8E6DFA, 0 14px 28px -18px rgba(91, 55, 214, .5); font-weight: 800; font-size: 30px; line-height: 1.1; color: var(--ink); overflow-wrap: anywhere; }
.in-val.empty { color: #B9B3E8; }
.in-val:not(.empty)::after { content: ""; display: inline-block; width: 2.5px; height: .9em; margin-left: 4px; background: #6C3FE0; vertical-align: -.1em; animation: m-blink 1s steps(2) infinite; }
@keyframes m-blink { 50% { opacity: 0; } }
.in-unit { font-size: 22px; color: var(--muted); font-weight: 700; }
.in-clear { position: absolute; right: 12px; top: 50%; width: 36px; height: 30px; margin-top: -15px; padding: 0; border: 0; border-radius: 9px; background: #8C8AB0; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.in-clear .ico { width: 20px; height: 20px; stroke: #fff; stroke-width: 2.4; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.kp-key { height: 56px; font: 600 24px var(--font); background: rgba(255, 255, 255, .85); border: 0; border-radius: 14px; box-shadow: var(--glass-sh); cursor: pointer; color: var(--ink); padding: 0; transition: transform .1s, background .15s; }
.kp-key:not(:disabled):active { transform: scale(.95); background: #fff; }
.kp-key:disabled { background: rgba(255, 255, 255, .5); color: var(--muted); cursor: default; box-shadow: none; }
.kp-del { background: #EEEBFB; color: var(--ink); }
.kp-gap { display: block; }
.kp-wide { grid-column: span 3; height: 48px; font: 800 17px var(--font); background: rgba(255, 255, 255, .6); box-shadow: none; border-radius: 999px; }
@media (max-height: 760px) {
  .in-display { min-height: 56px; font-size: 28px; }
  .kp-key { height: 48px; font-size: 22px; }
  .keypad { gap: 8px; margin-top: 8px; }
  .q-text { margin: 10px 0 12px; }
  .q-chip { margin-top: 12px; }
}
@media (max-height: 640px) {
  .kp-key { height: 42px; font-size: 20px; border-radius: 12px; }
  .keypad { gap: 6px; }
  .q-bottom { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .q-bottom .cta { height: 50px; }
}
/* kasr kiritish: butun | surat ustida, maxraj ostida */
.in-display.fin { min-height: 92px; justify-content: center; padding-right: 24px; }
.fin-row { display: inline-flex; align-items: center; gap: 12px; }
.fin-frac { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.fin-bar { display: block; width: 100%; min-width: 58px; height: 3px; border-radius: 2px; background: var(--ink); }
.fin-slot { min-width: 52px; height: 40px; padding: 0 8px; border: 0; border-radius: 10px; background: var(--brand-soft); font: 800 28px var(--font); color: var(--ink); cursor: pointer; }
.fin-slot.on { box-shadow: inset 0 0 0 2.5px #6C3FE0; background: #fff; }
.fin-toggle { margin: 8px auto 0; height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .7); color: var(--brand-deep); font: 800 15px var(--font); cursor: pointer; box-shadow: var(--glass-sh); }

/* ---------- tartiblash (order) ---------- */
.ord-wrap { display: flex; flex-direction: column; gap: 10px; }
.ord-end { font-weight: 800; font-size: 15px; color: var(--brand-deep); text-align: center; }
.ord-list { display: flex; flex-direction: column; gap: 14px; }
.ord-chip { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 12px 8px 20px; background: rgba(255, 255, 255, .8); border-radius: 18px; box-shadow: var(--glass-sh); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; transition: background .15s, box-shadow .15s, scale .15s; }
.ord-chip.dragging { position: relative; z-index: 5; cursor: grabbing; background: var(--select-bg); box-shadow: inset 0 0 0 2.5px #8E6DFA, 0 18px 32px -16px rgba(91, 55, 214, .6); scale: 1.02; }
.ord-no { display: none; }
.ord-t { flex: 1 1 auto; min-width: 0; font-weight: 800; font-size: 22px; line-height: 1.2; overflow-wrap: break-word; }
.ord-btns { display: flex; gap: 6px; margin-left: auto; }
.ord-b { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #EEEBFB; color: var(--brand-deep); display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; transition: transform .1s, background .15s; }
.ord-b:not(:disabled):active { transform: scale(.92); background: var(--brand-soft); }
.ord-b:disabled { opacity: .3; cursor: default; }
.ord-b .ico { width: 20px; height: 20px; stroke-width: 3; }
/* sudrash belgisi (6 nuqta): o'ng tomonda */
.grip { order: 3; width: 16px; height: 26px; flex: none; background: radial-gradient(circle, #8C8AB0 2.2px, transparent 2.8px) 0 0 / 8px 9px; }
.ord-btns { order: 2; }

/* ---------- birlashtirish (match) ---------- */
.m-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 56px; }
.m-col { display: flex; flex-direction: column; gap: 22px; }
.m-card { position: relative; min-height: 58px; padding: 10px 12px; font: 800 22px/1.2 var(--font); text-align: center; background: rgba(255, 255, 255, .85); border: 0; border-radius: 18px; box-shadow: var(--glass-sh); cursor: pointer; color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; display: flex; align-items: center; justify-content: center; transition: background .15s, box-shadow .15s, transform .12s; }
.m-card.right { touch-action: auto; }
/* ulash nuqtasi: chap kartochkaning o'ng chetida, o'ngnikining chap chetida */
.m-card::after { content: ""; position: absolute; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px #B9B3E8; z-index: 1; }
.m-card.left::after { right: -8px; }
.m-card.right::after { left: -8px; }
.m-card.linked { background: #fff; box-shadow: inset 0 0 0 2px var(--pc), var(--glass-sh); }
.m-card.linked::after { background: #fff; box-shadow: inset 0 0 0 4px var(--pc); }
.m-card.sel { background: var(--select-bg); box-shadow: inset 0 0 0 2.5px #8E6DFA, 0 14px 24px -14px rgba(91, 55, 214, .6); transform: translateY(-1px); }
.m-card.sel::after { box-shadow: inset 0 0 0 4px #6C3FE0; }
.m-card:disabled { cursor: default; color: var(--ink); }
.m-card .ct { display: block; min-width: 0; max-width: 100%; text-align: center; overflow-wrap: break-word; }
.m-card .frac { font-size: 1em; }
.m-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }

/* ---------- guruhlash (group) ---------- */
.grp-wrap { display: flex; flex-direction: column; gap: 14px; }
.grp-pool { display: flex; flex-wrap: wrap; gap: 10px; min-height: 76px; padding: 14px; background: rgba(255, 255, 255, .55); border-radius: 22px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .9); justify-content: center; align-items: center; }
.grp-pool.empty::after { content: "Hammasi joylaştirildi"; /* CSS matni DOM tuguni emas: public/alifbo.js uni o'tkazmaydi, shuning uchun yangi imloda yozilgan */ font-weight: 800; font-size: 16px; color: var(--muted); }
.grp-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.grp-box { min-width: 0; border-radius: 22px; background: rgba(255, 255, 255, .85); box-shadow: var(--glass-sh); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.grp-title { padding: 11px 12px; background: #EDE7FD; color: var(--ink); font-weight: 800; font-size: 16px; line-height: 1.2; text-align: center; }
.grp-box:nth-child(2) .grp-title { background: var(--warn-bg); }
.grp-box:nth-child(3) .grp-title { background: var(--sky); }
.grp-box:nth-child(4) .grp-title { background: var(--soft); }
.grp-title:focus-visible { outline-offset: -4px; }
.grp-zone { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; min-height: 96px; align-content: flex-start; }
.grp-chip { display: inline-block; max-width: 100%; min-width: 48px; min-height: 44px; padding: 9px 16px; overflow-wrap: anywhere; text-align: left; font: 800 19px/1.2 var(--font); background: #fff; border: 0; border-radius: 22px; box-shadow: var(--glass-sh); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; color: var(--ink); transition: background .15s, transform .12s; }
.grp-chip.sel { background: var(--select-bg); color: var(--ink); box-shadow: inset 0 0 0 2.5px #8E6DFA, 0 12px 20px -12px rgba(91, 55, 214, .6); transform: translateY(-2px); }
.grp-chip.lifted { opacity: .35; }
.grp-chip.ghost { position: fixed; z-index: 1000; pointer-events: none; margin: 0; background: var(--select-bg); color: var(--ink); box-shadow: var(--sh-2), 0 0 0 3px var(--brand); transform: rotate(-3deg) scale(1.06); }
.grp-chip:disabled { cursor: default; color: var(--ink); }

/* ---------- kichik ekranlar ---------- */
@media (max-width: 380px) {
  .q-text { font-size: 19px; }
  .opt { font-size: 17px; }
  .in-display { font-size: 28px; }
  .ord-t { font-size: 20px; }
  .m-grid { column-gap: 44px; }
  .m-card { font-size: 20px; }
}
@media (max-width: 340px) { .m-grid { column-gap: 36px; } .m-card { padding-inline: 8px; font-size: 18px; } }
@media (max-width: 440px) { .grip { display: block; } }

/* ---------- kasr: surat tepada, maxraj pastda, o'rtasida chiziq (matematik yozuvdagidek) ---------- */
.frac { position: relative; display: inline-flex; flex-direction: column; align-items: stretch; text-align: center; vertical-align: middle; margin: -.05em .12em; font-size: .95em; line-height: 1; white-space: nowrap; }
.frac .fn { padding: 0 .2em .08em; border-bottom: max(1.5px, .09em) solid currentColor; } /* ingichka, lekin har doim ko'rinadigan chiziq */
.frac .fd { padding: .06em .2em 0; }
.frac .ph { display: inline-block; width: .62em; height: .8em; border-radius: .18em; background: var(--brand-soft); box-shadow: inset 0 0 0 .07em var(--brand-tint); vertical-align: -.08em; }
.mixed { display: inline-flex; align-items: center; vertical-align: middle; white-space: nowrap; }
.mixed .mw { margin-right: .06em; }
.mixed .frac { margin: 0 0 0 .06em; }
.nobr { white-space: nowrap; }

/* ---------- savoldagi narsa rasmlari (pictures.js) ---------- */
.po { stroke: var(--pic-ink, var(--ink)); stroke-width: var(--pic-sw, 2); stroke-linejoin: round; stroke-linecap: round; }
.wi { width: 1.35em; height: 1.35em; vertical-align: -.34em; margin: 0 .1em 0 .2em; }
.vis.pics { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 24px; }
.pics .pg { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 100%; }
.pics .pic { width: 46px; height: 46px; flex: none; }
.vis .pie { width: 132px; height: 132px; }
.vis .pie .po { stroke: var(--vis-ink); stroke-width: 2px; vector-effect: non-scaling-stroke; }

/* ---------- geometriya shakllari (figures.js) ---------- */
.q-visual, .ifig { --vis-ink: var(--brand-deep); }
.vis:not(.fig):not(.pv):not(.pics) svg [stroke] { stroke: var(--vis-ink); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.vis:not(.fig):not(.pv):not(.pics) svg [stroke-width="3"] { stroke-width: 2.6px; }
.vis.fig svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.ifig { display: block; margin: 0 auto 6px; }
.ifig svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.fg-poly { fill: var(--fig-fill, var(--brand-soft)); stroke: var(--vis-ink); stroke-width: 2px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fg-poly.fg-y { fill: var(--peach); }
.fg-poly.fg-b { fill: var(--sky); }
.fg-poly.fg-p { fill: var(--brand-tint); }
.fg-poly.fg-g2 { fill: var(--brand-tint); }
.fg-seg { stroke: var(--vis-ink); stroke-width: 2px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.fg-seg.fg-dash { stroke-dasharray: 6 5; }
.fg-seg.fg-bold { stroke-width: 3px; }
.fg-hl { stroke: var(--fig-hl, var(--peach-deep)); stroke-width: 4px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.fg-mark { fill: none; stroke: var(--vis-ink); stroke-width: 1.8px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fg-dot { fill: var(--vis-ink); }
.fg-t { fill: var(--ink); font-family: var(--font); font-weight: 800; }
