/* STUDYMO PRINT — 写真から類題プリント（scan.html 専用） */
.vh{ position:absolute !important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.scan-wrap{ max-width:880px; margin-inline:auto; padding:20px 16px 64px; }
.scan-head .eyebrow{ font-size:12px; font-weight:700; letter-spacing:.14em; color:var(--red); }
.scan-head h1{ font-size:clamp(22px,5.4vw,32px); margin:4px 0 6px; }
.scan-head .h1-sub{ font-size:.6em; color:var(--ink-soft); margin-left:4px; }
.scan-head p{ font-size:14px; color:var(--ink-soft); margin:0; }

/* 手順 */
.scan-steps{ list-style:none; display:flex; gap:6px; padding:0; margin:16px 0; }
.scan-steps li{ flex:1; display:flex; align-items:center; justify-content:center; gap:6px; font-size:13px; font-weight:700; color:var(--ink-faint); background:#fff; border:1px solid var(--line); border-radius:999px; padding:6px 4px; }
.scan-steps b{ display:grid; place-items:center; width:22px; height:22px; border-radius:50%; background:var(--line); color:var(--ink); font-size:12px; }
.scan-steps li.on{ color:var(--red-deep); border-color:var(--red); background:var(--red-soft); }
.scan-steps li.on b{ background:var(--red); color:#fff; }
.scan-steps li.done b{ background:var(--ink); color:#fff; }

.scan-card{ background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); padding:20px 16px; margin-bottom:18px; }
.scan-card h2{ font-size:18px; margin-bottom:6px; }
.scan-card .note{ font-size:13px; color:var(--ink-soft); margin:0 0 12px; }
.rv-key{ color:var(--red-deep); font-weight:700; border:2px solid var(--red); border-radius:4px; padding:0 4px; }

/* 1. 撮影 */
.shot-btn{ display:flex; align-items:center; justify-content:center; gap:12px; width:100%; min-height:96px; padding:18px; border-radius:14px;
  background:var(--red); color:#fff; font-weight:700; font-size:clamp(17px,4.6vw,21px); cursor:pointer; box-shadow:0 4px 14px rgba(217,57,60,.25); text-align:center; }
.shot-btn:hover{ background:var(--red-deep); }
.shot-btn:active{ transform:scale(.99); }
#file:focus-visible + .tips, .shot-btn:focus-within{ outline:3px solid var(--ink); }
.tips{ list-style:none; padding:0; margin:14px 0 0; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.tips li{ background:var(--blue-soft); border-radius:10px; padding:10px; font-size:12px; line-height:1.5; color:var(--ink-soft); }
.tips b{ display:block; font-size:14px; color:var(--ink); }
@media (max-width:520px){ .tips{ grid-template-columns:1fr; } .tips li{ display:flex; gap:10px; align-items:baseline; } .tips b{ display:inline; flex:none; min-width:5.5em; } }

.preview{ margin-top:16px; }
.preview img{ display:block; max-width:100%; max-height:52vh; margin:0 auto; border-radius:8px; border:1px solid var(--line); background:var(--paper); }
.preview-acts, .cf-acts{ display:flex; gap:10px; margin-top:12px; flex-wrap:wrap; }
.preview-acts .btn, .cf-acts .btn{ flex:1 1 180px; justify-content:center; min-height:48px; font-size:15px; }
.btn, .btn.ghost{ min-height:44px; }

.loading{ display:flex; align-items:center; justify-content:center; gap:12px; margin-top:16px; padding:16px; border-radius:10px; background:var(--blue-soft); font-weight:700; font-size:14px; }
.spin{ width:22px; height:22px; border:3px solid var(--line); border-top-color:var(--red); border-radius:50%; animation:scspin .8s linear infinite; }
@keyframes scspin{ to{ transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce){ .spin{ animation-duration:2.4s; } }
.err{ margin:14px 0 0; padding:12px 14px; border-radius:10px; background:var(--red-soft); color:var(--red-deep); font-weight:700; font-size:14px; line-height:1.6; }
.warns{ margin:0 0 12px; padding:10px 14px 10px 30px; background:#FFF8E6; border:1px solid #EBD9A8; border-radius:10px; font-size:13px; }

/* 2. 確認リスト */
.plist{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:10px; }
.prow{ border:1.5px solid var(--line); border-radius:12px; padding:12px; background:#fff; }
.prow.review{ border:2.5px solid var(--red); background:#FFFBFB; }
.prow.review.ok{ border:1.5px solid var(--line); background:#fff; }
.prow-top{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-width:0; }
.prow .no{ font-weight:700; font-size:13px; color:var(--ink-faint); flex:none; }
.prow .tag{ font-size:11px; font-weight:700; padding:2px 8px; border-radius:999px; background:var(--blue-soft); color:var(--ink-soft); }
.prow .tag.rv{ background:var(--red); color:#fff; }
.prow .tag.na{ background:#EEE; color:#666; }
.prow .disp{ margin:8px 0; font-size:22px; min-height:1.6em; overflow-x:auto; overflow-y:hidden; max-width:100%; }
.prow .disp.bad{ font-size:14px; color:var(--red-deep); }
.prow-edit{ display:flex; gap:8px; align-items:stretch; }
.prow-edit input{ flex:1; min-width:0; min-height:44px; font:16px/1.3 ui-monospace,SFMono-Regular,Menlo,monospace; padding:8px 10px; border:1.5px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); }
.prow-edit input:focus{ outline:none; border-color:var(--ink); }
.icon-btn{ flex:none; min-width:44px; min-height:44px; border:1.5px solid var(--line); background:#fff; border-radius:8px; cursor:pointer; color:var(--ink-soft); font:700 13px var(--font-body); padding:0 10px; }
.icon-btn:hover{ border-color:var(--red); color:var(--red-deep); }
.rv-btn{ margin-top:8px; width:100%; min-height:44px; border:2px solid var(--red); background:#fff; color:var(--red-deep); border-radius:8px; font:700 14px var(--font-body); cursor:pointer; }
.prow.ok .rv-btn{ border-color:var(--line); color:var(--ink-soft); }
.prow .pnote{ font-size:12px; color:var(--ink-faint); margin:6px 0 0; }
.add-row{ margin-top:10px; width:100%; justify-content:center; }
.howto{ margin-top:12px; font-size:13px; color:var(--ink-soft); }
.howto summary{ cursor:pointer; min-height:44px; display:flex; align-items:center; font-weight:700; }
.howto code{ background:var(--blue-soft); padding:0 4px; border-radius:4px; }

.count-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:16px; padding-top:14px; border-top:1px dashed var(--line); flex-wrap:wrap; }
.count-row .lbl{ font-weight:700; }
.count-row small{ font-weight:400; color:var(--ink-faint); font-size:12px; }
.stepper{ display:flex; align-items:center; border:1.5px solid var(--line); border-radius:11px; overflow:hidden; }
.stepper button{ width:48px; height:48px; border:none; background:var(--blue-soft); font-size:22px; cursor:pointer; color:var(--ink); }
.stepper button:disabled{ opacity:.3; cursor:not-allowed; }
.stepper output{ width:64px; text-align:center; font-weight:700; font-size:20px; }

/* 3. プリント */
.sheet-bar{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.sheet-bar .btn{ flex:1 1 140px; justify-content:center; }
.tgl{ display:flex; align-items:center; gap:8px; min-height:44px; padding:0 14px; background:#fff; border:1.5px solid var(--line); border-radius:8px; font-weight:700; font-size:14px; cursor:pointer; flex:1 1 120px; justify-content:center; }
.tgl input{ width:20px; height:20px; accent-color:var(--red); }
.paper-scroll{ overflow:hidden; min-width:0; }
.sheet-fit{ transform-origin:top left; }
.sheet-a4{ width:210mm; min-height:297mm; margin:0 auto; background:#fff; border:1px solid var(--line); box-shadow:0 2px 4px rgba(38,41,46,.06),0 14px 34px rgba(38,41,46,.10); padding:16mm 14mm; box-sizing:border-box; color:var(--ink); line-height:1.5; }
.sheet-a4 .sh-head{ display:flex; justify-content:space-between; align-items:flex-end; border-bottom:3px solid var(--ink); padding-bottom:8px; margin-bottom:6px; }
.sheet-a4 .sh-title{ font-family:var(--font-disp); font-size:22px; font-weight:700; }
.sheet-a4 .sh-title .lv{ font-size:13px; color:var(--red); margin-left:8px; }
.sheet-a4 .sh-meta{ display:flex; gap:18px; font-size:11px; color:var(--ink-soft); align-items:flex-end; }
.sheet-a4 .sh-meta i{ font-style:normal; font-size:10.5px; }
.sheet-a4 .sh-meta u{ display:inline-block; text-decoration:none; border-bottom:1.2px solid var(--ink); height:1em; vertical-align:bottom; }
.sheet-a4 .shm-date u{ width:28px; }
.sheet-a4 .shm-name i{ margin-right:6px; }
.sheet-a4 .shm-name u{ width:170px; }
.sheet-a4 .shm-score u{ width:44px; }
.sheet-a4 .sh-sub{ display:flex; justify-content:space-between; font-size:11px; color:var(--ink-faint); margin-bottom:10px; }
.sheet-foot{ margin-top:14px; text-align:right; font-size:10px; color:var(--ink-faint); }

.rd-grp{ margin:10px 0 4px; font-size:12px; color:var(--ink-soft); font-weight:700; display:flex; gap:8px; align-items:center; border-left:4px solid var(--red); padding-left:8px; }
.rd-grp .m{ font-size:14px; color:var(--ink); font-weight:400; }
.rd-cols{ display:grid; grid-template-columns:1fr 1fr; gap:0 28px; }
.rd-cols.c1{ grid-template-columns:1fr; }
.rq{ display:flex; align-items:center; gap:10px; font-family:var(--font-disp); font-size:19px; padding:9px 0; border-bottom:1px dotted #DCDED5; min-height:58px; break-inside:avoid; }
.rq .qn{ font-size:12px; color:var(--ink-faint); min-width:30px; flex:none; }
.rq .body{ flex:1; display:flex; align-items:center; gap:8px; min-width:0; flex-wrap:wrap; }
.rq .eqs{ color:var(--red); font-weight:700; }
.rq .ansbox{ flex:1; min-width:70px; max-width:200px; min-height:38px; border:1.3px solid #b9b0a0; display:flex; align-items:center; padding:2px 8px; }
.rq .sol{ color:var(--red); font-weight:700; visibility:hidden; }
.sheet-a4.show-answers .rq .sol{ visibility:visible; }
.rq.wide .ansbox{ max-width:none; min-height:64px; flex-basis:100%; }
.rq.na{ color:var(--ink-faint); font-size:13px; }

/* 数式表示（確認リスト・用紙 共通） */
.mx{ display:inline-flex; align-items:center; gap:.18em; white-space:nowrap; font-family:var(--font-disp); }
.mx .op{ padding:0 .12em; }
.mx .fr{ display:inline-flex; flex-direction:column; align-items:center; vertical-align:middle; font-size:.82em; line-height:1.1; margin:0 .08em; }
.mx .fr > span{ padding:0 .2em; }
.mx .fr > .dn{ border-top:1.4px solid currentColor; }
.mx .mixw{ margin-right:.05em; }
.mx sup{ font-size:.65em; vertical-align:.7em; line-height:0; }
.mx .rt{ display:inline-flex; align-items:flex-start; }
.mx .rt > .rad{ border-top:1.4px solid currentColor; padding:0 .1em; }
.mx .var{ font-style:italic; font-family:"Times New Roman",serif; }
.mx .sep{ margin:0 .4em; color:var(--ink-faint); }

/* 印刷：用紙だけ */
@media print{
  @page{ size:A4; margin:0; }
  html, body{ margin:0 !important; padding:0 !important; background:#fff !important; }
  .no-print, .head-top, .gnav, .foot, .scan-head, .scan-steps, .scan-card, .sheet-bar, .search-results{ display:none !important; }
  .scan-wrap{ padding:0 !important; margin:0 !important; max-width:none !important; }
  #stSheet{ display:block !important; }
  .paper-scroll{ overflow:visible !important; border:none !important; }
  .sheet-fit{ transform:none !important; width:auto !important; height:auto !important; }
  .sheet-a4{ border:none !important; box-shadow:none !important; margin:0 !important; width:210mm !important; min-height:0 !important; max-height:297mm !important; overflow:hidden !important; break-inside:avoid; }
  .rq .ansbox{ border-color:#999; }
}

/* 読み取り方のタブ */
.mode-tabs{ display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:16px 0 0; padding:4px; background:#fff; border:1px solid var(--line); border-radius:14px; }
.mode-tabs button{ min-height:52px; border:none; border-radius:10px; background:transparent; color:var(--ink-soft); font:700 14px/1.3 var(--font-body); cursor:pointer; padding:6px 8px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.mode-tabs button small{ font-size:11px; font-weight:400; color:var(--ink-faint); }
.mode-tabs button[aria-selected="true"]{ background:var(--ink); color:#fff; }
.mode-tabs button[aria-selected="true"] small{ color:rgba(255,255,255,.75); }
.mode-tabs button:focus-visible{ outline:3px solid var(--red); outline-offset:1px; }

/* コード読み取り：カメラ */
.cam{ position:relative; width:100%; aspect-ratio:4/3; max-height:62vh; border-radius:12px; overflow:hidden; background:#1d2024; }
.cam video, .cam canvas{ position:absolute; inset:0; width:100%; height:100%; }
.cam video{ object-fit:cover; }
.cam canvas{ pointer-events:none; }
.cam-idle{ position:absolute; inset:0; display:grid; place-items:center; padding:16px; background:var(--blue-soft); }
.cam-idle .shot-btn{ border:none; font-family:var(--font-body); max-width:420px; }
.cam.on .cam-idle{ display:none; }
.cam-count{ position:absolute; top:10px; right:10px; background:rgba(0,0,0,.6); color:#fff; font-weight:700; font-size:15px; padding:4px 12px; border-radius:999px; }
.cam-count.bump{ background:#1E9E5A; }
.cam-toast{ position:absolute; left:50%; bottom:12px; transform:translate(-50%,8px); max-width:calc(100% - 24px); background:#1E9E5A; color:#fff; font-weight:700; font-size:14px; padding:8px 14px; border-radius:999px; opacity:0; transition:opacity .2s, transform .2s; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; pointer-events:none; }
.cam-toast.show{ opacity:1; transform:translate(-50%,0); }
.cam-toast.gray{ background:rgba(0,0,0,.7); }
.cam-acts{ display:flex; gap:10px; margin-top:10px; flex-wrap:wrap; }
.cam-acts .btn{ flex:1 1 160px; justify-content:center; min-height:48px; }
.cam-msg{ margin:12px 0 0; padding:12px 14px; border-radius:10px; background:#FFF8E6; border:1px solid #EBD9A8; font-size:14px; line-height:1.7; }
.cam-msg b{ color:var(--red-deep); }

/* コード読み取り：一覧 */
.clist-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:18px; }
.clist-head h3{ font-size:16px; margin:0; }
.clist-head h3 span{ margin-left:8px; font-size:13px; color:var(--ink-soft); }
.clist-empty{ font-size:13px; color:var(--ink-faint); margin:8px 0 0; }
.clist{ list-style:none; padding:0; margin:8px 0 0; display:flex; flex-direction:column; gap:8px; }
.crow{ display:flex; align-items:center; gap:10px; border:1.5px solid var(--line); border-radius:12px; padding:8px 8px 8px 12px; background:#fff; min-width:0; }
.crow.new{ animation:cflash 1.2s ease-out; }
@keyframes cflash{ from{ background:#E3F6EA; border-color:#1E9E5A; } }
.crow .no{ font-weight:700; font-size:13px; color:var(--ink-faint); flex:none; min-width:2.2em; }
.crow .cmain{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.crow .tag{ align-self:flex-start; font-size:11px; font-weight:700; padding:1px 8px; border-radius:999px; background:var(--blue-soft); color:var(--ink-soft); }
.crow .disp{ font-size:20px; overflow-x:auto; overflow-y:hidden; max-width:100%; }
.crow.off{ background:#F4F4F1; border-style:dashed; }
.crow.off .disp, .crow.off .tag{ opacity:.45; text-decoration:line-through; }
.crow .icon-btn{ flex:none; }
.crow.off .icon-btn{ border-color:var(--ink); color:var(--ink); }
@media (prefers-reduced-motion:reduce){ .crow.new{ animation:none; } .cam-toast{ transition:none; } }

/* プリント1枚のコード → 間違えた問題にチェック */
.ck-go{ width:100%; justify-content:center; margin-top:10px; min-height:48px; }
.ck-sheet{ margin-top:14px; }
.ck-sheet-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:8px; }
.ck-sheet-head h3{ font-size:16px; margin:0; min-width:0; overflow-wrap:anywhere; }
.ck-sheet-head h3 small{ margin-left:6px; font-size:12px; font-weight:400; color:var(--ink-soft); }
.ck-sheet-acts{ display:flex; gap:6px; }
.ck-list{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:8px; }
.ck-row{ display:flex; align-items:center; gap:12px; width:100%; min-height:56px; padding:8px 12px; border:1.5px solid var(--line); border-radius:12px; background:#fff; cursor:pointer; text-align:left; font:inherit; color:var(--ink); min-width:0; }
.ck-row:hover{ border-color:var(--red); }
.ck-row:focus-visible{ outline:3px solid var(--ink); outline-offset:2px; }
.ck-row .box{ flex:none; align-self:center; line-height:1; display:grid; place-items:center; width:30px; height:30px; border:2px solid var(--ink-faint); border-radius:8px; background:#fff; color:#fff; font-weight:700; font-size:18px; }
.ck-row .no{ flex:none; font-weight:700; font-size:14px; color:var(--ink-soft); min-width:2.4em; }
.ck-row .disp{ flex:1; min-width:0; font-size:20px; overflow-x:auto; overflow-y:hidden; }
.ck-row[aria-pressed="true"]{ border-color:var(--red); background:var(--red-soft); }
.ck-row[aria-pressed="true"] .box{ background:var(--red); border-color:var(--red); }
.ck-row.na{ cursor:default; background:#F4F4F1; border-style:dashed; }
.ck-row.na .disp{ font-size:13px; color:var(--ink-faint); }
.ck-more{ margin-top:14px; }
.ck-more .btn{ width:100%; justify-content:center; min-height:48px; }
.ck-bar{ position:sticky; bottom:0; z-index:2; display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:14px -16px -20px; padding:12px 16px; background:rgba(255,255,255,.96); border-top:1px solid var(--line); border-radius:0 0 12px 12px; }
.ck-count{ font-weight:700; font-size:15px; }
.ck-bar .btn{ flex:1 1 240px; justify-content:center; min-height:52px; font-size:15px; }
.ck-bar .btn:disabled{ opacity:.45; cursor:not-allowed; }

/* [OMR v0.5] 写真の□から自動で選んだとき（qr-mode.js） */
.ck-auto{ margin:0 0 8px; padding:8px 12px; border-radius:10px; background:var(--paper,#F4F3EF); font-size:13px; line-height:1.6; color:var(--ink); }
.ck-auto.warn{ color:var(--ink-soft); }
.ck-row.unsure{ border-color:var(--red); border-style:dashed; }
.ck-unsure{ flex:none; margin-left:auto; padding:2px 8px; border-radius:999px; border:1px solid var(--red); color:var(--red); font-size:11px; font-weight:700; white-space:nowrap; }

/* 2026-10-21 撮影をいちばん上に（iPhoneで確実に動く、標準カメラで撮る形） */
.shot-main{display:grid;gap:10px;margin:12px 0 6px}
.shot-main .btn{justify-content:center;min-height:52px;font-size:16px}
.shot-main .shot-big{gap:10px;font-size:18px;min-height:60px}
.cam-alt{font-size:12px;color:var(--ink-faint);margin:14px 0 6px;text-align:center}

/* hidden属性がボタンの表示指定に負けないように */
#stCode [hidden], #stCheck [hidden]{display:none !important}

/* 2026/11/16
   ・hidden をつけたものは必ず消す（.loading{display:flex} などに負けて「読み取り中です…」が出たままになっていた）
   ・1つ目のタブの赤い主ボタンは「プリントを撮る」だけ。「カメラでQRを読む」は白地の副ボタンに
   ・読めなかったときの案内（「写真から読む」へ） */
.scan-wrap [hidden]{ display:none !important; }
.cam-idle .shot-btn{ min-height:64px; background:#fff; color:var(--ink); border:1.5px solid var(--ink); box-shadow:none; font-size:16px; }
.cam-idle .shot-btn:hover{ background:var(--ink); color:#fff; }
.cam-msg-alt{ display:inline-flex; align-items:center; min-height:44px; margin:2px 0 -6px; padding:0 2px; border:0; background:none; font:inherit; font-weight:700; color:var(--red-deep); text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
