html { scroll-padding-block: 4.5rem 7rem; }

main {
  max-width: 60rem;
  margin-inline: auto;
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
}

.brand { font-family: var(--display); font-weight: 600; margin-block-end: 0.4rem; }
h1 { margin-block: 1.1rem 0.5rem; font-size: clamp(2rem, 1.5rem + 2.4vw, 3rem); letter-spacing: -0.015em; }
h1:focus, h2:focus { outline: none; }
.lede { max-width: 38rem; }

i { display: inline-block; flex: none; width: 0.75rem; height: 0.75rem; border-radius: 3px; }

.meaning { display: grid; gap: 0.35rem 1.5rem; margin: 1.1rem 0; }
.meaning div { display: grid; grid-template-columns: 10rem 1fr; gap: 0.5rem; align-items: baseline; }
.meaning dt { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; }
.meaning dd { margin: 0; color: var(--soft); }
@media (min-width: 48rem) { .meaning { grid-template-columns: 1fr 1fr; } }
@media (max-width: 24rem) { .meaning div { grid-template-columns: 1fr; gap: 0; } .meaning dd { padding-inline-start: 1.25rem; } }

.name-field { display: grid; gap: 0.25rem; max-width: 20rem; margin-block-end: 1.25rem; }
.name-field label { font-weight: 600; }
.name-field span { font-weight: 400; color: var(--soft); }

input {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.35rem 0.6rem;
  border: 1.5px solid var(--field);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: 400 1.0625rem/1.2 var(--ui);
}

/* A table at every width. On a phone each piece's name takes its own line and the four
   prices sit under it, lined up with the four headings stuck to the top. */
.price, .price thead, .price tbody { display: block; }
.price tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.375rem; }
.price th, .price td { padding: 0; text-align: start; font-weight: inherit; }
.price thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  padding-block: 0.5rem 0.4rem;
  background: var(--paper);
  border-block-end: 2px solid var(--ink);
}
.price thead th { display: grid; gap: 0.2rem; align-content: end; font-size: 0.8125rem; font-weight: 600; line-height: 1.15; }
.price thead i { width: 100%; height: 4px; border-radius: 2px; order: 2; }
.price thead .piece { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.price tbody tr { padding-block: 0.85rem; border-block-end: 1px solid var(--line); }
.price tbody th { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 0 0.6rem; align-items: center; padding-block-end: 0.35rem; }

.num {
  display: grid;
  place-content: center;
  min-width: 1.9rem;
  height: 1.9rem;
  padding-inline: 0.3rem;
  border-radius: 1rem;
  background: var(--walnut);
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.nm { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.nm small { display: block; font-size: 0.875rem; font-weight: 400; color: var(--soft); }
.tick { color: #2b6f46; font-weight: 700; visibility: hidden; }
tr.ok .tick { visibility: visible; }
.msg { grid-column: 1 / -1; margin-block-start: 0.25rem; color: var(--bad); font-size: 0.9375rem; font-weight: 600; line-height: 1.3; }
.msg:empty { display: none; }

.money { position: relative; display: block; }
.money::before { content: "$"; position: absolute; inset: 0 auto 0 0.5rem; display: grid; place-content: center; color: var(--soft); pointer-events: none; }
.money input { padding-inline: 1.25rem 0.25rem; font-variant-numeric: tabular-nums; }
.money input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }

@media (min-width: 46rem) {
  .price tr { grid-template-columns: minmax(12rem, 1.5fr) repeat(4, minmax(0, 1fr)); gap: 0.75rem; align-items: center; }
  .price thead tr { align-items: end; }
  .price thead th { font-size: 0.9375rem; }
  .price thead .piece { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .price tbody th { grid-column: auto; padding-block-end: 0; }
}

.skip { margin-block: 0.9rem; color: var(--soft); }

.bar {
  position: sticky;
  inset-block-end: 0;
  z-index: 3;
  margin-inline: -1rem;
  padding: 0.6rem 1rem max(0.75rem, env(safe-area-inset-bottom));
  background: var(--card);
  border-block-start: 1px solid var(--line);
}
.bar-in { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; }
.progress { display: grid; line-height: 1.25; min-width: 0; }
.progress span { color: var(--soft); font-size: 0.875rem; }
.bar .btn { flex: none; }
.error { color: var(--bad); font-weight: 600; line-height: 1.3; }
.error:not(:empty) { margin-block-end: 0.5rem; }

#thanks { display: grid; gap: 0.9rem; padding-block: 1.5rem 3rem; max-width: 36rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
#trouble { display: grid; gap: 1rem; justify-items: start; padding-block: 1rem; }
