/* mathbank.asia: satu file CSS, mobile-first. */
:root {
  --bg: #ffffff;
  --fg: #1b1f24;
  --muted: #5b6470;
  --line: #dfe3e8;
  --accent: #1f5fbf;
  --accent-fg: #ffffff;
  --ok: #1a7f37;
  --bad: #b42318;
  --warn: #9a6700;
  --surface: #f6f8fa;
  --radius: 8px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --fg: #e6e8eb;
    --muted: #9aa3ad;
    --line: #2c323a;
    --accent: #6ea8fe;
    --accent-fg: #0f1115;
    --ok: #4ac26b;
    --bad: #ff7b72;
    --warn: #d29922;
    --surface: #161a20;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.nav { display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { text-decoration: none; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 16px 0 32px; }
.site-footer p { margin: 6px 0; }
.muted { color: var(--muted); }
.message { max-width: 560px; }
h1 { font-size: 1.6rem; line-height: 1.25; }
.btn {
  display: inline-block; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-fg); text-decoration: none; font: inherit; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--accent); }

/* Formulir dan komponen (4C) */
.narrow { max-width: 520px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; background: var(--surface); }
.card h2 { margin-top: 0; font-size: 1.2rem; }
.field { margin: 0 0 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field.check label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.field.check input { margin-top: 4px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input:not([type]), .field select, .field textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.field.has-error input, .field.has-error select { border-color: var(--bad); }
.field .hint { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.field .error { margin: 4px 0 0; color: var(--bad); font-size: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }
.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.alert.ok { border-color: var(--ok); }
.alert.error { border-color: var(--bad); color: var(--bad); }
.alert.warn { border-color: var(--warn); }
form.inline { display: inline; }
.inline-right { float: right; margin-top: -48px; }
@media (max-width: 600px) { .inline-right { float: none; margin: 0 0 12px; } }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.site-header .nav form.inline .linklike { text-decoration: none; }
details summary { cursor: pointer; }

/* Katalog, beranda, halaman statis (4D) */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.set-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--bg); }
.set-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.set-card h3 { margin: 0; font-size: 1.1rem; }
.set-card .cats { padding-left: 18px; margin: 8px 0; font-size: 14px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.badge.free { border-color: var(--ok); color: var(--ok); }
.badge.owned { border-color: var(--accent); color: var(--accent); }
.badge.locked { color: var(--muted); }
.status { font-size: 14px; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.paper-link { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--fg); }
.paper-link span { display: block; }
.hero { padding: 8px 0 16px; }
.lead { font-size: 1.1rem; }
.note { font-size: 14px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }
.price .amount { font-size: 1.8rem; font-weight: 700; margin: 4px 0; }
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.6em; font-size: 1.25rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
textarea { width: 100%; padding: 10px 12px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }

/* Pemutar tes (4E) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.player-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 0; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; }
.timer.low { color: var(--warn); }
.timer.critical { color: var(--bad); }
.save-status { font-size: 13px; color: var(--muted); }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin: 12px 0; }
.qbtn { min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; cursor: pointer; }
.qbtn.answered { background: var(--surface); border-color: var(--ok); }
.qbtn.flagged { box-shadow: inset 0 -3px 0 var(--warn); }
.qbtn.current { outline: 2px solid var(--accent); }
.question { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.qhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.qhead h2 { margin: 0; font-size: 1.2rem; }
.qtext { margin: 12px 0; overflow-x: auto; }
.qtext table { border-collapse: collapse; }
.qtext td, .qtext th { border: 1px solid var(--line); padding: 4px 8px; }
img.fig { max-width: 100%; height: auto; display: block; margin: 12px auto; background: #fff; border-radius: 4px; }
.answer label { font-weight: 600; display: block; margin-bottom: 4px; }
.answer-input { width: 100%; max-width: 360px; font-size: 1.2rem; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--fg); }
.answer-input:focus { border-color: var(--accent); }
.symbols { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sym { min-width: 44px; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); font: inherit; cursor: pointer; }
.warn-comma { color: var(--warn); font-size: 14px; }
.answer .flag { font-weight: 400; display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.qnav { display: flex; justify-content: space-between; margin-top: 16px; gap: 8px; }
.finish-panel { border: 2px solid var(--accent); border-radius: var(--radius); padding: 16px; }
.finish-bottom { margin-top: 24px; text-align: right; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; z-index: 20; }
.overlay[hidden] { display: none; }
.overlay-box { background: var(--bg); padding: 20px; border-radius: var(--radius); max-width: 420px; margin: 16px; }
.score { font-size: 1.2rem; }
table.results { border-collapse: collapse; width: 100%; }
table.results th, table.results td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }

/* Hasil, laporan, solusi bertanda air (4F) */
.small { font-size: 14px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
table.report { width: 100%; border-collapse: collapse; }
table.report th, table.report td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.barcell { min-width: 110px; }
.bar { display: block; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin: 4px 0; }
.bar .fill { display: block; height: 100%; background: var(--accent); }
.bar .fill.ok { background: var(--ok); }
.bar .fill.warn { background: var(--warn); }
.bar .fill.bad { background: var(--bad); }
.bar .fill.muted { background: var(--muted); }
.lvl { font-size: 13px; white-space: nowrap; }
.lvl.ok { color: var(--ok); } .lvl.warn { color: var(--warn); } .lvl.bad { color: var(--bad); } .lvl.muted { color: var(--muted); }
.subs li { margin: 6px 0; }
.review { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
.review.right { border-left-color: var(--ok); }
.review.wrong { border-left-color: var(--bad); }
.review h3 { margin: 0; font-size: 1.1rem; }
.sol-wrap summary { font-weight: 600; margin: 8px 0; }
.solusi { position: relative; overflow: hidden; padding: 8px 0; }
.solusi .sol-body { position: relative; }
.wm { position: absolute; inset: -40% -20%; display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around;
  transform: rotate(-30deg); pointer-events: none; user-select: none; opacity: .13; font-size: 13px; color: var(--fg); z-index: 2; }
.wm span { padding: 18px 24px; white-space: nowrap; }
@media print { .wm { opacity: .18; } details.sol-wrap > *:not(summary) { display: block; } .site-header, .site-footer { display: none; } }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.qtext, .sol-body { overflow-wrap: anywhere; }
.barcell { width: 45%; }

/* Admin (4H) */
.admin-nav { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; font-size: 14px; }
.table-wrap { overflow-x: auto; }
table.admin { border-collapse: collapse; width: 100%; font-size: 14px; }
table.admin th, table.admin td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
table.admin code { white-space: pre-wrap; word-break: break-all; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.admin-actions form, table.admin form { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-actions input, table.admin input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding: 4px 12px; }
