:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #14213d;
  --muted: #5a6a86;
  --line: #dde4f0;
  --brand: #2f4bd8;
  --brand-ink: #ffffff;
  --brand-soft: #e8ecff;
  --accent: #f5a524;
  --accent-soft: #fff4dc;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 8px 24px rgba(20, 33, 61, .07);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1322;
    --card: #151d33;
    --ink: #e8edf8;
    --muted: #9aa9c6;
    --line: #26314c;
    --brand: #7f95ff;
    --brand-ink: #0d1322;
    --brand-soft: #1f2a52;
    --accent: #ffb84a;
    --accent-soft: #3a2d12;
    --ok: #4ade80;
    --ok-soft: #12301f;
    --warn: #fbbf24;
    --warn-soft: #3a2d12;
    --bad: #f87171;
    --bad-soft: #3b1a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: var(--ink); }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 18px;
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; line-height: 1.1; }
.spacer { flex: 1; }
.who { text-align: right; line-height: 1.2; }
.who b { display: block; font-size: .9rem; }
.who span { font-size: .75rem; color: var(--muted); }

/* ---------- buttons / inputs ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s ease, box-shadow .15s ease, background .15s;
  text-decoration: none; min-height: 44px;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .875rem; border-radius: 10px; }
.btn.block { width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }

label.f { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 14px; }
label.f > span { display: block; margin-bottom: 5px; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); font-weight: 400; min-height: 44px;
}
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
textarea.input { min-height: 84px; resize: vertical; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font-size: .78rem; font-weight: 700; background: var(--brand-soft); color: var(--brand);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- landing ---------- */
.hero { padding: 30px 0 10px; }
.hero .eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.hero h1 { font-size: clamp(1.6rem, 4.6vw, 2.5rem); margin-top: 6px; }
.hero p.lead { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }
.grid2 { display: grid; gap: 18px; grid-template-columns: 1.15fr .85fr; align-items: start; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps .n {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: .9rem;
}
.qr-card { text-align: center; }
.qr-box { background: #fff; border-radius: 14px; padding: 10px; display: inline-block; border: 1px solid var(--line); line-height: 0; }
.qr-box svg, .qr-box canvas { width: 210px; height: 210px; display: block; }
.url-pill { display: block; margin: 12px auto 12px; padding: 8px 12px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--line); font-size: .85rem; word-break: break-all; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.contents { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.contents li { display: flex; gap: 10px; align-items: baseline; }
.contents b { flex: none; min-width: 64px; color: var(--brand); }

/* ---------- app (siswa) ---------- */
.progress-wrap { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.bar { height: 9px; background: var(--line); border-radius: 99px; overflow: hidden; flex: 1; min-width: 80px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 99px; transition: width .3s; }
.nav-soal { margin: 18px 0 8px; display: grid; gap: 10px; }
.nav-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav-group .gl { font-weight: 700; font-size: .85rem; color: var(--muted); min-width: 58px; }
.chip {
  min-width: 42px; height: 42px; padding: 0 10px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card); cursor: pointer; font-weight: 700; display: inline-grid; place-items: center; position: relative;
}
.chip.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.note { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.active { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.chip.done::after { content: "✓"; position: absolute; top: -6px; right: -4px; font-size: .65rem; background: var(--ok); color: #fff; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }

.q-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.q-title { font-size: 1.15rem; font-weight: 700; }
.q-text { font-size: 1.12rem; font-weight: 600; background: var(--brand-soft); padding: 14px 16px; border-radius: 14px; margin: 12px 0; }
.context { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: var(--bg); }
.context figure { margin: 8px 0 4px; text-align: center; color: var(--ink); }
.context figure svg { max-width: 100%; height: auto; max-height: 260px; }
.datachips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.datachips span { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px 10px; font-weight: 600; font-size: .92rem; }

.tabs { display: flex; gap: 6px; margin: 16px 0 0; border-bottom: 2px solid var(--line); }
.tab {
  appearance: none; background: transparent; border: none; padding: 10px 14px; font-weight: 700; cursor: pointer;
  color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; border-radius: 8px 8px 0 0; min-height: 44px;
}
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.panel { padding: 14px 4px 4px; }
.formula {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 10px;
}
.formula .fn { color: var(--muted); font-size: .85rem; font-weight: 600; }
.formula .fv { font-size: 1.15rem; font-family: "Cambria Math", "STIX Two Math", Cambria, Georgia, serif; }
.guide { margin: 0; padding-left: 0; list-style: none; counter-reset: g; display: grid; gap: 10px; }
.guide li { counter-increment: g; display: flex; gap: 12px; align-items: flex-start; }
.guide li::before {
  content: counter(g); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800; font-size: .82rem; margin-top: 1px;
}
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .25em; font-size: .95em; line-height: 1.25; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 .3em; }
.frac > span:last-child { padding: 0 .3em; }
.rad { border-top: 1.5px solid currentColor; padding: 0 .2em; margin-left: 1px; }

.work { margin-top: 18px; border-top: 2px dashed var(--line); padding-top: 16px; }
.work h4 { font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.drop {
  border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; background: var(--bg);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.drag { border-color: var(--brand); background: var(--brand-soft); }
.drop b { display: block; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4/3; background: var(--bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb button.x {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}
.thumb.loading { display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.savestate { font-size: .82rem; color: var(--muted); min-height: 1.2em; }
.savestate.ok { color: var(--ok); }
.savestate.err { color: var(--bad); }

.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.sendbox { margin-top: 22px; }
.sendbox .miss { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.banner { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- modal / lightbox / toast ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(8, 12, 24, .6); z-index: 50; display: grid; place-items: center; padding: 16px;
}
.modal { background: var(--card); border-radius: 18px; padding: 22px; max-width: 460px; width: 100%; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 8px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.lightbox { background: rgba(0, 0, 0, .88); }
.lightbox img { max-width: 96vw; max-height: 90vh; border-radius: 8px; background: #fff; }
.lightbox .close { position: fixed; top: 14px; right: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 12px; z-index: 60; font-weight: 600; max-width: 92vw; box-shadow: var(--shadow);
}

/* ---------- guru ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input { width: auto; min-width: 150px; flex: 1; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; min-width: 760px; }
table.t th, table.t td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg); position: sticky; top: 0; }
table.t tr:last-child td { border-bottom: none; }
table.t tbody tr:hover { background: var(--brand-soft); cursor: pointer; }
.mini { display: flex; flex-wrap: wrap; gap: 3px; max-width: 250px; }
.mini i {
  width: 26px; height: 20px; border-radius: 5px; background: var(--line); font-style: normal; font-size: .62rem; font-weight: 700;
  display: grid; place-items: center; color: var(--muted);
}
.mini i.on { background: var(--ok); color: #fff; }
.mini i.tx { background: var(--warn-soft); color: var(--warn); }
.pcell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.detail { position: fixed; inset: 0; z-index: 40; background: rgba(8, 12, 24, .55); display: flex; justify-content: flex-end; }
.detail .sheet { width: min(760px, 100%); background: var(--bg); height: 100%; overflow-y: auto; padding: 18px; }
.ditem { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.ditem.empty { opacity: .65; }
.ditem h4 { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.keybox { background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 8px 12px; margin-top: 8px; font-size: .92rem; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin: 8px 2px 14px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; }
.center { min-height: 70vh; display: grid; place-items: center; }
.center .card { width: min(420px, 100%); }

@media (max-width: 560px) {
  .who { display: none; }
  .tab { padding: 10px 10px; }
  .q-text { font-size: 1.05rem; }
}
@media print {
  .topbar, .btn, .drop, .pager, .tabs { display: none !important; }
}

/* gambar per butir soal (voltmeter, osiloskop) */
.qfig { margin: 12px 0 4px; text-align: center; color: var(--ink); }
.qfig svg { max-width: 100%; height: auto; max-height: 300px; }
