/* 音の確認・案内・小窓の見た目（C2）。
   DOM は public/js/screens/{audio-setup,support}.js と app.js が作る（どれも書き換えない）。
   ここはその素の HTML に、紙色のカード・太縁・手順つきの見た目を与えるだけ。 */

/* ============================================================ 小窓（app.js） */
.modal__scrim { position: absolute; inset: 0; background: rgba(10, 7, 22, .74); }
.modal__row { display: flex; gap: 10px; justify-content: flex-end; }
.modal__row .btn { min-width: 120px; }

.modal--audio { padding: 0; align-items: stretch; }
.modal__box--audio {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px; margin: auto;
  padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
  max-height: min(92vh, 100% - 24px);
}
@media (max-width: 560px) {
  .modal--audio { padding: 0; }
  .modal__box--audio { max-width: none; max-height: 100%; height: 100%; margin: 0; border-radius: 0; border-width: 0; box-shadow: none; }
}

/* 見出しの帯 */
.audio__bar {
  position: sticky; top: 0; z-index: 2; flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 14px 18px;
  background: linear-gradient(180deg, var(--stage-3), var(--stage-2));
  border-bottom: var(--line-thick);
  color: var(--paper);
}
.audio__bar h3 {
  flex: 1; min-width: 0; margin: 0;
  font-family: var(--font-display); font-size: 18px; line-height: 1.25;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
}
.notice__x {
  flex: none; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(255, 247, 232, .5); background: rgba(27, 23, 38, .5); color: var(--paper);
  cursor: pointer;
}
.notice__x:hover { background: rgba(255, 247, 232, .16); }
.notice__x:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.notice__x svg { width: 20px; height: 20px; }

/* ============================================================ 本体 */
.audio {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 16px 18px calc(22px + env(safe-area-inset-bottom));
  background: var(--paper); color: var(--ink);
  counter-reset: audiostep;
}
.audio > div { display: flex; flex-direction: column; gap: 12px; }
.audio__lead {
  margin: 0 0 14px; padding: 11px 13px;
  border-left: 5px solid var(--gold); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(255, 201, 60, .16);
  font-size: 13.5px; line-height: 1.7;
}

/* 手順の見出し（1→2）。番号は CSS の counter で出す */
.sect {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px;
}
.sect:first-child { margin-top: 0; }
.sect__label {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-body); font-weight: 900; font-size: 15px; line-height: 1.3;
  white-space: nowrap;
}
.sect__label::before {
  counter-increment: audiostep; content: counter(audiostep);
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); color: var(--ink); border: 2.5px solid var(--ink);
  font-size: 15px; line-height: 1;
}
.sect__rule { flex: 1; height: 3px; border-radius: 3px; background: repeating-linear-gradient(90deg, rgba(27, 23, 38, .3) 0 8px, transparent 8px 14px); }

/* 3つめ（はじめる）。DOM に見出しが無いので、最後の箱へ番号を足す。
   「決定のボタンを持つ最後の箱」だけに当てる（:has が効かない環境では番号が出ないだけ）。 */
.audio > div > div:last-of-type:has(> .btn--primary) {
  position: relative;
  margin-top: 6px; padding-top: 16px;
  border-top: 3px dashed rgba(27, 23, 38, .22);
}
.audio > div > div:last-of-type:has(> .btn--primary)::before {
  counter-increment: audiostep; content: counter(audiostep);
  position: absolute; left: 0; top: -15px;
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gold); color: var(--ink); border: 2.5px solid var(--ink);
  font-family: var(--font-body); font-weight: 900; font-size: 15px; line-height: 1;
}


/* 機器えらび */
.pick { display: flex; flex-direction: column; gap: 6px; }
.pick__k { font-family: var(--font-body); font-weight: 900; font-size: 13.5px; }
.input, .pick__sel {
  width: 100%; min-height: 52px; padding: 12px 42px 12px 14px;
  border: var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--ink);
  font-family: var(--font-body); font-weight: 700; font-size: 15px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B1726' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 20px 20px;
  cursor: pointer;
}
.input:focus-visible, .pick__sel:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.input:disabled, .pick__sel:disabled { opacity: .55; cursor: default; }

