:root {
  --bg: #f7f6f2;
  --card: #ffffff;
  --ink: #23302b;
  --muted: #6b766f;
  --line: #e3e1da;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #e4efe9;
  --bad: #a4513f;
  --error: #b3261e;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px calc(32px + env(safe-area-inset-bottom));
}

.hero { padding: 8px 4px 16px; }
.store { margin: 0; color: var(--muted); font-size: 14px; letter-spacing: .04em; }
.hero h1 { margin: 4px 0 6px; font-size: 22px; line-height: 1.35; }
.lead { margin: 0; color: var(--muted); font-size: 14px; }

.q {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.q h2 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.q h2 small { font-weight: normal; color: var(--muted); font-size: 12px; }
.num {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: bold;
}
.hint { margin: -4px 0 10px; color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 14px;
  min-height: 44px;
  font: inherit; font-size: 15px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: bold;
}

.progress { margin: 0 4px 12px; font-size: 13px; color: var(--muted); }

/* 「とばして大丈夫」の案内 */
.notice {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  color: var(--accent);
  font-size: 16px; font-weight: bold;
}
.notice strong { text-decoration: underline; text-underline-offset: 3px; }
.nowrap { white-space: nowrap; }
.notice-icon {
  flex: none;
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: 14px;
}
.progress .on { color: var(--accent); font-weight: bold; }

.sub { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.sub-label { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.kw-group + .kw-group { margin-top: 12px; }

/* 文章の選択肢（1つだけ選ぶ。もう一度押すと解除） */
.options { display: grid; gap: 8px; }
.option {
  appearance: none;
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit; font-size: 15px; text-align: left;
  cursor: pointer;
}
.option::before {
  content: "";
  flex: none;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
}
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: bold; }
.option[aria-pressed="true"]::before { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, #fff 50%); }
/* 複数選択の質問はチェックボックス風（四角） */
.option.multi::before { border-radius: 4px; }
.option.multi[aria-pressed="true"]::before { background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }

.draft {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.draft-label { margin: 0 0 6px; font-weight: bold; color: var(--accent); }
.draft textarea { min-height: 120px; margin-bottom: 10px; resize: none; overflow: hidden; }

.comment-wrap { position: relative; }
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* iOS のズーム防止 */
  color: var(--ink);
  background: #fff;
  resize: vertical;
}
textarea:focus, .chip:focus-visible, .level:focus-visible, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}
#comment { padding-right: 56px; }
.mic {
  position: absolute; right: 8px; bottom: 10px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line); background: #fff;
  font-size: 20px; cursor: pointer;
}
.mic.listening { border-color: var(--bad); background: #f6e6e2; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.mic-status { margin: 6px 0 0; min-height: 1em; color: var(--muted); font-size: 13px; }

.primary, .secondary {
  display: block; width: 100%;
  min-height: 54px;
  border-radius: var(--radius);
  font: inherit; font-size: 17px; font-weight: bold;
  cursor: pointer;
}
.primary { border: 0; background: var(--accent); color: var(--accent-ink); margin-top: 4px; }
.primary:disabled { opacity: .6; cursor: progress; }
.secondary { margin-top: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-weight: normal; }

.error { color: var(--error); font-size: 14px; min-height: 1em; margin: 4px 0 8px; }

.result-title { font-size: 19px; margin: 0 0 6px; }
.howto {
  margin: 0 0 12px; padding: 12px 12px 12px 32px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 14px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 掲示用QRページ */
.pop { text-align: center; padding: 32px 16px; }
.pop h1 { font-size: 26px; margin: 8px 0; text-wrap: balance; }
.pop .qr { width: min(70vw, 320px); margin: 20px auto; background: #fff; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); }
.pop .qr img { width: 100%; display: block; }
.pop p { color: var(--muted); }
@media print { body { background: #fff; } .pop .qr { border: 0; } }
