/* ===== 二体目 画面デザイン（くねくねとは別の「記録・書き起こし」の見た目） =====
   style.css → nitaime.css → この順で読み込み、基本部分を上書きする */
:root {
  --mincho: "BIZ UDPMincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --mono: "M PLUS 1 Code", "BIZ UDGothic", ui-monospace, monospace;
  --ink: #e8ebf1;
  --ink-dim: #9aa3b5;
  --red: #c8283c;
  --panel: rgba(4, 6, 12, .9);
}
html, body { font-family: var(--mincho); }

/* 画面全体：フィルムの粒子と走査線 */
#stage::after { content: ""; position: absolute; inset: -50%; z-index: 2; pointer-events: none; opacity: .09;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  animation: grain .6s steps(4) infinite; }
@keyframes grain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -4%); } 75% { transform: translate(-1%, 3%); } }
#stage::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px 4px), radial-gradient(ellipse at 60% 45%, transparent 45%, rgba(0, 0, 0, .55)); }

/* 左上：録画表示 */
#case { position: absolute; left: 16px; top: max(12px, env(safe-area-inset-top)); z-index: 5; display: flex; gap: 14px; align-items: center; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--ink-dim); text-shadow: 0 1px 3px #000; pointer-events: none; }
#case .rec-dot { color: var(--red); font-weight: 600; animation: recblink 1.6s steps(2) infinite; }
@keyframes recblink { 50% { opacity: .25; } }
#tc { font-variant-numeric: tabular-nums; }
#case-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }

/* 書き起こし欄（PC：左の帯） */
#textbox { left: 0; top: 0; bottom: 0; transform: none; width: min(560px, 44vw); min-height: 0; max-width: none;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 80px 64px 96px 40px; border: none; border-radius: 0; box-shadow: none; backdrop-filter: none;
  background: linear-gradient(90deg, rgba(4, 6, 12, .93) 0%, rgba(4, 6, 12, .86) 68%, rgba(4, 6, 12, 0) 100%);
  font-size: clamp(16px, 1.35vw, 19px); line-height: 2.05; letter-spacing: .03em; z-index: 3; }
#hist .h { color: var(--ink-dim); opacity: .42; font-size: .9em; margin-bottom: .9em; line-height: 1.9; }
#hist .h:last-child { opacity: .62; }
#hist .h-who, #namebox { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .22em; color: var(--red); margin-bottom: 2px; }
#namebox { position: static; background: none; padding: 0; border-radius: 0; font-weight: 600; }
#namebox::before { content: "● "; }
#namebox:empty { display: none; }
#text { color: var(--ink); min-height: 3.6em; border-left: 2px solid var(--red); padding-left: 14px; margin-left: -16px; }
#textbox.thought #text { color: #b9c7e6; }
#next-mark { position: static; align-self: flex-start; margin-top: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .15em; color: var(--ink-dim); }
#next-mark.on { animation: nextblink 1.2s ease-in-out infinite; }
@keyframes nextblink { 50% { opacity: .2; } }

