:root {
  color-scheme: light;
  --bg: #fffdf8;
  --sand: #e4d3b8;
  --card: #fffdfb;
  --ink: #143044;
  --muted: #3a5164;
  --line: #d7e3ea;
  --sea: #0154b3;
  --sea-deep: #01448f;
  --lagoon: #09c1de;
  --lagoon-deep: #067f96;
  --lagoon-soft: #e5f8fb;
  --cape: #5e862e;
  --accent: var(--lagoon-deep);
  --accent-dark: var(--sea);
  --accent-soft: var(--lagoon-soft);
  --unknown: #9a3412;
  --unknown-bg: #ffedd5;
  --danger: #b4233a;
  --shadow: 0 16px 40px rgba(1, 84, 179, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: "Yu Gothic", "Yu Gothic UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

button, input, textarea { font: inherit; }

.app {
  width: min(100%, 32rem);
  min-height: 100vh;
  margin: 0 auto;
  border: 1px solid #d5c3a6;
  background: var(--bg);
  box-shadow: 0 12px 32px rgba(92, 64, 32, 0.14);
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.75rem 1rem 0.85rem;
  background: rgba(255, 253, 248, 0.96);
  border-bottom: 1px solid rgba(213, 226, 234, 0.95);
}

.top-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.85rem;
  margin-bottom: 0.65rem;
}

.step-label,
.step-count {
  margin: 0;
}

.step-label {
  min-width: 0;
  overflow: hidden;
  pointer-events: none;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

.step-count {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: right;
  white-space: nowrap;
}

.back {
  position: relative;
  z-index: 3;
  justify-self: start;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1.5px solid #c5d7e3;
  border-radius: 999px;
  background: #fff;
  color: var(--sea);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.back[hidden] { display: none; }

.track {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eef3;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--lagoon);
  transition: width 0.35s ease;
}

main {
  padding: 1.25rem 1rem 2rem;
}

.app:has(.intro) {
  min-height: 0;
}

.app:has(.intro) main {
  padding: 1rem 1rem 1.15rem;
}

main:focus { outline: none; }

h1 {
  margin: 0 0 1rem;
  color: var(--sea);
  font-size: 1.45rem;
  line-height: 1.4;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.12rem;
  line-height: 1.5;
}

.lead p,
.done-copy p {
  margin: 0 0 1rem;
  font-size: 1.08rem;
}

.question { margin: 0 0 1.7rem; }

.question h2 {
  overflow-wrap: anywhere;
}

.hint {
  margin: 0.35rem 0 0.8rem;
  color: var(--muted);
}

.choices, .stack {
  display: grid;
  gap: 0.7rem;
}

.choice, .primary, .ghost {
  width: 100%;
  min-height: 3.5rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  line-height: 1.45;
  text-align: left;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 2px solid #c9d8e3;
  background: var(--card);
  color: inherit;
}

.choice .mark {
  display: none;
}

.choice.is-multi .mark {
  display: grid;
  flex: 0 0 1.35rem;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid #b7c9d6;
  border-radius: 7px;
  background: #fff;
}

.choice.is-multi.is-selected .mark {
  border-color: var(--lagoon);
  background: var(--lagoon);
}

.choice.is-multi.is-selected .mark::after {
  content: "";
  width: 0.32rem;
  height: 0.58rem;
  margin-top: -0.12rem;
  border: solid var(--sea-deep);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.choice.is-selected {
  border-color: var(--lagoon-deep);
  background: var(--lagoon-soft);
  box-shadow: inset 4px 0 0 var(--lagoon);
  font-weight: 700;
}

.choice.is-unknown-option {
  border-style: dashed;
  border-color: #8d9a78;
  background: #f4efe4;
}

.choice.is-unknown-option.is-selected {
  border-style: dashed;
  border-color: var(--lagoon-deep);
  background: var(--lagoon-soft);
}

.primary, .ghost { cursor: pointer; }

.primary {
  border: 0;
  min-height: 3.4rem;
  background: var(--sea);
  color: #fff;
  font-size: 1.08rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 18px rgba(1, 84, 179, 0.18);
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost {
  border: 2px solid var(--line);
  background: white;
  color: var(--accent-dark);
  font-weight: 700;
  text-align: center;
}

.actions {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
}

label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 700;
}

input[type="text"],
input[type="tel"],
input[type="date"],
textarea {
  width: 100%;
  min-height: 3.4rem;
  padding: 0.8rem 0.95rem;
  border: 2px solid #c5d5e1;
  border-radius: 14px;
  background: #fff;
  color: inherit;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
textarea:focus {
  border-color: var(--lagoon);
  outline: 3px solid rgba(18, 138, 148, 0.2);
}

textarea {
  min-height: 8.5rem;
  resize: vertical;
}

.error {
  margin: 0.45rem 0 0;
  color: var(--danger);
  font-weight: 700;
}

.review-item, .panel {
  margin: 0 0 0.9rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.review-item h2, .panel h2 { font-size: 1rem; }

.answer {
  margin: 0 0 0.8rem;
  font-size: 1.05rem;
}

.unknown-check {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  margin-top: 0.45rem;
  font-weight: 700;
  cursor: pointer;
}

.unknown-check input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  accent-color: var(--lagoon);
}

.unknown {
  color: var(--unknown);
  background: var(--unknown-bg);
  border-radius: 8px;
  padding: 0.1rem 0.35rem;
}

.urgent {
  border-color: #b45309;
  background: #fff7ed;
}

.panel p, .panel li { margin-top: 0; }

.panel ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.kv {
  display: grid;
  grid-template-columns: 7.2rem 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
}

.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.payload-answer {
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.payload-answer h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.payload-answer p { margin: 0.2rem 0 0; }

details { margin-top: 0.8rem; }

pre {
  overflow: auto;
  padding: 0.8rem;
  border-radius: 12px;
  background: #1c1917;
  color: #f5f5f4;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.notify-failed {
  margin: 0.75rem 0 0;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: #fee2e2;
  color: var(--danger);
  font-weight: 700;
}

.case-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.case-meta {
  margin: 0.25rem 0 0;
  color: var(--muted, #57534e);
}

.hero-frame {
  width: 100%;
  margin: 0 0 0.85rem;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 1rem;
  background: #d5efe8;
}

.hero {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  border-radius: 0;
  background: transparent;
}

.office {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.3rem;
  color: var(--sea);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.cape-mark {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--cape);
}

.intro h1 {
  margin-bottom: 0.55rem;
  font-size: 1.55rem;
}

.intro .lead p {
  margin: 0 0 0.55rem;
  line-height: 1.55;
}

.intro .lead p:last-child {
  margin-bottom: 0;
}

.intro .actions {
  margin-top: 0.85rem;
  padding-top: 0;
}

.done-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.4rem;
  height: 4.4rem;
  margin: 0 0 1rem;
  border-radius: 999px;
  background: var(--lagoon-soft);
  color: var(--lagoon-deep);
}

.done-mark::after {
  content: "";
  position: absolute;
  right: 0.12rem;
  bottom: 0.12rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 3px solid var(--bg);
  border-radius: 999px;
  background: var(--cape);
}

.done-mark svg {
  width: 2.4rem;
  height: 2.4rem;
}

@media (min-width: 900px) {
  .app {
    width: min(100%, 40rem);
    min-height: calc(100vh - 3rem);
    margin: 1.5rem auto;
    border-radius: 1.75rem;
    overflow: hidden;
  }

  .app:has(.intro) {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; }
}

.admin-page {
  background: var(--sand);
}

.admin-page .app {
  width: min(100%, 46rem);
}

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.admin-bar .ghost {
  width: auto;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
}

.copy-all-wrap {
  margin: 0 0 1rem;
}

.copy-all-wrap .primary {
  min-height: 3.5rem;
  font-size: 1.08rem;
  text-align: center;
}

.admin-links {
  margin: 0;
}

.admin-links a {
  color: var(--sea);
  font-weight: 700;
}

.filter-label {
  margin-top: 0.2rem;
}

.admin-page select {
  width: 100%;
  min-height: 3.4rem;
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border: 2px solid #c5d5e1;
  border-radius: 14px;
  background: #fff;
  color: inherit;
}

.urgent-mark {
  margin: 0.35rem 0 0;
  color: var(--sea-deep);
  font-weight: 700;
}

.admin-page .danger {
  width: 100%;
  min-height: 3.4rem;
  margin-top: 0.4rem;
  border: 2px solid #e7b4bc;
  border-radius: 16px;
  background: #fff;
  color: var(--danger);
  font-weight: 700;
  cursor: pointer;
}
