:root {
  --navy: #1f2d52;
  --navy-700: #18234180;
  --amber: #e8a317;
  --amber-dark: #c98a0c;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(31, 45, 82, 0.08);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }

/* шапка */
.appbar {
  background: linear-gradient(135deg, #243567 0%, var(--navy) 70%);
  color: #fff;
}
.appbar .wrap { display: flex; align-items: center; gap: 12px; padding: 18px 16px; }
.brand-badge {
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: #cdd6f0; font-weight: 600;
}
.appbar h1 { font-size: 19px; margin: 2px 0 0; font-weight: 700; }
.appbar h1 .accent { color: var(--amber); }
.appbar .logo {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: rgba(255,255,255,.12); display: grid; place-items: center;
}
.lang-switch { margin-left: auto; display: flex; gap: 3px; background: rgba(255,255,255,.12); border-radius: 9px; padding: 3px; flex: none; }
.lang-btn { border: none; background: transparent; color: #cdd6f0; font-size: 12px; font-weight: 700; letter-spacing: .3px; padding: 6px 11px; border-radius: 7px; cursor: pointer; transition: background .12s, color .12s; }
.lang-btn:hover { color: #fff; }
.lang-btn.active { background: #fff; color: var(--navy); }

/* карточки */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin: 0 0 4px; }
.card .sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* формы */
label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=tel] {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232,163,23,.18); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

/* кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 600; padding: 12px 20px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn-primary { background: var(--navy); color: #fff; width: 100%; }
.btn-primary:hover { background: #19264d; }
.btn-amber { background: var(--amber); color: #3a2a00; }
.btn-amber:hover { background: var(--amber-dark); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* выбор дня */
.user-chip {
  display: flex; align-items: center; justify-content: space-between;
  background: #eef1f9; border: 1px solid #dce3f4; border-radius: 12px;
  padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}
.user-chip b { color: var(--navy); }
.user-chip a { color: var(--muted); font-size: 13px; text-decoration: none; }

.days { display: grid; gap: 12px; }
.day-card {
  text-align: left; width: 100%; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  transition: border-color .15s, transform .05s;
}
.day-card:hover { border-color: var(--amber); }
.day-card:active { transform: scale(.995); }
.day-num {
  flex: none; width: 38px; height: 38px; border-radius: 9px;
  background: var(--navy); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 16px;
}
.day-card .t { font-weight: 650; font-size: 15px; color: var(--ink); }
.day-card .s { font-size: 13px; color: var(--muted); }
.day-card .arrow { margin-left: auto; color: #cbd2e0; }
.day-card .done-badge {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ok);
  background: var(--ok-bg); padding: 3px 9px; border-radius: 999px;
}

/* тест */
.q {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
}
.q .qhead { font-weight: 650; font-size: 15px; margin-bottom: 12px; display: flex; gap: 10px; }
.q .qnum {
  flex: none; width: 24px; height: 24px; border-radius: 7px; font-size: 13px;
  background: #eef1f9; color: var(--navy); display: grid; place-items: center; font-weight: 700;
}
.opt {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer;
  font-size: 14.5px; transition: border-color .12s, background .12s;
}
.opt:hover { border-color: #c7cfe0; background: #fafbff; }
.opt input { margin-top: 2px; accent-color: var(--navy); }
.opt.sel { border-color: var(--amber); background: #fff8ec; }
.progress-line { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

/* результат */
.result-ring {
  width: 120px; height: 120px; margin: 6px auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: var(--navy);
}
.result-sub { text-align: center; color: var(--muted); margin-bottom: 18px; }
.result-title { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 2px; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 13px; font-size: 14px; margin-bottom: 12px; display: none; }
.err.show { display: block; }
.footer-note { text-align: center; color: #9aa3b2; font-size: 12px; padding: 10px 0 28px; }
.hidden { display: none !important; }

/* QR на экране входа (над формой, крупный — сканируют с монитора/доски) */
.qr-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.qr-card h2 { margin: 6px 0 0; }
.qr-card .sub { margin: 0; }
.qr-img { width: 470px; max-width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); padding: 12px; background: #fff; }
.qr-link { font-weight: 700; color: var(--navy); text-decoration: none; white-space: nowrap; }
.qr-link:hover { color: var(--amber-dark); }

/* тікелей нәтижелер тақтасы */
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #15803d;
  margin-right: 5px; vertical-align: middle; animation: livepulse 1.6s infinite;
}
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 rgba(21,128,61,.5); }
  70% { box-shadow: 0 0 0 6px rgba(21,128,61,0); }
  100% { box-shadow: 0 0 0 0 rgba(21,128,61,0); }
}
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; transition: background .4s;
}
.lb-rank { width: 24px; text-align: center; font-weight: 800; color: var(--muted); flex: none; }
.lb-name { font-weight: 600; font-size: 14.5px; }
.lb-pct { margin-left: auto; flex: none; }
.lb-me { background: #fff8ec; border-color: var(--amber); }
.lb-you { font-size: 11px; font-weight: 700; color: var(--amber-dark); background: #fff1d6; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.lb-new { animation: lbnew 1.2s ease; }
@keyframes lbnew { 0% { background: #dcfce7; } 100% { background: #fff; } }

/* студенттің өз нәтижелер тарихы */
.att { font-size: 11px; font-weight: 700; color: var(--amber-dark); background: #fff1d6; padding: 2px 7px; border-radius: 6px; }
.mr-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.mr-date { color: var(--muted); font-size: 13px; }
.mr-pct { margin-left: auto; flex: none; }
