/* 会員フォーム LIFFアプリ  見た目の定義 */

:root {
  color-scheme: light;
  --ground: #F3F5F2;
  --surface: #FFFFFF;
  --ink: #1B2420;
  --ink2: #3E4944;
  --muted: #56625C;
  --line: #DCE3DE;
  --line-strong: #8A9690;
  --choice-line: #C9D3CD;
  --green: #0B7A3E;
  --green-dark: #075C2E;
  --green-soft: #E6F2EA;
  --amber: #A8520A;
  --amber-soft: #FBEFE3;
  --red: #B42318;
  --red-soft: #FDECEA;
  --disabled: #6B7570;
  --bar-track: #EEF2EF;
  --focus: #1B5FD0;
  --radius-card: 14px;
  --radius-control: 10px;
  --font: 'BIZ UDPGothic', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

a { color: var(--green); }
a:hover { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
}
.app.plain { background: var(--surface); }

/* ---------- 見出し部分 ---------- */

.page-head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 24px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.page-head.compact { padding: 8px 16px 20px; gap: 10px; }
.page-head .who, .page-head .sub { margin: 0; font-size: 14px; color: var(--muted); }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.4; }
.page-head .lead { margin: 0; font-size: 15px; line-height: 1.8; color: var(--ink2); white-space: pre-line; overflow-wrap: anywhere; }
.page-head.compact h1, .page-head.compact .lead { margin: 0 4px; }

.back-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  font-size: 15px;
  text-decoration: none;
}

.main {
  flex-grow: 1;
  padding: 20px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.main .note { margin: 0 4px 4px; font-size: 15px; color: var(--muted); }
.section-title { margin: 20px 4px 0; font-size: 15px; font-weight: 700; color: var(--muted); }

/* ---------- フォーム一覧 ---------- */

.form-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: var(--ink);
}
.form-card:hover { color: var(--ink); border-color: var(--line-strong); }
.date-block {
  width: 60px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-right: 14px;
  border-right: 1px solid var(--line);
}
.date-block .lbl, .date-block .dow { font-size: 12px; color: var(--muted); }
.date-block .dow { font-size: 13px; }
.date-block .md { font-size: 22px; font-weight: 700; line-height: 1.2; }
.date-block .none { font-size: 16px; font-weight: 700; line-height: 1.6; }
.form-card .body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.form-card .title { font-size: 17px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.form-card .meta { font-size: 13px; color: var(--muted); }
.chev { flex-shrink: 0; color: var(--muted); }

.pill {
  align-self: flex-start;
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill.warn { color: var(--amber); background: var(--amber-soft); }
.pill.ok { color: var(--green); background: var(--green-soft); }
.pill.test { color: var(--ink2); background: #E8EBF2; }
.pill.quiet { color: var(--muted); background: transparent; border: 1px solid #AEB9B2; font-weight: 400; padding: 3px 10px; }

.plain-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.plain-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}
.plain-row .name { flex-grow: 1; font-size: 16px; overflow-wrap: anywhere; }
.plain-row.off { color: var(--disabled); }
.plain-row .side { font-size: 13px; color: var(--muted); }

.empty {
  margin: 24px 4px;
  padding: 28px 20px;
  border: 1px dashed #AEB9B2;
  border-radius: var(--radius-card);
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

/* ---------- 回答入力 ---------- */

.progress { margin: 4px 4px 0; display: flex; flex-direction: column; gap: 8px; }
.progress .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); transition: width .2s; }

.q-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px 18px;
  display: flex;
  gap: 14px;
}
.q-card.has-error { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.q-num { width: 28px; flex-shrink: 0; font-size: 34px; font-weight: 700; line-height: 1; color: var(--green); }
.q-body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.q-body fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.q-label { padding: 0; font-size: 17px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.req {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--amber);
  padding: 2px 8px;
  border-radius: 4px;
  vertical-align: 2px;
}
.q-hint { margin: 0; font-size: 14px; color: var(--muted); white-space: pre-line; }
.q-error { margin: 0; font-size: 14px; font-weight: 700; color: var(--red); }

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 17px;
  border: 1px solid var(--choice-line);
  border-radius: var(--radius-control);
  font-size: 17px;
  cursor: pointer;
  background: var(--surface);
}
.choice input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--green); }
.choice.on { padding: 7px 16px; border: 2px solid var(--green); background: var(--green-soft); font-weight: 700; }
.choice span { overflow-wrap: anywhere; }

.text-btn {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--green);
  font-size: 15px;
  text-decoration: underline;
  cursor: pointer;
}

.field {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 17px;
}
.field.num { width: 132px; font-size: 20px; }
textarea.field { height: auto; min-height: 140px; padding: 12px 14px; line-height: 1.7; resize: vertical; }
.field[aria-invalid="true"] { border: 2px solid var(--red); }
.with-unit { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.counter { align-self: flex-end; font-size: 13px; color: var(--muted); }
.counter.over { color: var(--red); font-weight: 700; }

.notice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--amber-soft);
  color: var(--ink);
  font-size: 15px;
}
.notice .actions { display: flex; gap: 10px; }

/* ---------- ボタン・下部 ---------- */

