/* 5秒アンケート：外部フレームワーク不使用 */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-subtle: #f3f2ee;
  --text: #18181b;
  --text-muted: #52525b;
  --text-faint: #8a8a93;
  --border: #e4e4e7;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #f0fdfa;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(24, 24, 27, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

/* 5秒タイマー：上部プログレスバー＋残り秒数 */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: rgba(15, 118, 110, 0.10);
  z-index: 100;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
}
.timer-pill {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 101;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 999px;
  padding: 4px 12px;
}

.stage {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 20px 56px;
}
.loading { color: var(--text-faint); }

.screen {
  width: 100%;
  max-width: 760px;
  animation: fadeIn 220ms ease-out;
}
#screen-step2 { align-self: flex-start; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 40px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0 0 12px;
}
.start-title {
  font-size: clamp(21px, 3.4vw, 28px);
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 16px;
}
.start-desc { color: var(--text-muted); font-size: 15px; margin: 0 0 28px; }
.start-desc p { margin: 0 0 8px; }

/* 5秒提示 */
.hero-stimulus { padding: 72px 48px; }
.hero-kicker {
  font-size: clamp(13px, 1.8vw, 15px);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin: 0 0 22px;
}
.hero-kicker.small { margin-bottom: 12px; }
.hero-headline {
  font-size: clamp(25px, 4.8vw, 42px);
  font-weight: 800;
  line-height: 1.42;
  letter-spacing: -0.01em;
  margin: 0;
}
/* 見出しは句読点の区切りで改行させ、語の途中で折れにくくする */
.phrase { display: inline-block; max-width: 100%; }

/* 質問 */
.section-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 12px;
}
.q-title { font-size: clamp(19px, 2.8vw, 23px); line-height: 1.5; margin: 0 0 8px; }
.q-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.intro-head { margin-bottom: 20px; }

.question {
  border: 0;
  margin: 0 0 30px;
  padding: 0;
  min-width: 0;
}
.question legend, .question .q-label {
  display: block;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 12px;
}
.q-num {
  display: inline-block;
  min-width: 2.6em;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  margin-right: 4px;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: 2px;
}
.badge.req { color: #fff; background: var(--danger); }
.badge.opt { color: var(--text-muted); background: var(--surface-subtle); }

.text-input, .text-area {
  width: 100%;
  font: inherit;
  font-size: 16px; /* iOSでズームしない大きさ */
  color: var(--text);
  background: #fff;
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  padding: 12px 14px;
}
.text-area { min-height: 120px; resize: vertical; }
.text-input:focus, .text-area:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.counter { font-size: 12px; color: var(--text-faint); text-align: right; margin-top: 4px; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); font-weight: 700; }

.options { display: grid; gap: 8px; }
.options.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .options.cols-2 { grid-template-columns: 1fr; } }

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.5;
  transition: border-color 120ms ease, background 120ms ease;
}
.option:hover { border-color: #c4c4cc; }
.option input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Q5 A/B 比較カード */
.ab-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
@media (max-width: 560px) { .ab-cards { grid-template-columns: 1fr; } }
.ab-card { align-items: flex-start; padding: 16px; min-height: 96px; }
.ab-card input { margin-top: 4px; }
.ab-card-body { display: block; }
.ab-card-label { display: block; font-size: 12px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.ab-card-headline { display: block; font-size: 16px; font-weight: 700; line-height: 1.55; }

.question.invalid .text-input,
.question.invalid .text-area,
.question.invalid .option { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; font-weight: 700; margin: 8px 0 0; }
.form-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #fecdca;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin: 0 0 16px;
}

/* 全文表示 */
.preview-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  margin-bottom: 14px;
}
.preview-block.second { background: var(--surface-subtle); margin-bottom: 24px; }
.preview-label { font-size: 12px; font-weight: 700; color: var(--text-faint); margin-bottom: 12px; letter-spacing: 0.04em; }
.preview-h1 { font-size: clamp(21px, 3.4vw, 28px); font-weight: 800; line-height: 1.45; margin: 0 0 16px; }
.preview-h2 { font-size: clamp(18px, 2.8vw, 22px); font-weight: 700; line-height: 1.5; margin: 0 0 12px; }
.preview-body { color: var(--text-muted); font-size: 15px; line-height: 1.9; margin: 0; }

/* ボタン */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  min-height: 52px;
  padding: 12px 28px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 140ms ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #9fb8b5; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--text); border-color: #d4d4d8; font-size: 14px; min-height: 44px; padding: 8px 18px; }
@media (max-width: 560px) {
  .btn-row .btn-primary { width: 100%; }
}

/* ハニーポット：画面外に置き、人には見えないようにする */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* デモモード */
.demo-box { border-top: 1px dashed var(--border); padding-top: 20px; margin-top: 8px; }
.demo-note { font-size: 14px; color: var(--text-muted); margin: 0 0 12px; }
.demo-json {
  font-size: 12px;
  line-height: 1.6;
  background: var(--surface-subtle);
  border-radius: 10px;
  padding: 14px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0 0 12px;
}
.copy-feedback { font-size: 13px; color: var(--accent); }

@media (max-width: 640px) {
  .stage { padding: 56px 14px 40px; }
  .card { padding: 28px 20px; }
  .hero-stimulus { padding: 44px 22px; }
  .preview-block { padding: 24px 20px; }
}

/* 5秒提示はフェードさせない（表示の瞬間から5.0秒を数えるため） */
#screen-stimulus { animation: none; }
