:root {
  color-scheme: light;
  --paper: #f7f4e9;
  --ink: #192d25;
  --muted: #49594e;
  --green: #0c5138;
  --line: #c3cbbb;
  --a: #e4eddf;
  --b: #f4e5cc;
  --input: #fffdf6;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.55; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:where(a, button, input, select, summary):focus-visible {
  outline: 3px solid #116946;
  outline-offset: 3px;
}

.wrap { width: min(100% - 2rem, 52rem); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.masthead { display: flex; align-items: center; gap: .8rem; min-height: 3.25rem; font-size: .75rem; }
.brand { font-weight: 900; letter-spacing: .11em; text-decoration: none; }
.masthead span { color: var(--muted); border-left: 1px solid var(--line); padding-left: .8rem; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding-block: clamp(1.55rem, 5vw, 3.2rem) clamp(1.15rem, 3vw, 2.3rem); }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.3rem, 5.55vw, 3.45rem); font-weight: 850; line-height: 1.24; letter-spacing: -.055em; }
h1 em { font-style: normal; color: var(--green); }
.intro p { margin-top: .65rem; color: var(--muted); font-size: clamp(.77rem, 2.2vw, .96rem); }
.wide-break { display: none; }
.rolls { width: clamp(3rem, 14vw, 10rem); height: clamp(3rem, 14vw, 10rem); position: relative; flex: none; }
.rolls span {
  position: absolute;
  width: 59%;
  height: 68%;
  left: 37%;
  top: 5%;
  transform: rotate(13deg);
  border: 1.5px solid var(--green);
  border-radius: 50% / 24%;
  background: repeating-linear-gradient(0deg, #f3e5c7 0 6px, #ead9b7 6px 7px);
}
.rolls span:last-child { left: 7%; top: 27%; transform: rotate(-14deg); background: repeating-linear-gradient(0deg, #d8e7d6 0 6px, #c9ddc6 6px 7px); }
.rolls span::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 48%;
  border: inherit;
  border-radius: 50%;
  background: radial-gradient(ellipse, #284a38 0 18%, #b9cbb2 19% 27%, #fbf7ea 28% 100%);
}

h2 { font-size: clamp(.93rem, 2.6vw, 1.24rem); line-height: 1.25; }
.form-heading { display: flex; align-items: center; justify-content: space-between; gap: .3rem; border-top: 1px solid var(--line); }
.form-actions { display: flex; gap: .15rem; flex-shrink: 0; }
.form-actions button {
  min-height: 44px;
  border: 0;
  padding-inline: .35rem;
  background: transparent;
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: .17em;
  cursor: pointer;
  font-size: .73rem;
}
.hint { font-size: .75rem; color: var(--muted); margin-bottom: .65rem; }
.products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.55rem, 2vw, 1rem); }
.product {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: .45rem clamp(.65rem, 2.7vw, 1.2rem) .95rem;
  background: var(--a);
}
.product-b { background: var(--b); border-color: #d6c6a6; }
.product legend {
  margin: 0;
  padding: .24rem .75rem;
  border: 1px solid var(--ink);
  border-radius: 99px;
  background: var(--input);
  font-weight: 800;
  font-size: .83rem;
}
.product label { display: block; font-size: .73rem; font-weight: 750; margin: .46rem 0 .18rem; }
.number { position: relative; }
.number span {
  position: absolute;
  inset-inline-end: .62rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: .75rem;
  color: var(--muted);
}
.number input, .product select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #8b9988;
  border-radius: .5rem;
  background: var(--input);
  padding: .4rem .58rem;
  font-size: 1rem;
}
.number input { appearance: textfield; padding-inline-end: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.number input::-webkit-inner-spin-button, .number input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.number input::placeholder { color: #67746a; font-weight: 400; }
[aria-invalid="true"] { outline: 2px solid #972e27; outline-offset: -2px; }
.field-error { margin-top: .4rem; color: #76271e; font-size: .72rem; }

.receipt {
  margin-top: 1rem;
  padding: clamp(.95rem, 3vw, 1.65rem);
  border-radius: .8rem;
  background: var(--green);
  color: #fffbed;
}
.receipt h2 { font-size: .8rem; letter-spacing: .08em; color: #d1e9d7; }
#verdict { font-weight: 800; font-size: clamp(1rem, 3.1vw, 1.48rem); margin-top: .35rem; }
.units { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .7rem; border-top: 1px dashed #aacdb7; padding-top: .55rem; }
.units dt, #result-note { color: #e0efe2; font-size: .77rem; }
.units dd { font-weight: 800; font-size: clamp(.83rem, 2.8vw, 1.18rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#result-note { margin-top: .6rem; }
.method { border-bottom: 1px solid var(--line); }
.method summary { padding-block: .75rem; cursor: pointer; font-size: .83rem; font-weight: 700; }
.method p { padding-bottom: .7rem; color: var(--muted); font-size: .82rem; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .7rem; color: var(--muted); font-size: .77rem; padding-block: 1.2rem; }

@media (max-width: 365px) {
  .wrap { width: calc(100% - 1.4rem); }
  .wide-break { display: initial; }
}

@media (min-width: 650px) {
  .product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: .65rem; }
  .product label { font-size: .86rem; margin: 0; }
  .field-error { grid-column: 1 / -1; }
}
