/* 共テ演習ノート
   紙：#F3F5F8 ／ 鉛筆：#1E2430 ／ 藍：#27408B（操作）／ 朱：#D23B2E（採点の丸・時間超過）
*/
:root {
  --paper: #F3F5F8;
  --surface: #FFFFFF;
  --ink: #1E2430;
  --ink-2: #5B6474;
  --line: #DCE1E8;
  --ai: #27408B;
  --ai-weak: #E6EBF6;
  --shu: #D23B2E;
  --shu-weak: #FBE8E5;
  --old: #6E5A1E;
  --old-weak: #F1EBD9;
  --ok: #1D7A4C;
  --radius: 12px;
  --radius-m: 12px;
  --warn: #B7791F;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.7;
  font-feature-settings: "palt" 1;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a, button, input, select, textarea, label, summary { touch-action: manipulation; }
a { color: var(--ai); }
code { font-size: .9em; background: var(--ai-weak); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 3px solid rgba(39, 64, 139, .45); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 上部バー ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(243, 245, 248, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 760px; margin: 0 auto; padding: 8px 12px; display: flex; align-items: center; gap: 8px; min-height: 52px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; line-height: 1.3; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -6px; color: var(--ink); border-radius: 50%; }
.back svg { width: 24px; height: 24px; }
.brand-dot { width: 14px; height: 9px; border-radius: 50%; background: var(--ink); margin: 0 6px 0 4px; flex: none; }

.wrap { max-width: 760px; margin: 0 auto; padding: 14px 14px 24px; }
.crumbs { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 2px 6px; line-height: 1.5; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs .sep { opacity: .45; }
h2 { font-size: 15px; color: var(--ink-2); font-weight: 700; margin: 26px 2px 8px; }
.muted { color: var(--ink-2); font-size: 13px; }
.center { text-align: center; }
.small { font-size: 13px; }
.hello { font-size: 22px; font-weight: 900; margin: 4px 2px 14px; }

/* ---------- まとまり ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 14px; padding: 0; list-style: none; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; min-height: 60px; }
a.row:active { background: var(--ai-weak); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 700; line-height: 1.45; }
.row .sub { font-size: 13px; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.row .chev { color: #A3ABB8; display: grid; flex: none; }
.row .chev svg, .folder-ico svg { width: 20px; height: 20px; }
.folder-ico { color: var(--ai); display: grid; }
.folders .row { min-height: 72px; }
.count { font-size: 13px; color: var(--ink-2); white-space: nowrap; }

.score { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 17px; }
.score small { font-weight: 500; color: var(--ink-2); font-size: 12px; }
.score-box { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.badge-sub { font-size: 11px; color: var(--ink-2); }
.muted-score { font-size: 12px; color: #A3ABB8; font-weight: 500; }
.round-no { font-size: 24px; font-weight: 900; line-height: 1; min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.round-no small { display: block; font-size: 10px; font-weight: 500; color: var(--ink-2); }

.tag { display: inline-block; font-size: 11.5px; line-height: 1; padding: 4px 7px; border-radius: 5px; background: var(--ai-weak); color: var(--ai); font-weight: 700; vertical-align: 2px; white-space: nowrap; }
.tag.old { background: var(--old-weak); color: var(--old); }
.tag.shu { background: var(--shu-weak); color: var(--shu); }
.tag.done { background: #E2F2E9; color: var(--ok); }
.tag.gray { background: #ECEFF3; color: var(--ink-2); }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; background: #E2F2E9; color: #145A37; font-size: 14px; display: block; text-decoration: none; }
.flash.err { background: var(--shu-weak); color: #9B2A20; }
.flash.warn { background: #FFF3D6; color: #7A5300; }
.flash.linkish::after { content: "›"; float: right; font-weight: 700; }
.linkish { color: var(--ai); text-decoration: none; }

/* ---------- ボタン・フォーム ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; user-select: none; -webkit-user-select: none; text-align: center; line-height: 1.3; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ai); border-color: var(--ai); color: #fff; }
.btn.danger { color: var(--shu); border-color: #F0C4BF; }
.btn.block { display: flex; width: 100%; margin-bottom: 10px; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn.added { background: var(--ai-weak); border-color: transparent; color: var(--ai); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.btn-grid .btn { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--ai); font: inherit; font-size: 14px; padding: 6px 4px; cursor: pointer; }

.field { margin-bottom: 16px; }
.lbl { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); min-height: 46px;
}
textarea { line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--ai); outline: none; box-shadow: 0 0 0 3px rgba(39, 64, 139, .15); }
.limit-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.limit-row input[type=number] { width: 92px; }
.limit-row select { width: auto; }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 14px; cursor: pointer; color: var(--ink); text-decoration: none; min-height: 40px; user-select: none; -webkit-user-select: none; }
.chk input { accent-color: var(--ai); width: 18px; height: 18px; margin: 0; }
.chk:has(input:checked) { border-color: var(--ai); background: var(--ai-weak); color: var(--ai); font-weight: 700; }
.subj-group + .subj-group { margin-top: 14px; }
.subj-kyouka { font-size: 13px; color: var(--ink-2); font-weight: 700; margin-bottom: 6px; }

.seg { display: flex; gap: 4px; background: #E5E9EF; padding: 4px; border-radius: 11px; margin-bottom: 14px; overflow-x: auto; }
.seg a, .seg label { flex: 1; text-align: center; padding: 9px 10px; border-radius: 8px; font-size: 14px; font-weight: 700; color: var(--ink-2); text-decoration: none; white-space: nowrap; cursor: pointer; }
.seg a.on, .seg label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(30, 36, 48, .12); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg-in { margin-bottom: 10px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl input, .tbl select { min-height: 40px; padding: 6px 8px; }
.scroll-x { overflow-x: auto; }

/* ---------- 下部タブ ---------- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; max-width: 132px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 7px; font-size: 11px; color: #7A8394; text-decoration: none; }
.tabbar a.on { color: var(--ai); font-weight: 700; }
.tabbar svg { width: 24px; height: 24px; }

/* ---------- 認証 ---------- */
.auth { max-width: 420px; margin: 24px auto 0; }
.auth-lead { font-size: 28px; font-weight: 900; line-height: 1.25; margin: 0 0 22px; }
.auth-lead span { display: block; font-size: 14px; font-weight: 500; color: var(--ink-2); margin-top: 6px; }

/* ---------- 科目ページ ---------- */
.item-head { margin: 0 2px 14px; }
.item-title { font-size: 26px; font-weight: 900; line-height: 1.3; }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-2); margin-top: 6px; align-items: center; }
.start .hint { margin: 4px 0 0; }

/* ---------- タイマー ---------- */
.run { text-align: center; padding-top: 6px; }
.run-subject { font-size: 22px; font-weight: 900; }
.run-mode { display: inline-block; margin: 22px 0 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; background: #fff; }
.timer { font-size: clamp(64px, 23vw, 132px); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.05; margin: 8px 0 6px; }
.timer.over { color: var(--shu); }
.timer.paused { opacity: .45; }
.run-sub { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: 14px; align-items: center; min-height: 28px; }
.run-sub b { font-variant-numeric: tabular-nums; color: var(--ink); }
.run-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin: 30px 0 18px; }
.run-more { text-align: left; }
.run-more summary { font-weight: 700; cursor: pointer; padding: 2px 0; }
.run-more .limit-row { margin-top: 12px; }
.mini-timer { font-size: 15px; }
.mini-timer.over { color: var(--shu); }

/* ---------- 採点 ---------- */
.score-page { padding-bottom: 24px; }
.score-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 2px 10px; }
.title-l { font-weight: 900; font-size: 18px; }
.title-l .muted { font-weight: 500; }
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; counter-reset: st; }
.stepper li { counter-increment: st; font-size: 13px; font-weight: 700; color: #8A93A3; padding: 8px 0 6px; border-bottom: 3px solid var(--line); text-align: center; cursor: pointer; }
.stepper li::before { content: counter(st) " "; }
.stepper li.on { color: var(--ink); border-color: var(--ink); }
.range-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.range-row .rlabel { font-weight: 700; min-width: 5.5em; }
.range-row input[type=number] { width: 76px; }
.range-row select { width: auto; }
.pages-info { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; margin: 0 0 12px; }
.photo-list { list-style: none; padding: 0; margin: 12px 0 0; }
.photo-item { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ok-text { color: var(--ok); font-weight: 700; }
.err-text { color: var(--shu); font-weight: 700; }
.warn-text { color: #8A5A00; margin-bottom: 6px; }

.tally { display: flex; align-items: center; gap: 14px; font-weight: 700; margin: 0 2px 10px; font-variant-numeric: tabular-nums; }
.tally .ok { color: var(--shu); }
.tally .ng { color: var(--ink-2); }
.tally .linkbtn { margin-left: auto; }

.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.qtop { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); font-weight: 700; }
.qlabel { font-size: 40px; font-weight: 900; line-height: 1.15; margin: 2px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.qlabel.num small { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.verdict { font-size: 30px; margin-left: auto; }
.verdict.ok { color: var(--shu); }
.verdict.ng { color: var(--ink-2); }
.crop { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); margin-bottom: 8px; background: #fff; }
.qread { margin: 4px 0 10px; font-size: 14px; font-weight: 700; }
.qrow-title { font-size: 12px; color: var(--ink-2); font-weight: 700; margin: 10px 0 6px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.ch { position: relative; height: 46px; border-radius: 50% / 42%; border: 1.5px solid #C9CFD8; background: #fff; font: inherit; font-weight: 700; font-size: 18px; color: var(--ink); padding: 0; cursor: pointer; user-select: none; -webkit-user-select: none; }
.ch.none { border-radius: 10px; font-size: 13px; grid-column: span 2; }
.ch.mine { background: var(--ink); border-color: var(--ink); color: #fff; }
.ch.key { box-shadow: 0 0 0 3px var(--shu); border-color: var(--shu); }
.ch.ghost { background: #E9ECF1; }
.maru { display: block; width: 100%; height: 88px; margin: 14px 0 4px; border-radius: 16px; border: 3px solid var(--shu); background: #fff; color: var(--shu); font: inherit; font-size: 54px; font-weight: 900; line-height: 1; cursor: pointer; user-select: none; -webkit-user-select: none; }
.maru.on { background: var(--shu); color: #fff; }
.maru:active { transform: scale(.985); }
.qnav { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 14px; }
.qnav .btn { padding: 0 6px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; }
.qgrid-sec { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-top: 4px; }
.qchip { border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 0; font: inherit; display: flex; flex-direction: column; align-items: center; line-height: 1.2; cursor: pointer; }
.qchip b { font-size: 14px; }
.qchip span { font-size: 12px; color: var(--ink-2); }
.qchip.ok { border-color: var(--shu); color: var(--shu); }
.qchip.ng { background: #ECEFF3; }
.qchip.cur { box-shadow: 0 0 0 2px var(--ai); }
.total-score { display: flex; align-items: baseline; gap: 8px; justify-content: center; margin: 4px 0 12px; }
.total-score b { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; }
.sec-score + .sec-score { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.sec-score-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.sec-score-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.sec-score-grid label span { display: block; font-size: 12px; color: var(--ink-2); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 記録・成績 ---------- */
.big-score { text-align: center; padding: 8px 0 4px; }
.big-score b { font-size: 56px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.big-score .of { font-size: 18px; color: var(--ink-2); }
.big-score .pct { display: block; font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.meta-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
.wrong-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: 14px; }
.wrong-list li { display: flex; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--line); }
.wrong-list b { min-width: 3em; }
.bar { height: 8px; background: #E5E9EF; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--ai); border-radius: 4px; }
.chart-box { position: relative; height: 240px; }
.total-card { text-align: center; }
.total-card .t-label { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.total-card b { font-size: 48px; font-weight: 900; font-variant-numeric: tabular-nums; }
.subj-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.subj-chips a { flex: none; }
.chk.on { border-color: var(--ai); background: var(--ai-weak); color: var(--ai); font-weight: 700; }

/* ---------- 印刷 ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.thumbs canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.thumbs figcaption { font-size: 12px; color: var(--ink-2); text-align: center; }
.thumbs figure { margin: 0; }

/* ---------- 管理 ---------- */
.admin-sec { margin-bottom: 18px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form > * { flex: 1 1 120px; }
.sec-edit td { padding: 4px 3px; }
.sec-edit input[type=text] { min-width: 90px; }
.sec-edit input[type=number] { width: 72px; }
.req-card .row { align-items: flex-start; }

@media (min-width: 700px) {
  .wrap { padding: 20px 20px 32px; }
  .qcard { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- 管理画面の補助 ---- */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.row-details[open] > summary { background: var(--ai-weak); }
.round-box { border-top: 1px solid var(--line); padding: 12px 0; }
.round-box:first-of-type { border-top: 0; }
.round-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.round-head .title { font-weight: 700; flex: 1; }
.tpl-pick { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 8px 0; }
.tpl-pick .subj-kyouka { margin-top: 6px; }
.item-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; background: #F1F3F6; border-radius: 6px; padding: 3px 8px; margin: 2px 4px 2px 0; }
.item-chip a { text-decoration: none; }
.warn-note { color: #7A5300; font-size: 13px; }

/* ---- マークシート（横向き）・読み取り確認 ---- */
.thumbs { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ov-thumb { display: block; width: 100%; max-width: 360px; height: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; }
.ov-thumb.big { max-width: none; cursor: zoom-out; }
.photo-item { overflow-x: auto; }

/* ---- 動線をわかりやすく ---- */
.guide { font-size: 14px; color: var(--ink-2); background: var(--ai-weak); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.home-actions { display: grid; gap: 10px; margin: 4px 0 20px; }
.action { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; text-decoration: none; color: inherit; }
.action .a-title { display: block; font-size: 17px; font-weight: 900; }
.action .a-sub { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.action.primary { background: var(--ai); border-color: var(--ai); }
.action.primary .a-title, .action.primary .a-sub { color: #fff; }
.action.primary .a-sub { opacity: .85; }
.action:active { transform: scale(.995); }
.howto { margin: 6px 0 12px; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.howto li { margin-bottom: 4px; }
.stepper { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 1fr; }
.stepper li.done { color: var(--ai); border-color: var(--ai); }
.qchip.mark.blank { border-style: dashed; color: var(--ink-2); }
.qchip.mark.multi { border-color: var(--warn); color: var(--warn); }
.ch.big-ch { height: 56px; font-size: 20px; }
.ch.mine-ring { box-shadow: inset 0 0 0 2px var(--ink-2); }
.ans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.ans-chip { display: flex; flex-direction: column; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 4px 2px; font-size: 13px; }
.ans-chip b { font-size: 12px; color: var(--ink-2); font-weight: 700; }
.ans-chip span { font-weight: 900; }

/* ---- 解答用紙の上でタップして入力 ---- */
.sheetwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 10px; }
.sheetbox { position: relative; }
.sheetimg { display: block; width: 100%; height: auto; }
.cellbtn { position: absolute; margin: 0; padding: 0; border: 0; background: transparent; border-radius: 45%/32%; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.cellbtn.on { background: rgba(28, 127, 70, .35); box-shadow: inset 0 0 0 2px #1C7F46; }
.cellbtn.read { box-shadow: inset 0 0 0 2px rgba(28, 127, 70, .4); }
.cellbtn.key.on { background: rgba(210, 55, 43, .32); box-shadow: inset 0 0 0 2px #D2372B; }
.cellbtn.mine::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #2B2F36; }
.cellbtn:active { background: rgba(39, 64, 139, .3); }
.colhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 6px; font-size: 14px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 12px; }
.legend .lg::before { content: ''; display: inline-block; width: 15px; height: 11px; border-radius: 7px/5px; margin-right: 5px; vertical-align: -1px; }
.legend .lg.on::before { background: rgba(28, 127, 70, .35); box-shadow: inset 0 0 0 2px #1C7F46; }
.legend .lg.read::before { box-shadow: inset 0 0 0 2px rgba(28, 127, 70, .4); }
.legend .lg.key::before { background: rgba(210, 55, 43, .32); box-shadow: inset 0 0 0 2px #D2372B; }
.legend .lg.mine::before { background: #2B2F36; border-radius: 50%; width: 11px; }
.plain-row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.plain-row .rlabel { width: 42px; font-weight: 700; }
.review-sheet { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 8px; cursor: zoom-in; }
.review-sheet.big { width: 220%; max-width: none; cursor: zoom-out; }
.review-wrap { overflow-x: auto; }

/* 選択肢ボタンの番号表示 */
.cellbtn .cellnum { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-weight: 900; color: transparent; pointer-events: none; line-height: 1; }
.cellbtn.on { background: rgba(21, 122, 66, .55); }
.cellbtn.on .cellnum { color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.85), 0 1px 2px rgba(0,0,0,.9); }
.cellbtn.read .cellnum { color: #0E5C33; text-shadow: 0 0 3px #fff, 0 0 5px #fff; }
.cellbtn.key.on { background: rgba(198, 40, 30, .6); }
.cellbtn.key.on .cellnum { color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.8), 0 1px 2px rgba(0,0,0,.9); }
.filter-box .inline-form > label { flex: 1 1 100px; }
.filter-box select { width: 100%; }

/* 選択中のマークをはっきり見せる */
.cellbtn.on { background: rgba(23, 122, 66, .55); box-shadow: inset 0 0 0 2px #0B5230; }
.cellbtn.key.on { background: rgba(200, 45, 34, .55); box-shadow: inset 0 0 0 2px #8E2018; }
.cellbtn .cellnum { font-size: 15px; }
.cellbtn.on .cellnum, .cellbtn.key.on .cellnum { color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, .9), 0 0 6px rgba(0, 0, 0, .7); }
.cellbtn.read .cellnum { color: #0B5230; font-size: 14px; text-shadow: 0 0 3px #fff, 0 0 6px #fff; }

/* 選んだ選択肢の番号をはっきり見せる（白いバッジ） */
.cellbtn .cellnum { font-size: 1em; }
.cellbtn.on .cellnum, .cellbtn.key.on .cellnum {
  width: auto; height: auto; min-width: 1.5em; padding: .05em .25em;
  margin: auto; border-radius: 999px; background: rgba(255, 255, 255, .94);
  font-size: 1.15em; font-weight: 900; line-height: 1.25; text-shadow: none;
}
.cellbtn.on .cellnum { color: #0B5230; border: 1.5px solid #0B5230; }
.cellbtn.key.on .cellnum { color: #8E2018; border: 1.5px solid #8E2018; }
.cellbtn.read .cellnum { font-size: 1.05em; }

/* 文書ページ */
.doc h3 { font-size: 15px; margin: 18px 0 6px; }
.doc h3:first-of-type { margin-top: 4px; }
.doc p, .doc li { font-size: 14px; line-height: 1.8; }
.doc ul, .doc ol { padding-left: 20px; margin: 6px 0 10px; }
.center { text-align: center; }
.small { font-size: 12px; }

/* 結果の点数表 */
.score-table th, .score-table td { white-space: nowrap; vertical-align: middle; }
.score-table input { width: 86px; }
.total-card .warn-text { margin-top: 6px; font-size: 13px; }
.code-sample { background: #F1F3F6; border-radius: 8px; padding: 10px 12px; font-size: 13px; overflow-x: auto; white-space: pre; }
.nudge { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.nudge .btn.small { min-width: 44px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
.site-note { font-size: 11px; color: var(--ink-2); text-align: center; margin: 24px 0 8px; line-height: 1.6; }
.sel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.sel-crop { width: 150px; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.secret-q { margin: 2px 0 6px; padding: 8px 10px; border-radius: 8px; background: var(--ai-weak); font-weight: 700; }
.pages-left { margin-top: 8px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.pages-left.warn { color: #B45309; background: #FFF7E6; border: 1px solid #F5D08A; border-radius: 8px; padding: 8px 10px; }
.pages-left.ok { color: #1F7A4D; }
.review-notes { margin: 0 0 10px; padding: 8px 12px 8px 26px; background: #FFF7E6; border: 1px solid #F5D08A; border-radius: 8px; font-size: 13px; }
.review-notes li { margin: 2px 0; }
.choose-row { width: 100%; background: transparent; border: 0; text-align: left; font: inherit; cursor: pointer; }

/* 共有解答：配点の確認 */
.pt-summary .pt-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pt-cell { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 999px; background: var(--ai-weak); font-size: 13px; }
.pt-cell b { font-weight: 700; }
.ans-chip em { display: block; font-style: normal; font-size: 11px; color: var(--ink-2); line-height: 1.3; min-height: 1.3em; }
.ans-chip i { display: block; font-style: normal; font-size: 10px; color: var(--ai); line-height: 1.2; }
.ans-chip.no-pt em { color: var(--shu); }

/* 抜けていたスタイル */
.ranges { display: grid; gap: 8px; margin-top: 10px; }
.total-line { font-weight: 700; font-size: 16px; margin: 12px 0; }
.steps-guide .howto { margin-bottom: 10px; }

/* 採点する大問・範囲の調整を目立たせる */
.range-panel { border: 2px solid var(--ai); background: var(--ai-weak); }
.range-panel > summary { padding: 2px 0; }
.range-panel .range-hint { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--ai); }
.choose-row.muted-row .title { color: var(--ink-2); }
.warn-panel { border: 2px solid var(--warn); }
.tag.ok { background: #E3F4EA; color: #1B7F3B; }

/* 大問ごとのタイマー・画面のマークシート */
.sec-timer-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.sec-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; }
.sec-btn .tm { font-size: 12px; color: var(--ink-2); }
.sec-btn.on { border-color: var(--ai); background: var(--ai-weak); color: var(--ai); }
.sec-btn.on .tm { color: var(--ai); }
.sheet-rows { display: grid; gap: 6px; margin-top: 8px; }
.sheet-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sheet-row .no { min-width: 30px; font-weight: 700; font-size: 13px; }
.cellbtn.screen { position: static; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 14px; }
.cellbtn.screen.on { background: var(--ai); border-color: var(--ai); color: #fff; font-weight: 700; }
.screen-opt { margin: 10px 0 4px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-in { background: var(--surface); border-radius: 14px; padding: 18px; max-width: 420px; width: 100%; }
.modal-in .btn-grid { margin: 14px 0 6px; }
.bar { display: inline-block; height: 10px; border-radius: 999px; background: var(--ai); min-width: 4px; }
.sec-timer { margin-bottom: 12px; }
.sec-btn .nm { font-weight: 700; font-size: 13px; }
.screen-sheet { margin-bottom: 12px; }

/* 写真の画面のボタン */
.btn.ghost { background: var(--surface); color: var(--ai); border: 2px solid var(--ai); }
.btn.block.big { padding: 16px; font-size: 16px; line-height: 1.4; }
.btn .btn-sub { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; opacity: .85; }
.range-panel { margin-bottom: 12px; }
.range-panel > summary { list-style: none; cursor: pointer; }
.range-panel > summary::-webkit-details-marker { display: none; }
.range-panel > summary b { display: block; font-size: 15px; color: var(--ai); }
.gen-picks { flex-direction: column; align-items: flex-start; gap: 10px; }
.gen-picks .chk { display: flex; align-items: center; gap: 8px; }
.marks-cell { font-family: ui-monospace, monospace; letter-spacing: 1px; }

/* 共有された成績の表示 */
.share-head { border: 2px solid var(--ai); background: var(--ai-weak); }
.share-view a.row { pointer-events: none; }
.share-view a.row .chev { display: none; }
.share-view .btn { display: none; }
.share-view .seg a, .share-view .chk { pointer-events: auto; }
