:root {
  color-scheme:light;
  --paper:#eceae0;
  --sheet:#f7f5ed;
  --ink:#202720;
  --muted:#4c5b51;
  --line:#adb2a5;
  --accent:#284f4a;
  --serif:"Noto Serif TC","Microsoft JhengHei",Georgia,serif;
  --sans:"Noto Sans TC","Microsoft JhengHei",sans-serif;
}

[data-theme="07"] {
  --paper:#eee7da;
  --sheet:#faf6ee;
  --ink:#2b2920;
  --muted:#655947;
  --line:#b3a592;
  --accent:#773d2e;
}

[data-theme="08"] {
  color-scheme:dark;
  --paper:#191814;
  --sheet:#24231e;
  --ink:#f1ebdd;
  --muted:#c0b5a0;
  --line:#666053;
  --accent:#f2cc9b;
}

[data-theme="09"] {
  color-scheme:dark;
  --paper:#171c23;
  --sheet:#232b36;
  --ink:#ececf0;
  --muted:#adbccc;
  --line:#526174;
  --accent:#b1d4ee;
}

[data-theme="10"] {
  --paper:#e8e5de;
  --sheet:#f6f4ef;
  --ink:#282521;
  --muted:#534e48;
  --line:#a6a197;
  --accent:#743d32;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font:1rem/1.55 var(--sans);
}

a {
  color:inherit;
  text-underline-offset:.22em;
}

a:hover {
  color:var(--accent);
}

:focus-visible {
  outline:2px solid var(--accent);
  outline-offset:4px;
}

button,input,select {
  font:inherit;
}

button {
  cursor:pointer;
}

button:disabled {
  cursor:default;
  opacity:.48;
}

img {
  max-width:100%;
  display:block;
}

h1,h2,h3,p,figure {
  margin:0;
}

h1,h2,h3 {
  font-family:var(--serif);
}

[hidden] {
  display:none!important;
}

.layout {
  width:min(100% - 5rem,1350px);
  margin-inline:auto;
}

.masthead {
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:78px;
  border-bottom:1px solid var(--line);
}

.identity {
  text-decoration:none;
  display:flex;
  flex-direction:column;
  font-family:var(--serif);
  font-size:1.05rem;
  font-weight:700;
}

.identity span,.edition {
  color:var(--muted);
  font:500 .72rem/1.5 var(--sans);
  letter-spacing:.116em;
}

.masthead nav {
  display:flex;
  align-items:center;
  gap:1.7rem;
  font-size:.85rem;
}

.masthead nav a {
  text-decoration:none;
}

.locale-selector {
  display:inline-flex;
}

.locale-label {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
}

.locale-selector select {
  max-width:7rem;
  border:1px solid var(--line);
  border-radius:0;
  padding:.3rem;
  background:var(--sheet);
  color:var(--ink);
}

.license-reference {
  max-width:48rem;
  padding-block:2rem 4rem;
}

.license-reference h1 {
  margin-block:1.4rem .7rem;
}

.license-reference p + p,.license-reference section {
  margin-block-start:1rem;
}

#bag-number {
  display:inline-block;
  border:1px solid var(--line);
  padding-inline:.25rem;
  min-width:1.1rem;
  text-align:center;
  margin-inline-start:.25rem;
}

.intro {
  display:grid;
  grid-template-columns:.85fr 1.15fr;
  gap:3rem;
  align-items:center;
  padding-block:4.5rem 4rem;
  border-bottom:1px solid var(--line);
}

.intro h1 {
  font-size:clamp(3.2rem,7vw,7.1rem);
  font-weight:600;
  line-height:1.04;
  letter-spacing:-.07em;
  margin-block:.5rem 1rem;
}

.intro p:not(.edition) {
  color:var(--muted);
  font-size:1.13rem;
}

.intro img {
  width:100%;
  height:clamp(240px,36vw,440px);
  object-fit:cover;
}

.jump {
  display:inline-block;
  margin-top:1.6rem;
  padding-block:.4rem;
  border-bottom:1px solid var(--accent);
  text-decoration:none;
  color:var(--accent);
}

.jump span {
  margin-left:1rem;
}

.store {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(245px,320px);
  gap:2.5rem;
  align-items:start;
  padding-block:2.4rem 4rem;
}

.section-head {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:1.1rem;
  margin-bottom:1.25rem;
}

.section-head h2,.bag h2 {
  font-size:1.6rem;
  font-weight:600;
}

.section-head span,.card small,.price {
  color:var(--muted);
  font-size:.84rem;
}

.group {
  padding-block:1.25rem 1.85rem;
  border-top:1px solid var(--line);
}

.group-head {
  display:flex;
  align-items:center;
  gap:.7rem;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom:1rem;
}

.group h3 {
  font-size:1.08rem;
}

.work-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:1.15rem 1rem;
}

.card img {
  width:100%;
  aspect-ratio:5/4;
  object-fit:cover;
  background:var(--sheet);
}

[data-theme="10"] .card img {
  object-fit:contain;
}

.card .caption {
  min-height:4rem;
  padding-block:.55rem .35rem;
}

.card h3 {
  font-size:1.05rem;
}

.card small {
  display:block;
}

.card-row,.bagline,.total {
  display:flex;
  gap:.8rem;
  align-items:center;
  justify-content:space-between;
}

