/* アプリの画面（見出し・手順・カード・編集画面・マップ画面）。 */
body { min-height: 100vh; }
main { padding: 0 20px 40px; max-width: 1400px; margin: 0 auto; }

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 14px 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.app-title { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: 0.04em; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; flex: 1; min-width: 0; }
.steps li {
  padding: 4px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  background: transparent;
}
.steps li.current { background: var(--ink); color: #fff; }
.steps li.done { color: var(--ink); }

.card {
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 8px; font-size: 22px; }
.card.narrow { max-width: 720px; margin: 24px auto; }

.error { color: var(--danger); font-weight: 700; min-height: 1em; }
.error:empty { display: none; }
.warning {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-size: 16px;
}
.hint { color: var(--muted); font-size: 15px; margin: 0 0 8px; }

.btn-large { min-height: 60px; padding: 0 2em; font-size: 22px; }

/* 合言葉 */
.pass-form { display: flex; gap: 10px; flex-wrap: wrap; }
.pass-form input {
  flex: 1; min-width: 200px; min-height: 52px; padding: 0 14px;
  font: inherit; font-size: 22px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}

/* 録音 */
.record-area { display: flex; justify-content: center; padding: 24px 0; }
.btn-record { min-height: 72px; padding: 0 2.2em; font-size: 24px; background: var(--a); border-color: var(--a); color: #fff; }
.btn-record:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-record:hover { background: #cf5530; }
.file-pick { margin-top: 8px; color: var(--muted); font-size: 16px; }
.file-pick summary { cursor: pointer; }

/* 待ち時間 */
.busy { text-align: center; padding: 40px 24px; }
.busy p { font-size: 20px; font-weight: 700; white-space: pre-line; }
.spinner {
  width: 54px; height: 54px; margin: 0 auto 12px;
  border: 6px solid var(--b-soft); border-top-color: var(--b); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ② 文字を直す */
.edit-layout { max-width: 960px; margin: 16px auto 0; display: flex; flex-direction: column; gap: 16px; }
#player { width: 100%; margin: 6px 0 12px; }
.make-bar {
  position: sticky; bottom: 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96); box-shadow: var(--shadow);
}
.make-bar p { margin: 0; }

.editor-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.editor-help { margin: 0; color: var(--muted); font-size: 16px; }
.who-sample { display: inline-block; width: 1.5em; text-align: center; border-radius: 6px; color: #fff; margin: 0 2px; font-size: 14px; }
.who-sample.a { background: var(--a); }
.who-sample.b { background: var(--b); }

.editor-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.editor-row {
  position: relative;
  display: grid;
  grid-template-columns: 2.2em 52px 1fr 40px;
  align-items: start;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.editor-row:hover { background: var(--surface-2); }
.editor-row.hit { background: var(--accent-soft); outline: 2px solid var(--accent); }
.editor-row .no { color: var(--muted); text-align: right; font-size: 15px; padding-top: 10px; }
.editor-row .who {
  width: 52px; height: 44px;
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 20px; font-weight: 900;
}
.editor-row .who.a { background: var(--a); }
.editor-row .who.b { background: var(--b); }
.editor-row .text {
  width: 100%; min-height: 44px; margin: 0; padding: 8px 12px;
  font: inherit; font-size: 18px; line-height: 1.5;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  resize: none; overflow: hidden; background: var(--surface);
}
.editor-row .text:focus { outline: none; border-color: var(--b); box-shadow: 0 0 0 3px var(--b-soft); }
.editor-row .more {
  width: 40px; height: 44px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 22px; font-weight: 900;
}
.editor-row .more:hover { background: var(--guide); }

.row-menu {
  position: absolute; right: 6px; top: 52px; z-index: 10;
  display: flex; flex-direction: column;
  min-width: 260px; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: 0 8px 24px rgba(35, 40, 51, 0.16);
}
.row-menu button {
  min-height: 44px; padding: 0 12px; text-align: left;
  border: none; border-radius: 6px; background: transparent; font-size: 16px; font-weight: 700;
}
.row-menu button:hover, .row-menu button:focus { background: var(--surface-2); outline: none; }
.row-menu button.danger { color: var(--danger); }

/* 読むだけの文字起こし（マップの横） */
.editor.readonly .editor-row { grid-template-columns: 2em 30px 1fr; padding: 6px 8px; }
.editor.readonly .who {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 14px; font-weight: 700; margin-top: 2px;
}
.editor.readonly .who.a { background: var(--a); }
.editor.readonly .who.b { background: var(--b); }
.editor.readonly .text { margin: 0; padding: 0; min-height: 0; border: none; background: transparent; font-size: 16px; line-height: 1.5; }
.editor.readonly .no { padding-top: 2px; }

/* ③ マップ */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; margin-top: 12px; }
.transcript-side { max-height: calc(100vh - 120px); overflow: auto; position: sticky; top: 12px; padding: 16px; }
.transcript-side h2 { font-size: 18px; }
@media (max-width: 960px) { .map-layout { grid-template-columns: 1fr; } .transcript-side { position: static; } }

/* 確認・お知らせの窓 */
.app-dialog {
  max-width: min(520px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(35, 40, 51, 0.25);
}
.app-dialog::backdrop { background: rgba(35, 40, 51, 0.35); }
.app-dialog-msg { margin: 0 0 20px; font-size: 20px; font-weight: 700; line-height: 1.6; white-space: pre-line; }
.app-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b03232; }
.editor-tools .tool-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* マップ画面の上の保存バー */
.save-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding: 12px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.save-bar p { margin: 0; font-size: 16px; color: var(--muted); }

/* 録音 */
.record-area.recording, .record-area.done { flex-direction: column; align-items: stretch; gap: 14px; }
.rec-timer { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 56px; font-weight: 900; font-variant-numeric: tabular-nums; }
.rec-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--a); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.rec-progress { position: relative; height: 12px; border-radius: 999px; background: var(--guide); overflow: hidden; }
.rec-progress #rec-bar { height: 100%; width: 0; background: var(--a); transition: width 0.25s linear; }
.rec-progress .rec-mark { position: absolute; top: 0; bottom: 0; left: calc(180 / 210 * 100%); width: 2px; background: var(--ink); opacity: 0.5; }
.rec-meter { height: 18px; border-radius: 999px; background: var(--b-soft); overflow: hidden; }
.rec-meter #rec-level { height: 100%; width: 0; background: var(--b); transition: width 0.08s linear; }
.rec-note { margin: 0; text-align: center; color: var(--muted); font-size: 16px; }
.rec-note.soon { color: var(--danger); font-weight: 700; }
.btn-stop { align-self: center; min-height: 64px; padding: 0 2.4em; font-size: 22px; background: var(--ink); border-color: var(--ink); color: #fff; }
#rec-player { width: 100%; }
.rec-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#rec-recovered { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* 画面のはばがせまいとき（Chromebook を縦にしたときなど） */
@media (max-width: 600px) {
  main { padding: 0 12px 32px; }
  .app-header { padding: 12px; }
  .steps li { padding: 2px 10px; font-size: 14px; }
  .card { padding: 16px; }
  .editor-row { grid-template-columns: 1.6em 44px 1fr 36px; gap: 6px; }
  .editor-row .who { width: 44px; }
}

.save-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.save-title label { font-weight: 700; font-size: 16px; }
.save-title input {
  width: 14em; min-height: 44px; padding: 0 12px;
  font: inherit; font-size: 18px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}
.save-title input:focus { outline: none; border-color: var(--b); box-shadow: 0 0 0 3px var(--b-soft); }