/* 声の大きさ（この画面の主役） */
.lvl {
  display: flex; flex-direction: column; gap: 9px;
  padding: 15px 15px 13px;
  border: var(--line); border-radius: var(--r);
  background: linear-gradient(170deg, #FFF6DC, var(--paper) 60%);
  box-shadow: var(--shadow-sm);
}
.lvl::before {
  content: "声の大きさ";
  font-family: var(--font-body); font-weight: 900; font-size: 12.5px; letter-spacing: .06em; color: #6C6478;
}
.lvl__bar {
  position: relative; height: 30px; overflow: hidden;
  border: 3px solid var(--ink); border-radius: var(--r-pill);
  background: #E8E0CD;
}
.lvl__bar i {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  background: repeating-linear-gradient(115deg, var(--gold) 0 12px, var(--orange) 12px 24px);
  transition: width .07s linear;
}
.lvl__bar.is-on i { background: repeating-linear-gradient(115deg, #3FD177 0 12px, var(--green) 12px 24px); }
.lvl__bar::after {   /* 「ここを超えたら声が入っている」の目安 */
  content: ""; position: absolute; left: 12%; top: 0; bottom: 0; width: 3px;
  background: rgba(27, 23, 38, .28);
}
.lvl__t { font-size: 13.5px; font-weight: 700; line-height: 1.5; color: #6C6478; min-height: 1.5em; }
.lvl__t.is-ok { color: #147A3C; }

/* 注記 */
.formnote { margin: 0; font-size: 12.5px; line-height: 1.66; color: #6C6478; }

/* ボタン */
.btn--wide { width: 100%; }
.audio .field { display: flex; flex-direction: column; gap: 8px; }
.audio .btn { font-size: 15px; }
.hidden__i { width: 20px; height: 20px; flex: none; }

/* マイクが開けないときの案内 */
.audio__err {
  display: flex; flex-direction: column; gap: 10px;
  padding: 15px; border: 3px solid var(--red); border-radius: var(--r);
  background: rgba(230, 62, 43, .09);
}
.audio__errh { display: flex; align-items: center; gap: 10px; }
.audio__errh b { font-family: var(--font-body); font-weight: 900; font-size: 15.5px; line-height: 1.35; }
.help__i { flex: none; width: 26px; height: 26px; color: var(--red); }
.audio__err > p { margin: 0; font-size: 13.5px; line-height: 1.7; }

/* 手順（support.js の stepList） */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.steps > li {
  position: relative; padding: 2px 0 2px 34px;
  font-size: 13.5px; line-height: 1.66;
}
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 1px;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-body); font-weight: 900; font-size: 12.5px; line-height: 1;
}

/* 「もっと詳しく調べる」 */
.checklink { margin: 6px 0 0; text-align: center; }
.checklink--tight { margin: 0; }
.checklink a, .checklink button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 48px; padding: 10px 14px;
  border: none; background: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: 13.5px;
  color: #4A4358; text-decoration: underline; text-underline-offset: 3px;
}
.checklink a:hover, .checklink button:hover { color: var(--red-deep); }
.checklink a:focus-visible, .checklink button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: var(--r-sm); }
.checklink__i { flex: none; width: 18px; height: 18px; color: var(--green); }

/* ============================================================ やりとりの記録（app.js） */
.talklog { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; overflow-y: auto; padding-right: 4px; }
.talk { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: var(--r-sm); background: rgba(27, 23, 38, .05); }
.talk--ai { background: rgba(255, 201, 60, .2); }
.talk__w { font-family: var(--font-body); font-weight: 900; font-size: 11.5px; color: #6C6478; }
.talk--ai .talk__w { color: #8A6A12; }
.talk__b { margin: 0; font-size: 14px; line-height: 1.6; }

/* ============================================================ 念のための保険
   万一これらのクラスに寸法が付かなかった場合でも、SVG が画面いっぱいにならないように。 */
.audio svg, .modal__box svg { max-width: 100%; max-height: 40px; }
.audio .lvl svg, .modal__box .pt svg { max-height: none; }
