:root {
  --bg: #f2f2f7;
  --surface: #fff;
  --surface-mute: #e5e5ea;
  --ink: #1c1c1e;
  --ink-2: #6c6c70;
  --ink-3: #aeaeb2;
  --accent: #007aff;
  --accent-soft: #e3f0ff;
  --bad: #ff3b30;
  --good: #34c759;
  --border: #e5e5ea;
  --content-width: 640px;
  font-family: "LINE Seed JP", -apple-system, "Hiragino Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(100%, var(--content-width));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(48px + env(safe-area-inset-bottom));
}

.site-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
}

.brand-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}

.save-indicator {
  min-height: 18px;
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  text-align: right;
}

.save-indicator[data-state="saved"]::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--good);
  content: "";
}

.save-indicator[data-state="error"] {
  color: var(--bad);
}

.app:focus {
  outline: none;
}

.intro {
  padding: 29px 4px 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.progress-label,
.client-label {
  margin: 0;
}

.progress-label {
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.02em;
}

.client-label {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 4px;
  margin-top: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-mute);
}

.progress-bar {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: background-color 160ms ease;
}

.form-card,
.state-card,
.gate-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.form-card {
  overflow: hidden;
}

.category-header {
  padding: 28px 22px 24px;
  border-bottom: 1px solid var(--border);
}

.category-header h1,
.state-card h1,
.gate-card h1 {
  margin: 0;
  font-size: clamp(24px, 7vw, 32px);
  line-height: 1.28;
  letter-spacing: -.04em;
}

.category-header p,
.gate-header > p:last-child {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.75;
}

#question-form {
  padding: 0 22px 24px;
}

.question {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.question-label {
  display: block;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
}

.required-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff0ef;
  color: var(--bad);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: 2px;
}

.question-hint {
  margin: -3px 0 12px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.65;
}

.text-control {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  border: 1px solid #c7c7cc;
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  transition: border-color 150ms ease, background-color 150ms ease;
}

textarea.text-control {
  min-height: 96px;
  resize: none;
  overflow-y: hidden;
}

.text-control::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.text-control:hover {
  border-color: var(--ink-3);
}

.text-control:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}

.option-list {
  display: grid;
  gap: 8px;
}

.radio-option {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.radio-option::before {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  background: var(--surface);
  content: "";
  transition: background-color 150ms ease, border-color 150ms ease;
}

.radio-option:hover {
  border-color: #c7c7cc;
  background: #fafafa;
}

.radio-option.is-selected {
  border-color: #b8d9ff;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.radio-option.is-selected::before {
  border-color: var(--accent);
  background: var(--accent);
}

.radio-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.radio-option:has(input:focus-visible) {
  outline: 3px solid var(--accent-soft);
  outline-offset: 1px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.chip:hover {
  border-color: #c7c7cc;
}

.chip[aria-pressed="true"] {
  border-color: #b8d9ff;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.purpose {
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 12px;
}

.purpose summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.purpose summary::-webkit-details-marker {
  display: none;
}

.purpose summary::before {
  margin-right: 5px;
  color: var(--accent);
  content: "▸";
}

.purpose[open] summary::before {
  content: "▾";
}

.purpose p {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: #f7f7fa;
  line-height: 1.65;
}

.memo-question {
  margin-bottom: 0;
}

.submit-review {
  margin: 24px 0 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f7f7fa;
}

.submit-review h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
}

.submit-review p:last-child {
  margin-bottom: 0;
}

.missing-intro,
.all-complete {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
}

.missing-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.missing-list li {
  position: relative;
  margin-top: 7px;
  padding-left: 14px;
  color: var(--bad);
  font-size: 12px;
  line-height: 1.55;
}

.missing-list li::before {
  position: absolute;
  top: .65em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.form-message {
  min-height: 20px;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.form-message.is-error {
  color: var(--bad);
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 10px;
  margin-top: 7px;
}

.button {
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.button:active {
  opacity: .7;
}

.button:focus-visible,
.chip:focus-visible,
.text-button:focus-visible {
  outline: 3px solid #b8d9ff;
  outline-offset: 2px;
}

.button:disabled,
.text-button:disabled {
  cursor: wait;
  opacity: .5;
}

.button--primary {
  background: var(--accent);
  color: #fff;
}

.button--secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.button--full {
  width: 100%;
  margin-top: 8px;
}

.text-button {
  display: block;
  margin: 18px auto 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: color 150ms ease, background-color 150ms ease, opacity 150ms ease;
}

.text-button:hover {
  background: var(--accent-soft);
}

.state-card {
  margin-top: 64px;
  padding: 44px 24px;
  text-align: center;
}

.state-card--error {
  text-align: left;
}

.state-message {
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.8;
}

.loading-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto 14px;
  border: 3px solid var(--surface-mute);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading 800ms linear infinite;
}

.state-card > p:last-child {
  margin-bottom: 0;
}

.complete-card {
  padding-block: 52px;
}

.complete-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 22px;
  place-items: center;
  border-radius: 50%;
  background: #e9f8ed;
  color: var(--good);
  font-size: 23px;
  font-weight: 800;
}

.submitted-at {
  margin: 18px 0 0;
  color: var(--ink-3);
  font-size: 11px;
}

.gate {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  overflow-y: auto;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.gate-card {
  width: min(100%, 440px);
  padding: 30px 24px 24px;
}

.gate-header {
  margin-bottom: 28px;
}

.gate-header .brand-mark {
  width: 14px;
  height: 14px;
  margin-bottom: 24px;
}

.gate-card h1 {
  font-size: 27px;
}

@keyframes loading {
  to {
    rotate: 360deg;
  }
}

@media (min-width: 600px) {
  .page-shell {
    padding-inline: 24px;
  }

  .category-header {
    padding: 36px 36px 30px;
  }

  #question-form {
    padding: 0 36px 32px;
  }

  .question {
    padding-block: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
