/* 見るたび変わる 第一弾「あなたの本当の性格診断」カルテ風(仕様書/コンテンツ企画/変わるサイトシリーズ.md 4.2・5章、2026-11-17 ユーザー決定)
   .mt = 机、.k-paper = 診療録の紙。段階(結果を見た回数)のクラス .mt-s0〜.mt-s5 は main.js が #mt に付ける(描く前は _head.html が <html> に mt-pre-s◯)。
   印刷の文字は BIZ UD明朝・BIZ UDPゴシック、手書きは Klee One(青=あなた、赤=診断の書きこみ)。広告の枠はどの段階でも崩さない(.mt-ad) */

.mt {
  --desk: #D9D6CC;
  --paper: #FCFCF7;
  --form: #2F6E4F;
  --form-bg: #EEF4EE;
  --ink: #1F2A26;
  --hand: #1B2A44;
  --red: #B8281F;
  --line: #C7D8CB;
  --sub: #5B6B63;
  --btn: #1F2A26;
  --btn-ink: #F7F6F0;
  --black: #1F2A26;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  /* 世界観を保つため、下のタグ・フッターがファーストビューに入らないよう、最低でも画面の高さにする(2026-11-17、ユーザー指示) */
  min-height: 100vh;
  min-height: 100svh;
  padding: 16px 12px 40px;
  background: var(--desk);
  color: var(--ink);
  font-family: 'BIZ UDPGothic', sans-serif;
  line-height: 1.8;
}
.mt > * { position: relative; max-width: 560px; margin-left: auto; margin-right: auto; }
.mt-s2, .mt-pre-s2 .mt { --desk: #CBC6B8; --paper: #F8F5EA; --form: #4A6E5C; --form-bg: #EAEFE7; --line: #CFD6C6; }
.mt-s3, .mt-pre-s3 .mt { --desk: #8E877A; --paper: #F0EAD8; --form: #4F5E52; --form-bg: #E4E3D2; --line: #C9C6B4; --sub: #5E5848; }
.mt-s4, .mt-pre-s4 .mt { --desk: #26221E; --paper: #EFE8D5; --form: #3F5E4E; --form-bg: #E3E3D2; --line: #BFC5B0; --sub: #5E5848; --btn: #B8281F; --btn-ink: #F6EEDC; --black: #1B1A17; }
.mt-s5, .mt-pre-s5 .mt { --desk: #0F0D0B; --ink: #DDD5CA; --sub: #A69C90; --btn: transparent; --btn-ink: #DDD5CA; }

/* 段階の見た目に切り替わるまで中身を隠す(_head.html が <html> に付け、main.js が外す。机の色は mt-pre-s◯ で先に段階の色にしてある) */
html.mt-wait .mt > * { visibility: hidden; }

.mt p { margin: 0; }
.k-hand { font-family: 'Klee One', cursive; font-weight: 600; color: var(--hand); }
.k-hand--l { font-size: 18px; }
.k-red, .mt .k-red { color: var(--red); }
.k-g { color: var(--form); }
.k-c { text-align: center; }
.k-small { font-size: 11px; line-height: 1.7; color: var(--sub); }
.mt-black { color: transparent !important; background: var(--black); text-shadow: none !important; padding: 0 1px; }
.mt-ch { display: inline-block; }
.mt-line { display: block; }

/* ---- 紙 ---- */
.k-paper {
  box-sizing: border-box;
  padding: 16px 14px 18px;
  background: var(--paper);
  border-left: 10px solid var(--form);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.k-paper--form { border-left: 0; border-top: 8px solid var(--form); }
.mt-s3 .k-paper { transform: rotate(-.4deg); background-image: radial-gradient(circle at 85% 12%, rgba(140, 110, 60, .14), transparent 38%); }
.mt-s4 .k-paper { transform: rotate(-.8deg); background-image: radial-gradient(circle at 85% 12%, rgba(140, 110, 60, .2), transparent 38%), radial-gradient(circle at 10% 60%, rgba(140, 110, 60, .15), transparent 35%); }
.k-paper > * { position: relative; }
.k-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font-size: 10px; color: var(--form); }
.k-top span:last-child { color: var(--sub); font-size: 11px; }
.k-kick { font-family: 'Klee One', cursive; font-weight: 600; font-size: 17px; color: var(--red); transform: rotate(-3deg); }
.mt-s3 .k-kick { transform: rotate(-5deg) translateX(30px); }
.mt-s4 .k-kick { font-size: 20px; }
.k-cover { text-align: center; font-family: 'BIZ UDMincho', serif; font-size: 26px; font-weight: 700; letter-spacing: .9em; padding-left: .9em; color: var(--form); }

/* 紙に薄く書かれた赤い書きこみ(段階3〜) */
.mt-whisper { position: absolute !important; inset: 0; pointer-events: none; overflow: hidden; }
.mt-whisper__word { position: absolute; margin: 0; white-space: nowrap; font-family: 'Klee One', cursive; font-weight: 600; font-size: 42px; color: rgba(184, 40, 31, .1); }
.mt-s4 .mt-whisper__word { font-size: 52px; color: rgba(184, 40, 31, .13); }

/* 見出し */
.mt-titlewrap { position: relative; display: block; }
/* 題名「ミタビ診療所」と副題(2026-11-19)。副題 .mt-title は今までの見た目のまま */
.mt-h1 { margin: 0; display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.mt-clinic { display: block; text-align: center; font-family: 'BIZ UDMincho', serif; font-size: 28px; line-height: 1.4; font-weight: 700; letter-spacing: .18em; padding-left: .18em; color: var(--ink); }
.mt-title { display: block; margin: 0; text-align: center; font-family: 'BIZ UDMincho', serif; font-size: 20px; line-height: 1.5; font-weight: 700; }
.mt-ghost { display: none; position: absolute; left: 6px; top: 4px; margin: 0; font-weight: 700; opacity: .13; pointer-events: none; }
.mt-titlewrap > .mt-ghost:not(.mt-ghost--q):not(.mt-ghost--card) { width: 100%; text-align: center; font-family: 'BIZ UDMincho', serif; font-size: 20px; line-height: 1.5; }
.mt-ghost--q { font-family: 'BIZ UDMincho', serif; font-size: 20px; line-height: 1.6; }
.mt-ghost--card { font-family: 'BIZ UDMincho', serif; font-size: 27px; line-height: 1.4; }
.mt-s2 .mt-ghost, .mt-s3 .mt-ghost, .mt-s4 .mt-ghost { display: block; }
.mt-s3 .mt-ghost { left: 12px; top: -6px; opacity: .2; }
.mt-s4 .mt-ghost { opacity: .2; filter: blur(1.5px); }
.mt-s2 .mt-title, .mt-s3 .mt-title, .mt-s4 .mt-title,
.mt-s2 .mt-q, .mt-s3 .mt-q, .mt-s4 .mt-q,
.mt-s2 .mt-card__name, .mt-s3 .mt-card__name, .mt-s4 .mt-card__name { text-shadow: 2px 0 rgba(184, 40, 31, .45), -2px 0 rgba(30, 80, 140, .35); }
.mt-s4 .mt-title .mt-ch:nth-child(-n+3) { color: var(--red); }

/* 表 */
.k-tb { width: 100%; border-collapse: collapse; table-layout: fixed; }
.k-tb th, .k-tb td { border: 1px solid var(--form); padding: 6px; vertical-align: middle; }
.k-tb th { width: 68px; font-family: 'BIZ UDMincho', serif; font-weight: 400; font-size: 11px; color: var(--form); background: var(--form-bg); text-align: center; letter-spacing: .1em; }
.k-tb td { font-size: 13px; }
.k-tb__s { font-size: 11px; color: var(--sub); }
.k-dx th { width: auto; }
.k-dx th:first-child { width: 48%; }
.k-dx tr.is-missing td:first-child { text-decoration: line-through; color: var(--red); }
.k-dx tr.is-missing td:first-child .k-hand { color: var(--red); }
.k-dx__next td { opacity: .55; }
.mt-s3 .k-dx { transform: rotate(-.6deg); }

.mt-lead { font-size: 13.5px; line-height: 1.85; }
.mt-s3 .mt-lead { transform: rotate(.8deg); }
.mt-s4 .mt-lead { font-family: 'Klee One', cursive; font-weight: 600; color: var(--red); transform: rotate(-2deg); }

/* 赤ペンの書きこみ(診断の声) */
.k-note { padding: 10px 12px; border-left: 3px solid var(--red); font-family: 'Klee One', cursive; font-weight: 600; font-size: 15px; line-height: 1.75; color: var(--red); transform: rotate(-1deg); }
.k-note[hidden] { display: none; }
.mt-s1 .k-qbox .k-note { font-size: 13px; }
.mt-s3 .k-note { transform: rotate(-2.5deg) translateX(-6px); }
.mt-s4 .k-note { font-size: 17px; transform: rotate(3deg) translateX(10px); }
.k-note--in { margin-top: 4px !important; padding: 6px 10px; font-size: 14px; }

/* ボタン */
.mt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  padding: 8px 16px;
  border: 0;
  border-radius: 3px;
  font-family: 'BIZ UDPGothic', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  cursor: pointer;
}
.mt-btn:focus-visible, .mt-choice:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.mt-btn--go { background: var(--btn); color: var(--btn-ink); }
.mt-btn--line { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.mt-s2 #mt-start, .mt-s2 #mt-again { width: 94%; }
.mt-s3 #mt-start, .mt-s3 #mt-again { width: 80%; transform: rotate(2deg) translateX(26px); }
.mt-s4 #mt-start { width: 64%; transform: rotate(-5deg) translateX(70px); }

/* この診断について = 院内の掲示「受診のご案内」(2026-11-20) */
.k-about { gap: 12px; margin-top: 14px; font-size: 13px; line-height: 1.8; border-left: 0; border-top: 8px solid var(--form); }
.k-about[hidden] { display: none; }
.k-about__title { margin: 0; text-align: center; font-family: 'BIZ UDMincho', serif; font-weight: 700; font-size: 18px; letter-spacing: .5em; padding-left: .5em; color: var(--form); }
.k-about__sub { margin: -8px 0 0; text-align: center; font-size: 11px; color: var(--sub); }
.k-about__sec { display: flex; flex-direction: column; gap: 6px; }
.k-about__head { margin: 0; padding-bottom: 2px; border-bottom: 1px solid var(--line); font-family: 'BIZ UDMincho', serif; font-weight: 400; font-size: 12px; letter-spacing: .1em; color: var(--form); }
.k-about__sign { text-align: right; }
.k-about .k-tb th { width: 56px; }
.k-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.k-flow li { position: relative; padding: 6px 2px; border: 1px solid var(--form); text-align: center; font-size: 11px; line-height: 1.4; }
.k-flow li span { white-space: nowrap; }
@media (max-width: 360px) { .k-flow li { font-size: 10px; } }
.k-flow li b { display: block; font-family: 'BIZ UDMincho', serif; font-size: 13px; color: var(--form); }
.k-flow li + li::before { content: "▶"; position: absolute; left: -7px; top: 50%; transform: translateY(-50%); font-size: 7px; color: var(--form); }
.k-hours { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.k-hours th, .k-hours td { border: 1px solid var(--line); padding: 4px 0; }
.k-hours thead th { background: var(--form-bg); font-family: 'BIZ UDMincho', serif; font-weight: 400; font-size: 11px; color: var(--form); }
.k-hours thead td:first-child { width: 86px; }
.k-hours tbody th { white-space: nowrap; letter-spacing: 0; font-weight: 400; font-size: 10.5px; color: var(--sub); }
.k-hours__t { font-family: 'Klee One', cursive; font-weight: 600; color: var(--red); }
.k-caution { margin: 0; padding-left: 1.2em; font-size: 12px; line-height: 1.8; }
.k-caution li { list-style: disc; }
.k-caution li::marker { color: var(--form); }

/* 終わり(6回目以降) */
.mt-end { display: flex; flex-direction: column; justify-content: flex-start; gap: 22px; min-height: 560px; padding: 40px 10px 0; color: var(--ink); }
.mt-end[hidden], .k-paper[hidden] { display: none; }
.mt-end__body { display: flex; flex-direction: column; gap: 24px; font-family: 'BIZ UDMincho', serif; font-size: 19px; line-height: 2.1; }
.mt-end__stamp { align-self: flex-start; padding: 2px 10px; border: 2.5px solid var(--red); color: var(--red); font-size: 15px; font-weight: 700; letter-spacing: .2em; transform: rotate(-8deg); }
.mt-end__sub { font-size: 14px; color: var(--sub); }
.mt-end__act { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.mt-end__note { font-family: 'Klee One', cursive; font-weight: 600; font-size: 14px; color: #C9A9A0; }
.mt-end__link { margin-top: 8px; font-size: 13px; color: var(--sub); }
.mt-s5 .mt-btn--line { border-color: rgba(255, 255, 255, .25); }

/* ---- 問診票 ---- */
.k-qtop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.k-formtitle { font-family: 'BIZ UDMincho', serif; font-size: 20px; font-weight: 700; letter-spacing: .5em; color: var(--form); }
.k-qtop__meta { font-size: 11px; color: var(--sub); }
.k-qtop__meta b { color: var(--ink); }
.mt-s3 .k-qtop { transform: rotate(1deg); }
.mt-bar { height: 4px; background: var(--line); overflow: hidden; }
.mt-bar[hidden] { display: none; }
.mt-bar__fill { display: block; height: 100%; background: var(--form); }
.mt-bar--2 { transform: translateX(12px); }
.mt-bar--2 .mt-bar__fill { width: 14%; margin-left: auto; opacity: .7; }
.mt-s4 .mt-bar--2 .mt-bar__fill { width: 90%; background: var(--red); }
.k-done, .k-rest { margin: 0; padding: 0; list-style: none; }
.k-done { border-top: 1.5px solid var(--form); }
.k-done__row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 6px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--sub); }
.k-done__no { font-family: 'BIZ UDMincho', serif; color: var(--form); }
.k-done__more { display: grid; grid-template-columns: auto 1fr; gap: 6px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--sub); }
.k-done__more .k-done__no { white-space: nowrap; }
.k-done__a { font-size: 13px; white-space: nowrap; }
.mt-s3 .k-done__row:nth-child(odd) { transform: translateX(6px); }
.k-rest { opacity: .45; }
.k-rest li { display: grid; grid-template-columns: 34px 1fr; gap: 6px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 12px; }
.k-rest__bar { height: 8px; background: var(--line); }
.k-qbox { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 10px; background: var(--form-bg); border: 1.5px solid var(--form); }
.mt-qno { font-family: 'BIZ UDMincho', serif; font-size: 13px; color: var(--form); }
.mt-q { margin: 0; font-family: 'BIZ UDMincho', serif; font-size: 20px; line-height: 1.6; font-weight: 700; }
.mt-past { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-past[hidden] { display: none; }
.mt-chip { padding: 2px 8px; font-family: 'Klee One', cursive; font-weight: 600; font-size: 12px; color: var(--hand); background: var(--paper); border: 1px solid var(--line); }
.mt-chip:nth-child(1) { transform: rotate(-4deg); }
.mt-chip:nth-child(2) { transform: rotate(3deg) translateY(4px); }
.mt-chip:nth-child(3) { transform: rotate(-2deg) translateY(-2px); }
.mt-choices { display: flex; flex-direction: column; background: var(--paper); border-top: 1px solid var(--line); }
.mt-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  min-height: 50px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  text-decoration: none;
  transition: transform .18s ease-out;
}
.mt-choice::before { content: ""; flex: none; width: 18px; height: 18px; box-sizing: border-box; border: 1.5px solid var(--form); }
.mt-choice--extra { font-family: 'Klee One', cursive; font-weight: 600; color: var(--red); border-bottom-style: dashed; }
.mt-s2 .mt-choice:nth-child(2) { width: 96%; }
.mt-s2 .mt-choice:nth-child(4) { width: 92%; }
.mt-s3 .mt-choice:nth-child(2) { transform: rotate(-1.2deg); }
.mt-s3 .mt-choice:nth-child(3) { transform: translateX(-8px) rotate(.8deg); }
.mt-choice--dup1 { transform: translate(14px, -40px) rotate(-3deg); opacity: .6; }
.mt-s3 .mt-choice--dup2 { transform: translate(28px, -80px) rotate(-6deg); opacity: .35; }
.mt-choice.is-running { border: 1.5px dashed var(--form); opacity: .55; }
.mt-s4 .mt-choice { font-family: 'BIZ UDMincho', serif; }
.mt-s4 .mt-choice:nth-child(1) { transform: rotate(-2deg); }
.mt-s4 .mt-choice:nth-child(2) { transform: translate(14px, -10px) rotate(3deg); }
.mt-s4 .mt-choice:nth-child(3) { transform: translate(-6px, -20px) rotate(-5deg); }
.mt-s4 .mt-choice--dup2 { transform: translate(30px, 20px) rotate(10deg); opacity: .45; white-space: nowrap; width: 120%; }
@media (prefers-reduced-motion: reduce) { .mt-choice { transition: none; } }
/* 前回とちがう答えを押した瞬間(2026-11-19、ユーザー決定。main.js の showChanged)。押した方の□に手書きの✓(色は選択肢の文字の色。4回目以降の暗い画面でも見えるように) */
.mt-choice { position: relative; }
.mt-choice.is-picked::before, .mt-choice.mt-yank::before { content: "✓"; display: flex; align-items: flex-end; justify-content: center; font-family: 'Klee One', cursive; font-weight: 600; font-size: 24px; line-height: 1; color: currentColor; }
/* B(2・3回目): 選択肢の右上に赤ペンで1文字ずつ書かれ(左から見えていく)、書き終わると前回の答えを赤い丸で囲む */
.mt-choices { position: relative; }
/* 文字は画面の幅で 13〜16px(幅320pxの端末でも「前回は「どちらかといえば、いいえ」。」が1行に収まるように、2026-11-20) */
.mt-pen { position: absolute; right: 6px; top: -30px; z-index: 2; margin: 0; font-family: 'Klee One', cursive; font-weight: 600; font-size: clamp(13px, 4.1vw, 16px); color: var(--red); white-space: nowrap; rotate: -4deg; clip-path: inset(0 100% 0 0); animation: mt-pen .45s linear .05s forwards; }
@keyframes mt-pen { to { clip-path: inset(0 0 0 0); } }
.mt-choice.mt-ring::after { content: ""; position: absolute; left: 2px; top: 50%; width: min(70%, 230px); height: 38px; margin-top: -19px; box-sizing: border-box; border: 2px solid var(--red); border-radius: 50%; rotate: -4deg; opacity: 0; animation: mt-ring .01s linear .5s forwards; pointer-events: none; }
@keyframes mt-ring { to { opacity: .85; } }
/* D(4回目以降): ✓が一瞬だけ前回の答えへ(赤)、紙がザザっと揺れる */
.mt-choice.mt-yank::before { color: var(--red); }
.mt-yank-on .k-paper { animation: mt-yank .24s steps(1) both; }
@keyframes mt-yank { 0% { translate: -5px 2px; filter: contrast(1.4); } 33% { translate: 4px -3px; filter: invert(.08); } 66% { translate: -2px 1px; filter: none; } 100% { translate: 0 0; } }
@media (prefers-reduced-motion: reduce) { .mt-pen { animation: none; clip-path: none; } .mt-choice.mt-ring::after { animation: none; opacity: .85; } .mt-yank-on .k-paper { animation: none; } }

/* 付箋(スマホB: 手が止まった時/スマホA: 戻ってきた時) */
/* 付箋の中の色は段階に関係なく固定(4回目以降の黒い画面で --hand が明るい色になり、黄色の上で読めなくなるため) */
.k-sticky { --hand: #1B2A44; --red: #B8281F; position: relative; background: #FFF6A8; box-shadow: 0 6px 14px rgba(0, 0, 0, .22); color: var(--hand); }
.k-tape { position: absolute; left: 50%; top: -12px; width: 90px; height: 24px; transform: translateX(-50%) rotate(3deg); background: rgba(230, 225, 210, .8); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.k-tape--s { top: -9px; width: 54px; height: 18px; transform: translateX(-50%) rotate(-4deg); }
.k-sticky__head { font-family: 'BIZ UDMincho', serif; font-size: 10px; color: #6B6440; }
.k-sticky__text { margin-top: 4px !important; font-family: 'Klee One', cursive; font-weight: 600; font-size: 16px; line-height: 1.5; color: var(--red); }
.k-sticky--idle { position: absolute; right: -4px; top: -26px; z-index: 3; width: 150px; padding: 12px 12px 10px; transform: rotate(4deg); animation: k-stick .35s ease-out both; }
.k-sticky--idle[hidden] { display: none; }
@keyframes k-stick { from { opacity: 0; transform: translateY(-8px) rotate(4deg); } to { opacity: 1; transform: rotate(4deg); } }
.k-modal { position: fixed !important; inset: 0; z-index: 2147483001; max-width: none !important; margin: 0 !important; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(20, 24, 22, .5); }
.k-modal[hidden] { display: none; }
.k-sticky--modal { width: 100%; max-width: 320px; box-sizing: border-box; padding: 26px 22px 20px; display: flex; flex-direction: column; gap: 12px; transform: rotate(-2.5deg); }
.k-sticky__big { font-family: 'Klee One', cursive; font-weight: 600; font-size: 23px; line-height: 1.6; color: var(--red); }
.k-sticky__sub { font-family: 'Klee One', cursive; font-weight: 600; font-size: 14px; line-height: 1.7; }
.k-sticky--modal .mt-btn--go { background: #1F2A26; color: #F7F6F0; }
@media (prefers-reduced-motion: reduce) { .k-sticky--idle { animation: none; } }

/* ---- 広告(崩れた部品より上に重ね、どの段階でも傾けない) ---- */
.mt-ad { z-index: 2; display: flex; justify-content: center; min-height: 250px; margin-top: 24px; padding: 8px 0; background: var(--paper); }
.mt-ad[hidden] { display: none; }

/* ---- ローディング ---- */
.k-loading { align-items: center; gap: 18px; padding: 90px 14px 60px; text-align: center; }
.k-loading__title { font-family: 'BIZ UDMincho', serif; font-size: 18px; font-weight: 700; color: var(--form); }
.mt-s1 .k-loading__title, .mt-s2 .k-loading__title, .mt-s3 .k-loading__title, .mt-s4 .k-loading__title { font-family: 'Klee One', cursive; font-weight: 600; color: var(--red); }
.k-loading__note { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 96px; font-size: 19px; line-height: 1.6; text-align: left; }
.k-loading__line { min-height: 30px; margin: 0; white-space: pre; }
.k-ink { display: inline-block; animation: k-ink .22s ease-out both; }
@keyframes k-ink { from { opacity: 0; filter: blur(2.5px); transform: translateY(1px) scale(.9); } 60% { opacity: .85; filter: blur(.6px); } to { opacity: 1; filter: none; transform: none; } }
.mt-loading__bar { display: block; width: 220px; height: 4px; background: var(--line); overflow: hidden; }
.mt-loading__bar span { display: block; width: 0; height: 100%; background: var(--form); }
/* 長さは main.js がページを開いた時から数えた残り時間を --mt-load-ms に入れる(結果へ移る時刻と同じ) */
.mt-loading__bar.is-run span { animation: mt-load var(--mt-load-ms, 4.8s) linear forwards; }
@keyframes mt-load { to { width: 100%; } }
.mt-s3 .mt-loading__bar.is-run span { animation-timing-function: steps(7); }
.mt-s4 .mt-loading__bar span { animation-direction: reverse; background: var(--red); }
@media (prefers-reduced-motion: reduce) { .k-ink { animation: none; } }

/* ---- 結果(診療録の2枚目) ---- */
.k-patient { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.k-patient[hidden] { display: none; }
.k-patient .k-hand { font-size: 19px; transform: rotate(-6deg); display: inline-block; }
.k-dxbox { position: relative; border: 1.5px solid var(--form); }
.k-colh { margin: 0; padding: 4px 8px; font-family: 'BIZ UDMincho', serif; font-size: 10px; color: var(--form); background: var(--form-bg); border-bottom: 1px solid var(--form); }
.k-dxbox__body { padding: 10px 10px 14px; }
.k-dxbox__num { font-size: 13px; }
.mt-card__name { margin: 2px 0 0; padding-right: 50px; font-family: 'BIZ UDMincho', serif; font-size: 27px; line-height: 1.4; font-weight: 700; }
.mt-s3 .mt-card__name { color: var(--sub); text-shadow: none; }
.mt-s4 .mt-card__name { font-size: 30px; }
.k-stamp { position: absolute; right: 8px; top: 30px; min-width: 54px; height: 54px; box-sizing: border-box; padding: 0 4px; border: 2.5px solid var(--red); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--red); font-family: 'BIZ UDMincho', serif; font-size: 11px; font-weight: 700; line-height: 1.2; text-align: center; transform: rotate(-12deg); opacity: .85; }
.mt-s3 .k-stamp { border-radius: 0; transform: rotate(8deg); }
.mt-s4 .k-stamp { border-radius: 0; height: auto; padding: 3px 7px; transform: rotate(14deg); top: 20px; right: 2px; font-size: 13px; }
.mt-card__struck p { font-size: 13px; color: var(--sub); text-decoration: line-through; }
.mt-card__struck p:nth-child(2) { transform: translateX(10px); }
.mt-card__struck p:nth-child(3) { transform: translateX(-6px); }
.mt-card__struck[hidden] { display: none; }
.k-who { font-family: 'Klee One', cursive; font-weight: 600; font-size: 30px; line-height: 1.5; color: var(--red); transform: rotate(-2deg); }
.k-who[hidden] { display: none; }

/* 1回目の診断名: 数秒に一度、1文字だけが一瞬赤い別の字に変わる(案C) */
.mt-flk { position: relative; display: inline-block; }
.mt-flk::after { content: attr(data-alt); position: absolute; left: 0; top: 0; color: var(--red); background: var(--paper); opacity: 0; animation: mt-flick 5s infinite steps(1); }
@keyframes mt-flick { 0% { opacity: 0; } 88% { opacity: 1; } 92% { opacity: 0; } 94% { opacity: 1; } 95% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mt-flk::after { animation: none; } }

/* 経過の欄(月日/経過等/処方・処置等) */
.k-sheet { display: grid; grid-template-columns: 44px minmax(0, 1fr) 88px; border: 1.5px solid var(--form); }
.k-sheet > .k-colh { padding: 4px 2px; text-align: center; }
.k-sheet > .k-colh:not(:nth-of-type(3)) { border-right: 1px solid var(--form); }
.k-sheet__rows { display: contents; }
.k-row { padding: 0 5px; font-size: 13px; line-height: 28px; white-space: pre-line; background-image: repeating-linear-gradient(transparent 0 27px, var(--line) 27px 28px); }
.k-row__d { padding: 0 2px; text-align: center; font-size: 10.5px; white-space: nowrap; border-right: 1px solid var(--form); }
.k-row__soap { border-right: 1px solid var(--form); }
.k-row__rp { font-size: 12px; }
.k-row--s3 { color: var(--red); }
.k-row--s3.k-row__soap { transform: rotate(1deg); }
.k-row--s4 { color: var(--red); letter-spacing: .06em; }
.k-row--s4.k-row__soap { transform: rotate(-2deg); }

.k-block { display: flex; flex-direction: column; gap: 6px; }
.k-block[hidden], .mt-actions[hidden] { display: none; }
.k-label { font-family: 'BIZ UDMincho', serif; font-size: 12px; color: var(--form); }
.k-text { font-family: 'BIZ UDMincho', serif; font-size: 15px; line-height: 1.95; }
.k-block__strong { font-family: 'BIZ UDMincho', serif; font-size: 15px; font-weight: 700; line-height: 1.6; }
.mt-changed { padding: 6px 0; border-bottom: 1px solid var(--line); }
.mt-changed__q { font-size: 12px; color: var(--sub); }
.mt-changed__a { font-size: 14px; }
.mt-changed__a s { color: var(--sub); }
.k-block--table { border: 1px solid var(--form); gap: 0; }
.k-block--table .k-label { padding: 6px 10px; background: var(--form-bg); border-bottom: 1px solid var(--form); }
.mt-facts { margin: 0; }
.mt-facts__row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.mt-facts__row dt { color: var(--sub); }
.mt-facts__row dd { margin: 0; font-weight: 700; text-align: right; }
.mt-facts__row dd.is-circle { padding: 0 6px; border: 2px solid rgba(184, 40, 31, .75); border-radius: 50%; }

/* 次回予約票(次の結果の予告。鍵マークは有料に見えるため使わない) */
.k-slip { margin: 6px 4px 0; padding: 16px 14px 14px; background: #FFFDF2; border: 1px solid #C9BE98; box-shadow: 2px 3px 0 rgba(0, 0, 0, .08); transform: rotate(1.2deg); }
.k-slip[hidden] { display: none; }
.k-staple { position: absolute !important; left: 22px; top: -6px; width: 26px; height: 6px; border: 2px solid #8C9299; border-bottom: 0; }
.k-slip__head { display: flex; justify-content: space-between; align-items: baseline; }
.k-slip__title { font-family: 'BIZ UDMincho', serif; font-size: 15px; font-weight: 700; letter-spacing: .3em; color: var(--form); }
.k-slip__tb { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.k-slip__tb th { width: 56px; padding: 5px 0; text-align: left; font-weight: 400; color: var(--sub); border-bottom: 1px dotted #C9BE98; }
.k-slip__tb td { border-bottom: 1px dotted #C9BE98; }
.k-slip__tb tr:last-child th, .k-slip__tb tr:last-child td { border-bottom: 0; }
.k-slip__tb .k-hand { font-size: 15px; }
.k-slip__memo { margin-top: 10px !important; font-size: 14px; line-height: 1.7; }
.k-scribble { display: inline-block; width: 110px; height: 14px; margin: 0 2px; vertical-align: middle; background: repeating-linear-gradient(-20deg, var(--hand) 0 2px, transparent 2px 5px); }

.mt-actions { display: flex; flex-direction: column; gap: 10px; }
.mt-actions .mt-btn[hidden] { display: none; }
.k-last { margin-top: 18px !important; text-align: right; font-family: 'Klee One', cursive; font-weight: 600; font-size: 14px; color: var(--red); transform: rotate(-2deg); }
.mt-s3 .k-last, .mt-s4 .k-last { text-align: left; font-size: 17px; }

/* ---- 開発用(devだけ、_dev.html)。左下に固定 ---- */
.mt-dev {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 2147483000;
  max-width: 172px;
  padding: 6px 8px 8px;
  border-radius: 8px;
  background: rgba(20, 20, 20, .82);
  color: #FFFFFF;
  font-family: 'BIZ UDPGothic', sans-serif;
  font-size: 11px;
  line-height: 1.4;
}
.mt-dev__head { margin: 0 0 4px; font-weight: 700; }
.mt-dev__btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.mt-dev__btn { min-height: 30px; padding: 0 4px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 4px; background: transparent; color: #FFFFFF; font-family: inherit; font-size: 11px; cursor: pointer; }
.mt-dev__btn.is-current { background: #FFFFFF; color: #141414; font-weight: 700; }
.mt-dev__btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }

/* ---- 恐怖の演出: 案3「紙 → 画面に崩れる」(仕様書 7章、2026-11-18)。main.js の horror() がクラスと重ねる要素を足す ----
   .mt-copy=2回目(紙のかすれ) / .mt-scan=3回目(スキャン画像) / .mt-crt=4回目以降(黒い画面) / .mt-fx-on=ザザの0.3秒。
   重ねる要素は .k-paper の中だけ(広告の枠には重ねない)。動きを減らす設定ではノイズ・揺れを止める */
.mt-mirror { display: inline-block; transform: scaleX(-1); }
.mt-mirror-once { display: inline-block; animation: mt-mirror-once .2s steps(1) 3s 1; }
@keyframes mt-mirror-once { 0% { transform: scaleX(-1); } 100% { transform: none; } }
.mt-swap { position: absolute !important; left: 0; top: 0; right: 0; margin: 0; font-family: 'BIZ UDMincho', serif; font-size: 20px; line-height: 1.6; font-weight: 700; background: var(--form-bg); visibility: hidden; }
.mt-swap.is-on { visibility: visible; }

.mt-fx-noise, .mt-fx-lines, .mt-fx-lamp, .mt-fx-band { position: absolute !important; pointer-events: none; }
.mt-fx-noise { inset: 0; opacity: 0; background-image: var(--mt-noise); }
/* 動くのはザザ・かすれの間だけ(普段は止まった模様。スマホの電池のため、2026-11-18 恒例のチェック) */
.mt-fx-on .mt-fx-noise, .mt-copy-on .mt-fx-noise { animation: mt-jit .12s steps(1) infinite; }
@keyframes mt-jit { 0% { background-position: 0 0; } 33% { background-position: -47px 23px; } 66% { background-position: 31px -59px; } }
.mt-fx-lines { inset: 0; background: repeating-linear-gradient(rgba(0, 0, 0, .05) 0 1px, transparent 1px 3px); }

/* 2回目: コピー機の光の帯とかすれ(ページを開いた時に1回) */
.mt-copy .mt-fx-noise { mix-blend-mode: multiply; }
.mt-copy-on .mt-fx-noise { opacity: .35; }
.mt-copy-on .k-paper { filter: blur(.5px) contrast(1.5) grayscale(.6); }
.mt-fx-lamp { left: 0; right: 0; top: -60px; height: 46px; opacity: 0; background: linear-gradient(transparent, rgba(255, 255, 255, .85) 45%, rgba(220, 235, 255, .9) 55%, transparent); }
.mt-copy-on .mt-fx-lamp { opacity: 1; animation: mt-lamp .6s linear 1 forwards; }
@keyframes mt-lamp { 0% { top: -60px; } 90% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

/* 3回目: 紙がスキャン画像になり始める */
.mt-viewer { display: flex; justify-content: space-between; gap: 8px; max-width: none !important; margin: -16px -12px 12px !important; padding: 6px 12px; background: #2B2F2E; color: #C9D3CF; font-family: ui-monospace, monospace; font-size: 10px; line-height: 1.6; }
.mt-scan .k-paper { filter: grayscale(.35) contrast(1.08); }
.mt-scan .mt-fx-noise { opacity: .07; }
.mt-backghost { position: absolute !important; right: 14px; top: 46px; margin: 0; white-space: pre-line; font-size: 18px; line-height: 1.5; opacity: .16; transform: scaleX(-1) rotate(4deg); pointer-events: none; }
.mt-fx-on .k-paper { filter: grayscale(.35) drop-shadow(3px 0 rgba(220, 30, 30, .8)) drop-shadow(-3px 0 rgba(30, 80, 255, .8)); translate: -7px 0; }
.mt-fx-on .mt-fx-noise { opacity: .7; }

/* 4回目以降: 黒い画面として崩れる */
html .mt.mt-crt { --desk: #070908; --paper: #101513; --form: #7FA894; --form-bg: #141A17; --ink: #D8E2DC; --hand: #C9D6CF; --red: #E0544A; --line: #3A4A42; --sub: #8FA39A; --btn: #D8E2DC; --btn-ink: #0B0F0D; --black: #D8E2DC; }
.mt-crt .mt-viewer { background: #141917; color: #7FA894; border-bottom: 1px solid #24302B; }
.mt-crt .k-paper { background-image: none; box-shadow: none; border-color: var(--form); }
.mt-crt .mt-fx-lines { background: repeating-linear-gradient(rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px); }
.mt-crt .mt-fx-noise { opacity: .12; mix-blend-mode: screen; }
.mt-crt.mt-fx-on .k-paper { translate: -9px 0; transform: skewX(6deg); filter: drop-shadow(4px 0 rgba(220, 30, 30, .9)) drop-shadow(-4px 0 rgba(30, 90, 255, .9)); }
.mt-crt.mt-fx-on .mt-fx-noise { opacity: .8; }
.mt-fx-band { display: none; left: -10px; right: -10px; top: 38%; height: 22px; background: rgba(200, 220, 210, .25); backdrop-filter: invert(1); -webkit-backdrop-filter: invert(1); }
.mt-fx-on .mt-fx-band { display: block; }
.mt-typed { margin: 4px 0 0 !important; font-family: ui-monospace, monospace; font-size: 14px; color: var(--ink); }
.mt-typed__cur { display: inline-block; width: 9px; height: 18px; margin-left: 2px; vertical-align: -3px; background: var(--ink); animation: mt-cur 1s steps(1) infinite; }
@keyframes mt-cur { 0% { opacity: 1; } 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .mt-mirror-once, .mt-fx-noise, .mt-fx-lamp, .mt-typed__cur { animation: none; }
  .mt-fx-lamp, .mt-fx-band { display: none; }
}


/* 案1「回収」: やり直した後の1回目の表紙。傷病名の欄に前の診断名を消した跡と、少しして赤ペンの「おかえりなさい」(2026-11-18) */
.mt-ghostcell { position: relative; overflow: hidden; }
.mt-erased { position: absolute; left: 6px; top: 3px; margin: 0; white-space: pre-line; font-family: 'Klee One', cursive; font-weight: 600; font-size: 10px; line-height: 1.4; color: var(--hand); opacity: .09; transform: rotate(-2deg); pointer-events: none; }
.mt-okaeri { margin: -8px 6px -4px 0 !important; text-align: right; font-family: 'Klee One', cursive; font-weight: 600; font-size: 16px; color: var(--red); transform: rotate(-4deg); opacity: 0; animation: mt-okaeri 1.2s ease-out 2.5s forwards; pointer-events: none; }
@keyframes mt-okaeri { to { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .mt-okaeri { animation: none; opacity: .9; } }

/* 案3「最後の1枚」: 終わりに渡す、診断(わたし)の診療録(2026-11-18) */
.mt-mine { display: flex; flex-direction: column; gap: 12px; }
.mt-mine__log { border: 1px solid var(--form); }
.mt-mine__head { padding: 4px 8px; font-family: 'BIZ UDMincho', serif; font-size: 10px; color: var(--form); background: var(--form-bg); border-bottom: 1px solid var(--form); }
.mt-mine__list { margin: 0; padding: 6px 10px; list-style: none; font-size: 14px; line-height: 2; }
.mt-mine__thanks { text-align: right; font-size: 14px; transform: rotate(-2deg); }

/* 結果の「再診を受ける」: 7〜11秒に1度、0.3秒だけ崩れる(2026-11-18、ユーザー案C。main.js の againButton が .is-fx を付け外し)。
   1〜2回目=紙のにじみ・二重ずれ / 3回目以降=横ずれ・赤青の色ずれ・砂嵐。段階3の傾き(transform)とぶつからないよう translate を使う */
/* 2026-11-20: 3秒に1度・0.6秒に。紙の時期のにじみは強め+わずかに大きく(scale は段階3の傾き transform とぶつからない) */
.mt-again-ink { transition: scale .12s; }
.mt-again-ink.is-fx { text-shadow: 5px 2px 0 rgba(184, 40, 31, .75), -3px -1px 1px rgba(27, 42, 68, .5); filter: blur(.6px); letter-spacing: .14em; scale: 1.03; }
/* 予約票の下の赤ペンの1行(main.js の askNote が .is-on。左から書かれる) */
.mt-ask { margin: 2px 0 0 18px; font-size: 16px; line-height: 1.6; color: var(--red); transform: rotate(-2deg); clip-path: inset(0 100% 0 0); }
.mt-ask[hidden] { display: none; }
.mt-ask.is-on { animation: mt-ask .9s steps(13) .1s forwards; }
.mt-ask.is-still { animation: none; clip-path: none; }
@keyframes mt-ask { to { clip-path: inset(0 0 0 0); } }
.mt-again-glitch.is-fx { translate: -6px 0; filter: drop-shadow(3px 0 rgba(220, 30, 30, .9)) drop-shadow(-3px 0 rgba(30, 90, 255, .9)); background-image: var(--mt-noise); background-blend-mode: overlay; }

/* エンディング7種類・見つけたエンディング(2026-11-18、仕様書 8章) */
.mt-mine__dx { white-space: pre-line; }
.mt-mine.is-hidden-end { border-left-color: var(--red); }
.mt-found { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); }
.mt-found__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.mt-found__head p { font-family: 'BIZ UDMincho', serif; font-size: 13px; color: var(--form); }
.mt-found__head b { font-size: 16px; color: var(--red); }
.mt-found__list { display: flex; justify-content: space-between; gap: 2px; margin: 0; padding: 0; list-style: none; }
.mt-found__item { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; font-size: 9px; line-height: 1.3; color: var(--sub); text-align: center; }
.mt-found__item b { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1.5px solid var(--line); border-radius: 50%; font-family: 'BIZ UDMincho', serif; font-size: 12px; color: var(--sub); }
.mt-found__item.is-found b { border-color: var(--red); color: var(--red); }
.mt-found__item.is-now b { background: var(--red); color: var(--paper); }
.mt-found__note { font-size: 11px; line-height: 1.7; color: var(--sub); }
/* サイト共通のCSSで <s> の取り消し線が消えているため、診療録の中では付け直す */
.mt-mine s, .k-dx s { text-decoration: line-through; text-decoration-color: currentColor; }

/* 戻ってきた時の付箋の重なり(2026-11-18、A+B+D)。main.js の fillBackNote が --x --y --r --o を入れる */
.k-stack { position: absolute !important; inset: 0; max-width: none !important; margin: 0 !important; overflow: hidden; pointer-events: none; }
.k-stack__note { position: absolute; left: 50%; top: 50%; width: 220px; padding: 22px 16px 18px; box-sizing: border-box; opacity: var(--o, 1); transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, 0px))) rotate(var(--r, 0deg)); animation: k-slap-under .26s cubic-bezier(.3, 0, .6, 1) both; }
.k-stack__text { margin: 0; font-family: 'Klee One', cursive; font-weight: 600; font-size: 17px; line-height: 1.55; color: var(--red); }
/* 付箋をバシッと貼る(2026-11-19、ユーザー指示): 手前の大きい位置から落ちてきて、少しつぶれて貼りつく。下の付箋が先に、真ん中の付箋は最後(--slap-delay は main.js の fillBackNote)。
   真ん中の付箋が貼りついた瞬間に下の付箋が小さく揺れる(.k-stack の k-thud。暗い幕ごと揺らすと端に明るいすき間が出るため)。scale・translate は位置の transform と別に重なる */
@keyframes k-slap-under { 0% { opacity: 0; scale: 1.7; translate: 0 -24px; } 70% { opacity: var(--o, 1); scale: .95; translate: 0 0; } 100% { opacity: var(--o, 1); scale: 1; translate: 0 0; } }
@keyframes k-slap { 0% { opacity: 0; scale: 2.1; translate: 0 -40px; filter: drop-shadow(0 34px 26px rgba(0, 0, 0, .35)); } 60% { opacity: 1; scale: .93; translate: 0 0; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .2)); } 78% { scale: 1.03; } 90% { scale: .99; } 100% { opacity: 1; scale: 1; translate: 0 0; filter: none; } }
@keyframes k-thud { 0%, 100% { translate: 0 0; } 25% { translate: -4px 3px; } 50% { translate: 3px -2px; } 75% { translate: -2px 1px; } }
.k-modal:not([hidden]) .k-stack { animation: k-thud .2s linear calc(var(--slap-delay, 0ms) + .22s) both; }
.k-modal:not([hidden]) .k-sticky--modal { animation: k-slap .38s cubic-bezier(.3, 0, .55, 1) var(--slap-delay, 0ms) both; }
.k-sticky__time { font-family: 'Klee One', cursive; font-weight: 600; font-size: 14px; line-height: 1.7; color: var(--hand); }
.k-sticky--modal { z-index: 1; }
@media (prefers-reduced-motion: reduce) { .k-stack__note, .k-modal:not([hidden]) .k-stack, .k-modal:not([hidden]) .k-sticky--modal { animation: none; } }
