:root {
  --ink: #1c1915;
  --muted: #5c564c;
  --line: #e4ddd2;
  --paper: #f4f1ea;
  --card: #fffcf7;
  --navy: #1e3a5f;
  --seal: #8c3a2f;
  --ok: #1f6b45;
  --nav: 4.25rem;
  --kb: 0px;
  color-scheme: light;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
html { scroll-padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom) + 1rem); }
button, textarea, input, select, summary { scroll-margin-bottom: calc(var(--nav) + env(safe-area-inset-bottom) + 0.75rem); }
body { min-height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

#app {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(var(--nav) + env(safe-area-inset-bottom) + 1.25rem);
}

.top { margin-bottom: 0.75rem; }
.top h1 { font-size: 1.55rem; line-height: 1.3; margin: 0.15rem 0 0; letter-spacing: 0.02em; }
.eyebrow, .kicker { margin: 0; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; }
.back {
  border: 0; background: transparent; color: var(--navy);
  padding: 0.35rem 0; min-height: 2.75rem; font-weight: 700;
}

.next {
  display: block; width: 100%; text-align: left;
  background: var(--navy); color: #f7f4ee; border: 0; border-radius: 1rem;
  padding: 1rem 1.05rem; margin-bottom: 0.9rem;
}
.next strong { display: block; font-size: 1.2rem; margin: 0.2rem 0; }
.next span { display: block; line-height: 1.5; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.9rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 0.8rem;
  padding: 0.7rem 0.75rem;
}
.stat span { display: block; color: var(--muted); font-size: 0.78rem; }
.stat strong { font-size: 1.15rem; }
.stat.ok { border-color: #b7d7c4; background: #f3faf6; }
.stat.ok strong { color: var(--ok); }

.panel, fieldset {
  background: var(--card); border: 1px solid var(--line); border-radius: 0.9rem;
  padding: 0.9rem 1rem; margin: 0 0 0.7rem;
}
fieldset { min-inline-size: 0; }
legend { font-weight: 700; padding: 0 0.2rem; }
.panel h2, .sub { font-size: 1.05rem; margin: 0 0 0.45rem; }
.panel h3 { font-size: 1rem; margin: 0.85rem 0 0.2rem; }
.explain { background: #f3f7f4; border: 1px solid #c5d9cb; border-radius: 0.9rem; padding: 0.9rem 1rem; margin: 0.7rem 0; }
.explain h2 { font-size: 0.95rem; margin: 0.7rem 0 0.25rem; }
.explain h2:first-child { margin-top: 0; }
.explain p { line-height: 1.65; margin: 0.3rem 0; }
.yours { color: var(--muted); }
.reason { display: block; color: var(--muted); font-weight: 400; font-size: 0.88rem; line-height: 1.5; margin-top: 0.15rem; }
.reasons { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.reasons li { margin: 0.55rem 0; line-height: 1.5; }
.num {
  display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem;
  margin-right: 0.4rem; border-radius: 50%; background: var(--navy); color: #fff;
  font-size: 0.85rem;
}
.panel p, .note { line-height: 1.65; margin: 0.35rem 0; }
.note { color: var(--muted); font-size: 0.92rem; }
.q { font-size: 1.15rem; line-height: 1.55; margin: 0; }

.steps { margin: 0.2rem 0 0; padding-left: 1.2rem; }
.steps li { margin: 0.35rem 0; line-height: 1.55; }

.table { display: grid; gap: 0.45rem; }
.trow { display: grid; gap: 0.1rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--line); }
.trow:last-child { border: 0; padding: 0; }
.muted { color: var(--muted); }

.actions, .row-actions, .filters, .switch, .dock, .chips, .pair { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pair { margin: 0.4rem 0 0.8rem; }
.pair .ghost, .pair .primary { flex: 1; }
.choice {
  display: block; width: 100%; text-align: left; background: var(--card);
  border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.9rem 0.95rem;
  margin: 0.45rem 0; min-height: 3.1rem; font-weight: 700; line-height: 1.45;
}
.choice.on { border-color: var(--navy); background: #eef3f8; }
.tag {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem;
  border-radius: 99px; background: #e7eef6; color: var(--navy);
  font-size: 0.72rem; font-weight: 700; vertical-align: 0.1em;
}
.stepdots { display: flex; gap: 0.35rem; margin: 0.2rem 0 0.7rem; }
.stepdots i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #ddd4c8; display: block; }
.stepdots i.on { background: var(--navy); }
.facts { margin: 0.3rem 0 0; padding-left: 1.15rem; }
.facts li { margin: 0.3rem 0; line-height: 1.5; }
.bone { margin: 0.2rem 0 0.8rem; padding-left: 1.2rem; }
.bone li { margin: 0.55rem 0; line-height: 1.55; }
.actions, .filters, .switch { margin-bottom: 0.8rem; }
.dock {
  position: sticky;
  bottom: calc(var(--nav) + var(--kb));
  background: linear-gradient(transparent, var(--paper) 28%);
  padding: 0.6rem 0 0.2rem;
  z-index: 2;
}
body.typing { --nav: 0px; }
body.typing #tabbar { display: none; }

.primary, .ghost, .chips button, .filters button, .switch button, .list button {
  min-height: 2.75rem; border-radius: 0.75rem;
}
.primary {
  background: var(--seal); color: #fff; border: 0; padding: 0.65rem 1rem; font-weight: 700;
}
.primary.block, .ghost.block { width: 100%; }
.ghost, .filters button, .switch button, .chips button {
  background: var(--card); border: 1px solid var(--line); padding: 0.55rem 0.8rem;
}
.filters button.on, .switch button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.textlink { border: 0; background: transparent; color: var(--navy); min-height: 2.75rem; font-weight: 700; padding: 0.5rem 0; }

.field { display: grid; gap: 0.3rem; margin: 0.7rem 0; }
.field span { font-size: 0.86rem; font-weight: 700; }
textarea, input[type="text"], input:not([type]), select {
  width: 100%; border: 1px solid #d9d0c3; border-radius: 0.7rem;
  padding: 0.7rem 0.75rem; background: #fff; font-size: 16px; line-height: 1.55;
}
textarea { resize: vertical; }
.check { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.45rem 0 0.8rem; line-height: 1.45; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; flex: none; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.list button {
  width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 0.8rem; padding: 0.75rem 0.85rem; display: grid; gap: 0.45rem;
}
.list strong { display: block; }
.list small { display: block; color: var(--muted); margin-top: 0.15rem; line-height: 1.4; }
.bar { display: block; height: 0.28rem; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar::before { content: ""; display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--navy); }

.hint { background: #f7f3ea; border-radius: 0.8rem; padding: 0.6rem 0.8rem; margin-bottom: 0.6rem; }
.hint summary { min-height: 2.5rem; display: flex; align-items: center; font-weight: 700; }
.hint ol, .picked { margin: 0.4rem 0; padding-left: 1.2rem; }
.hint li, .picked li { margin: 0.35rem 0; line-height: 1.5; }
.picked { min-height: 6rem; background: var(--card); border: 1px dashed #cfc6b8; border-radius: 0.8rem; padding: 0.6rem 0.6rem 0.6rem 1.6rem; }
.chips button { flex: 1 1 auto; }
.sealed { background: var(--navy); color: #f7f4ee; border-radius: 0.8rem; padding: 0.8rem 0.9rem; }
.msg { color: var(--seal); font-weight: 700; min-height: 1.4rem; }
.install { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fffcf7; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar button {
  border: 0; background: transparent; min-height: var(--nav);
  color: var(--muted); font-size: 0.78rem; font-weight: 700;
}
#tabbar button.on { color: var(--navy); }

@media (min-width: 720px) {
  #app { padding-top: 1.5rem; }
}