/* 立ち絵・電話は、書き起こし欄を避けて右側に */
.ch[data-pos="l"] { left: 54%; } .ch[data-pos="c"] { left: 68%; } .ch[data-pos="r"] { left: 84%; }
.ch { height: 92%; }
.ch img { filter: drop-shadow(0 0 30px rgba(0, 0, 0, .6)) saturate(.85) contrast(1.05); }
#phone { left: 70%; }
#phone { border-radius: 4px; border: 1px solid rgba(232, 235, 241, .2); border-top: 3px solid var(--red); background: #0b0e15; }
.phone-head { background: #0b0e15; font-family: var(--mono); font-size: 12px; letter-spacing: .15em; color: var(--ink-dim); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.phone-head::before { content: "SMS  "; color: var(--red); }
#phone-body { background: #0b0e15; }
.bubble { background: #1a1f2b; color: var(--ink); border-radius: 2px 12px 12px 12px; font-family: var(--gothic); }

/* 選択肢：書き起こしの続きとして番号付きで並ぶ */
#stage.choosing #textbox { padding-bottom: calc(var(--nchoice, 2) * 62px + 120px); }
#choices { left: 0; top: auto; bottom: 0; right: auto; width: min(560px, 44vw); align-items: stretch; justify-content: flex-end; gap: 10px; padding: 0 64px 96px 40px; background: none; }
#choices button { width: 100%; text-align: left; padding: 13px 16px; font-size: clamp(15px, 1.25vw, 18px); letter-spacing: .06em; border-radius: 0;
  background: rgba(232, 235, 241, .04); border: 1px solid rgba(232, 235, 241, .18); border-left: 3px solid var(--red); color: var(--ink); }
#choices button:hover { background: rgba(200, 40, 60, .22); color: #fff; transform: none; }
#choices button:focus { background: rgba(232, 235, 241, .04); transform: none; }
#choices button:focus-visible { outline: 1px solid rgba(232, 235, 241, .6); outline-offset: 2px; color: var(--ink); background: rgba(232, 235, 241, .08); transform: none; }
.c-no { font-family: var(--mono); font-size: 12px; color: var(--red); margin-right: 14px; letter-spacing: .1em; }

/* 操作ボタン：右下のテープデッキ */
#hud { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; gap: 0; }
#hud button { border-radius: 0; margin-left: -1px; padding: 7px 11px; background: rgba(4, 6, 12, .7); border: 1px solid rgba(232, 235, 241, .22); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-dim); }
#hud button i { font-style: normal; margin-right: 5px; color: var(--ink); }
#hud button.on { background: var(--red); color: #fff; border-color: var(--red); }
#hud button.on i { color: #fff; }

/* 章見出し：記録ファイルの表紙 */
#chapter-card { align-items: flex-start; justify-content: center; padding: 0 10vw; background: #05070c; }
#chapter-card.in { animation: ccIn2 2.6s ease forwards; }
@keyframes ccIn2 { 0% { opacity: 0; } 12%, 85% { opacity: 1; } 100% { opacity: 1; } }
.cc-file { font-family: var(--mono); font-size: 12px; letter-spacing: .2em; color: var(--ink-dim); border-bottom: 1px solid rgba(232, 235, 241, .2); padding-bottom: 10px; margin-bottom: 18px; width: min(640px, 80vw); }
.cc-idx { font-family: var(--mincho); font-size: clamp(64px, 12vw, 140px); line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(232, 235, 241, .5); font-weight: 600; }
#chapter-card .cc-num { font-family: var(--mono); font-size: 14px; letter-spacing: .4em; color: var(--red); margin: 14px 0 6px; }
#chapter-card .cc-title { font-family: var(--mincho); font-size: clamp(26px, 4vw, 44px); letter-spacing: .25em; font-weight: 700; }
.cc-stamp { position: absolute; right: 12vw; bottom: 18vh; font-family: var(--mincho); font-weight: 700; font-size: clamp(22px, 3vw, 34px); letter-spacing: .2em; color: var(--red); border: 3px solid var(--red); padding: 6px 16px 6px 22px; transform: rotate(-12deg) scale(1.6); opacity: 0; }
#chapter-card.in .cc-stamp { animation: stampIn .5s .5s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes stampIn { to { transform: rotate(-12deg) scale(1); opacity: .85; } }

/* 資料・謎の枠 */
.modal-inner { border-radius: 0; border: 1px solid rgba(232, 235, 241, .14); border-top: 3px solid var(--red); background: #0b0d12; }
#modal-foot { background: #07080c; }
#modal-foot button { border-radius: 0; font-family: var(--mono); letter-spacing: .1em; }
.pz h2 { font-family: var(--mono); font-size: 15px; letter-spacing: .15em; color: var(--ink-dim); border-bottom: 1px solid rgba(232, 235, 241, .12); padding-bottom: 8px; }
.pz-q { font-family: var(--mincho); }
.paper { border-radius: 0; }

/* タイトル：右に縦書きの題、左に記録票 */
#title::after { background: linear-gradient(90deg, rgba(3, 4, 9, .92) 0%, rgba(3, 4, 9, .6) 45%, rgba(3, 4, 9, .25) 75%, rgba(3, 4, 9, .55) 100%); }
.title-inner { left: 0; right: 0; top: 0; bottom: 0; transform: none; display: flex; justify-content: space-between; align-items: center; padding: 0 7vw; }
.t-file { max-width: 520px; }
.t-pre { font-family: var(--mono); font-size: 12px; letter-spacing: .25em; line-height: 1.9; color: var(--ink-dim); border-left: 3px solid var(--red); padding-left: 12px; margin: 0 0 18px; }
.t-num { font-family: var(--mincho); font-weight: 700; font-size: clamp(56px, 9vw, 120px); line-height: 1; margin: 0; color: transparent; -webkit-text-stroke: 1px rgba(232, 235, 241, .55); letter-spacing: .06em; }
.t-sub { display: block; font-family: var(--mincho); font-size: clamp(14px, 1.5vw, 18px); letter-spacing: .3em; color: #cfd8ea; margin: 14px 0 34px; }
#title h1.t-main { margin: 0; writing-mode: vertical-rl; font-family: var(--mincho); font-weight: 700; font-size: clamp(72px, 13vh, 150px); letter-spacing: .3em; line-height: 1; text-shadow: 0 0 40px rgba(0, 0, 0, .8); animation: none; color: #f1f3f7; }
.t-stamp { position: absolute; right: calc(7vw + clamp(80px, 14vh, 160px)); top: 18vh; font-weight: 700; font-size: 22px; letter-spacing: .2em; color: var(--red); border: 2px solid var(--red); padding: 4px 10px 4px 14px; transform: rotate(-10deg); opacity: .8; }
.title-menu { gap: 0; border-top: 1px solid rgba(232, 235, 241, .15); }
.title-menu button { width: 100%; text-align: left; font-family: var(--mincho); font-size: clamp(16px, 1.6vw, 19px); letter-spacing: .2em; padding: 12px 4px; border-bottom: 1px solid rgba(232, 235, 241, .15); }
.title-menu button span:first-child { font-family: var(--mono); font-size: 12px; color: var(--red); margin-right: 18px; letter-spacing: .05em; }
.title-menu button::before { content: none; }
.title-menu button:hover, .title-menu button:focus-visible { background: rgba(200, 40, 60, .16); }
.title-menu button.small { border-bottom: none; margin-top: 4px; font-size: 13px; }
.title-note { font-family: var(--gothic); font-size: 11px; color: #8d96a8; }

/* エンディング：記録票に判を押す */
#ending { background: #05070c; overflow-y: auto; }
#ending .end-inner { position: relative; text-align: left; width: min(640px, 100%); padding: 32px 34px 30px; background: #0b0d12; border: 1px solid rgba(232, 235, 241, .14); border-top: 3px solid var(--red); }
.end-head { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--ink-dim); border-bottom: 1px solid rgba(232, 235, 241, .12); padding-bottom: 10px; margin-bottom: 18px; }
#ending .end-kind { font-family: var(--mono); letter-spacing: .3em; color: var(--red); font-size: 13px; }
#ending .end-title { font-family: var(--mincho); font-weight: 700; letter-spacing: .25em; margin: 10px 0 18px; font-size: clamp(34px, 6vw, 60px); }
#ending .end-desc { font-family: var(--mincho); }
.end-stamp { position: absolute; right: 28px; top: 54px; font-family: var(--mincho); font-weight: 700; font-size: 22px; letter-spacing: .15em; color: var(--red); border: 3px double var(--red); padding: 6px 12px 6px 16px; transform: rotate(-9deg); opacity: .85; }
.end-stamp:empty { display: none; }
#ending .end-buttons { align-items: stretch; }
#ending .end-buttons button { border-radius: 0; text-align: left; font-family: var(--mincho); }

/* ログ・一覧 */
.log h2, .endlist h2 { font-family: var(--mono); font-size: 15px; letter-spacing: .2em; }
.log b { display: block; font-family: var(--mono); font-size: 11px; color: var(--red); letter-spacing: .2em; }
.ek { font-family: var(--mono); color: var(--red); }

/* スマホ縦：書き起こし欄を下に */
@media (max-width: 760px) {
  #textbox { top: auto; width: 100%; max-height: 58vh; padding: 70px 20px 74px; justify-content: flex-end;
    background: linear-gradient(0deg, rgba(4, 6, 12, .95) 62%, rgba(4, 6, 12, 0) 100%); font-size: 16px; }
  #hist .h:not(:last-child) { display: none; }
  #text { margin-left: -8px; padding-left: 10px; }
  #stage.choosing #textbox { padding-bottom: calc(var(--nchoice, 2) * 58px + 92px); }
  #choices { width: 100%; padding: 0 20px 74px; }
  .ch[data-pos="l"] { left: 26%; } .ch[data-pos="c"] { left: 50%; } .ch[data-pos="r"] { left: 74%; }
  /* 下の書き起こし欄に隠れないよう、上半身が欄の上に収まる高さへ持ち上げる。足元は背景へなじませる */
  .ch { bottom: 38vh; height: 54vh; width: 86vw; max-width: 420px;
    -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 100%); mask-image: linear-gradient(180deg, #000 78%, transparent 100%); }
  #phone { left: 50%; }
  #hud { right: 8px; bottom: 12px; }
  #hud button { padding: 6px 8px; font-size: 10px; }
  #hud button i { display: none; }
  #case { font-size: 10px; gap: 8px; }
  #case-label { max-width: 38vw; }
  .title-inner { flex-direction: column-reverse; justify-content: center; align-items: flex-start; padding: 24px; gap: 10px; }
  #title h1.t-main { writing-mode: horizontal-tb; font-size: 56px; letter-spacing: .2em; }
  .t-stamp { right: 24px; top: 26px; font-size: 16px; }
  .t-sub { margin-bottom: 18px; letter-spacing: .15em; }
  #title::after { background: linear-gradient(0deg, rgba(3, 4, 9, .95) 0%, rgba(3, 4, 9, .55) 60%, rgba(3, 4, 9, .35) 100%); }
  .cc-stamp { right: 8vw; bottom: 22vh; }
  .end-stamp { position: static; display: inline-block; margin: 0 0 8px; }
}
/* 横向きスマホなど高さが低い画面 */
@media (max-height: 500px) {
  #textbox { padding: 44px 40px 56px 28px; font-size: 14px; line-height: 1.8; width: min(520px, 52vw); }
  #hist .h:not(:last-child) { display: none; }
  #stage.choosing #textbox { padding-bottom: calc(var(--nchoice, 2) * 46px + 60px); }
  #choices { width: min(520px, 52vw); padding: 0 40px 52px 28px; gap: 6px; }
  #choices button { padding: 8px 12px; font-size: 14px; }
  .ch[data-pos="l"] { left: 60%; } .ch[data-pos="c"] { left: 72%; } .ch[data-pos="r"] { left: 86%; }
  #phone { left: 74%; }
  .title-inner { padding: 0 5vw; }
  .t-num { font-size: 52px; }
  .t-sub { margin: 8px 0 12px; }
  .title-menu button { padding: 6px 4px; font-size: 15px; }
  #title h1.t-main { font-size: 64px; }
  .title-note { display: none; }
  .cc-idx { font-size: 64px; }
  #ending { align-items: flex-start; }
  #ending .end-inner { padding: 18px 24px; }
  #ending .end-title { margin: 4px 0 8px; font-size: 32px; }
  .end-stamp { top: 36px; font-size: 18px; }
  #case-label { max-width: 40vw; }
}

/* エンディング後アンケート：協会の聞き取り票 */
#endpop .modal-card { border-radius: 0; background: #0b0d12; border: 1px solid rgba(232, 235, 241, .14); border-top: 3px solid var(--red); text-align: left; }
.pop-file { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--ink-dim); border-bottom: 1px solid rgba(232, 235, 241, .12); padding-bottom: 10px; margin-bottom: 14px; }
#endpop .pop-head { font-family: var(--mincho); font-weight: 700; letter-spacing: .12em; }
#endpop .pop-label { font-family: var(--mono); font-size: 12px; letter-spacing: .15em; color: var(--red); }
#endpop .stars { justify-content: flex-start; }
#endpop .star { color: #3a3f4c; }
#endpop .star.on { color: #e8c45a; }
#endpop .fb-text { border-radius: 0; background: rgba(232, 235, 241, .05); border-color: rgba(232, 235, 241, .2); }
#endpop .fb-send { margin-left: 0; border-radius: 0; font-family: var(--mincho); }
#endpop .fb-thanks { text-align: left; padding: 16px 0; font-family: var(--mincho); }
#endpop .line-btn { margin-left: 0; }
#ending .end-buttons button.survey { border-style: dashed; color: var(--ink-dim); }
