:root {
  --blue: #2f6fed;
  --blue-dark: #2557c7;
  --border: #e6e9ef;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #faf7f6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }

.wrap { max-width: 640px; margin: 0 auto; padding: 32px 18px 80px; }
.wrap.wide { max-width: 780px; }

.top-logo { margin-bottom: 14px; }
.top-logo img { height: 30px; width: auto; display: block; border-radius: 7px; }

.brand { text-align: center; margin-bottom: 24px; }
.brand h1 { font-size: 20px; margin: 0 0 4px; }
.brand p { color: var(--text-light); margin: 0; font-size: 14px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; font-weight: 600; }
.field input, .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid #cddcfb; border-color: var(--blue); }
.hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.btn { display: inline-flex; align-items:center; justify-content:center; gap:6px; border:none; border-radius:9px; padding:12px 20px; font-size:15px; font-weight:700; cursor:pointer; width: 100%; text-decoration: none; transition: background-color .15s ease, transform .1s ease; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { background: #a9c0f0; cursor: not-allowed; transform: none; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); transition: background-color .15s ease; }
.btn-secondary:active { background: #f5f5f5; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row .btn { flex: 1; }

.confirm-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.confirm-row:last-child { border-bottom: none; }
.confirm-row .label { color: var(--text-light); }
.confirm-row .value { font-weight: 600; text-align: right; }

.progress-bar-outer { height: 6px; background: #e9edf5; border-radius: 999px; margin-bottom: 22px; overflow: hidden; position: sticky; top: 0; }

.exam-instructions {
  background: var(--blue-bg, #eef3fc);
  border: 1px solid #cddcfb;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 18px;
}
.progress-bar-inner { height: 100%; background: var(--blue); transition: width .2s ease; }

.section-nav { margin-bottom: 4px; }
.section-pills { display: flex; gap: 8px; justify-content: center; margin-bottom: 6px; flex-wrap: wrap; }
.section-pill {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.section-pill:active { transform: scale(.9); }
.section-pill.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.section-pill.complete:not(.active) { background: #dcfce7; border-color: #86efac; color: #15803d; }
.section-nav-label { text-align: center; font-size: 12px; color: var(--text-light); margin-bottom: 18px; }

.section-block { margin-bottom: 28px; animation: fade-in-up .25s ease; }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.section-block h2 { font-size: 16px; margin: 0 0 2px; }
.section-block .section-sub { font-size: 12px; color: var(--text-light); margin-bottom: 12px; }

.q-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.q-row:last-child { border-bottom: none; }
.q-head { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.opt-group { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.opt-btn:active { transform: scale(.92); }
.opt-btn.selected { background: var(--blue); border-color: var(--blue); color: #fff; transform: scale(1.04); }
.opt-btn.selected.multi { background: #16a34a; border-color: #16a34a; }
.subpoint { margin-bottom: 8px; }
.subpoint-label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.multi-counter { font-size: 12px; color: var(--text-light); margin-top: 6px; }

.state-msg { text-align: center; padding: 60px 20px; color: var(--text-light); }

.result-card { text-align: center; padding: 8px 0 20px; animation: fade-in-up .3s ease; }
.result-total { font-size: 40px; font-weight: 800; color: var(--blue); margin: 6px 0 2px; }
.result-total-label { color: var(--text-light); font-size: 13px; margin-bottom: 20px; }
.result-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; text-align: left; }
.result-row:last-child { border-bottom: none; }
.result-row .bar-outer { flex:1; height: 6px; background:#e9edf5; border-radius:999px; margin: 0 12px; overflow:hidden; align-self:center; }
.result-row .bar-inner { height:100%; background: var(--blue); width: 0; transition: width .6s ease; }

.result-row-wrap { border-bottom: 1px solid var(--border); padding: 8px 0; }
.result-row-wrap:last-child { border-bottom: none; }
.result-row-wrap .result-row { border-bottom: none; padding: 4px 0 6px; }

.btn-detail-toggle {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 0 6px;
  -webkit-tap-highlight-color: transparent;
}
.btn-detail-toggle:hover { text-decoration: underline; }

.review-panel { animation: fade-in-up .2s ease; padding-top: 2px; }
.review-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.review-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.review-badge:active { transform: scale(.88); }
.review-badge.correct { background: #16a34a; }
.review-badge.partial { background: #d97706; }
.review-badge.incorrect { background: #dc2626; }
.review-badge.skipped { background: #9ca3af; }
.review-badge.picked { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text); }
.review-detail-line { font-size: 12.5px; color: var(--text-light); min-height: 18px; line-height: 1.5; }

.review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 10px;
  font-size: 11.5px;
  color: var(--text-light);
}
.review-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.review-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.review-legend-dot.correct { background: #16a34a; }
.review-legend-dot.partial { background: #d97706; }
.review-legend-dot.incorrect { background: #dc2626; }
.review-legend-dot.skipped { background: #9ca3af; }

.sticky-submit {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(250,247,246,0), var(--bg) 30%);
  padding: 16px 0 4px;
}


/* Совсем узкие экраны (маленькие телефоны) - чуть меньше отступов, чтобы
   оставить больше места под содержимое. */
@media (max-width: 360px) {
  .wrap { padding: 20px 12px 70px; }
  .card { padding: 16px; }
  .btn { padding: 12px 14px; font-size: 14px; }
}


.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: dialog-fade-in .15s ease;
}
@keyframes dialog-fade-in { from { background: rgba(15, 23, 42, 0); } to { background: rgba(15, 23, 42, .45); } }
.dialog-box {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .25);
}
.dialog-message { font-size: 14.5px; line-height: 1.5; color: var(--text); }