.page-foot {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.page-foot .small { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.page-foot .two { display: flex; gap: 10px; }
.page-foot .two > * { flex: 1 1 0; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #FFFFFF; font-size: 18px; font-weight: 700; }
.btn.primary:hover { background: var(--green-dark); color: #FFFFFF; }
.btn.outline { border: 2px solid var(--green); color: var(--green); font-weight: 700; }
.btn.small { min-height: 48px; font-size: 16px; border-radius: var(--radius-control); }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- 確認・完了・履歴 ---------- */

.confirm-list { margin: 0; display: flex; flex-direction: column; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.confirm-list > div { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.confirm-list > div:last-child { border-bottom: 0; }
.confirm-list dt { font-size: 14px; color: var(--muted); }
.confirm-list dd { margin: 0; font-size: 17px; white-space: pre-line; overflow-wrap: anywhere; }
.confirm-list dd.none { color: var(--disabled); }

.done {
  flex-grow: 1;
  padding: 96px 28px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}
.done-mark { width: 88px; height: 88px; border-radius: 50%; background: var(--green-soft); display: flex; align-items: center; justify-content: center; color: var(--green); }
.done h1 { margin: 0; font-size: 26px; line-height: 1.5; }
.done p { margin: 0; font-size: 16px; line-height: 1.8; color: var(--ink2); white-space: pre-line; }
.facts { margin: 12px 0 0; width: 100%; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-card); display: flex; flex-direction: column; gap: 10px; text-align: left; }
.facts > div { display: flex; gap: 12px; }
.facts dt { width: 72px; flex-shrink: 0; font-size: 14px; color: var(--muted); }
.facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card.cancelled { background: transparent; border: 1px dashed #AEB9B2; }
.card h2 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.card .head { display: flex; align-items: flex-start; gap: 10px; }
.card .head h2 { flex-grow: 1; }
.card .meta { margin: 0; font-size: 14px; color: var(--muted); }
.card .ok-text { margin: 0; font-size: 14px; font-weight: 700; color: var(--green); }
.card .actions { display: flex; gap: 10px; }
.card .actions > * { flex: 1 1 0; }

/* ---------- 招待コード・利用不可 ---------- */

.intro { padding: 48px 24px 0; display: flex; flex-direction: column; gap: 14px; }
.intro .sys { margin: 0; font-size: 14px; color: var(--muted); }
.intro h1 { margin: 0; font-size: 26px; line-height: 1.5; }
.intro p { margin: 0; font-size: 16px; line-height: 1.8; color: var(--ink2); }
.invite { flex-grow: 1; padding: 32px 24px 0; display: flex; flex-direction: column; gap: 24px; }
.invite .group { display: flex; flex-direction: column; gap: 10px; }
.invite label { font-size: 15px; font-weight: 700; }
.code-input {
  width: 100%;
  height: 64px;
  padding: 0 16px;
  border: 2px solid var(--green);
  border-radius: 12px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .32em;
  text-align: center;
  text-transform: uppercase;
}
.help { margin: 0; font-size: 13px; color: var(--muted); }
details.privacy { border-top: 1px solid var(--line); padding-top: 16px; }
details.privacy summary { font-size: 15px; font-weight: 700; cursor: pointer; min-height: 44px; }
details.privacy p { margin: 8px 0 0; font-size: 14px; line-height: 1.8; color: var(--ink2); white-space: pre-line; }
.foot-text { padding: 20px 24px 32px; margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); }

/* ---------- 集計 ---------- */

.summary { margin-top: 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.summary .big { font-size: 40px; font-weight: 700; line-height: 1; }
.summary .big small { font-size: 18px; margin-left: 2px; }
.summary .of { font-size: 15px; color: var(--muted); }
.summary .rate { margin-left: auto; font-size: 20px; font-weight: 700; color: var(--green); }
.bar.thick { height: 10px; border-radius: 5px; }

.choice-stat { display: flex; flex-direction: column; gap: 6px; }
.choice-stat .row { display: flex; gap: 8px; font-size: 15px; }
.choice-stat .row .lbl { flex-grow: 1; overflow-wrap: anywhere; }
.choice-stat .row .cnt { font-weight: 700; white-space: nowrap; }
.choice-stat .row .pct { width: 56px; text-align: right; color: var(--muted); white-space: nowrap; }
.choice-stat .track { height: 12px; border-radius: 3px; background: var(--bar-track); }
.choice-stat .track > span { display: block; height: 100%; border-radius: 3px; background: var(--green); }

.num-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.num-grid > div { padding: 12px; border-radius: var(--radius-control); background: var(--ground); }
.num-grid dt { font-size: 13px; color: var(--muted); }
.num-grid dd { margin: 4px 0 0; font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }

table.groups { width: 100%; border-collapse: collapse; font-size: 15px; }
table.groups th, table.groups td { padding: 12px 0; border-bottom: 1px solid var(--bar-track); }
table.groups thead th { padding: 8px 0; font-size: 13px; font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--line); }
table.groups th[scope="row"] { text-align: left; font-weight: 400; }
table.groups .r { text-align: right; }
table.groups .strong { font-weight: 700; }
table.groups .dim { color: var(--muted); }

.detail-card .qa { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; border-top: 1px solid var(--bar-track); }
.detail-card .qa .q { font-size: 13px; color: var(--muted); }
.detail-card .qa .a { font-size: 16px; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- 下部のメニュー ---------- */

.tabs {
  position: sticky;
  bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0 14px;
  border-top: 3px solid transparent;
  margin-top: -1px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
}
.tabs a[aria-current="page"] { border-top-color: var(--green); color: var(--green); font-weight: 700; }

/* ---------- 読み込み・お知らせ ---------- */

.loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(243, 245, 242, .82);
  z-index: 50;
  font-size: 15px;
  color: var(--ink2);
}
.loading[hidden] { display: none; }
.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--green);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 14px 16px;
  background: var(--red-soft);
  color: var(--red);
  border-bottom: 1px solid #F3C4BF;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.banner.info { background: var(--green-soft); color: var(--green-dark); border-bottom-color: #BFDCC9; }
.banner[hidden] { display: none; }
.banner span { flex-grow: 1; }
.banner button { border: 0; background: none; color: inherit; font-size: 15px; min-height: 32px; min-width: 44px; cursor: pointer; text-decoration: underline; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 3s !important; }
}
