:root {
  --ink: #141414;
  --paper: #F3F3F1;
  --sheet: #fff;
  --line: #E4E4E0;
  --muted: #5E5E58;
  --mark: #FFE14A;
  --mark-press: #F0D22A;
  --edge: 20px;
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-bottom: 128px; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang TC", "Hiragino Sans CNS", "Noto Sans TC", sans-serif;
  font-size: 17px;
  line-height: 1.45;
}
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
button:focus { outline: none; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; margin: 0 0 var(--s1); }
.sub { margin: 0 0 var(--s2); font-size: 16px; color: var(--muted); text-wrap: balance; }
.layout { width: min(1100px, 100%); margin: 0 auto; background: var(--sheet); min-height: 100vh; padding-bottom: 136px; }
.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--ink);
  color: #fff;
  padding: var(--s2) var(--edge) calc(var(--s2) + env(safe-area-inset-bottom));
}
.bar .lead { flex: 1; margin: 0; padding: 0; color: #fff; }
.bar button.lead {
  background: none;
  border: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
  min-height: 44px;
}
.bar .wait { color: var(--mark); background: none; }
.notice {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 8px 8px 8px 20px;
  background: var(--mark);
  color: var(--ink);
}
.notice[hidden] { display: none; }
.notice p { flex: 1; margin: 0; font-size: 16px; line-height: 1.45; }
.notice button {
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: 16px;
}
.now {
  display: none;
  position: sticky;
  top: 0;
  z-index: 1;
  justify-content: space-between;
  gap: 12px;
  margin: 0 calc(var(--edge) * -1) var(--s2);
  padding: var(--s2) calc(var(--edge) + 16px);
  background: var(--sheet);
  border-bottom: 1px solid var(--ink);
  font-size: 17px;
  font-weight: 600;
}
.now.on { display: flex; top: var(--notice-offset, 0px); }
.fields { --edge: 20px; padding: var(--s2) var(--edge) var(--s4); }
.index { padding: var(--s3) var(--edge) var(--s1); }
@media (max-width: 899px) {
  .layout { display: flex; flex-direction: column; }
  .index { display: contents; padding: 0; }
  .mast { order: 1; padding: var(--s3) var(--edge) 0; }
  .fields { order: 2; }
  #reset { order: 3; align-self: flex-start; margin: var(--s3) var(--edge) 0; }
  .fields h2 { display: none; }
}
@media (min-width: 900px) {
  .now, .now.on { display: none; }
  body { background: #E4E4E0; }
  .layout { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
  .index { border-right: 1px solid var(--line); padding: var(--s5) var(--s3) var(--s5) var(--s4); position: sticky; top: 0; align-self: start; }
  .fields { --edge: 40px; padding: var(--s5) var(--edge) 48px; }
  h1 { font-size: 32px; }
  .bar {
    left: calc((100vw - min(1100px, 100vw)) / 2 + 300px);
    right: calc((100vw - min(1100px, 100vw)) / 2);
    padding-top: var(--s2);
    padding-bottom: var(--s2);
  }
  #reset { margin: 16px 8px 0; }
}
.ch {
  position: relative;
  width: 100%;
  min-height: 56px;
  padding: var(--s2) 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}
.ch::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  transform: translateY(-50%);
  background: transparent;
}
.ch.open::before { background: var(--mark); }
.ch.on { font-weight: 600; }
.ch.on::before { background: var(--ink); }
.ch:active, .choice:active { background: var(--paper); }
.ch .meta { font-weight: 400; font-size: 15px; color: var(--muted); text-align: right; }
.pre { color: var(--ink); font-weight: 400; }
.fields h2 { font-size: 22px; margin: 0 0 var(--s1); padding: 0 16px; font-weight: 600; }
.lead { margin: 0 0 var(--s2); padding: 0 16px; font-size: 16px; color: var(--muted); }
.row {
  width: 100%;
  min-height: 56px;
  padding: var(--s2) 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}
.row b { font-weight: 400; }
.row span { text-align: right; max-width: 62%; overflow-wrap: anywhere; }
.row span.yn { max-width: none; }
.row.gap, .row.need {
  background: var(--mark);
  border-bottom: 0;
  width: 100%;
  margin-top: var(--s2);
  padding: var(--s2) 16px;
}
.group + .row.gap,
.group + .row.need,
.lead + .row.gap,
.lead + .row.need { margin-top: var(--s1); }
.row.gap + .row:not(.gap):not(.need),
.row.need + .row:not(.gap):not(.need) { margin-top: var(--s2); }
.row.fail { background: var(--mark); border-bottom: 0; margin-top: var(--s2); padding: var(--s2) 16px; flex-wrap: wrap; }
.row.fail span { flex: 1 1 100%; max-width: 100%; text-align: left; }
.row.fail.line { flex-wrap: nowrap; align-items: center; }
.row.fail.line b { flex: 0 0 auto; white-space: nowrap; }
.row.fail.line span { flex: 1 1 auto; max-width: none; text-align: right; white-space: nowrap; }
.row.gap b, .row.need > b { color: var(--ink); font-weight: 600; }
.miss { color: var(--ink); font-weight: 400; }
.row:active { background: var(--paper); }
.row.gap:active, .row.need:active { background: var(--mark-press); }
.row.edit { align-items: stretch; flex-wrap: wrap; background: var(--sheet); }
.inline {
  width: 100%;
  min-height: 44px;
  font-size: 18px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  text-align: left;
}
.group {
  margin: var(--s4) 0 var(--s1);
  padding: 0 16px;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.wait { color: var(--ink); font-weight: 700; }
.row.need .yn button, .row.gap .yn button { border-color: var(--ink); color: var(--ink); background: #fff; }
.row.need .yn button.on, .row.gap .yn button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.locked { color: var(--muted); }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 2;
  border: 0;
  background: rgba(20, 20, 20, 0.46);
}
.sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--keyboard-inset, 0px);
  background: var(--sheet);
  border-top: 1px solid var(--ink);
  padding: var(--s2) var(--edge) calc(var(--s4) + env(safe-area-inset-bottom));
  max-height: min(50vh, calc(var(--vvh, 50vh) - 24px));
  overflow: auto;
  z-index: 3;
}
.sheet-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--sheet);
  padding: var(--s1) 0 var(--s2);
}
.sheet-head h3 { margin: 0; }
.sheet-head .cancel { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .row { transition: background 80ms linear; }
  .sheet { animation: rise 160ms ease-out; }
}
@keyframes rise {
  from { transform: translateY(16px); }
  to { transform: none; }
}
@media (min-width: 900px) {
  .sheet { left: auto; width: min(520px, 46vw); right: 40px; bottom: calc(24px + var(--keyboard-inset, 0px)); border: 1px solid var(--ink); }
}
.sheet .group { margin: 16px 0 4px; }
.sheet h3 { margin: 0 0 8px; font-size: 22px; font-weight: 600; }
.sheet p { margin: 0 0 10px; font-size: 16px; color: var(--muted); }
.sheet input, textarea {
  width: 100%;
  min-height: 52px;
  font-size: 18px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  margin: var(--s1) 0 var(--s2);
  border-radius: 0;
}
textarea { min-height: 96px; border: 1px solid var(--ink); padding: 10px; }
textarea.need { background: var(--mark); }
.sheet input:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 3px; }
.choice {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}
.choice.on { font-weight: 600; box-shadow: inset 3px 0 0 var(--ink); }
.ch:focus-visible, .row:focus-visible, .choice:focus-visible, .yn button:focus-visible, .quiet:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.wizard {
  margin: var(--s4) 0 var(--s3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wizard .step {
  min-height: 48px;
  width: 100%;
  background: var(--ink);
  color: #fff;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}
.wizard .step:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.wizard .lead { margin: 0; padding: 0; text-align: center; }
.wizard .quiet {
  display: block;
  width: 100%;
  margin: 0;
  text-align: center;
}
.save, .done {
  margin-top: 12px;
  min-height: 48px;
  width: 100%;
  background: var(--ink);
  color: #fff;
  text-align: center;
  font-size: 17px;
}
.save:disabled, .done:disabled { background: #D0D0D0; color: #333; }
.bar .done {
  width: auto;
  min-width: 128px;
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}
.bar .done:disabled { background: #3A3A3A; color: #C8C8C8; }
.bar .done:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cancel, .quiet {
  display: inline-block;
  min-height: 44px;
  margin-top: 8px;
  font-size: 16px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.err { min-height: 1.2em; margin: 8px 0 0; font-size: 16px; }
.err:empty { display: none; min-height: 0; margin: 0; }
.yn { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.row.actions {
  flex-wrap: wrap;
  align-items: stretch;
  row-gap: 12px;
}
.row.actions > b { flex: 1 1 100%; }
.row.actions .yn {
  flex: 1 1 100%;
  justify-content: flex-start;
}
.row.actions .yn button:first-child { flex: 1 1 12em; }
.row span.yn { flex: 1; }
.yn button {
  min-height: 44px;
  min-width: 56px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  background: #fff;
  text-align: center;
}
.yn button.on { background: var(--ink); color: #fff; }
.yn button:active { background: var(--paper); }
.yn button.on:active { background: var(--ink); }
.health { padding: 12px 0; border-bottom: 1px solid var(--line); }
.health.need { background: var(--mark); margin-top: var(--s2); padding: var(--s2) 16px; border-bottom: 0; }
.health p { margin: 0 0 8px; font-size: 16px; }
.admin { max-width: 880px; margin: 0 auto; background: var(--sheet); min-height: 100vh; padding: 28px 18px 48px; }
.admin table { width: 100%; border-collapse: collapse; }
.admin th, .admin td { text-align: left; font-weight: 400; font-size: 16px; padding: 12px 8px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin input {
  width: 100%;
  min-height: 52px;
  font-size: 18px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  margin: 4px 0 12px;
}
