/* SAT imtihon sahifasi — Bluebook uslubidagi tuzilma, o'z ranglari va shriftlari bilan */
:root {
  --blue: #2f4bc4;
  --blue-dark: #2338a0;
  --navy: #1e2a78;
  --yellow: #ffd426;
  --ink: #1a1a1a;
  --muted: #666;
  --line: #474747;
  --soft: #f2f2f2;
  --review: #b3261e;
  --ui: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Noto Serif', 'Times New Roman', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--ui); color: var(--ink); background: #fff; font-size: 16px; }
button { font-family: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.hidden { display: none !important; }
.serif { font-family: var(--serif); }

/* ---------- Umumiy ---------- */
.screen { min-height: 100%; }
.screen-center { display: flex; flex-direction: column; align-items: center; padding: 48px 16px; background: #f7f7f7; }
.page-title { font-weight: 400; font-size: 34px; margin: 0 0 28px; text-align: center; }
.card { background: #fff; border-radius: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }

.btn-blue {
  background: var(--blue); color: #fff; border: none; border-radius: 999px;
  padding: 11px 28px; font-weight: 700; font-size: 16px;
}
.btn-blue:hover { background: var(--blue-dark); }
.btn-blue:disabled { opacity: .45; cursor: default; }
.btn-yellow {
  background: var(--yellow); color: var(--ink); border: 1px solid #c9a400; border-radius: 999px;
  padding: 11px 32px; font-weight: 700; font-size: 16px;
}
.btn-yellow:disabled { background: #eee; border-color: #ccc; color: #999; cursor: default; }
.btn-outline {
  background: #fff; color: var(--ink); border: 1px solid #888; border-radius: 999px;
  padding: 11px 28px; font-weight: 500; font-size: 16px; text-decoration: none; display: inline-block;
}
.btn-outline-blue {
  background: #fff; color: var(--blue); border: 2px solid var(--blue); border-radius: 999px;
  padding: 8px 22px; font-weight: 700;
}

/* ---------- Kirish ekrani ---------- */
.intro-card { max-width: 560px; width: 100%; padding: 28px 32px; }
.intro-item { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.intro-item b { font-size: 18px; }
.intro-item span { color: #333; line-height: 1.45; }
.intro-note { color: var(--muted); font-size: 14px; border-top: 1px solid #e5e5e5; padding-top: 14px; }
.intro-credits { font-weight: 500; margin: 10px 0; }
.intro-admin { margin: 10px 0; display: flex; gap: 8px; align-items: center; }
.intro-admin select { padding: 6px 8px; border-radius: 6px; border: 1px solid #aaa; }
.check-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; font-weight: 500; }
.check-row input { width: 20px; height: 20px; accent-color: var(--blue); }
.intro-error { margin-top: 12px; color: var(--review); font-weight: 500; }
.intro-actions { display: flex; gap: 14px; margin-top: 24px; }
.msg-card { max-width: 560px; width: 100%; padding: 28px 32px; line-height: 1.55; text-align: center; }

/* ---------- Imtihon tuzilmasi ---------- */
.exam { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.ex-header {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 10px 28px 8px; background: #fff;
}
.hd-title { font-size: 20px; font-weight: 500; }
.hd-link { background: none; border: none; padding: 6px 0 0; font-size: 15px; color: var(--ink); }
.hd-link .chev { font-size: 14px; }
.hd-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.timer { font-size: 22px; font-weight: 700; min-height: 28px; letter-spacing: .5px; }
.timer.warn { color: var(--review); }
.pill-sm { background: #fff; border: 1px solid #555; border-radius: 999px; padding: 1px 12px; font-size: 13px; font-weight: 500; }
.hd-right { display: flex; justify-content: flex-end; gap: 18px; }
.tool {
  background: none; border: none; display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 13px; color: var(--ink); padding: 2px 4px; border-bottom: 2px solid transparent;
}
.tool.active { border-bottom-color: var(--ink); }
.ico-x2 { font-family: var(--serif); font-weight: 700; font-size: 18px; line-height: 22px; font-style: italic; }

.dash-line {
  height: 2px; flex: none;
  background-image: linear-gradient(to right, var(--line) 62%, transparent 0);
  background-size: 14px 2px; background-repeat: repeat-x;
}

.ex-main { flex: 1; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.banner {
  background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .3px;
  text-align: center; padding: 7px 12px; margin: 0 24px; border-radius: 0 0 12px 12px; flex: none;
}

/* ---------- Savol maydoni ---------- */
.q-area { flex: 1; display: flex; overflow: hidden; }
.q-col { flex: 1; overflow-y: auto; padding: 26px 24px 40px; }
.q-col > * { max-width: 720px; margin-left: auto; margin-right: auto; }

.q-area.spr .spr-dir { display: block; }
.spr-dir { width: 50%; overflow-y: auto; padding: 26px 32px 40px; font-family: var(--serif); line-height: 1.55; }
.spr-dir h2 { font-family: var(--serif); font-size: 21px; margin: 0 0 14px; }
.spr-dir ul { padding-left: 22px; }
.spr-dir li { margin-bottom: 6px; }
.splitter {
  width: 6px; background: #555; position: relative; cursor: col-resize; flex: none; border-radius: 3px; margin: 14px 0;
}
.splitter span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #222; color: #fff; font-size: 12px; padding: 4px 2px; border-radius: 4px; line-height: 1;
}
.q-area.spr .q-col > * { max-width: 600px; }

.ex-table { border-collapse: collapse; margin-top: 18px; width: 100%; font-size: 15px; }
.ex-table caption { padding-bottom: 6px; }
.ex-table th, .ex-table td { border: 1px solid #333; padding: 8px; text-align: center; vertical-align: middle; font-weight: 400; }
.ex-table code { display: block; font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #eee; margin: 3px auto; padding: 1px 4px; width: fit-content; border-radius: 3px; }

.q-head {
  display: flex; align-items: center; gap: 12px; background: var(--soft);
  padding: 4px 6px 4px 0; border-bottom: 2px dashed var(--line);
}
.q-num { background: #000; color: #fff; font-weight: 700; min-width: 30px; height: 30px; display: grid; place-items: center; font-size: 16px; }
.mark-btn { background: none; border: none; display: flex; align-items: center; gap: 4px; font-size: 15px; color: var(--ink); padding: 4px 2px; }
.mark-btn.on { font-weight: 700; }
.mark-btn.on svg path { fill: var(--review); stroke: var(--review); }
.abc-btn {
  margin-left: auto; background: #fff; border: 1.5px solid var(--blue); color: var(--blue);
  border-radius: 4px; font-size: 11px; font-weight: 700; padding: 4px 5px; line-height: 1;
}
.abc-btn.on { background: var(--blue); color: #fff; }

.q-text { font-size: 18px; line-height: 1.6; margin-top: 18px; white-space: pre-line; }
.q-img { margin-top: 12px; text-align: center; }
.q-img img { max-width: 100%; max-height: 380px; border: 1px solid #ddd; border-radius: 4px; }

/* Variantlar */
.options { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.opt { display: flex; align-items: center; gap: 14px; }
.opt-btn {
  flex: 1; display: flex; align-items: center; gap: 16px; text-align: left;
  background: #fff; border: 1px solid #9a9a9a; border-radius: 10px; padding: 12px 18px;
  font-family: var(--serif); font-size: 18px; color: var(--ink); min-height: 52px;
}
.opt-btn:hover { border-color: #555; }
.opt-letter {
  flex: none; width: 28px; height: 28px; border: 1.6px solid var(--ink); border-radius: 50%;
  display: grid; place-items: center; font-family: var(--ui); font-weight: 700; font-size: 14px;
}
.opt-content img { max-height: 120px; display: block; margin-top: 6px; }
.opt.selected .opt-btn { border: 3px solid var(--blue); padding: 10px 16px; }
.opt.selected .opt-letter { background: var(--blue); border-color: var(--blue); color: #fff; }
.opt-btn { position: relative; }
.opt.crossed .opt-btn { border-color: #b5b5b5; }
.opt.crossed .opt-letter,
.opt.crossed .opt-content { opacity: .45; }
/* Butun variant ustidan chiziq — formula, rasm, matn uchun bir xil */
.opt.crossed .opt-btn::after {
  content: ''; position: absolute; left: -8px; right: -8px; top: 50%;
  height: 2px; background: var(--ink); transform: translateY(-50%); pointer-events: none;
}

.elim-btn {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--ink);
  background: #fff; font-weight: 700; font-size: 12px; position: relative; display: none;
}
.elim-btn::after { content: ''; position: absolute; left: -3px; right: -3px; top: 50%; height: 1.6px; background: var(--ink); }
.options.elim-on .elim-btn { display: block; }
.opt.crossed .elim-btn { border: none; width: auto; font-size: 14px; text-decoration: underline; font-weight: 700; }
.opt.crossed .elim-btn::after { content: none; }

/* SPR */
.spr-box { margin-top: 22px; }
.spr-input {
  width: 140px; font-size: 22px; padding: 8px 12px 4px; text-align: left;
  border: 1px solid #888; border-radius: 8px; border-bottom: 2px solid var(--ink);
}
.spr-preview { margin-top: 18px; font-size: 18px; font-family: var(--serif); }

/* ---------- Footer ---------- */
.ex-footer {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 12px 28px; background: #fff;
}
.ft-name { font-size: 18px; font-weight: 500; }
.nav-pill { background: #000; color: #fff; border: none; border-radius: 8px; padding: 8px 16px; font-weight: 700; font-size: 15px; }
.nav-pill .caret { font-size: 13px; margin-left: 4px; }
.ft-right { display: flex; justify-content: flex-end; gap: 12px; }

/* ---------- Navigator va review to'ri ---------- */
.nav-pop {
  position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%);
  width: min(620px, 94vw); background: #fff; border-radius: 12px; padding: 20px 24px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, .25); z-index: 30;
}
.nav-pop::after {
  content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  border: 10px solid transparent; border-bottom: none; border-top-color: #fff;
}
.grid-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #ccc; }
.x-btn { background: none; border: none; font-size: 26px; line-height: 1; }
.legend { display: flex; gap: 18px; font-size: 14px; padding: 12px 0; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.lg-current { width: 14px; height: 14px; background: var(--navy); display: inline-block; }
.lg-unans { width: 14px; height: 14px; border: 1.5px dashed #444; display: inline-block; }
.lg-review { width: 11px; height: 14px; background: var(--review); display: inline-block; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }

.q-grid { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 6px; }
.q-cell {
  position: relative; width: 36px; height: 36px; display: grid; place-items: center;
  font-weight: 700; font-size: 16px; color: var(--blue); background: #fff;
  border: 1.5px solid var(--blue);
}
.q-cell.unans { border: 1.5px dashed #444; color: var(--blue); }
.q-cell.current { background: var(--navy); color: #fff; border-color: var(--navy); }
.q-cell.marked::after {
  content: ''; position: absolute; top: -6px; right: -5px; width: 10px; height: 13px;
  background: var(--review); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}
.q-grid.big .q-cell { width: 44px; height: 44px; font-size: 20px; }
.nav-pop-foot { display: flex; justify-content: center; padding-top: 18px; }

/* ---------- Check Your Work ---------- */
.review { flex: 1; overflow-y: auto; padding: 30px 16px; text-align: center; }
.review p { margin: 6px 0; }
.grid-card { max-width: 720px; margin: 28px auto 0; padding: 22px 28px; text-align: left; }

/* ---------- Tasdiqlash oynasi ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 12px; padding: 24px 28px; width: min(460px, 92vw); }
.modal-card h3 { margin: 0 0 10px; font-size: 20px; }
.modal-card p { margin: 0 0 20px; line-height: 1.5; color: #333; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* ---------- Kichik ekranlar ---------- */
@media (max-width: 900px) {
  .ex-header, .ex-footer { padding-left: 14px; padding-right: 14px; }
  .hd-title { font-size: 16px; }
  .tool span:last-child { display: none; }
  .banner { margin: 0 10px; font-size: 10px; }
  .q-area.spr { flex-direction: column; overflow-y: auto; }
  .q-area.spr .spr-dir { width: 100%; max-height: 40%; }
  .q-area.spr .splitter { display: none !important; }
  .ft-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Yakun ---------- */
.score-big { font-size: 64px; font-weight: 700; color: var(--navy); line-height: 1; }
.score-sub { color: var(--muted); margin: 6px 0 20px; }
.dom-table { margin: 0 auto; border-collapse: collapse; text-align: left; }
.dom-table td { padding: 6px 14px; border-bottom: 1px solid #e5e5e5; }
.dom-table td:last-child { text-align: right; font-weight: 700; }


/* ================= 2-bosqich: asboblar ================= */
.ex-body { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.ex-center { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Panellar sarlavhasi */
.panel-bar { display: flex; align-items: center; gap: 8px; background: #000; color: #fff; padding: 6px 10px; flex: none; }
.panel-bar .spacer { flex: 1; }
.icon-btn { background: none; border: none; color: #fff; font-size: 20px; line-height: 1; padding: 2px 6px; }
.panel-msg { padding: 20px; color: var(--muted); }

/* Calculator */
.calc-panel {
  width: 38%; min-width: 340px; max-width: 760px; display: flex; flex-direction: column;
  border-right: 2px solid #555; background: #fff; margin-top: 10px;
}
.calc-panel.wide { width: 60%; max-width: none; }
.calc-tabs { display: flex; gap: 4px; }
.ctab { background: #2b2b2b; color: #fff; border: 1px solid #555; border-radius: 6px; padding: 4px 10px; font-size: 13px; font-weight: 500; }
.ctab.active { background: #fff; color: #000; }
.drag-dots { flex: 1; text-align: center; letter-spacing: 2px; opacity: .6; }
.calc-body { flex: 1; min-height: 0; }

/* Reference */
.ref-panel { width: 380px; display: flex; flex-direction: column; border-left: 2px solid #555; background: #fff; margin-top: 10px; }
.ref-panel.wide { width: 60%; }
.ref-panel .panel-bar b { font-size: 16px; }
.ref-body { flex: 1; overflow-y: auto; padding: 18px; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
.ref-item { text-align: center; font-size: 15px; }
.ref-item svg { width: 100%; max-width: 130px; height: auto; fill: none; stroke: #111; stroke-width: 1.3; }
.ref-item svg text { fill: #111; stroke: none; font-family: var(--serif); font-style: italic; font-size: 12px; }
.ref-item svg text.sm { font-size: 9px; font-style: normal; }
.ref-item svg .dash { stroke-dasharray: 3 3; }
.ref-item svg .dot { fill: #111; }
.ref-cap { font-weight: 700; font-size: 13px; margin: 4px 0; }
.ref-note { margin-top: 22px; line-height: 1.6; font-size: 15px; }

/* Directions */
.hd-link.open .chev { display: inline-block; transform: rotate(180deg); }
.dir-pop {
  position: fixed; top: 72px; left: 20px; width: min(820px, 94vw); max-height: calc(100vh - 170px);
  background: #fff; border-radius: 10px; box-shadow: 0 8px 34px rgba(0, 0, 0, .3); z-index: 40;
  display: flex; flex-direction: column;
}
.dir-pop::before {
  content: ''; position: absolute; top: -10px; left: 60px;
  border: 10px solid transparent; border-top: none; border-bottom-color: #fff;
}
.dir-body { overflow-y: auto; padding: 22px 28px; line-height: 1.6; font-size: 16px; }
.dir-body ul { padding-left: 22px; }
.dir-body h3 { font-size: 18px; margin: 18px 0 8px; }
.dir-foot { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid #e5e5e5; }

/* More */
.more-menu {
  position: fixed; top: 64px; right: 18px; background: #fff; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); z-index: 40; padding: 8px 0; min-width: 230px;
}
.more-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 12px 20px; font-size: 16px; }
.more-menu button:hover { background: var(--soft); }

/* 5 daqiqa ogohlantirishi */
.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  background: #000; color: #fff; padding: 10px 18px; border-radius: 8px; font-weight: 500; z-index: 45;
}

/* Ma'lumot oynasi */
.modal-card.wide { width: min(620px, 94vw); }
.info-body { line-height: 1.55; margin-bottom: 18px; max-height: 60vh; overflow-y: auto; }
.info-body ul { padding-left: 20px; margin: 0; }
.info-body li { margin-bottom: 6px; }
.info-body table { border-collapse: collapse; width: 100%; }
.info-body td { padding: 7px 8px; border-bottom: 1px solid #eee; }
.info-body kbd { background: #eee; border: 1px solid #ccc; border-radius: 4px; padding: 1px 6px; font-size: 13px; }

/* Rasm zoom'i */
.zoom-wrap { display: inline-block; max-width: 100%; border: 1px solid #ccc; border-radius: 6px; }
.zoom-bar { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 4px 10px; border-bottom: 1px solid #ddd; font-size: 13px; }
.zoom-bar button { background: none; border: none; font-size: 15px; padding: 2px 4px; }
.zoom-view { overflow: auto; max-height: 440px; max-width: 100%; padding: 6px; }
.q-img .zoom-view img { border: none; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .8); display: grid; place-items: center; z-index: 60; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; background: #fff; }

@media (max-width: 900px) {
  .calc-panel, .ref-panel { position: absolute; inset: 10px 0 0 0; width: 100%; max-width: none; z-index: 20; }
}

/* Imtihon joyi yo'riqnomasi (8-ish) */
.guide-steps { text-align: left; margin: 12px auto; padding-left: 22px; max-width: 460px; }
.guide-steps li { margin: 6px 0; }
.guide-box { margin-top: 8px; padding: 10px 14px; border-left: 4px solid var(--yellow, #ffd426); background: var(--soft, #f5f6fa); border-radius: 6px; }
.guide-box p { margin: 6px 0; }
.guide-note { color: var(--muted, #666); font-size: .92em; }
