:root {
  /* MAT Abacus brand (sampled from the official logo) */
  --navy: #012f6b;
  --navy-2: #0b3d82;
  --gold: #f0b324;
  --serif: 'EB Garamond', Garamond, 'Times New Roman', serif;
  --gold-2: #e6a50f;
  --bg: #f3f4f6;
  --card: #ffffff;
  --line: #e2e8f0;
  --soft: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --red: #ef4444;
  --green: #10b981;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 32px; min-height: 62px;
}
.brand { display: flex; align-items: center; text-decoration: none; padding-right: 28px; border-right: 1px solid var(--line); }
.brand-logo { height: 56px; width: auto; display: block; }
.clock { display: flex; flex-direction: column; gap: 4px; }
.clock-time { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 2px; }
.clock-time svg { width: 13px; height: 13px; }
.clock-tag { color: var(--gold-2); font-size: 8.5px; font-weight: 700; letter-spacing: .6px; }
.share-btn {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: none; border: 0; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 2.4px; padding: 8px;
}
.share-btn:hover { color: var(--navy); }

/* ---------- stage ---------- */
.stage { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px 48px; }
.loading { color: var(--faint); margin-top: 80px; letter-spacing: 2px; font-size: 12px; text-transform: uppercase; }
.footer {
  text-align: center; font-size: 9.5px; letter-spacing: 3px; font-weight: 700;
  color: #c3ccd8; padding: 14px 16px; background: #fff; border-top: 1px solid var(--line);
}

