/* アクチュアリー一次試験（私用）— 画面の見た目。参考書（LaTeX）の配色（紺・青緑・れんが・黄土）に合わせる */
:root {
  --bg: #f7f6f2;
  --paper: #ffffff;
  --ink: #1d232b;
  --sub: #5b6470;
  --line: #e2dfd7;
  --navy: #1f3a5a;
  --teal: #1f6f6b;
  --brick: #a2432f;
  --ochre: #9a6b12;
  --slate: #5a6878;
  --ok: #1f6f4a;
  --ng: #a2432f;
  --soft: #eef2f6;
  --radius: 8px;
  --tabh: 56px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.8 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  text-wrap: pretty;
}
a { color: var(--navy); }
h1, h2, h3, h4 { line-height: 1.45; text-wrap: balance; word-break: auto-phrase; }
.nw { display: inline-block; }
h1 { font-size: 24px; margin: 4px 0 12px; }
h2 { font-size: 19px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.sub { color: var(--sub); font-size: 14px; }
.lead { color: var(--sub); }
.loading { color: var(--sub); }
.big { font-size: 28px; font-weight: 700; line-height: 1.3; }

/* 枠組み */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.side { display: none; }
main { padding: 16px 16px calc(var(--tabh) + 24px + env(safe-area-inset-bottom)); max-width: 980px; width: 100%; margin: 0 auto; outline: none; min-width: 0; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a, .tabbar button {
  min-height: var(--tabh); display: flex; align-items: center; justify-content: center;
  color: var(--sub); text-decoration: none; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer;
}
.tabbar [aria-current="page"] { color: var(--navy); font-weight: 700; box-shadow: inset 0 3px 0 var(--navy); }
@media (min-width: 900px) {
  .shell { grid-template-columns: 232px 1fr; }
  .side {
    display: block; position: sticky; top: 0; height: 100vh; overflow: auto;
    background: var(--paper); border-right: 1px solid var(--line); padding: 16px 12px;
  }
  .tabbar { display: none; }
  main { padding: 24px 32px 48px; }
  .brand { display: block; font-weight: 700; color: var(--navy); text-decoration: none; margin: 0 6px 14px; font-size: 17px; }
  .navlist a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; min-height: 36px; }
  .navlist a[aria-current="page"] { background: var(--soft); color: var(--navy); font-weight: 700; }
  .navsub { margin: 14px 10px 4px; font-size: 13px; color: var(--sub); }
  .navfoot { margin-top: 18px; padding: 0 6px; display: grid; gap: 10px; font-size: 13px; color: var(--sub); }
}

/* 部品 */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.panel.warn { border-color: #e2c48a; background: #fffaf0; }
details.panel > summary, details > summary { cursor: pointer; min-height: 32px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.row.tight { margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 6px 16px; border-radius: 6px; border: 1px solid #c9c5bb;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 15px; text-decoration: none; cursor: pointer;
}
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 14px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { border-color: var(--brick); color: var(--brick); }
.btn:disabled { opacity: .45; cursor: default; }
.btn[aria-pressed="true"] { background: var(--soft); border-color: var(--navy); color: var(--navy); font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 4px 0; min-height: 32px; color: var(--navy); text-decoration: underline; font: inherit; cursor: pointer; }
.chip { min-height: 34px; padding: 4px 12px; border-radius: 17px; border: 1px solid #c9c5bb; background: var(--paper); font: inherit; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 4px; background: var(--soft); color: var(--slate); font-size: 13px; font-weight: 400; vertical-align: middle; }
.crumb { font-size: 14px; margin: 0 0 4px; }
.crumb a { display: inline-flex; align-items: center; min-height: 32px; }
input[type="date"], input[type="number"], input[type="email"], input:not([type]), select, textarea {
  font: inherit; font-size: 16px; padding: 6px 8px; border: 1px solid #c9c5bb; border-radius: 6px; background: #fff; min-height: 40px; max-width: 100%;
}
textarea { width: 100%; }
label { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
label.chk { min-height: 32px; }
label.chk input { width: 20px; height: 20px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 10px; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.tabs a, .tabs button {
  flex: none; padding: 8px 14px; min-height: 42px; display: flex; align-items: center; color: var(--sub); text-decoration: none;
  border: 0; background: none; font: inherit; cursor: pointer; border-bottom: 3px solid transparent;
}
.tabs [aria-current="page"] { color: var(--navy); border-bottom-color: var(--navy); font-weight: 700; }
.tablewrap { overflow-x: auto; margin: 8px 0 12px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; font-size: 15px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { border-bottom: 1.5px solid var(--ink); font-weight: 600; white-space: nowrap; }
table.list { width: 100%; }
td > a { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; min-width: 32px; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.steps { padding-left: 1.4em; margin: 0; }

/* ホーム */
.subjgrid { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 0 0 16px; }
@media (min-width: 700px) { .subjgrid { grid-template-columns: 1fr 1fr; } }
.subjcard { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-top: 4px solid var(--navy); }
.subjcard h2 a { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; }
.when { margin: 0 0 8px; }
.next { color: var(--teal); }
.today .todayrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: center; margin: 4px 0 8px; }

/* 重要度・状況 */
.juyo { display: inline-block; padding: 0 7px; border-radius: 3px; color: #fff; font-size: 13px; font-weight: 600; line-height: 1.7; vertical-align: 2px; white-space: nowrap; }
.juyo.jS { background: var(--brick); }
.juyo.jA { background: var(--ochre); }
.juyo.jB { background: var(--slate); }
.plist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; }
.plist li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plist li.dim { opacity: .4; }
.st { font-size: 13px; padding: 0 6px; border-radius: 3px; background: var(--soft); color: var(--slate); }
.st-wrong { background: #f6e3de; color: var(--brick); }
.st-learning { background: #e2efe8; color: var(--ok); }
.st-master { background: var(--ok); color: #fff; }

/* 参考書の本文 */
.toc { padding-left: 1.2em; margin: 0; }
.toc li { margin: 4px 0; }
.toc a, .secnav a { display: inline-flex; align-items: center; min-height: 32px; }
.toc .sub { margin-left: 8px; }
.secnav { margin: 0 0 16px; }
.secnav ol { margin: 6px 0 0; }
.book, .qbody, .kaitou, .official { overflow-wrap: anywhere; }
.book h2 { font-size: 20px; color: var(--navy); border-bottom: 1.5px solid var(--navy); padding-bottom: 4px; margin: 32px 0 12px; scroll-margin-top: 12px; }
.book h3 { font-size: 17px; color: var(--teal); }
.book h4 { font-size: 16px; }
.readmark { margin: 12px 0 24px; text-align: right; }
.chapintro { color: var(--sub); border-left: 3px solid var(--line); padding-left: 12px; margin: 0 0 16px; }
.chapdata { background: var(--soft); border-radius: 6px; padding: 10px 14px; margin: 0 0 16px; }
.chapdata dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; }
.chapdata dt { color: var(--navy); font-weight: 600; }
.chapdata dd { margin: 0; }
@media (max-width: 520px) { .chapdata dl { grid-template-columns: 1fr; } .chapdata dd { margin-bottom: 6px; } }
.youten, .koushiki, .teigi, .otoshiana, .kakomon, .hosoku, .reidai, .checklist {
  margin: 16px 0; padding: 12px 14px; border-radius: 4px; background: var(--paper);
}
.youten { background: #eef2f7; border-left: 4px solid var(--navy); }
.koushiki { border: 1px solid var(--teal); }
.teigi { border: 1px solid var(--slate); }
.otoshiana { background: #faf0ed; border-left: 4px solid var(--brick); }
.kakomon { background: #faf5e9; border-left: 4px solid var(--ochre); }
.hosoku { background: #f4f3ef; }
.reidai { border-top: 1.5px solid var(--teal); border-bottom: 1px solid var(--teal); border-radius: 0; padding-left: 0; padding-right: 0; }
.checklist { background: var(--soft); }
.boxtitle { font-weight: 700; margin: 0 0 6px; }
.youten > .boxtitle { color: var(--navy); }
.koushiki > .boxtitle { color: var(--teal); }
.otoshiana > .boxtitle { color: var(--brick); }
.kakomon > .boxtitle { color: var(--ochre); }
.reidai > .boxtitle { color: var(--teal); }
.kai { font-weight: 700; color: var(--teal); }
.pointline { margin: 10px 0; }
.pointline::before { content: "ここが要点　"; color: var(--teal); font-weight: 700; }
.seikai { font-weight: 700; margin: 0 0 10px; }
.seikai::before { content: "正解　"; color: var(--brick); }
.haiten::before { content: "配点　"; color: var(--slate); font-weight: 700; }
.fukushu::before { content: "復習先　"; color: var(--slate); font-weight: 700; }
.figcap { text-align: center; color: var(--sub); font-size: 14px; margin: 8px 0; }
figure { margin: 16px 0; text-align: center; }
figure > figcaption { color: var(--sub); font-size: 14px; }
img.fig { display: block; margin: 12px auto; max-width: 100%; height: auto; cursor: zoom-in; }
.center { text-align: center; }
.center .tablewrap, .table .tablewrap { display: flex; justify-content: safe center; }
.ku { display: inline-block; min-width: 3em; padding: 0 6px; border: 1px solid var(--navy); border-radius: 2px; text-align: center; line-height: 1.5; margin: 0 2px; }
.mathd, .katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: 2px 0; }
.katex { font-size: 1.08em; }
dl { margin: 8px 0; }
dt { font-weight: 600; }
dd { margin-left: 2em; }
.shiwake, .tkanjou { display: flex; justify-content: center; }

/* 問題 */
.solvehead, .examhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.examhead h1 { font-size: 19px; margin: 0; }
.qtitle { font-size: 20px; margin: 8px 0 4px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); }
.timer.warn { color: var(--brick); }
.problem { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.choices { list-style: none; padding: 0; margin: 10px 0 14px; display: grid; gap: 6px 18px; }
.choices.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choices.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices.c1 { grid-template-columns: 1fr; }
@media (max-width: 600px) { .choices.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .choices.c2 { grid-template-columns: 1fr; } }
.choices li { display: flex; gap: 4px; min-width: 0; }
.choices .cl { flex: none; color: var(--slate); }
.choices .ct { min-width: 0; overflow-x: auto; }
.sheet { border-top: 1.5px solid var(--line); margin-top: 14px; padding-top: 10px; }
.sheet-h { font-size: 16px; margin: 0 0 6px; }
.brow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.bl { min-width: 3.4em; font-weight: 700; }
.bbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.bk { min-width: 40px; min-height: 40px; border: 1px solid #c9c5bb; border-radius: 6px; background: #fff; font: inherit; cursor: pointer; }
.bk[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.sheet.locked .bk { cursor: default; }
.bk.right { box-shadow: 0 0 0 3px var(--ok) inset; }
.brow.ok .bmark { color: var(--ok); font-weight: 700; }
.brow.ng .bmark { color: var(--ng); font-weight: 700; }
.verdict { font-size: 20px; font-weight: 700; margin: 8px 0; }
.verdict.ok { color: var(--ok); }
.verdict.ng { color: var(--ng); }
.kaitou { background: var(--paper); border: 1px solid var(--navy); border-left-width: 4px; border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.memo textarea { min-height: 64px; }
pre.memo { white-space: pre-wrap; font: inherit; }
details.lead { margin: 6px 0; }
.qnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.qnav button { min-height: 36px; min-width: 64px; border: 1px solid #c9c5bb; border-radius: 6px; background: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.qnav .done { background: var(--soft); }
.qnav .flag { border-color: var(--ochre); box-shadow: 0 0 0 2px var(--ochre) inset; }
.qnav .cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager { justify-content: space-between; }

/* 過去問の PDF */
.pdfbox { height: 70vh; overflow: auto; background: #d9d7d0; border-radius: var(--radius); padding: 8px; --pdfw: 100%; }
.pdfbox.tall { height: calc(100vh - 260px); min-height: 420px; }
.pdfpage { position: relative; width: var(--pdfw); max-width: none; margin: 0 auto 8px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.pdfpage canvas { display: block; width: 100%; height: auto; }
.pdfpage .pno { position: absolute; right: 6px; top: 4px; font-size: 12px; color: var(--sub); background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 3px; }
.pastwrap { display: grid; gap: 12px; }
@media (min-width: 1100px) { .pastwrap { grid-template-columns: 1fr 320px; align-items: start; } .pastwrap .pdfbox { height: calc(100vh - 180px); } }
.jumps { margin: 4px 0; }
table.past td { white-space: nowrap; }

/* 電卓 */
.calc {
  position: fixed; z-index: 40; right: 12px; bottom: calc(var(--tabh) + 12px + env(safe-area-inset-bottom));
  width: 260px; background: var(--paper); border: 1px solid #b9b5ab; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); padding: 10px;
}
@media (min-width: 900px) { .calc { bottom: 16px; } }
.calc[hidden] { display: none; }
.chead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.cscreen { display: flex; justify-content: space-between; align-items: baseline; background: #eef0ea; border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
.cind { font-size: 12px; color: var(--sub); min-width: 2em; }
.cdisp { font: 600 24px/1.3 ui-monospace, "SF Mono", Menlo, monospace; overflow: hidden; text-overflow: ellipsis; }
.ckeys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ck { min-height: 42px; border: 1px solid #c9c5bb; border-radius: 6px; background: #fff; font: inherit; font-size: 17px; cursor: pointer; }
.ck.op { background: var(--soft); }

/* ダイアログ・通知・拡大 */
.dlg-back, .zoom { position: fixed; inset: 0; z-index: 60; background: rgba(20,24,30,.45); display: grid; place-items: center; padding: 16px; }
.dlg { background: var(--paper); border-radius: 10px; padding: 18px; max-width: 420px; width: 100%; }
.zoom { background: rgba(20,24,30,.8); }
.zoomin { max-width: 100%; max-height: 100%; overflow: auto; background: #fff; border-radius: 8px; padding: 12px; }
.zoomin img { display: block; width: min(1400px, 200vw); max-width: none; height: auto; }
.zoom .close { position: fixed; top: 12px; right: 12px; min-height: 44px; min-width: 44px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + 20px); transform: translateX(-50%); background: #263240; color: #fff; padding: 8px 16px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 70; font-size: 15px; }
#toast.on { opacity: 1; }
.syncdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #bbb; margin-right: 6px; }
.syncdot.ok { background: var(--ok); }
.syncdot.err { background: var(--ng); }
.syncdot.busy { background: var(--ochre); }
.qr-box { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 10px; }
@media (min-width: 640px) { .qr-box { grid-template-columns: 220px 1fr; } }
.qr svg { width: 220px; height: 220px; }
.official h2 { font-size: 18px; color: var(--navy); margin-top: 20px; }
.official em { font-style: normal; font-weight: 600; }

/* 公開版 */
.panel.lock { border-color: #c9d3de; background: #f5f8fb; }
.code { font: 600 15px/1.4 ui-monospace, "SF Mono", Menlo, monospace; background: var(--soft); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.pdfframe { width: 100%; height: 100%; min-height: 70vh; border: 0; background: #fff; border-radius: 6px; }
.pdfbox.pdflink { height: auto; min-height: 0; background: var(--paper); border: 1px solid var(--line); }
.pdfout { padding: 8px 6px; }
.seo-intro { max-width: 760px; }
html.pw-bar-on .tabbar { bottom: 0; }
label select, label input { min-width: 0; max-width: 100%; }
.row > label { max-width: 100%; }
select { width: auto; max-width: min(100%, 520px); text-overflow: ellipsis; }
.pjump input { width: 5.5em; }
