/* ヤバい契約書チェック */
:root {
  --red: #d0101a;
  --ink: #1f1a16;
  --paper: #fffdf8;
  --desk1: #6b4a2f;
  --desk2: #4a321f;
  --ui: 'Zen Maru Gothic', system-ui, sans-serif;
  --mincho: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --hand: 'Klee One', 'Zen Maru Gothic', cursive;
  --hud-h: 78px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--desk2) repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.03) 0 3px, transparent 3px 11px), linear-gradient(160deg, var(--desk1), var(--desk2));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
/* 審査中は、ページ全体を動かさない（スクロールするのは契約書の枠だけ） */
html.lock, html.lock body { height: 100%; overflow: hidden; overscroll-behavior: none; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

.screen { min-height: 100%; padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }

/* ---------------- ボタン ---------------- */
.btn {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 10px auto 0;
  padding: 13px 16px;
  border: 0;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.btn-main { background: var(--red); color: #fff; }
.btn-sub { background: #f3ead8; color: #4a321f; }
.btn-x { background: #111; color: #fff; }
.btn-line { background: #06c755; color: #fff; }
.btn-share { background: #4a6ee0; color: #fff; }
.share-row { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
.share-row .btn { flex: 1 1 140px; margin-top: 10px; font-size: 15px; }

.corner-mute {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  z-index: 50;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  font-size: 18px;
}

/* ---------------- タイトル ---------------- */
.title-inner, .intro-inner, .result-inner, .file-inner {
  max-width: 600px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 6px;
  padding: 28px 18px 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  position: relative;
}
.logo { position: relative; text-align: center; padding-top: 8px; }
.logo h1 {
  margin: 0;
  font-family: var(--mincho);
  font-weight: 800;
  font-size: clamp(40px, 13vw, 64px);
  line-height: 1.12;
  letter-spacing: 0.04em;
}
.logo h1 em { font-style: normal; color: var(--red); }
/* 「危」の印は「ヤバい」のすぐ右に並べる（題字の大きさに合わせて大きさが変わり、字に重ならない） */
.logo-stamp {
  display: inline-grid;
  place-items: center;
  width: 1.75em;
  height: 1.75em;
  margin-left: 0.12em;
  font-size: 0.6em;
  line-height: 1;
  letter-spacing: 0;
  vertical-align: 0.25em;
  border: 0.1em solid var(--red);
  border-radius: 50%;
  color: var(--red);
  font-family: var(--mincho);
  font-weight: 800;
  transform: rotate(-14deg);
  opacity: 0.85;
  mix-blend-mode: multiply;
}
.catch { text-align: center; margin: 14px 0 6px; font-weight: 700; font-size: 15px; letter-spacing: 0.08em; color: #6b4a2f; }
.howto { font-size: 14px; line-height: 1.8; text-align: center; margin: 10px 0 18px; }
.list-head { font-size: 15px; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #e0d4bd; }
.stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.case {
  width: 100%;
  text-align: left;
  border: 1px solid #c9b48c;
  border-radius: 4px 12px 4px 4px;
  background: linear-gradient(#f6e7c4, #eed9ab);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  color: #3a2a1c;
  box-shadow: 0 2px 0 #b8a27a;
}
.case:active { transform: translateY(1px); }
.case-no { grid-row: span 2; align-self: center; white-space: nowrap; font-size: 12px; background: #fff8e6; border: 1px solid #c9b48c; padding: 4px 6px; border-radius: 4px; }
.case-name { font-family: var(--mincho); font-weight: 700; font-size: 17px; }
/* 長い名前（13 字以上）は、スマホで折り返さないように小さめにする */
.case-name.long { font-size: clamp(13px, 3.7vw, 17px); }
.case-meta { font-size: 12px; color: #6b5a40; }
.case.locked { background: #e6e1d6; color: #8a8478; box-shadow: none; cursor: default; }
.case.locked .case-name { letter-spacing: 0.2em; }
.ok-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--red); border-radius: 50%; color: var(--red); font-size: 11px; transform: rotate(-10deg); }
#btn-file { margin-top: 18px; }
.note { font-size: 11px; color: #776; margin: 16px 0 4px; line-height: 1.6; }
.links { font-size: 12px; text-align: center; margin: 10px 0 0; }
.ver { position: absolute; right: 10px; bottom: 6px; font-size: 11px; color: #b0a490; }

/* ---------------- 依頼 ---------------- */
.intro-case { font-size: 13px; color: #6b4a2f; margin: 0 0 12px; font-weight: 700; }
.memo {
  position: relative;
  background: #fff6a8;
  padding: 18px 16px 14px;
  margin: 6px 6px 18px;
  transform: rotate(-1.2deg);
  box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.2);
  font-family: var(--hand);
}
.memo::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  width: 90px;
  height: 22px;
  margin-left: -45px;
  background: rgba(220, 220, 200, 0.7);
  transform: rotate(2deg);
}
.memo-from { margin: 0 0 6px; font-size: 13px; color: #6b5a20; }
.memo-text { margin: 0; font-size: 17px; line-height: 1.7; }
.envelope {
  margin: 0 auto 16px;
  max-width: 340px;
  background: linear-gradient(#d9b77a, #c9a463);
  border-radius: 4px;
  padding: 26px 14px 18px;
  text-align: center;
  position: relative;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}
.envelope::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 14px;
  background: linear-gradient(#b8915a, transparent);
}
.env-title { display: inline-block; background: #fffdf3; padding: 8px 14px; font-family: var(--mincho); font-weight: 700; font-size: 16px; border: 1px solid #a88850; }
.rules { margin: 0 0 8px; padding-left: 1.2em; font-size: 15px; line-height: 1.9; }
.rules b { color: var(--red); }
.rules li.alert { list-style: none; margin: 0 0 8px -1.2em; }
.rule-alert { display: block; border: 2px solid var(--red); background: rgba(200, 16, 46, 0.08); border-radius: 6px; padding: 8px 12px; line-height: 1.7; }
body[data-stage='demon'] .memo { background: #2a1b2e; color: #e8d8f0; }
body[data-stage='demon'] .memo-from { color: #b090c0; }
body[data-stage='demon'] .envelope { background: #151015; }
body[data-stage='demon'] .env-title { background: #2a0a0a; color: #ff5050; border-color: #600; }

/* ---------------- 審査中 ---------------- */
.play { padding: 0; }
.hud {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: calc(var(--hud-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0;
  background: #2b1f15;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  touch-action: none; /* ヘッダーの上ではスクロールを始めない（iPhone で枠が動かなくなるのを防ぐ） */
}
.hud-row { display: flex; align-items: center; gap: 8px; height: 38px; max-width: 800px; margin: 0 auto; }
.hud-name { flex: 1; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-btn { width: 34px; height: 30px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 15px; flex: none; }
#btn-loupe { width: auto; padding: 0 10px; background: #f3d36b; color: #3a2a1c; font-weight: 700; }
.timer { position: relative; flex: 1; height: 26px; background: rgba(255, 255, 255, 0.12); border-radius: 13px; overflow: hidden; }
.timer-bar { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#5fc46a, #3a9a46); transition: width 0.2s linear; }
.timer-bar.hurry { background: linear-gradient(#f05050, #b01818); animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.6; } }
.timer-text { position: relative; display: block; text-align: center; line-height: 26px; font-weight: 900; font-size: 14px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); font-variant-numeric: tabular-nums; }
.hud-found { flex: none; font-size: 13px; letter-spacing: 0.05em; }
.hud-found b { color: #ff5a5a; }

.desk {
  position: fixed;
  inset: calc(var(--hud-h) + env(safe-area-inset-top)) 0 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 18px 10px calc(90px + env(safe-area-inset-bottom));
}
body[data-stage='demon'] .desk { background: radial-gradient(circle at 50% 30%, #3a1630, #0c060c 70%); }
/* アプリは、スマホの画面（.doc）の中だけをスクロールさせる（上のバーと下の同意ボタンを画面に貼りつける） */
body[data-stage='app'] .desk { background: #2c2c30; overflow: hidden; padding-bottom: max(12px, env(safe-area-inset-bottom)); }

.doc {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  background: var(--paper);
  padding: 30px 20px 40px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  font-family: var(--mincho);
  font-size: 15px;
  line-height: 1.95;
  color: #222;
  user-select: none;
  -webkit-user-select: none;
}
.doc p { margin: 0; }
.doc .doc-title { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 0.25em; margin: 4px 0 18px; }
.doc .doc-title small { display: block; font-size: 14px; letter-spacing: 0.1em; }
.doc .lead { text-indent: 1em; margin-bottom: 14px; }
.doc .right { text-align: right; }
.doc .small { font-size: 0.82em; color: #555; margin-top: 10px; }
.doc h3 { font-size: 1em; font-weight: 700; margin: 16px 0 2px; }
.doc .para { display: flex; gap: 0.5em; }
.doc .para .pn { flex: none; min-width: 1em; }
.doc .para .pb { flex: 1; }
.doc .para:not(:has(.pn)) .pb { text-indent: 1em; }
.doc .item { display: flex; gap: 0.2em; padding-left: 0.5em; }
.doc .item .pn { flex: none; }
.doc .note { font-size: 0.85em; color: #444; padding-left: 1em; text-indent: -1em; margin-top: 2px; }

/* タップできる文 */
.s { cursor: pointer; border-radius: 3px; transition: background-color 0.15s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (hover: hover) {
  .s:hover { background: rgba(255, 220, 0, 0.28); }
}
.s:active { background: rgba(255, 200, 0, 0.4); }
.s.checked { cursor: default; background: none; text-decoration: underline dotted #8a9aa8; text-underline-offset: 4px; color: #667; }
.s.hit {
  cursor: default;
  background: rgba(220, 0, 0, 0.06);
  box-shadow: 0 0 0 2px var(--red);
  border-radius: 12px;
  padding: 0 2px;
  animation: circle 0.35s ease-out;
}
@keyframes circle { from { box-shadow: 0 0 0 10px rgba(208, 16, 26, 0); } to { box-shadow: 0 0 0 2px var(--red); } }
.s.missed { background: rgba(255, 0, 0, 0.15); outline: 2px dashed var(--red); outline-offset: 2px; animation: missed 0.8s ease-in-out 3; }
@keyframes missed { 50% { background: rgba(255, 0, 0, 0.35); } }
.tsukkomi {
  display: inline-block;
  margin: 0 0.3em;
  font-family: var(--hand);
  font-weight: 600;
  color: var(--red);
  font-size: 0.95em;
  line-height: 1.4;
  text-indent: 0;
  transform: rotate(-2deg);
  animation: pop 0.3s ease-out;
}
.tsukkomi::before { content: '← '; }
@keyframes pop { from { transform: scale(0.4) rotate(-8deg); opacity: 0; } }

/* 署名欄・物件の表示 */
.doc .sig-date { margin: 26px 0 10px; }
.doc .sigs p { margin: 10px 0; line-height: 2.2; }
.doc .blank { display: inline-block; width: 9em; border-bottom: 1px solid #999; margin-left: 0.5em; }
.doc .inkan {
  display: inline-grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  margin-left: 0.8em;
  border: 2px solid #c8102e;
  border-radius: 50%;
  color: #c8102e;
  font-size: 0.8em;
  vertical-align: middle;
  line-height: 1;
}
.doc .inkan.empty { border: 1px dashed #aaa; color: #aaa; }
.doc .prop { border-collapse: collapse; margin: 20px 0 0; width: 100%; font-size: 0.9em; }
.doc .prop caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
.doc .prop th, .doc .prop td { border: 1px solid #555; padding: 4px 8px; text-align: left; }
.doc .prop th { width: 6em; background: #f3f0e8; font-weight: 400; }
.art.special { margin-top: 22px; border: 1px solid #555; padding: 4px 12px 10px; }
.art.special h3 { text-align: center; letter-spacing: 0.3em; }
.art.special .pb { text-indent: 0 !important; }

/* 1. 賃貸：収入印紙の欄 */
.doc-rent::before {
  content: '収入\A印紙';
  white-space: pre;
  position: absolute;
  top: 18px;
  left: 16px;
  width: 52px;
  height: 60px;
  border: 1px dashed #999;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
  color: #999;
}
.doc-rent .doc-title { margin-top: 44px; }

/* 2. 表の書式（労働条件通知書） */
.layout-table { font-size: 14px; line-height: 1.75; }
.layout-table .form-no { font-size: 12px; color: #555; }
.layout-table .addressee { font-size: 16px; margin: 6px 0 10px; text-decoration: underline; text-underline-offset: 5px; }
.layout-table .right { margin-bottom: 14px; font-size: 13px; }
.form { width: 100%; border-collapse: collapse; }
.form th, .form td { border: 1px solid #333; padding: 6px 8px; vertical-align: top; text-align: left; }
.form th { width: 7.5em; background: #eef1f4; font-weight: 700; font-size: 13px; }
.form td .para + .para { margin-top: 4px; }
.form td .pb { text-indent: 0 !important; }

/* 3. 修正履歴 */
.layout-redline .draft {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 2px solid #1a4fd6;
  color: #1a4fd6;
  padding: 2px 8px;
  font-size: 12px;
  font-family: var(--ui);
  font-weight: 700;
  transform: rotate(4deg);
}
.layout-redline .doc-title { margin-top: 26px; }
.s.ins { color: #1840c8; text-decoration: underline; text-decoration-color: #1840c8; text-underline-offset: 3px; }
.del { color: #c33; text-decoration: line-through; opacity: 0.8; }

/* 4. アプリの利用規約（スマホの画面） */
.layout-app {
  max-width: 400px;
  padding: 0;
  border-radius: 22px;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-size: 13px;
  line-height: 1.75;
  color: #444;
  border: 8px solid #111;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.layout-app .app-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  height: 46px;
  background: #fafafc;
  border-bottom: 1px solid #ddd;
  text-align: center;
  font-weight: 700;
  color: #111;
}
.layout-app .app-back { font-size: 26px; color: #2a7cf6; }
.layout-app .app-hero { display: flex; gap: 12px; align-items: center; padding: 16px; background: linear-gradient(#e9f5ec, #fff); }
.layout-app .app-hero p { margin: 0; color: #333; }
.layout-app .app-icon { width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, #3cc06a, #179a48); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 900; flex: none; }
.layout-app .lead { padding: 0 16px; text-indent: 0; font-size: 12.5px; }
.layout-app .art { padding: 0 16px; }
.layout-app h3 { font-size: 13.5px; color: #111; margin-top: 18px; }
.layout-app .para .pb { text-indent: 0 !important; }
.layout-app .right, .layout-app .small { padding: 0 16px; }
.layout-app .app-agree {
  position: sticky;
  bottom: 0;
  margin-top: 20px;
  padding: 12px 16px 16px;
  background: #fff;
  border-top: 1px solid #ddd;
  font-size: 13px;
}
.layout-app .app-agree label { display: block; margin-bottom: 8px; color: #666; }
.app-agree-btn { width: 100%; padding: 12px; border: 0; border-radius: 24px; background: #2a7cf6; color: #fff; font-size: 16px; font-weight: 700; }

/* ポップアップ */
.popup-layer { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.5); display: grid; place-items: center; padding: 20px; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.popup {
  position: relative;
  width: min(320px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 30px 20px 20px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  animation: up 0.25s ease-out;
}
@keyframes up { from { transform: translateY(30px) scale(0.95); opacity: 0; } }
.popup-title { font-size: 21px; font-weight: 800; margin: 0 0 8px; color: #111; line-height: 1.35; }
.popup-body { font-size: 14px; color: #555; margin: 0 0 18px; line-height: 1.6; }
.popup-yes { width: 100%; padding: 15px; border: 0; border-radius: 26px; background: linear-gradient(#ff8a3a, #f0561a); color: #fff; font-size: 18px; font-weight: 800; box-shadow: 0 4px 0 #b53a0a; }
.popup-x { position: absolute; top: 6px; right: 8px; width: 26px; height: 26px; border: 0; background: none; color: #bbb; font-size: 15px; line-height: 1; }

/* 5. 保険の約款（小さい字・2 段組み） */
.layout-yakkan { background: #fbf8ec; font-size: 11px; line-height: 1.7; padding: 22px 14px 30px; }
.layout-yakkan .ins-co { text-align: center; font-size: 12px; color: #2f6b4a; font-weight: 700; letter-spacing: 0.15em; }
.layout-yakkan .doc-title { font-size: 17px; color: #2f6b4a; border-top: 3px double #2f6b4a; border-bottom: 3px double #2f6b4a; padding: 6px 0; }
.layout-yakkan h3 { background: #e3eee4; padding: 0 6px; margin-top: 10px; break-after: avoid; }
.layout-yakkan .art { break-inside: avoid-column; }
.layout-yakkan .note { font-size: 0.82em; color: #555; }
.layout-yakkan.zoom { font-size: 16px; }
@media (min-width: 700px) {
  .layout-yakkan { column-count: 2; column-gap: 26px; column-rule: 1px solid #ddd; }
  .layout-yakkan .ins-co, .layout-yakkan .doc-title, .layout-yakkan > .small:first-of-type { column-span: all; }
  .layout-yakkan.zoom { column-count: 1; }
}

/* 6. 便箋（結婚の誓約書） */
.layout-letter {
  --line: 2.1em;
  font-family: var(--hand);
  font-weight: 600;
  color: #1d2a5a;
  font-size: 16px;
  line-height: var(--line);
  background: #fffef9;
  padding-left: 26px;
}
/* 罫線は段落ごとに引く（行の高さと必ずそろう） */
.layout-letter p, .layout-letter h3 { background: linear-gradient(transparent calc(var(--line) - 1px), #b9cbe0 0) 0 0 / 100% var(--line); }
.layout-letter .doc-title { background: none; }
.layout-letter::after { content: ''; position: absolute; top: 0; bottom: 0; left: 16px; border-left: 1px solid #e8a0a8; }
.layout-letter .doc-title { letter-spacing: 0.2em; font-size: 22px; }
.layout-letter h3 { margin: 6px 0 0; }
.layout-letter .art.addendum { margin-top: 18px; font-family: 'Yomogi', var(--hand); color: #2c6a3c; transform: rotate(-0.6deg); }
.layout-letter .art.addendum h3 { display: inline-block; border-bottom: 2px solid #2c6a3c; }
.layout-letter .art.addendum .pb { text-indent: 0 !important; }
.layout-letter .witness { color: #2c6a3c; }
.layout-letter .inkan { border-radius: 50%; }

/* 7. 魔界の羊皮紙 */
.layout-grimoire {
  background: radial-gradient(ellipse at center, #f1dfb0 40%, #d5b47a 80%, #a07840);
  color: #4a0808;
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(180, 0, 40, 0.55), inset 0 0 60px rgba(90, 40, 0, 0.5);
}
.layout-grimoire .doc-title { color: #8a0010; font-size: 24px; text-shadow: 0 0 6px rgba(200, 0, 0, 0.35); }
.layout-grimoire h3 { color: #7a0010; text-align: center; letter-spacing: 0.2em; margin-top: 20px; }
.layout-grimoire h3::before, .layout-grimoire h3::after { content: ' ✠ '; color: #a06030; }
.layout-grimoire .inkan.blood { background: #8a0010; color: #f1dfb0; border-color: #8a0010; }
.layout-grimoire .blank { border-color: #8a5a3a; }

/* 表の行（'|' の段落）：行ごとにタップする */
.doc .grid { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 0.92em; line-height: 1.6; }
.doc .grid th, .doc .grid td { border: 1px solid #777; padding: 4px 6px; text-align: left; vertical-align: top; }
.doc .grid th { background: #eef0f2; font-weight: 700; font-size: 0.92em; }
.doc .grid td:first-child { white-space: nowrap; }
tr.s { border-radius: 0; }
tr.s.checked td { color: #778; text-decoration: underline dotted #8a9aa8; text-underline-offset: 4px; }
tr.s.hit { animation: none; box-shadow: none; padding: 0; }
tr.s.hit td { background: rgba(220, 0, 0, 0.07); border-top: 2px solid var(--red); border-bottom: 2px solid var(--red); }
tr.s.hit td:first-child { border-left: 2px solid var(--red); }
tr.s.hit td:last-child { border-right: 2px solid var(--red); }
tr.s.hit .tsukkomi { display: block; margin: 2px 0 0; white-space: normal; }
tr.s.missed { outline: none; }
tr.s.missed td { background: rgba(255, 0, 0, 0.15); border-top: 2px dashed var(--red); border-bottom: 2px dashed var(--red); }
/* 黒塗り（読めない） */
.redact { background: #111; color: #111; border-radius: 1px; padding: 0 1px; letter-spacing: 0.05em; }

/* 6. 住宅ローン：銀行の帳票と返済予定表 */
.layout-loan { background: #fcfdfb; }
.layout-loan .bank-bar { margin: -30px -20px 18px; padding: 10px 16px; background: #1f5a44; color: #fff; font-family: var(--ui); font-weight: 700; letter-spacing: 0.1em; display: flex; align-items: center; gap: 8px; }
.layout-loan .bank-logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #1f5a44; font-size: 18px; }
.layout-loan .doc-title { color: #1f5a44; }
.layout-loan .art.special { border-color: #1f5a44; }
.layout-loan .yoko .grid td:first-child { width: 7.5em; background: #eef5f0; }
.layout-loan .sched .grid { font-family: var(--ui); font-size: 10.5px; font-variant-numeric: tabular-nums; line-height: 1.5; }
.layout-loan .sched .grid th { background: #1f5a44; color: #fff; font-size: 10px; text-align: center; }
.layout-loan .sched .grid td { padding: 3px 4px; text-align: right; white-space: nowrap; }
.layout-loan .sched .grid td:first-child, .layout-loan .sched .grid td:nth-child(2) { text-align: center; }
.layout-loan .sched .grid tbody tr:nth-child(even) td { background: #f2f6f3; }
.layout-loan .sched .grid tr.s.hit td { background: rgba(220, 0, 0, 0.07); }

/* 7. 自動車保険：保険証券の枠・確認欄のチェック */
.layout-car { background: #fbfdff; border: 6px solid transparent; border-image: repeating-linear-gradient(45deg, #9cc1e6 0 4px, #e3eefa 4px 8px) 6; font-size: 14px; }
.layout-car .car-co { text-align: center; color: #1b5aa6; font-family: var(--ui); font-weight: 900; letter-spacing: 0.15em; font-size: 13px; }
.layout-car .doc-title { color: #1b5aa6; font-size: 19px; letter-spacing: 0.12em; }
.layout-car .car-policy { width: 100%; border-collapse: collapse; font-size: 11.5px; line-height: 1.5; margin-bottom: 4px; }
.layout-car .car-policy th, .layout-car .car-policy td { border: 1px solid #9cb6d4; padding: 3px 5px; text-align: left; }
.layout-car .car-policy th { background: #e6f0fb; font-weight: 700; white-space: nowrap; }
.layout-car h3 { background: #1b5aa6; color: #fff; padding: 1px 8px; font-family: var(--ui); font-size: 14px; }
.layout-car .grid th { background: #e6f0fb; }
.layout-car .checks .para { border-bottom: 1px dotted #b8c8dc; padding: 3px 0; }
.layout-car .checks .para::before { content: '✓'; flex: none; display: grid; place-items: center; width: 1.3em; height: 1.3em; margin-top: 0.3em; border: 1.5px solid #555; color: #1b5aa6; font-family: var(--hand); font-weight: 700; line-height: 1; }
.layout-car .checks .pb { text-indent: 0 !important; }
.layout-car .checks .pn { display: none; }
.layout-car .car-agent { margin-top: 22px; font-size: 13px; }

/* 9. 相続：縦書きの遺言書（右から左へ横にスクロール） */
body[data-stage='will'] .desk { writing-mode: vertical-rl; overflow-x: auto; overflow-y: hidden; padding: 14px 10px calc(14px + env(safe-area-inset-bottom)); background: #3b2b20; }
.layout-will {
  --line: 2.2em;
  writing-mode: vertical-rl;
  max-width: none;
  margin: 0;
  padding: 26px 30px;
  font-family: var(--hand);
  font-weight: 600;
  font-size: 16px;
  line-height: var(--line);
  color: #1e1a2e;
  background: #f8f1df;
}
/* 縦の罫線は段落ごとに引く（列の幅と必ずそろう） */
.layout-will p, .layout-will h3 { background: linear-gradient(to right, #d8c6a0 1px, transparent 1px) 0 0 / var(--line) 100%; }
.layout-will .doc-title { background: none; font-size: 26px; letter-spacing: 0.6em; margin: 0 0 0 18px; }
.layout-will .lead { text-indent: 1em; margin: 0 0 0 8px; }
.layout-will h3 { margin: 0 0 0 0; font-size: 1em; }
.layout-will .item { padding: 0 0.5em 0 0; }
.layout-will .art.addendum { margin: 0 18px 0 0; font-family: 'Yomogi', var(--hand); }
.layout-will .art.addendum .pb { text-indent: 0 !important; }
.layout-will .sig-date { margin: 0 24px 0 10px; }
.layout-will .sigs p { margin: 0 4px; line-height: var(--line); }
.layout-will .inkan { margin: 0.8em 0 0; }
.layout-will .tsukkomi { margin: 0.3em 0; transform: rotate(2deg); }
.layout-will .tsukkomi::before { content: '↑ '; }

/* 10. ファンド：運用実績のグラフ・注意の赤枠 */
.layout-fund { font-family: var(--ui); font-size: 14px; line-height: 1.85; }
.layout-fund .fund-co { font-weight: 900; color: #a8781a; letter-spacing: 0.12em; font-size: 13px; text-align: center; }
.layout-fund .doc-title { font-family: var(--mincho); font-size: 20px; letter-spacing: 0.1em; color: #3a2a10; }
.layout-fund h3 { border-left: 6px solid #d9a52a; padding-left: 8px; }
.layout-fund .art.warn { border: 2px solid #d0101a; background: #fff6f6; }
.layout-fund .art.warn h3 { color: #d0101a; border: 0; padding: 0; }
.layout-fund .grid td:first-child { white-space: normal; width: 8.5em; background: #fbf5e6; font-weight: 700; }
.fund-chart { margin: 6px 0 4px; padding: 6px; border: 1px solid #e3d6b0; background: #fffdf5; }
.fund-chart svg { display: block; width: 100%; height: auto; font-family: var(--ui); }
.fund-chart .grid line { stroke: #e8dfc8; }
.fund-chart .ax text { font-size: 8px; fill: #887; text-anchor: end; }
.fund-chart .yr text { font-size: 8px; fill: #887; text-anchor: middle; }
.fund-chart .area { fill: rgba(217, 165, 42, 0.18); }
.fund-chart .line { fill: none; stroke: #c48a12; stroke-width: 2.5; stroke-linejoin: round; }
.fund-chart .mk circle { fill: #fff; stroke: #c48a12; }
.fund-chart .mk text { font-size: 9px; text-anchor: middle; fill: #8a5a00; }
.fund-chart figcaption { font-size: 11px; color: #887; text-align: center; }

/* 11. 共同研究開発：社外秘・方眼の別紙 */
.layout-lab { font-size: 14.5px; }
.layout-lab .lab-no { font-family: var(--ui); font-size: 11px; color: #667; display: flex; justify-content: space-between; }
.layout-lab .lab-secret { border: 2px solid #c8102e; color: #c8102e; padding: 0 6px; font-weight: 900; transform: rotate(3deg); }
.layout-lab h3 { color: #234; border-bottom: 1px solid #9ab; }
.layout-lab .art.plan { border: 1px solid #7a9; background: #f7fbf8 linear-gradient(#dbe9e0 1px, transparent 1px) 0 0 / 100% 12px, linear-gradient(90deg, #dbe9e0 1px, transparent 1px) 0 0 / 12px 100%; background-blend-mode: multiply; }
.layout-lab .plan .grid { background: #fff; }
.layout-lab .plan .grid td:last-child { width: 7.5em; font-size: 0.85em; }
.layout-lab .plan .grid td:nth-child(3) { white-space: nowrap; }

/* 12. M&A：厳秘の印・黒塗り */
.layout-ma { background: #fdfdfb; font-size: 14.5px; overflow: hidden; } /* 透かし文字を紙の外にはみ出させない */
.layout-ma .ma-mark { position: absolute; top: 14px; right: 14px; border: 3px double #c8102e; color: #c8102e; padding: 2px 10px; font-weight: 800; letter-spacing: 0.3em; transform: rotate(6deg); }
.layout-ma .doc-title { margin-top: 30px; }
.layout-ma::after { content: 'CONFIDENTIAL'; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-30deg); font: 900 54px var(--ui); color: rgba(0, 0, 40, 0.05); pointer-events: none; white-space: nowrap; }

/* ？？？ おかあさんとのけいやくしょ：じゆうちょう・全部ひらがな・クレヨンの書き足し */
.layout-mom { background: #fffef6; font-family: var(--ui); font-weight: 500; font-size: 17px; line-height: 2.1; letter-spacing: 0.06em; color: #3a3226; border-radius: 4px; }
.layout-mom .mom-hanamaru { position: absolute; top: 12px; right: 14px; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; border: 3px solid #e8507a; color: #e8507a; font-family: var(--hand); font-size: 13px; transform: rotate(-12deg); background: repeating-conic-gradient(from 0deg, rgba(232, 80, 122, 0.12) 0 10deg, transparent 10deg 20deg); }
.layout-mom .doc-title { font-size: 22px; letter-spacing: 0.15em; margin-top: 40px; }
.layout-mom h3 { display: inline-block; margin: 18px 0 4px; padding: 0 8px; background: linear-gradient(transparent 55%, #ffe27a 55%); }
.layout-mom .art.addendum { margin-top: 22px; font-family: 'Yomogi', var(--hand); color: #e06a1a; font-size: 19px; transform: rotate(-1.2deg); }
.layout-mom .art.addendum h3 { background: none; border-bottom: 3px solid #f0a060; }
.layout-mom .art.addendum .pb { text-indent: 0 !important; }
.layout-mom .inkan { border-color: #e8507a; color: #e8507a; font-size: 0.7em; }

/* ？？？ ポチとタマ：にゃん語の正文（猫が書いた）と日本語の訳文・肉球のハンコ */
.layout-pets { background: #f6ead0 radial-gradient(circle at 20px 20px, rgba(160, 110, 60, 0.08) 6px, transparent 7px) 0 0 / 60px 60px; color: #3a2a18; }
.layout-pets .doc-title { font-size: 20px; letter-spacing: 0.1em; }
.layout-pets .seibun { margin: 0 0 2px; padding: 2px 8px; font-family: var(--hand); font-size: 12px; color: #9a6a3a; background: rgba(255, 255, 255, 0.45); border-left: 3px solid #c89a60; }
.layout-pets .seibun::before { content: '正文　'; font-family: var(--ui); font-size: 10px; color: #b08050; }
.layout-pets .paw { display: inline-grid; place-items: center; width: 2.2em; height: 2.2em; margin-left: 0.8em; border-radius: 50%; border: 2px solid #8a5a2a; font-size: 0.9em; vertical-align: middle; }
.layout-pets .paw.empty { border: 1px dashed #aaa; filter: grayscale(1) opacity(0.35); }

/* 押印・差し戻しのハンコ */
.big-stamp {
  position: fixed;
  z-index: 60;
  top: 46%;
  left: 50%;
  width: 230px;
  height: 230px;
  margin: -115px 0 0 -115px;
  border: 10px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  display: grid;
  place-content: center;
  text-align: center;
  font-family: var(--mincho);
  font-weight: 800;
  /* 後ろの条文が透けるとハンコの字が読みにくいので、紙の色で塗りつぶす */
  background: #fffdf6;
  box-shadow: inset 0 0 0 4px #fffdf6, inset 0 0 0 7px var(--red), 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: stamp 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  pointer-events: none;
}
.big-stamp span { font-size: 60px; line-height: 1.1; letter-spacing: 0.05em; }
.big-stamp small { font-size: 22px; border-top: 3px solid var(--red); margin-top: 6px; padding-top: 4px; }
.big-stamp.ng { border-radius: 14px; width: 250px; margin-left: -125px; }
@keyframes stamp { from { transform: scale(2.6) rotate(-30deg); opacity: 0; } to { transform: scale(1) rotate(-12deg); opacity: 1; } }

/* トースト */
.toasts {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast { padding: 10px 14px; border-radius: 10px; font-size: 14px; text-align: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); animation: up 0.2s ease-out; transition: opacity 0.4s, transform 0.4s; }
.toast.miss { background: rgba(40, 40, 46, 0.94); color: #fff; }
.toast.hit { background: var(--red); color: #fff; font-family: var(--hand); font-size: 20px; }
.toast.out { opacity: 0; transform: translateY(10px); }
body[data-stage='app'] .toasts { bottom: calc(110px + env(safe-area-inset-bottom)); }
.toast .pen { color: #ff8a8a; font-weight: 900; white-space: nowrap; }
.float { position: fixed; z-index: 35; color: var(--red); font-weight: 900; font-size: 20px; pointer-events: none; transform: translate(-50%, -100%); animation: rise 0.9s ease-out forwards; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
@keyframes rise { to { transform: translate(-50%, -260%); opacity: 0; } }

/* ---------------- 結果 ---------------- */
.res-case { margin: 0; font-size: 13px; color: #6b4a2f; font-weight: 700; }
.res-title { font-family: var(--mincho); font-weight: 800; font-size: clamp(22px, 6.4vw, 30px); margin: 6px 0 14px; line-height: 1.35; }
.res-title small { display: block; font-size: 14px; font-family: var(--ui); color: #6b4a2f; }
.res-title.ok { color: var(--red); }
.res-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; margin: 0 0 16px; }
.res-stats div { background: #f6efe0; border-radius: 6px; padding: 6px 10px; }
.res-stats dt { font-size: 11px; color: #6b5a40; }
.res-stats dd { margin: 0; font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums; }
/* ファイル コンプリート（金のバッジ・金の枠） */
.comp { display: inline-block; background: linear-gradient(#f7d774, #d9a521); color: #4a3000; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 3px; vertical-align: middle; letter-spacing: 0.05em; }
.case.complete { border-color: #d9a521; box-shadow: 0 2px 0 #b8860b, inset 0 0 0 1px #f7d774; }
.file-tabs button.complete small { color: #a87400; font-weight: 700; }
.res-comp { margin: -6px 0 16px; padding: 10px 12px; text-align: center; border: 2px solid #d9a521; border-radius: 8px; background: linear-gradient(#fff6d6, #f7e3a1); color: #6b4a00; font-weight: 900; font-size: 18px; animation: comp-pop 0.5s ease-out; }
.res-comp small { display: block; font-size: 12px; font-weight: 600; margin-top: 2px; }
@keyframes comp-pop { 0% { transform: scale(0.8); opacity: 0; } 70% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
.red { color: var(--red); }
.new { display: inline-block; background: var(--red); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.reply { transform: rotate(0.8deg); }
.res-list, .file-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.res-list li, .file-list li { background: #fff; border: 1px solid #e3d6bd; border-radius: 6px; padding: 10px 12px; }
.res-list q, .file-list q { display: block; font-family: var(--mincho); font-size: 14px; line-height: 1.75; quotes: none; }
.res-list .tk, .file-list .tk { display: block; margin-top: 4px; font-family: var(--hand); font-weight: 600; color: var(--red); font-size: 16px; }
.res-list .tk::before, .file-list .tk::before { content: '→ '; }
.res-list li.missed { background: #fff2f2; border-color: #f0b0b0; }
.miss-tag { display: inline-block; background: #444; color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px; margin-bottom: 4px; }
.follow { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 18px; font-size: 12px; color: #6b5a40; flex-wrap: wrap; }
.follow svg { width: 22px; height: 22px; fill: #4a321f; display: block; }

/* ---------------- ファイル ---------------- */
.file-title { font-family: var(--mincho); font-size: 24px; margin: 0; }
.file-sub { font-size: 13px; color: #6b5a40; margin: 6px 0 12px; line-height: 1.6; }
.file-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.file-tabs button { flex: none; border: 1px solid #c9b48c; background: #f6e7c4; border-radius: 8px 8px 0 0; padding: 6px 10px; font-size: 12px; color: #3a2a1c; }
.file-tabs button small { display: block; color: #8a6a40; }
.file-tabs button.on { background: #3a2a1c; color: #fff; }
.file-tabs button.on small { color: #e0c890; }
.file-list li.unknown q { color: #bbb; letter-spacing: 0.1em; }

@media (min-width: 700px) {
  .doc { padding: 44px 56px 56px; font-size: 16px; }
  .layout-app { padding: 0; font-size: 13px; }
  .layout-yakkan { padding: 30px 36px 40px; font-size: 11.5px; }
  .layout-yakkan.zoom { font-size: 17px; }
  .layout-letter { padding-left: 64px; }
  .layout-letter::after { left: 44px; }
  .doc-rent::before { left: 28px; }
  .layout-loan .bank-bar { margin: -44px -56px 22px; }
  .layout-loan .sched .grid { font-size: 13px; }
  .layout-will { padding: 40px 48px; font-size: 18px; }
}

/* 難易度の星 */
.stars { color: #d0101a; letter-spacing: 0.05em; white-space: nowrap; }
.stars i { font-style: normal; color: #d9ccb4; }
.case.locked .stars { color: #a89c88; }
.rules .stars b, .rules .stars { font-weight: 400; }
.case-meta .nw { white-space: nowrap; }

/* 豆知識（法務部メモ） */
.tip { margin: 0 0 16px; padding: 10px 14px 12px; background: #eef4fb; border-left: 5px solid #3b6fb6; border-radius: 4px; }
.tip-head { margin: 0 0 4px; font-weight: 900; font-size: 13px; color: #2a5590; }
.tip-head small { font-weight: 700; color: #5a7aa8; margin-left: 4px; }
.tip-text { margin: 0; font-size: 14px; line-height: 1.75; }
.tip ul { margin: 0; padding-left: 1.2em; font-size: 13.5px; line-height: 1.75; }
.tip li + li { margin-top: 6px; }
