* { box-sizing: border-box; }
html { font-size: var(--base-size); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; padding-bottom: 72px; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; margin-top: 1.8rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
ul, ol { padding-left: 1.3rem; margin: 0 0 1rem; }
li { margin-bottom: .35rem; }
.wrap { max-width: 860px; margin: 0 auto; padding: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading { color: var(--muted); padding: 2rem 0; }
#app:focus { outline: none; }

/* ---------- top bar ---------- */
.topbar { background: #fff; color: var(--dark); border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .topbar { position: sticky; top: 0; z-index: 20; } }
.topbar-inner { max-width: 860px; margin: 0 auto; padding: .6rem 1rem; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.brand { color: var(--dark); text-decoration: none; font-weight: 800; display: flex; align-items: center; gap: .55rem; font-size: 1.05rem; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--dark); color: #fff; display: grid; place-items: center; font-size: .9rem; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.topsearch { flex: 1 1 100%; }
.topsearch input, .search-big input { width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: 99px; padding: .6rem 1rem; font: inherit; font-size: 1rem; }
.topsearch input:focus { outline: none; border-color: var(--brand); background: #fff; }

/* ---------- language button ---------- */
.lang-btn { margin-left: auto; background: transparent; color: var(--dark); border: 1.5px solid var(--dark); border-radius: 99px; padding: .3rem .95rem; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; min-height: 38px; }
.lang-btn:hover { background: var(--bg); }

/* ---------- main nav: bottom bar on mobile, in the top bar on desktop ---------- */
.mainnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); display: flex; z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
.mainnav a { flex: 1; text-align: center; padding: .7rem .2rem; font-size: .8rem; color: var(--muted); text-decoration: none; line-height: 1.3; }
.mainnav a.active { color: var(--brand); font-weight: 700; box-shadow: inset 0 3px 0 var(--brand); }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .mainnav { position: static; background: transparent; border: 0; gap: .2rem; padding: 0; }
  .mainnav a { flex: 0 0 auto; color: var(--text); font-weight: 600; font-size: .95rem; padding: .45rem .75rem; border-radius: 8px; }
  .mainnav a:hover { background: var(--bg); }
  .mainnav a.active { color: #fff; box-shadow: none; background: var(--dark); }
  .topbar-inner { max-width: 1100px; flex-wrap: nowrap; }
  .topsearch { flex: 0 1 260px; }
}

/* ---------- cards & buttons ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: .8rem; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1.2rem; border-radius: 12px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-strong); }
.btn.ghost { background: var(--surface); color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.small { min-height: 38px; padding: .3rem .8rem; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.back { display: inline-block; margin: .2rem 0 .8rem; text-decoration: none; font-size: .95rem; }

/* ---------- home ---------- */
.hero { padding: .4rem 0 .2rem; }
.search-big { margin: .8rem 0 1.2rem; }
.search-big input { border: 2px solid var(--line); padding: .85rem 1rem; font-size: 1.05rem; }
.search-big input:focus { border-color: var(--brand); outline: none; }
.next-step { background: var(--dark); color: #fff; border-radius: 18px; padding: 1.4rem; margin-bottom: 1.2rem; position: relative; overflow: hidden; }
.next-step::after { content: ""; position: absolute; right: -70px; top: -70px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(184,134,43,.35), transparent 70%); pointer-events: none; }
.next-step .label { color: var(--accent); font-weight: 700; }
.next-step .label { font-size: .85rem; opacity: .85; letter-spacing: .04em; }
.next-step h2 { margin: .3rem 0 .8rem; font-size: 1.3rem; }
.next-step .btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.next-step .btn:hover { filter: brightness(.95); }
.next-step .btn.ghost-inv { background: transparent; color: var(--brand-ink); border-color: rgba(255,255,255,.55); }
.next-step .btn.ghost-inv:hover { background: rgba(255,255,255,.12); }
.next-step .sub { font-size: .9rem; opacity: .9; margin-top: .8rem; }
.next-step .sub a { color: var(--brand-ink); }
.entries { display: grid; gap: .7rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .entries { grid-template-columns: 1fr 1fr; } }
.entry { display: flex; gap: .9rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: inherit; min-height: 80px; }
.entry:hover { border-color: var(--brand); }
.entry .num { flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.entry strong { display: block; font-size: 1.08rem; }
.entry span.d { color: var(--muted); font-size: .88rem; }

/* ---------- progress ---------- */
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }
.prog-row { display: grid; grid-template-columns: 5.5rem 1fr 3.2rem; gap: .6rem; align-items: center; margin-bottom: .55rem; text-decoration: none; color: inherit; }
.prog-row .pct { text-align: right; font-size: .9rem; color: var(--muted); }

/* ---------- tags & badges ---------- */
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .3rem 0; }
.tag { display: inline-block; font-size: .78rem; padding: .12rem .55rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); text-decoration: none; white-space: nowrap; }
.tag.t-new { background: #fff1e0; color: #8a4b00; }
.tag.t-exam { background: #ece9fb; color: #4b3a9e; }
.tag.t-form { background: #e3f3f1; color: #13645b; }
.tag.t-ask { background: #fdeef3; color: #9a2550; }
.updated { display: inline-flex; gap: .4rem; align-items: center; background: var(--warn-soft); color: var(--warn); font-weight: 700; border-radius: 10px; padding: .35rem .7rem; font-size: .92rem; }
.updated.old { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .6rem; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: .4rem .85rem; font: inherit; font-size: .9rem; color: var(--text); text-decoration: none; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.done-mark { color: var(--ok); font-weight: 700; font-size: .85rem; }

/* ---------- lists / checks ---------- */
.check { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: .5rem; }
.check input { width: 24px; height: 24px; flex: 0 0 24px; margin: .1rem 0 0; accent-color: var(--ok); }
.check.is-done { background: var(--ok-soft); border-color: #bfe3cf; }
.check.is-done .ctext { color: var(--muted); text-decoration: line-through; }
.check .ctext { flex: 1; }
.check .ctext a { font-weight: 600; }
.check .meta { display: block; font-size: .82rem; color: var(--muted); text-decoration: none; }
.check.today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: .8rem 1rem; border-radius: 0 12px 12px 0; margin: 1rem 0; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.criteria { border: 2px dashed var(--ok); background: var(--ok-soft); border-radius: var(--radius); padding: 1rem; margin-top: 1.2rem; }
.pager { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1.5rem; }

/* ---------- material page ---------- */
.pdf { background: #3b4252; border-radius: var(--radius); padding: .6rem; margin: 1rem 0; }
.pdf-tools { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; color: #fff; margin-bottom: .6rem; }
.pdf-tools .btn { min-height: 40px; padding: .3rem .8rem; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.pdf-tools .zoom { min-width: 3.5rem; text-align: center; font-size: .9rem; }
.pdf-tools .spacer { flex: 1; }
.pdf-pages { overflow: auto; max-height: 75vh; -webkit-overflow-scrolling: touch; }
.pdf-pages canvas { display: block; margin: 0 auto .6rem; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.pdf-pages iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.pdf-msg { color: #e5e9f0; padding: 1rem; }
.keypoints li { margin-bottom: .6rem; }
.bigcheck { display: flex; gap: .8rem; align-items: center; padding: 1rem; border: 2px solid var(--ok); border-radius: var(--radius); background: var(--surface); font-weight: 700; cursor: pointer; margin: 1.2rem 0; }
.bigcheck input { width: 28px; height: 28px; accent-color: var(--ok); }

/* ---------- table ---------- */
.fields { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; }
.fields th, .fields td { text-align: left; padding: .7rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .95rem; }
.fields th { background: var(--brand-soft); }
@media (max-width: 600px) {
  .fields thead { display: none; }
  .fields tr { display: block; border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .fields td { display: block; border: 0; padding: .15rem .7rem; }
  .fields td:first-child { font-weight: 700; }
  .fields td:last-child { color: var(--warn); font-size: .88rem; }
}

/* ---------- FAQ ---------- */
details.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: .6rem; }
details.faq summary { cursor: pointer; padding: 1rem; font-weight: 700; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "＋ "; color: var(--brand); }
details.faq[open] summary::before { content: "－ "; }
details.faq .body { padding: 0 1rem 1rem; }
.say { background: var(--ok-soft); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .6rem; }
.avoid { background: var(--bad-soft); border-radius: 10px; padding: .7rem .9rem; color: var(--bad); font-size: .92rem; }

/* ---------- quiz ---------- */
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem; }
.q .qn { font-size: .82rem; color: var(--muted); }
.q .qt { font-weight: 700; margin: .2rem 0 .7rem; }
.opt { display: block; width: 100%; text-align: left; padding: .8rem .9rem; margin-bottom: .45rem; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; cursor: pointer; color: var(--text); }
.opt:hover:not([disabled]) { border-color: var(--brand); }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt[disabled] { cursor: default; }
.explain { border-radius: 10px; padding: .7rem .9rem; margin-top: .4rem; font-size: .95rem; }
.explain.ok { background: var(--ok-soft); }
.explain.no { background: var(--bad-soft); }
.stickybar { position: sticky; bottom: 64px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; display: flex; justify-content: space-between; align-items: center; gap: .6rem; box-shadow: 0 4px 16px rgba(0,0,0,.08); z-index: 5; }
@media (min-width: 900px) { .stickybar { bottom: 12px; } }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }
.timer.low { color: var(--bad); }
.score { font-size: 2.4rem; font-weight: 800; }
.pass { color: var(--ok); } .fail { color: var(--bad); }

/* ---------- gate ---------- */
.gate { max-width: 420px; margin: 3rem auto; }
.gate input { width: 100%; padding: .8rem 1rem; font: inherit; border: 2px solid var(--line); border-radius: 12px; margin: .6rem 0; }
.error { color: var(--bad); }
input[type=date] { font: inherit; padding: .6rem .8rem; border: 2px solid var(--line); border-radius: 12px; }

/* ---------- footer ---------- */
.footer { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1rem; padding-bottom: 1.5rem; }
