:root {
  color-scheme: light;
  --ink: #222b25;
  --muted: #59635d;
  --paper: #f5f6f2;
  --surface: #fff;
  --line: #d9dfd7;
  --accent: #244b3b;
  --accent-hover: #17382b;
  --accent-soft: #e3ede4;
  --hero: #193a2e;
  font: 100%/1.55 "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .2em; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #6954c8; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.85rem, 3.5vw, 2.55rem); letter-spacing: -.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.12rem; }
p + p { margin-top: .65rem; }
code, .numeric { font-variant-numeric: tabular-nums; }
code { font: .92em/1.5 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }

.theme-clay {
  --ink: #39291f;
  --muted: #685b52;
  --paper: #fbf6ef;
  --line: #e5d8ca;
  --accent: #8e442f;
  --accent-hover: #713221;
  --accent-soft: #f4e5d8;
  --hero: #7b3e2b;
}

.ops { --paper: #f3f5f4; }
.shell { width: min(100% - 3rem, 72rem); margin-inline: auto; }
.narrow { width: min(100%, 31rem); }
.shell.narrow { width: min(100% - 3rem, 31rem); }
.main-space { padding-block: 2rem 3.5rem; }
.muted { color: var(--muted); }
.skip { position: absolute; z-index: 2; top: -6rem; left: 1rem; background: var(--surface); padding: .7rem; }
.skip:focus { top: .5rem; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; min-height: 4.5rem; gap: 1.5rem; justify-content: space-between; }
.brand { color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.15rem; display: inline-flex; align-items: center; gap: .75rem; overflow-wrap: anywhere; }
.brandmark { display: inline-grid; place-items: center; flex: none; width: 2.35rem; height: 2.35rem; background: var(--accent); color: white; border-radius: .55rem; font: 700 1.23rem/1 "Songti SC", "SimSun", serif; }
.brand small { display: block; color: var(--muted); font-size: .75rem; font-weight: 550; }
.header-inner nav, .session-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.header-inner nav a, .session-actions a, .session-actions button { text-decoration: none; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.header-inner nav a { padding: .55rem .65rem; border-radius: .4rem; }
.header-inner nav a[aria-current], .header-inner nav a:hover { background: var(--accent-soft); color: var(--accent); }
.session-user { font-size: .8rem; color: var(--muted); font-weight: 700; overflow-wrap: anywhere; }
.session-actions form { margin: 0; }
.session-actions a:hover, .session-actions button:hover { color: var(--accent); text-decoration: underline; }

.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: .45rem; padding: .6rem 1rem; min-height: 2.7rem; font-size: .94rem; font-weight: 650; text-decoration: none; line-height: 1.35; text-align: center; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.button.secondary { background: var(--surface); border-color: var(--line); color: var(--accent); }
.button.secondary:hover:not(:disabled) { background: var(--accent-soft); }
.text-button { background: transparent; color: var(--accent); border: 0; padding: .3rem .25rem; border-radius: .25rem; font-size: .87rem; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
.text-link { font-weight: 650; }
.back-link { display: inline-block; margin-bottom: .85rem; font-size: .9rem; }

.store-hero { display: grid; overflow: hidden; border-radius: .8rem; color: #fff; background: var(--hero); }
.store-hero.with-photo { grid-template-columns: 1fr 1.06fr; min-height: 23rem; }
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: clamp(1.55rem, 5vw, 4rem); }
.hero-copy h1 { max-width: 12ch; font-family: "Songti SC", SimSun, "Noto Serif CJK SC", serif; letter-spacing: -.025em; font-size: clamp(2.2rem, 4.8vw, 4.15rem); line-height: 1.13; overflow-wrap: anywhere; }
.hero-copy p { margin-top: 1rem; max-width: 27em; color: #f4eee4; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.65rem; }
.hero-button { background: #f5f0e4; color: var(--hero); }
.hero-button:hover { background: #fff; }
.hero-secondary { border-color: #ffffff70; color: #fff; }
.hero-secondary:hover { background: #ffffff20; }
.hero-photo { width: 100%; height: 100%; min-height: 0; object-fit: cover; max-height: 28rem; }
@media (hover: hover) and (pointer: fine) {
  html:has(.store-home, .catalog-main) { scrollbar-gutter: stable; }
  html:has(.store-home, .catalog-main)::-webkit-scrollbar { width: 10px; }
}
.shell.store-home { width: min(100% - 2rem, 78rem); }
.shell.catalog-main { width: min(100% - 2rem, 90.5rem); }
.catalog-main .page-heading h1 { font-size: clamp(1.35rem, 2vw, 1.6rem); }
.store-home :is(.store-hero, .store-update) { width: min(100% - 1rem, 72rem); margin-inline: auto; }
.catalog { margin-top: clamp(1.65rem, 3.5vw, 2.75rem); scroll-margin-top: 1rem; }
.catalog:first-child { margin-top: 0; }
.catalog-heading :is(h1, h2) { font-size: clamp(1.45rem, 2.2vw, 1.8rem); }
.store-update { margin-top: 1.65rem; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.store-home .products { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.product-card { display: flex; flex-direction: column; container-type: inline-size; border-radius: 1rem; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface); }
.product-photo { position: relative; display: grid; place-items: center; flex: none; aspect-ratio: 4 / 3; background: var(--paper); }
.product-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.product-info { display: flex; flex: 1; flex-direction: column; min-height: 195px; gap: .6rem; padding: 1rem; overflow-wrap: anywhere; }
.product-info h3 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.product-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  color: var(--muted); font-size: .875rem; line-height: 1.25rem; margin-top: .35rem; }
.product-info .product-availability { margin-top: .4rem; padding: .2rem .45rem; font-size: .8125rem; }
.stock-label { color: var(--muted); font-size: .9rem; margin-top: .45rem; }
.product-buy { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  margin-top: auto; border-top: 1px solid var(--line); padding-top: .75rem; }
.product-prices { display: flex; align-items: baseline; flex-wrap: wrap; gap: .15rem .65rem; }
.comparison-price { color: var(--muted); font-size: .87rem; font-variant-numeric: tabular-nums; }
.price { color: var(--accent); font-weight: 750; font-variant-numeric: tabular-nums; }
.product-buy .product-prices { display: grid; gap: .15rem; min-width: 0; }
.product-buy .price { font-size: 1.125rem; line-height: 1.2; }
.product-buy .comparison-price { font-size: .75rem; line-height: 1.25; }
.product-buy .button { flex: none; padding-inline: .65rem; }
.store-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); padding-block: clamp(1.6rem, 3vw, 2.8rem); font-size: .9rem; }
.store-footer-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, .75fr) minmax(0, 1fr); gap: clamp(1.4rem, 4vw, 3.4rem); }
.store-footer h2 { color: var(--ink); font-size: 1rem; margin-bottom: .65rem; }
.footer-brand { margin-bottom: .9rem; }
.footer-notice p { white-space: pre-line; overflow-wrap: anywhere; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links a { display: inline-block; padding-block: .21rem; color: var(--muted); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; color: var(--accent); }
.footer-contact { overflow-wrap: anywhere; }
.footer-contact address { display: grid; gap: .2rem; font-style: normal; }
.footer-contact strong { color: var(--ink); }
.footer-contact address + p { margin-top: .6rem; }
.store-mobile-nav { display: none; }
.help-content section[id] { scroll-margin-top: 1rem; }
.help-content ol { padding-left: 1.5rem; }
.help-content li + li { margin-top: .4rem; }
.help-faq h2 { margin-bottom: .65rem; }
.help-faq details { border-top: 1px solid var(--line); padding: .8rem 0; }
.help-faq summary { cursor: pointer; font-weight: 650; }
.help-faq p { color: var(--muted); margin-top: .45rem; }

.panel { padding: clamp(1.05rem, 2.7vw, 1.65rem); background: var(--surface); border: 1px solid var(--line); border-radius: .65rem; min-width: 0; }
.panel h1 + p, .panel h2 + p, .panel h2 + .details, .panel h1 + .stack, .panel h2 + .stack, .panel p + form { margin-top: .85rem; }
.page-title { margin-bottom: 1.25rem; }
.page-heading, .panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: 1.25rem; }
.panel-heading { margin-bottom: .9rem; }
.split-grid, .checkout-grid, .receipt-grid, .form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.checkout-grid { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); }
.receipt-grid { grid-template-columns: minmax(0, 1fr) minmax(0, .65fr); }
.checkout-photo { width: 100%; aspect-ratio: 4 / 3; max-height: 20rem; object-fit: contain; border-radius: .45rem; margin-bottom: 1.05rem; }
.checkout-product .product-prices { margin-top: .65rem; }
.price { font-size: 1.45rem; }
.checkout-total, .receipt-total { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .65rem; }
.checkout-total { border-top: 1px solid var(--line); padding-top: .75rem; }
.receipt-total { padding-bottom: .85rem; }
.receipt-total .price { font-size: clamp(1.6rem, 3vw, 2.15rem); }
.receipt-total + .details { border-top: 1px solid var(--line); }
.details { display: grid; gap: .55rem; margin: .65rem 0 0; padding-top: .65rem; }
.details > div { display: grid; grid-template-columns: minmax(5.15rem, 7.5rem) minmax(0, 1fr); gap: .65rem; align-items: baseline; }
.details dt { color: var(--muted); font-size: .9rem; }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copy-line { display: flex; gap: .45rem; flex-wrap: wrap; align-items: baseline; }
.delivery-list { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .65rem; }
.delivery-list li { background: var(--paper); border-radius: .45rem; padding: .7rem; }
.delivery-list code { white-space: pre-wrap; }
.pre-line { white-space: pre-line; }
.qr-image { width: min(100%, 14rem); height: auto; padding: .45rem; background: #fff; border: 1px solid var(--line); border-radius: .65rem; margin-block: 1rem; }
.payment-panel .qr-image { margin-inline: auto; }
.payment-panel > p { font-size: .9rem; }
.payment-payee { text-align: center; overflow-wrap: anywhere; }

.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .35rem; font-weight: 650; font-size: .92rem; color: var(--ink); }
label small { color: var(--muted); font-size: .85rem; font-weight: 400; }
input, textarea { width: 100%; padding: .58rem .68rem; border: 1px solid #bcc6bd; border-radius: .4rem; background: var(--surface); color: var(--ink); font-weight: 400; font-size: 1rem; }
input { min-height: 2.65rem; }
.order-search select { max-width: min(100%, 16rem); min-height: 2.65rem; padding: .5rem; color: var(--ink);
  background: var(--surface); border: 1px solid #bcc6bd; border-radius: .4rem; }
.storefront-profile { margin-bottom: 1.1rem; }
input[type="checkbox"] { width: 1.1rem; min-height: 1.1rem; accent-color: var(--accent); }
.checkbox { display: flex; align-items: center; gap: .55rem; }
textarea { resize: vertical; }
.quantity { max-width: 7rem; }
.lookup-panel, .login-panel { padding: clamp(1.4rem, 4vw, 2.55rem); }
.login-space { padding-block: clamp(3.5rem, 13vh, 8rem); }
.login-panel .brandmark { margin-bottom: .9rem; }
.form-error { margin-block: .7rem; color: #832619; font-weight: 650; }
.success-note { margin-bottom: 1rem; background: var(--accent-soft); color: var(--accent); border-radius: .45rem; padding: .75rem 1rem; }
.empty { padding: 2rem 1rem; color: var(--muted); text-align: center; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.summary-card { text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: .65rem; padding: .9rem 1.15rem; color: var(--ink); display: grid; gap: .25rem; }
.summary-card:hover { border-color: var(--accent); }
.summary-card span { color: var(--muted); font-size: .9rem; }
.summary-card strong { color: var(--accent); font-size: 1.9rem; font-variant-numeric: tabular-nums; }
.notice-board { background: #f8f4e9; border: 1px solid #e7dbc1; color: #493f2a; padding: 1rem 1.15rem; border-radius: .65rem; margin-bottom: 1.1rem; }
.notice-board h2 { display: flex; align-items: center; gap: .65rem; font-size: 1.05rem; }
.notice-board p, .notice-list { margin: .45rem 0 0; }
.notice-count { background: #e9d5a9; font-size: .82rem; border-radius: 999px; padding: .2rem .55rem; line-height: 1; }
.notice-list { list-style: none; padding: 0; }
.notice-list li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .35rem .75rem; padding-block: .18rem; }
.notice-list time { color: #625540; font-size: .88rem; }
.list-panel { padding: 0; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.tabs a { padding: .48rem .65rem; border-radius: .35rem; font-size: .9rem; text-decoration: none; color: var(--muted); }
.tabs a[aria-current], .tabs a:hover { background: var(--accent-soft); color: var(--accent); }
.order-search, .inline-form { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.order-search input { width: min(11.5rem, 53vw); }
.inline-form { margin: .85rem 0 1rem; }
.inline-form input { max-width: 19rem; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: .8rem 1.05rem; }
th { color: var(--muted); font-weight: 650; white-space: nowrap; }
td { vertical-align: middle; }
td.numeric { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.cell-subtitle { display: block; color: var(--muted); font-size: .81rem; margin-top: .2rem; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline-block; margin-right: .55rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: .9rem; border-top: 1px solid var(--line); margin-top: .3rem; padding: .9rem 1rem; font-size: .9rem; }
.badge { display: inline-block; border-radius: 999px; background: #edf1ef; color: #364941; padding: .33rem .65rem; font-size: .86rem; font-weight: 650; line-height: 1.25; white-space: nowrap; }
.badge-awaiting_payment { background: #f6e9d9; color: #704321; }
.badge-awaiting_shipment { background: #e4edf8; color: #24517e; }
.badge-shipped, .badge-delivered { background: #dfeee2; color: #245436; }
.image-fields { display: grid; gap: .5rem; }
input[type="file"] { border-style: dashed; }
.upload-preview, .product-preview { max-height: 16rem; width: auto; border-radius: .45rem; border: 1px solid var(--line); }
.upload-preview { max-width: min(100%, 15rem); }
.media-feedback:empty { display: none; }
.media-feedback { font-size: .9rem; }
.history-panel { margin-top: 1.1rem; }
.history-panel h2 { margin-bottom: .65rem; }
.history-panel > p + .table-scroll { margin-top: .7rem; }
.row-actions > a + a { margin-left: .7rem; }
.row-actions > a + form { margin-left: .7rem; }

@media (min-width: 1024px) {
  .catalog-main .products { grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); }
}

@media (max-width: 1279px) {
  .store-home .products { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .products, .store-home .products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@container (max-width: 251px) {
  .product-info { min-height: 224px; }
}

@container (max-width: 173px) {
  .product-info { min-height: 252px; }
}

@media (max-width: 790px) {
  .shell { width: min(100% - 2rem, 72rem); }
  .shell.narrow { width: min(100% - 2rem, 31rem); }
  .header-inner { padding-block: .65rem; flex-wrap: wrap; gap: .45rem .75rem; }
  .header-inner nav, .session-actions { gap: .45rem; }
  .ops-header .session-actions { flex-basis: 100%; }
  .hero-photo { min-height: 15rem; }
  .store-home :is(.store-hero, .store-update) { width: 100%; }
  .receipt-grid, .checkout-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
  .products, .store-home .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
}

@media (max-width: 640px) {
  .product-info { min-height: 141px; gap: .4rem; padding: .625rem .75rem; }
  .product-info h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    white-space: normal; font-size: .875rem; line-height: 1.15rem; }
  .product-info .product-availability { margin-top: .3rem; padding: .15rem .4rem; font-size: .75rem; }
  .product-description { display: none; }
  .product-buy { gap: .375rem; padding-top: .375rem; }
  .product-buy .price { font-size: 1rem; }
  .product-buy .button { padding-inline: .425rem; font-size: .8125rem; }

  @container (max-width: 142px) {
    .product-info { min-height: 157px; padding-inline: .625rem; }
    .product-buy { gap: .25rem; }
    .product-buy .price { font-size: .875rem; }
    .product-buy .button { padding-inline: .25rem; }
  }
}

@media (max-width: 575px) {
  .main-space { padding-top: 1.2rem; }
  .store-hero.with-photo, .split-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { padding: 1.55rem; }
  .hero-photo { max-height: 16rem; }
  .summary-grid { gap: .45rem; }
  .summary-card { padding: .6rem .48rem; }
  .summary-card span { font-size: .84rem; }
  .summary-card strong { font-size: 1.45rem; }
  th, td { padding: .65rem .7rem; }
  .details > div { grid-template-columns: minmax(4.7rem, 6rem) minmax(0, 1fr); gap: .45rem; }
  .store .store-desktop-nav { display: none; }
  .store-footer { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
  .store-footer-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .store-mobile-nav { position: fixed; inset: auto 0 0; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line); background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
  .store-mobile-nav a { text-align: center; padding: .75rem .35rem; text-decoration: none; color: var(--muted); font-size: .9rem; }
  .store-mobile-nav a[aria-current] { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
}
