:root {
  --navy: #14284b;
  --navy-2: #1f3a68;
  --ink: #1b2330;
  --muted: #5d6878;
  --line: #dfe4ec;
  --bg: #f3f5f9;
  --card: #ffffff;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --ok: #1a7f4b;
  --warn: #b7791f;
  --bad: #c0392b;
  --a5: #1a7f4b;
  --a4: #3f9d5a;
  --a3: #d39e1c;
  --a2: #c0392b;
  --radius: 12px;
  font-family: 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 16px; line-height: 1.5; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

.topbar {
  background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar-inner { max-width: 860px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.topbar .brand { font-weight: 600; font-size: 15px; flex: 1; line-height: 1.25; }
.topbar .brand small { display: block; opacity: .75; font-weight: 400; font-size: 12px; }
.part-tag { background: rgba(255,255,255,.14); border-radius: 8px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.progress { height: 4px; background: rgba(255,255,255,.15); }
.progress > div { height: 100%; background: #6ea8ff; width: 0; transition: width .3s; }

.wrap { max-width: 860px; margin: 0 auto; padding: 18px 14px 120px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.sec-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.sec-head .letter { background: var(--navy); color: #fff; border-radius: 8px; min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.sec-head h2 { margin: 0; font-size: 20px; }
.sec-note { background: #fff8e6; border: 1px solid #f3dfa8; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }

.q { scroll-margin-top: 80px; }
.q .qtitle { font-weight: 600; margin-bottom: 4px; }
.q .qcode { color: var(--accent); font-weight: 700; margin-right: 6px; }
.q .qhint { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.q .req { color: var(--bad); }
.q.err { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.q .errmsg { color: var(--bad); font-size: 13px; margin-top: 6px; display: none; }
.q.err .errmsg { display: block; }

.opts { display: grid; gap: 8px; margin-top: 10px; }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.opt:hover { border-color: #b8c6dc; }
.opt input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.dis { opacity: .45; cursor: not-allowed; }
.counter { font-size: 13px; color: var(--muted); margin-top: 6px; }

.lk-legend { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.lk-row { border-top: 1px dashed var(--line); padding: 12px 0; }
.lk-row:first-of-type { border-top: 0; }
.lk-row .lk-t { margin-bottom: 8px; }
.lk-row .lk-n { color: var(--muted); font-weight: 600; margin-right: 4px; }
.lk-row.miss .lk-t { color: var(--bad); }
.lk-btns { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; max-width: 420px; }
.lk-btns button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 0; font-weight: 600; color: var(--ink); }
.lk-btns button:hover { border-color: #9fb4d6; }
.lk-btns button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lk-btns button.nn { color: var(--muted); }
.lk-btns button.nn.on { background: #6b7685; border-color: #6b7685; color: #fff; }
.lk-scale { display: flex; justify-content: space-between; max-width: 420px; font-size: 11px; color: var(--muted); margin-top: 3px; }

textarea, .input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
textarea:focus, .input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.navbar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 20; }
.navbar-inner { max-width: 860px; margin: 0 auto; padding: 10px 14px; display: flex; gap: 10px; align-items: center; }
.navbar .step { flex: 1; text-align: center; font-size: 13px; color: var(--muted); }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 18px; font-weight: 600; }
.btn:hover { border-color: #b8c6dc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #185ccc; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 14px; }

.hero h1 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
.hero .sub { color: var(--muted); margin-bottom: 14px; }
.badge-anon { display: inline-flex; gap: 6px; align-items: center; background: #e7f6ee; color: var(--ok); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.guarantees { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.big-ok { font-size: 54px; line-height: 1; margin: 10px 0; color: var(--ok); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* hub */
.course-q { margin-top: 4px; }
.parts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.part-btn { text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s, transform .1s; min-height: 170px; color: var(--ink); }
.part-btn:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(31,111,235,.12); }
.part-btn:active { transform: translateY(1px); }
.part-btn .pn { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.part-btn .pt { font-size: 20px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.part-btn .ps { font-size: 13px; color: var(--muted); flex: 1; }
.part-btn .pst { align-self: flex-start; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 700; background: #eef2f8; color: var(--muted); }
.part-btn.done { border-color: var(--ok); background: #f3fbf6; }
.part-btn.done .pst { background: #dff3e7; color: var(--ok); }
.part-btn.started .pst { background: #fff1d6; color: #8a6510; }
.part-btn.next { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.submit-box { text-align: center; padding: 22px 18px; }
.submit-box .btn { font-size: 18px; padding: 14px 28px; }
.rule { background: var(--accent-soft); border: 1px solid #c9dafc; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.fixed-val { display: flex; align-items: center; gap: 10px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-weight: 600; }
.fixed-val .lock { color: var(--accent); }

/* matrix */
.mx-legend { font-size: 13px; color: var(--muted); margin: 6px 0 4px; }
.mx-crit { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.mx-cat { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 12px; background: #fbfcfe; }
.mx-cat h4 { margin: 0 0 6px; font-size: 15px; color: var(--navy); }
.mx-cat .lk-row { padding: 8px 0; }
.mx-cat .lk-t { font-size: 14px; }

/* freq */
.fq-btns { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.fq-btns button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 4px; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.fq-btns button:hover { border-color: #9fb4d6; }
.fq-btns button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fq-btns button.nn.on { background: #6b7685; border-color: #6b7685; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,25,45,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; max-width: 460px; width: 100%; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 8px; color: var(--navy); font-size: 19px; }
.modal p { margin: 0 0 16px; color: var(--ink); }
.modal .mbtns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal .input { margin-bottom: 14px; }

@media (max-width: 680px) { .parts { grid-template-columns: 1fr; } .part-btn { min-height: 0; } }
@media (max-width: 560px) {
  .fq-btns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body { font-size: 15px; }
  .card { padding: 14px; }
  .hero h1 { font-size: 19px; }
  .lk-btns button { padding: 10px 0; }
}
