:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #12263f;
  --accent: #f5a300;
  --accent-ink: #1f1500;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --warn-bg: #fef3c7;
  --grey-bg: #e5e7eb;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1520;
    --card: #162234;
    --ink: #f3f4f6;
    --muted: #9ca3af;
    --line: #2a3a52;
    --ok-bg: #12351f;
    --bad-bg: #3d1717;
    --warn-bg: #3a2e0b;
    --grey-bg: #263447;
    --ok: #4ade80;
    --bad: #f87171;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
.topbar {
  background: var(--brand); color: #fff; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 4px solid var(--accent);
}
.topbar .brand { font-weight: 800; letter-spacing: .02em; font-size: 18px; }
.topbar .brand small { display: block; font-weight: 500; opacity: .75; font-size: 12px; letter-spacing: 0; }
.topbar .date { font-size: 14px; opacity: .9; text-align: right; }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 18px; margin: 18px 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 12px; }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px 0; cursor: pointer; font-size: 14px; }

.btn {
  display: block; width: 100%; min-height: 56px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 18px; padding: 12px 16px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--card); color: var(--ink); border: 2px solid var(--line); }
.btn.green { background: var(--ok); color: #fff; }
.btn.inline { display: inline-block; width: auto; min-height: 40px; font-size: 15px; padding: 8px 14px; }

.idinput {
  width: 100%; font-size: 40px; text-align: center; letter-spacing: .4em; padding: 12px 8px 12px 20px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); margin: 8px 0 14px;
}
.idinput:focus { outline: 3px solid var(--accent); border-color: var(--accent); }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: 15px; }
.notice { background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; font-size: 15px; }

.talk-body { font-size: 19px; line-height: 1.6; }
.talk-body ul { padding-left: 22px; margin: 0 0 12px; }
.talk-body li { margin-bottom: 6px; }
.talk-body h3 { font-size: 19px; }
audio { width: 100%; margin: 4px 0 12px; }
.listen { display: flex; gap: 8px; margin: 4px 0 14px; }
.listen .btn { min-height: 48px; font-size: 16px; }
.progress { height: 10px; border-radius: 99px; background: var(--grey-bg); overflow: hidden; margin: 6px 0 4px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .9s linear; }

.qcount { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.opt {
  display: block; width: 100%; text-align: left; min-height: 56px; margin: 0 0 10px; padding: 12px 14px;
  border: 2px solid var(--line); background: var(--card); border-radius: 12px; font-size: 18px; cursor: pointer;
}
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.why { background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; margin: 4px 0 12px; font-size: 16px; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; font-size: 17px; }
.check input { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.bigok { font-size: 64px; text-align: center; margin: 4px 0; }
.center { text-align: center; }

/* ---------- admin ---------- */
.admin .wrap { max-width: 1150px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 0; background: var(--card); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 15px; }
.tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 28px; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--card); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); position: sticky; top: 0; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.pill.missed { background: var(--bad-bg); color: var(--bad); }
.pill.exempt { background: var(--grey-bg); color: var(--muted); }
.cell { text-align: center; font-weight: 800; border-radius: 6px; padding: 4px 0; min-width: 44px; cursor: default; }
.cell.done { background: var(--ok-bg); color: var(--ok); }
.cell.missed { background: var(--bad-bg); color: var(--bad); cursor: pointer; }
.cell.exempt { background: var(--grey-bg); color: var(--muted); cursor: pointer; font-size: 12px; }
.cell.future { color: var(--muted); font-weight: 400; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.row > .grow { flex: 1; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; color: var(--muted); }
.field input, .field textarea, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.field textarea { min-height: 220px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.qblock { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: var(--bg); }
.qblock .opts { display: grid; gap: 8px; margin: 8px 0; }
.qblock .optrow { display: flex; gap: 8px; align-items: center; }
.qblock .optrow input[type=text] { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.cov { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.cov div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 12px; min-height: 64px; }
.cov div.gap { background: var(--bad-bg); border-color: var(--bad); }
.cov div b { display: block; font-size: 13px; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--card); border-radius: 14px; padding: 20px; max-width: 420px; width: 100%; }
.modal .btn { margin-bottom: 8px; min-height: 46px; font-size: 16px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; font-size: 15px; }
.toast.bad { background: var(--bad); }
.hidden { display: none !important; }
.printonly { display: none; }
@media print {
  .printonly { display: block !important; }
  .topbar, .tabs, .noprint { display: none !important; }
  body { background: #fff; color: #000; font-size: 11px; }
  .wrap { max-width: none; padding: 0; }
  .tablewrap { overflow: visible; border: 0; }
  th { position: static; }
  @page { size: landscape; margin: 10mm; }
}
