/* 375px の幅から崩さない。文字の大きさはブラウザの設定に従う（html に px で大きさを決めず、rem と em だけを使う） */
:root {
  --color-text: #1f2328;
  --color-bg: #ffffff;
  --space: 1rem;
  --max-width: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #e6e6e6;
    --color-bg: #16181b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

main {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space);
}

[hidden] {
  display: none !important;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

button {
  min-height: 2.75rem;
}

/* 規約のページ（privacy.html・terms.html）の表。375px でははみ出さず、枠の中で折り返す */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.5em;
  border: 1px solid currentColor;
  text-align: left;
  vertical-align: top;
}

/* ---------- 最初の画面から登録まで（4.1） ---------- */
:root {
  --color-accent: #1f6feb;
  --color-accent-text: #ffffff;
  --color-muted: #59636e;
  --color-error: #b42318;
  --color-box: #f3f5f7;
  --color-border: #c9d1d9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-accent: #4c8dff;
    --color-accent-text: #0d1117;
    --color-muted: #a5adb6;
    --color-error: #ff8a80;
    --color-box: #22262b;
    --color-border: #3d444d;
  }
}

h1 {
  font-size: 1.5rem;
  line-height: 1.4;
  margin: 0.5rem 0 1rem;
}

button,
.button {
  display: block;
  width: 100%;
  margin: 0.75rem 0;
  padding: 0.6em 1em;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button.primary,
.button.line {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-text);
  font-weight: 700;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.link-button {
  border: none;
  background: none;
  color: var(--color-accent);
  text-decoration: underline;
  min-height: 2.75rem;
}

.field {
  margin: 1rem 0;
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

input[type="email"],
input[type="text"],
select {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.4em 0.6em;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  background: var(--color-bg);
  color: var(--color-text);
}

/* LP の登録フォーム（web/lp/index.html の受け皿）: チェックからボタンまでを1つの枠にまとめる（4.1。375px でも1つのまとまり） */
.lp-form {
  margin: 1.5rem 0;
}

.lp-consent {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-accent);
  border-radius: 0.5rem;
  background: var(--color-box);
}

.lp-consent label.check {
  margin-top: 0;
}

.lp-consent .note {
  margin: 0;
}

.lp-sent {
  margin: 1.5rem 0;
}

.list-consent {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 2px solid var(--color-accent);
  border-radius: 0.5rem;
  background: var(--color-box);
}

.list-consent p {
  margin: 0.4rem 0;
}

label.check {
  display: flex;
  gap: 0.6em;
  align-items: flex-start;
  margin-top: 0.75rem;
  font-weight: 700;
}

label.check input {
  flex: none;
  width: 1.4em;
  height: 1.4em;
  margin-top: 0.15em;
}

/* 4.3: 未チェックのまま押されたときの欄の印（枠の色だけ。文は出さない） */
label.check[data-missing="true"] {
  outline: 2px solid var(--color-error);
  outline-offset: 4px;
  border-radius: 0.25rem;
}

.consent-text p {
  margin: 0.5rem 0;
}

.notice,
.note {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.error {
  color: var(--color-error);
}

.message:empty,
.error:empty {
  display: none;
}

.message {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background: var(--color-box);
}

.captcha {
  min-height: 0;
  margin: 0.75rem 0;
  max-width: 100%;
  overflow: hidden;
}

.links a + a {
  margin-left: 0.75em;
}

/* ---------- 通話の前・通話・終わり（4.2） ---------- */
.choices {
  margin: 1rem 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.choices legend {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

label.choice {
  display: flex;
  gap: 0.6em;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.25rem 0.75rem;
  margin: 0.4rem 0;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
}

label.choice input {
  flex: none;
  width: 1.3em;
  height: 1.3em;
  margin: 0;
}

/* 声の行: 選択の枠と「▶ 聞いてみる」を横に並べる（7.1。375px でも折り返して横にはみ出さない） */
.voice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.75rem;
}

.voice-row label.choice {
  flex: 1 1 10rem;
  min-width: 0;
}

.voice-row button.preview {
  flex: none;
  padding: 0 0.25rem;
  white-space: nowrap;
}

.voice-row [data-role="preview-failed"] {
  flex-basis: 100%;
  margin: 0 0 0.25rem;
}

.notice-box {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--color-box);
}

.notice-box h1,
.notice-box h2 {
  font-size: 1.15rem;
  margin: 0.25rem 0 0.5rem;
}

.ai-badge {
  display: inline-block;
  margin: 0.5rem 0;
  padding: 0.2em 0.8em;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-accent-text);
  font-weight: 700;
}

.elapsed {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  margin: 0.25rem 0;
}

.turn {
  min-height: 3.4em;
  margin: 0.75rem 0;
  font-weight: 700;
}

.turn[data-turn="user"] {
  color: var(--color-accent);
}

.level {
  height: 0.6rem;
  border-radius: 999px;
  background: var(--color-box);
  overflow: hidden;
}

.level-bar {
  width: 0;
  height: 100%;
  background: var(--color-accent);
  transition: width 0.1s linear;
}

.closing {
  font-weight: 700;
}

button.danger {
  background: var(--color-error);
  border-color: var(--color-error);
  color: var(--color-bg);
  font-weight: 700;
}

.report-form {
  margin: 0.5rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
}