.card-row {
  border-top:1px solid var(--line);
  padding-top:.35rem;
}

.bag {
  position:sticky;
  top:1.1rem;
  padding:1.1rem;
  background:var(--sheet);
  border:1px solid var(--line);
  min-width:0;
}

.bag h2 {
  margin-bottom:.45rem;
}

.bagline {
  padding-block:.75rem;
  border-bottom:1px solid var(--line);
  font-size:.9rem;
}

.bagline output {
  display:block;
  color:var(--muted);
  font-size:.76rem;
}

.quantity {
  display:flex;
  gap:.25rem;
  align-items:center;
}

.quantity button {
  padding:.1rem .35rem;
  min-width:1.65rem;
}

.total {
  margin-block:1rem;
}

.total output {
  font-weight:600;
}

.bag label,.trial label {
  display:block;
  margin-top:.85rem;
  font-size:.83rem;
}

.bag input,.bag select,.trial input,.trial select,.lot input {
  display:block;
  margin-top:.25rem;
  width:100%;
  color:var(--ink);
  background:transparent;
  border:1px solid var(--line);
  padding:.43rem .4rem;
}

.buttons {
  display:flex;
  flex-wrap:wrap;
  gap:.4rem;
  margin-top:.8rem;
}

button {
  display:inline-block;
  color:var(--ink);
  background:transparent;
  border:1px solid var(--line);
  padding:.3rem .63rem;
  border-radius:1px;
  font-size:.83rem;
}

button:hover:not(:disabled) {
  border-color:var(--accent);
  color:var(--accent);
}

#send,#check:not(:disabled) {
  background:var(--ink);
  color:var(--paper);
  border-color:var(--ink);
}

#status,.lot-state {
  font-size:.84rem;
  margin-block:.7rem;
  overflow-wrap:anywhere;
}

details {
  border-block-start:1px solid var(--line);
  padding-top:.6rem;
  margin-top:.7rem;
  font-size:.87rem;
}

summary {
  cursor:pointer;
}

details button {
  margin-top:.5rem;
}

footer {
  border-top:1px solid var(--line);
  padding-block:1rem 2rem;
  color:var(--muted);
  font-size:.86rem;
}

footer p + p {
  margin-top:.45rem;
}

.lot label {
  display:block;
  margin-top:.6rem;
  font-size:.85rem;
}

.lot button {
  margin-top:.4rem;
}

.trial {
  border-top:1px solid var(--line);
  padding-top:1.25rem;
}

.trial .controls {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:.6rem;
  align-items:end;
  max-width:720px;
}

.trial canvas {
  display:block;
  width:min(100%,650px);
  height:auto;
  margin-block:1rem;
  background:var(--sheet);
  border:1px solid var(--line);
}

#receipt a {
  display:block;
  overflow-wrap:anywhere;
}

.support {
  display:flex;
  flex-wrap:wrap;
  gap:.4rem;
  align-items:center;
}

.lot {
  padding-bottom:.7rem;
}

#review-bar p {
  font-size:.82rem;
  color:var(--muted);
  margin-top:.4rem;
}

@media(max-width:930px) {
  .layout {
    width:calc(100% - 3rem);
  }
  .intro {
    gap:1.65rem;
  }
  .store {
    grid-template-columns:minmax(0,1fr) minmax(215px,260px);
    gap:1.25rem;
  }
}

@media(max-width:700px) {
  .layout {
    width:calc(100% - 1.9rem);
  }
  .masthead {
    height:62px;
  }
  .intro {
    grid-template-columns:1fr;
    gap:1.3rem;
    padding-block:2rem;
  }
  .intro h1 {
    font-size:clamp(2.8rem,13vw,5rem);
  }
  .intro img {
    height:auto;
    max-height:330px;
  }
  .store {
    grid-template-columns:1fr;
    gap:1.2rem;
    padding-block:1.35rem 2rem;
  }
  .bag {
    position:static;
  }
  .card-row {
    gap:.35rem;
  }
  .card-row button {
    padding-inline:.4rem;
  }
  .card small,.price {
    font-size:.75rem;
  }
  .work-grid {
    column-gap:.65rem;
  }
  .masthead nav {
    gap:1rem;
  }
  .trial .controls {
    grid-template-columns:1fr;
  }
}

@media(prefers-reduced-motion:no-preference) {
  html {
    scroll-behavior:smooth;
  }
}

#print-pages {
  display:none;
}

#sheet-count {
  color:var(--muted);
  margin-top:.8rem;
}

#rain-steps {
  columns:2;
  font-variant-numeric:tabular-nums;
}

#rain-steps li {
  break-inside:avoid;
}

[data-theme="06"] .intro img {
  object-position:center 21%;
}

[data-theme="08"] .intro img,[data-theme="08"] .card img,[data-theme="07"] .card img {
  object-fit:contain;
  background:var(--sheet);
}

@media print {
  @page {
    size:A4;
    margin:12mm;
  }
  body:has(#print-pages img) {
    background:white;
  }
  body:has(#print-pages img)>:not(#print-pages) {
    display:none!important;
  }
  body:has(#print-pages img) #print-pages {
    display:block;
  }
  #print-pages img {
    width:100%;
    height:auto;
    break-inside:avoid;
    break-after:page;
  }
  #print-pages img:last-child {
    break-after:auto;
  }
}
