:root {
  color-scheme: light;
  --paper: #f8f4ee;
  --white: #fffcf8;
  --ink: #2c2231;
  --muted: #655769;
  --plum: #482e52;
  --line: #ddd1df;
  font: 100%/1.55 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
.wrap { width: min(100% - 2rem, 64rem); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: var(--white); }
.brand { display: flex; align-items: center; gap: .65rem; min-height: 3.5rem; font-weight: 750; }
.mark { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: .35rem; background: var(--plum); color: #ffe1c5; }
.skip { position: absolute; left: 1rem; top: .5rem; z-index: 1; padding: .5rem 1rem; background: white; transform: translateY(-180%); }
.skip:focus { transform: translateY(0); }
.hero {
  margin-block: 1rem 1.7rem;
  background: var(--plum);
  color: var(--white);
  border-radius: 1rem;
  padding: 1.3rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.hero img { display: none; }
.eyebrow { margin: 0 0 .35rem; color: var(--plum); font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
.hero .eyebrow { color: #ffccb2; }
h1, h2, h3 { font-family: Georgia, serif; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(2.15rem, 6vw, 4.05rem); font-weight: 500; letter-spacing: -.035em; }
h2 { font-size: clamp(1.65rem, 4vw, 2.25rem); }
h3 { font-size: 1.65rem; }
.promise { color: #f8e9f3; margin: .65rem 0 0; max-width: 37ch; }
.tools-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .8rem; }
label, legend { display: block; font-weight: 650; font-size: .9rem; }
.unit-picker label { font-size: .78rem; margin-bottom: .25rem; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { min-height: 2.75rem; border: 1px solid #a997ad; background: #fff; border-radius: .45rem; padding: .5rem .65rem; }
input, textarea { width: 100%; margin-top: .25rem; }
textarea { resize: vertical; }
input[aria-invalid="true"] { border: 2px solid #a02d46; }
:focus-visible { outline: 3px solid #835399; outline-offset: 3px; }
.tool-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: .85rem 0; }
.tool-nav a { display: flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--line); border-radius: .55rem; padding: .62rem .35rem; color: var(--ink); background: var(--white); text-decoration: none; font-weight: 700; text-align: center; }
.tool-nav a span { font-size: .72rem; opacity: .84; }
@media (max-width: 28rem) {
  .tool-nav a span { display: none; }
}
.tool-nav a[aria-current] { color: white; background: var(--plum); border-color: var(--plum); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: .9rem; padding: 1.05rem; }
.feedback-panel { margin-top: 1rem; }
.intro, .hint { color: var(--muted); margin: .35rem 0 .85rem; }
.hint, .field-note { font-size: .84rem; }
.fields { display: grid; grid-template-columns: 1fr; gap: .85rem 1rem; }
.fields > div { min-width: 0; }
.fields select { width: 100%; margin-top: .25rem; }
.block-piece { min-width: 0; margin: .8rem 0; padding: .8rem; border: 1px solid var(--line); border-radius: .55rem; }
.block-piece button { margin-top: .7rem; }
.block-grid { margin: 0 0 1rem; border: 1px solid var(--line); border-radius: .55rem; padding: .7rem .8rem; }
.block-grid button { margin-top: .7rem; }
#grid-result:empty { display: none; }
#grid-result { background: #f1e7f4; border-radius: .45rem; color: var(--plum); font-weight: 650; padding: .65rem .8rem; }
#width-estimate-help + div { margin-top: .6rem; }
.field-note { display: block; color: var(--muted); margin-top: .25rem; }
.mode { margin: 0 0 .9rem; }
.mode select { display: block; margin-top: .25rem; max-width: 100%; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1rem 0 0; }
button { padding: .55rem .9rem; border: 1px solid var(--plum); border-radius: .5rem; cursor: pointer; min-height: 2.75rem; font-weight: 700; }
.primary { background: var(--plum); color: white; }
.secondary { background: transparent; color: var(--plum); }
.error { color: #90273d; font-weight: 650; }
.result { margin-top: 1rem; background: #f1e7f4; border: 1px solid #d8c3df; border-radius: .65rem; padding: 1rem; }
.result:empty, .error:empty { display: none; }
.result strong { display: block; color: var(--plum); font: 700 1.75rem/1.15 Georgia, serif; }
.result p { margin: .45rem 0 0; }
details { margin-top: 1rem; border-top: 1px dashed #c9b7ce; padding-top: .7rem; }
summary { color: var(--plum); font-weight: 750; cursor: pointer; min-height: 2.5rem; }
details p { margin: .45rem 0; color: var(--muted); }
.shop-checklist { margin-top: .8rem; padding: .8rem 1rem; background: var(--paper); border-radius: .55rem; font-size: .9rem; }
.shop-checklist h4, .shop-checklist p { margin: 0; }
.shop-checklist ul { margin: .4rem 0; padding-left: 1.25rem; }
.shop-checklist li + li { margin-top: .2rem; }
footer.wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; padding-block: 1rem 2rem; font-size: .83rem; color: var(--muted); }
@media (min-width: 35rem) {
  .tool-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 1.55rem; }
  .hero { padding: 1.65rem 2rem; }
  .hero img { display: block; width: min(31%, 12rem); height: auto; flex: none; }
}