.fade-in { animation: fade .28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- hero ---------- */
.hero {
  width: 100%; max-width: 1024px; margin-top: 0;
  background: radial-gradient(1200px 400px at 85% -20%, rgba(255,255,255,.06), transparent 60%),
              radial-gradient(800px 400px at 0% 120%, rgba(255,255,255,.05), transparent 60%), var(--navy);
  color: #fff; border-radius: 20px; padding: 84px 32px 80px; text-align: center;
  box-shadow: 0 30px 60px -20px rgba(0,45,107,.35);
}
.hero .motto { font-family: var(--serif); font-variant-caps: small-caps; color: var(--gold); letter-spacing: 4px; font-size: 18px; margin-bottom: 18px; }
.hero h1 { margin: 0; font-family: var(--serif); font-variant-caps: small-caps; font-size: clamp(48px, 8vw, 88px); font-weight: 700; letter-spacing: 1px; line-height: 1; }
.hero h1 span { color: var(--gold); }
.hero .bar { width: 96px; height: 3px; background: var(--gold); margin: 28px auto 34px; border-radius: 3px; }
.hero p { max-width: 560px; margin: 0 auto 64px; font-size: 19px; line-height: 1.7; color: #dbe4f3; }
.btn-gold {
  background: var(--gold); color: var(--navy); border: 0; border-radius: 3px;
  padding: 20px 46px; font-weight: 900; font-size: 15px; letter-spacing: 5px;
  display: inline-flex; align-items: center; gap: 14px; transition: transform .15s, background .15s;
}
.btn-gold:hover { background: #f5c242; transform: translateY(-1px); }
.btn-gold svg { width: 14px; height: 14px; stroke-width: 2.4; }

/* ---------- card ---------- */
.card {
  width: 100%; max-width: 448px; background: var(--card);
  border-radius: var(--radius); border: 1px solid var(--line); border-top: 4px solid #e6ebf2;
  padding: 44px 40px 36px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.card.wide { max-width: 448px; }
.card h2 { margin: 0 0 6px; color: var(--navy); font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: 0; line-height: 1.2; }
.card .sub { margin: 0 0 24px; color: #475569; font-size: 12px; }
.card h2 + .options, .card h2 + .grid, .card h2 + .tiles { margin-top: 24px; }
.card .sub.tight { margin-bottom: 0; }
.center { text-align: center; }

.options { display: flex; flex-direction: column; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--soft); border: 1px solid var(--line); border-radius: 3px;
  padding: 16px 18px; color: #475569; font-size: 11.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; text-align: left;
  transition: background .15s, color .15s, border-color .15s;
}
.opt .chev { margin-left: auto; width: 14px; height: 14px; }
.opt:hover, .opt:focus-visible, .opt.active { background: var(--navy); border-color: var(--navy); color: #fff; outline: none; }

.tiles { display: flex; flex-direction: column; gap: 14px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 30px 16px;
  color: #475569; font-size: 11.5px; font-weight: 900; letter-spacing: 3px; text-transform: uppercase;
  transition: all .15s;
}
.tile svg { width: 20px; height: 20px; color: var(--faint); }
.tile:hover, .tile:focus-visible, .tile.active { background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: 0 10px 20px -10px rgba(0,45,107,.5); outline: none; }
.tile:hover svg, .tile.active svg { color: #9fb2d3; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chip {
  background: var(--soft); border: 1px solid var(--line); border-radius: 3px; padding: 14px 8px;
  color: #475569; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  transition: all .15s;
}
.chip:hover, .chip:focus-visible, .chip.active { background: var(--navy); color: #fff; border-color: var(--navy); outline: none; }

.link {
  display: block; margin: 28px auto 0; background: none; border: 0;
  color: #475569; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
}
.link:hover { color: var(--navy); text-decoration: underline; }

/* ---------- form ---------- */
.field { margin-top: 26px; }
.field label { display: block; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: #475569; text-transform: uppercase; margin-bottom: 8px; }
.input, .textarea {
  width: 100%; background: var(--soft); border: 1px solid var(--line); border-radius: 3px;
  padding: 14px 16px; font: inherit; font-size: 14px; color: var(--text);
}
.input::placeholder, .textarea::placeholder { color: #8a96a8; }
.input:focus, .textarea:focus { outline: none; border-color: var(--navy); background: #fff; box-shadow: 0 0 0 3px rgba(0,45,107,.08); }
.textarea { min-height: 106px; resize: vertical; }
.phone-wrap { display: flex; }
.phone-prefix {
  display: flex; align-items: center; padding: 0 14px; background: #eef2f7; border: 1px solid var(--line); border-right: 0;
  border-radius: 3px 0 0 3px; font-size: 14px; color: #475569; font-weight: 700;
}
.phone-wrap .input { border-radius: 0 3px 3px 0; }
.hint { font-size: 10px; font-style: italic; color: #475569; margin-top: 10px; }
.hint.err { color: var(--red); font-style: normal; font-weight: 700; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 22px; font-size: 11px; line-height: 1.5; color: #475569; }
.consent input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--navy); flex-shrink: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn-primary {
  width: 100%; margin-top: 28px; background: var(--navy); color: #fff; border: 0; border-radius: 3px;
  padding: 17px; font-size: 11px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; transition: background .15s;
}
.btn-primary:hover:not(:disabled) { background: var(--navy-2); }
.btn-primary:disabled { background: #7f93b3; cursor: not-allowed; }

/* ---------- questionnaire ---------- */
.legend {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--soft); border: 1px solid #edf1f6; border-radius: 6px; padding: 9px 14px; margin: 24px 0 24px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .4px;
}
.legend .poor { color: var(--red); display: flex; align-items: center; gap: 6px; }
.legend .exc { color: #059669; display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.legend .dots { color: #cbd5e1; letter-spacing: 4px; }
.qlist { max-height: 400px; overflow-y: auto; padding-right: 8px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.q { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 20px 16px 18px; transition: border-color .2s; }
.q.done { border-color: #cfe0f5; }
.q.missing { border-color: var(--red); }
.q h3 { margin: 0; font-size: 11px; font-weight: 900; color: var(--navy); text-transform: uppercase; letter-spacing: -.1px; }
.q p { margin: 4px 0 14px; font-size: 9.5px; font-style: italic; color: #64748b; }
.stars { display: flex; gap: 8px; align-items: center; }
.star {
  width: 33px; height: 33px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: #cbd5e1; padding: 0; transition: all .12s;
}
.star svg { width: 15px; height: 15px; }
.star:hover { border-color: var(--gold); color: var(--gold); }
.star.on { background: var(--gold); border-color: var(--gold); color: #fff; }
.star.on svg { fill: #fff; }
.star:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.score-label { margin-left: 10px; font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--muted); text-transform: uppercase; }

/* ---------- done ---------- */
.done-icon { width: 64px; height: 64px; border-radius: 50%; background: #e7f6ef; color: var(--green); display: grid; place-items: center; margin: 0 auto 20px; }
.done-icon svg { width: 30px; height: 30px; stroke-width: 2.4; }
.ref { display: inline-block; margin-top: 14px; padding: 6px 12px; border-radius: 4px; background: var(--soft); border: 1px dashed var(--line); font-size: 11px; letter-spacing: 1.5px; color: var(--navy); font-weight: 700; }
.countdown { margin-top: 18px; font-size: 10px; color: var(--faint); letter-spacing: 1px; text-transform: uppercase; }

.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translate(-50%, 20px); opacity: 0;
  background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13px; transition: all .25s; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; gap: 12px; }
  .brand { padding-right: 12px; border-right: 0; }
  .brand-logo { height: 42px; }
  .clock { display: none; }
  .share-btn span { display: none; }
  .stage { padding: 20px 12px 32px; }
  .hero { padding: 56px 20px; border-radius: 16px; }
  .hero p { font-size: 16px; margin-bottom: 40px; }
  .btn-gold { padding: 17px 28px; letter-spacing: 3px; font-size: 13px; }
  .card { padding: 30px 20px 26px; }
  .star { width: 38px; height: 38px; }
  .qlist { max-height: none; overflow: visible; padding-right: 0; }
}
