/* CFSC practice course. Chunky, rounded, one-colour line icons. Government-style palette: navy brand, red accent, plain greys; green stays for "correct". */
:root {
  --bg: #ffffff; --card: #ffffff; --soft: #f5f6f8; --ink: #26374a; --muted: #5d6b7a; --line: #d8dde3;
  --brand: #335075; --brand-d: #26374a; --brand-l: #e3e9f1;
  --green: #2e8540; --green-d: #206030; --green-l: #e1f1e5;
  --orange: #d52b1e; --orange-d: #a81f15; --orange-l: #fbe6e4;
  --gold: #c99700; --gold-d: #8a6700;
  --blue: #2572b4; --blue-d: #1b5a8f; --blue-l: #e0eefa;
  --red: #b3261e; --red-d: #8a1c16; --red-l: #fbe9e7;
  --lock: #d8dde3; --lock-d: #b8c0c9;
  --r: 16px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17212c; --card: #1f2c3a; --soft: #263648; --ink: #eef1f5; --muted: #a6b3c1; --line: #35465a;
    --brand: #6f93c2; --brand-d: #4a6f9e; --brand-l: #23364d;
    --green: #4cb26b; --green-d: #7fd69a; --green-l: #1b3a26;
    --orange: #ee5a4d; --orange-l: #40201d; --blue-l: #1a3350;
    --red: #ee6a60; --red-d: #ff9d95; --red-l: #3d1c1a;
    --lock: #2f4156; --lock-d: #263648; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 700 17px/1.45 var(--font); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue); }
.boot { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.ico { width: 1.4em; height: 1.4em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- art (inline SVG illustrations) ---- */
svg.art { width: 100%; height: auto; display: block; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
svg.art .soft { fill: var(--soft); }
svg.art .a { stroke: var(--orange); }
svg.art .g { stroke: var(--green); }
svg.art .r { stroke: var(--red); }
svg.art .ns * { vector-effect: non-scaling-stroke; stroke-width: 2.2; }
svg.art .thin { stroke-width: 2; stroke: var(--muted); }
svg.art text.t { fill: var(--ink); stroke: none; font: 800 14px var(--font); }
svg.art text.t.s { font-size: 13px; }
svg.art text.t.m { fill: var(--muted); font-size: 12.5px; }
svg.art text.t.b { font-size: 15px; font-weight: 900; }
svg.art text.t.a { fill: var(--orange); }

/* ---- buttons ---- */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .6rem 1.4rem;
  border: 2px solid var(--brand-d); border-bottom-width: 5px; border-radius: var(--r); background: var(--brand); color: #fff;
  font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: .95rem; transition: filter .1s, transform .05s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(3px); border-bottom-width: 2px; margin-bottom: 3px; }
.btn[disabled] { background: var(--lock); border-color: var(--lock-d); color: var(--muted); cursor: not-allowed; filter: none; }
.btn.block { display: flex; width: 100%; }
.btn.orange { background: var(--orange); border-color: var(--orange-d); }
.btn.blue { background: var(--blue); border-color: var(--blue-d); }
.btn.red { background: var(--red); border-color: var(--red-d); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.small { min-height: 38px; padding: .3rem .9rem; font-size: .8rem; border-bottom-width: 4px; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 800; text-decoration: underline; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 2px solid var(--line); border-top: 5px solid var(--brand-d); }
.top-in { max-width: 1040px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .6rem; }
.logo { display: flex; align-items: center; gap: .55rem; font-weight: 900; font-size: 1.15rem; color: var(--brand); text-decoration: none; letter-spacing: -.01em; }
.logo svg { width: 34px; height: 34px; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-weight: 900; padding: .25rem .5rem; border-radius: 12px; }
.chip.flame { color: var(--orange); } .chip.xp { color: var(--gold-d); } .chip.pass { color: var(--brand-d); }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--soft); font-weight: 900; }
.menu { position: absolute; right: 1rem; top: 58px; background: var(--card); border: 2px solid var(--line); border-radius: var(--r); min-width: 220px; padding: .4rem; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 30; }
.menu .who { padding: .5rem .7rem; color: var(--muted); font-size: .85rem; border-bottom: 2px solid var(--line); margin-bottom: .3rem; word-break: break-all; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .6rem .7rem; border-radius: 10px; font-weight: 800; }
.menu button:hover { background: var(--soft); }

/* ---- home layout ---- */
.home { max-width: 1040px; margin: 0 auto; padding: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
@media (min-width: 900px) { .home { grid-template-columns: minmax(0, 560px) 300px; justify-content: center; } }
.side { display: none; }
@media (min-width: 900px) { .side { display: block; position: sticky; top: 76px; align-self: start; } }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.bar { height: 16px; background: var(--soft); border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 8px; transition: width .35s; }
.muted { color: var(--muted); font-weight: 700; }
.small { font-size: .85rem; }
.notice { background: var(--blue-l); border: 2px solid var(--blue); border-radius: var(--r); padding: .8rem 1rem; font-size: .9rem; margin-bottom: 1rem; }

/* ---- path ---- */
.banner { display: flex; gap: .8rem; align-items: center; border-radius: var(--r); padding: 1rem 1.1rem; color: #fff; margin: 1.6rem 0 .6rem; border-bottom: 5px solid rgba(0,0,0,.2); }
.banner.t0 { background: var(--brand); } .banner.t1 { background: #2f8f83; } .banner.t2 { background: #6a63c9; } .banner.t3 { background: var(--orange); }
.banner small { text-transform: uppercase; letter-spacing: .1em; opacity: .9; font-weight: 900; }
.banner h2 { margin: .1rem 0 .15rem; font-size: 1.25rem; line-height: 1.2; }
.banner p { margin: 0; font-size: .9rem; font-weight: 700; opacity: .95; }
.banner .info { flex: 1; min-width: 0; }
.banner .btn { background: rgba(255,255,255,.18); border-color: rgba(0,0,0,.25); }
.path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; }
.path li { position: relative; width: 100%; display: flex; justify-content: center; padding: .55rem 0; }
.node { position: relative; width: 78px; height: 72px; border-radius: 50%; border: 0; background: var(--brand); color: #fff;
  box-shadow: 0 7px 0 var(--brand-d); display: grid; place-items: center; transform: translateX(var(--x, 0)); transition: transform .08s, box-shadow .08s; }
.node svg.ico { width: 34px; height: 34px; stroke-width: 2.4; }
.node:active { transform: translate(var(--x, 0), 5px); box-shadow: 0 2px 0 var(--brand-d); }
.node.test { background: var(--orange); box-shadow: 0 7px 0 var(--orange-d); }
.node.test:active { box-shadow: 0 2px 0 var(--orange-d); }
.node.done { background: var(--gold); box-shadow: 0 7px 0 var(--gold-d); }
.node.locked { background: var(--lock); box-shadow: 0 7px 0 var(--lock-d); color: var(--muted); cursor: not-allowed; }
.node.current::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--brand-l); border-top-color: var(--brand); animation: spin 2.4s linear infinite; }
.node.test.current::before { border-color: var(--orange-l); border-top-color: var(--orange); }
.start-tip { position: absolute; top: -36px; left: 50%; transform: translateX(-50%); background: var(--card); color: var(--brand-d); border: 2px solid var(--line); border-radius: 12px;
  padding: .15rem .7rem; font-weight: 900; font-size: .8rem; letter-spacing: .08em; white-space: nowrap; animation: bob 1.4s ease-in-out infinite; pointer-events: none; }
.start-tip::after { content: ""; position: absolute; bottom: -8px; left: 50%; margin-left: -6px; width: 10px; height: 10px; background: var(--card); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.node-label { position: absolute; left: calc(50% + 56px); top: 50%; transform: translate(var(--x, 0), -50%); font-size: .8rem; color: var(--muted); font-weight: 800; max-width: 150px; line-height: 1.2; pointer-events: none; }
.final { text-align: center; margin: 1.6rem 0 2rem; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translate(-50%, -5px); } }

/* ---- guidebook ---- */
.page { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.page h1 { font-size: 1.6rem; margin: .4rem 0 .2rem; line-height: 1.2; }
.page .lead { color: var(--muted); margin: 0 0 1rem; }
.guide-art { background: var(--soft); border: 2px solid var(--line); border-radius: var(--r); padding: .6rem; margin: 1rem 0; }
.gblock { margin: 1.2rem 0; }
.gblock h3 { margin: 0 0 .3rem; font-size: 1.1rem; color: var(--brand-d); }
.gblock p { margin: .2rem 0 .5rem; font-weight: 600; }
.gblock ul { margin: .2rem 0; padding-left: 1.2rem; font-weight: 600; }
.gblock li { margin: .3rem 0; }
.sticky-foot { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 2px solid var(--line); padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); }
.sticky-foot .in { max-width: 640px; margin: 0 auto; display: flex; gap: .8rem; }
.back { display: inline-flex; gap: .3rem; align-items: center; background: none; border: 0; color: var(--muted); font-weight: 900; padding: .4rem 0; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }
.src { font-size: .8rem; color: var(--muted); font-weight: 700; margin-top: 1.4rem; }

/* ---- lesson runner ---- */
.run { max-width: 680px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding: .8rem 1rem 0; }
.run-top { display: flex; align-items: center; gap: .8rem; }
.x { background: none; border: 0; color: var(--muted); padding: .3rem; border-radius: 10px; }
.x:hover { color: var(--ink); background: var(--soft); }
.run-top .bar { flex: 1; }
.shells { display: flex; gap: 3px; align-items: center; color: var(--orange); }
.shells svg { width: 15px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.shells svg.lost { opacity: .22; }
.q { flex: 1; padding: 1.4rem 0 8.5rem; }
.q-kind { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 900; }
.q h2 { font-size: 1.4rem; line-height: 1.3; margin: .3rem 0 1rem; }
.q .qart { background: var(--soft); border: 2px solid var(--line); border-radius: var(--r); padding: .4rem; margin: 0 0 1.1rem; max-width: 520px; }
.opts { display: grid; gap: .65rem; }
.opt { display: flex; align-items: center; gap: .8rem; text-align: left; background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: var(--r); padding: .8rem 1rem; font-weight: 800; }
.opt:hover { background: var(--soft); }
.opt .k { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 9px; font-size: .85rem; color: var(--muted); }
.opt.sel { border-color: var(--blue); background: var(--blue-l); color: var(--blue-d); }
.opt.sel .k { border-color: var(--blue); color: var(--blue-d); }
.opt.right { border-color: var(--green); background: var(--green-l); color: var(--green-d); }
.opt.wrong { border-color: var(--red); background: var(--red-l); color: var(--red-d); }
.opts.lock .opt { pointer-events: none; }
.tf { grid-template-columns: 1fr 1fr; }
.tf .opt { justify-content: center; font-size: 1.2rem; padding: 1.4rem 1rem; }
.sentence { font-size: 1.25rem; line-height: 2.2; font-weight: 800; margin: .5rem 0 1.2rem; }
.blank { display: inline-block; min-width: 110px; border-bottom: 3px solid var(--line); text-align: center; padding: 0 .5rem; color: var(--blue-d); }
.blank.right { color: var(--green-d); border-color: var(--green); } .blank.wrong { color: var(--red-d); border-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-btn { background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 14px; padding: .55rem .9rem; font-weight: 800; text-align: left; }
.chip-btn.used { opacity: .25; pointer-events: none; }
.zone { min-height: 66px; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); padding: .7rem 0; margin: .6rem 0 1rem; display: flex; flex-direction: column; gap: .5rem; counter-reset: s; }
.zone .chip-btn { counter-increment: s; display: flex; gap: .6rem; align-items: center; }
.zone .chip-btn::before { content: counter(s); flex: none; width: 26px; height: 26px; display: grid; place-items: center; background: var(--blue-l); color: var(--blue-d); border-radius: 8px; font-size: .8rem; }
.zone-hint { color: var(--muted); font-weight: 700; padding: .6rem 0; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.match .col { display: grid; gap: .6rem; align-content: start; }
.match .opt { padding: .65rem .8rem; }
.pair { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; font-size: .8rem; background: var(--blue); color: #fff; }
.opt.p1 { border-color: #1f8bd0; } .opt.p2 { border-color: #8a63d2; } .opt.p3 { border-color: #d47a00; } .opt.p4 { border-color: #2f8f83; } .opt.p5 { border-color: #c2418a; }
.opt.p1 .pair { background: #1f8bd0; } .opt.p2 .pair { background: #8a63d2; } .opt.p3 .pair { background: #d47a00; } .opt.p4 .pair { background: #2f8f83; } .opt.p5 .pair { background: #c2418a; }
.opt.active { border-color: var(--ink); }

.foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); background: var(--bg); z-index: 10; }
.foot .in { max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; }
.foot .in .btn { margin-left: auto; min-width: 150px; }
.foot.ok { background: var(--green-l); border-color: var(--green); }
.foot.bad { background: var(--red-l); border-color: var(--red); }
.fb { flex: 1; min-width: 0; }
.fb b { display: flex; gap: .4rem; align-items: center; font-size: 1.15rem; }
.foot.ok .fb b { color: var(--green-d); } .foot.bad .fb b { color: var(--red-d); }
.fb p { margin: .15rem 0 0; font-size: .9rem; font-weight: 700; }
.fb .ans { color: var(--red-d); }
@media (max-width: 520px) { .foot .in { flex-direction: column; align-items: stretch; gap: .6rem; } .foot .in .btn { margin: 0; width: 100%; } }

/* ---- results / modal / auth ---- */
.center { max-width: 520px; margin: 0 auto; padding: 2.4rem 1rem 8rem; text-align: center; }
.center h1 { font-size: 1.8rem; line-height: 1.2; margin: 1rem 0 .4rem; }
.center .art-wrap { max-width: 320px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1.4rem 0; }
.stat { border: 2px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat b { display: block; background: var(--orange); color: #fff; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; padding: .25rem; }
.stat span { display: block; padding: .7rem .2rem; font-size: 1.4rem; font-weight: 900; }
.stat.g b { background: var(--brand); } .stat.b b { background: var(--blue); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--card); border-radius: 20px; padding: 1.4rem; max-width: 420px; width: 100%; text-align: center; }
.modal h2 { margin: 0 0 .4rem; } .modal .btn { margin-top: .6rem; }
.auth { max-width: 460px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }
.auth h1 { text-align: center; font-size: 1.7rem; line-height: 1.2; margin: .8rem 0 .4rem; }
.auth .sub { text-align: center; color: var(--muted); margin: 0 0 1.2rem; }
.field { display: block; margin: .8rem 0; font-size: .85rem; color: var(--muted); }
.field input { display: block; width: 100%; margin-top: .3rem; font: inherit; font-weight: 800; font-size: 1.05rem; padding: .8rem .9rem; border: 2px solid var(--line); border-radius: 14px; background: var(--soft); color: var(--ink); }
.field input:focus { outline: 3px solid var(--blue-l); border-color: var(--blue); }
.err { background: var(--red-l); border: 2px solid var(--red); color: var(--red-d); border-radius: 12px; padding: .6rem .8rem; font-size: .9rem; margin: .8rem 0; }
.fine { font-size: .78rem; color: var(--muted); font-weight: 700; text-align: center; margin-top: 1rem; }
.hero-art { max-width: 300px; margin: 0 auto; }
.feat { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; margin: 1rem 0 0; font-size: .85rem; color: var(--muted); }
.feat span { display: inline-flex; gap: .3rem; align-items: center; }

/* ---- certificate ---- */
.cert-wrap { max-width: 860px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.cert { background: #ffffff; color: #1d2733; border: 3px solid #26374a; outline: 2px solid #26374a; outline-offset: -12px; border-radius: 6px; padding: 3rem 2.4rem; text-align: center; font-family: Georgia, "Times New Roman", serif; position: relative; }
.cert .seal { width: 90px; margin: 0 auto 1rem; }
.cert .seal svg { stroke: #26374a; fill: none; stroke-width: 3; }
.cert small { letter-spacing: .25em; text-transform: uppercase; color: #5d6b7a; font-family: var(--font); font-weight: 800; }
.cert h1 { font-size: 2.2rem; margin: .4rem 0 1.4rem; font-weight: 700; }
.cert .name { font-size: 2.4rem; font-style: italic; border-bottom: 2px solid #26374a; display: inline-block; padding: .2rem 2rem; margin: .6rem 0 1.2rem; word-break: break-word; }
.cert p { margin: .5rem auto; max-width: 560px; font-size: 1.05rem; line-height: 1.55; }
.cert .meta { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 1rem; margin-top: 1.8rem; font-family: var(--font); font-size: .85rem; font-weight: 800; }
.cert .meta span { display: block; font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; color: #5d6b7a; }
.cert .disc { margin-top: 1.6rem; font-family: var(--font); font-size: .75rem; color: #5d6b7a; font-weight: 700; border-top: 1px solid #cfd5dc; padding-top: .8rem; }
.noprint { }
@media print {
  body { background: #fff; }
  .top, .noprint, .sticky-foot { display: none !important; }
  .cert-wrap { padding: 0; max-width: none; }
  .cert { border-width: 4px; }
  @page { size: landscape; margin: 12mm; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
