:root {
  color-scheme: light;
  --paper: #f5f5f5;
  --ink: #171717;
  --muted: #707070;
  --line: #d9d9d9;
  --card: #e8e8e8;
  --accent: #d4d4d4;
  --white: #fff;
  --shadow: 0 18px 60px rgba(0, 0, 0, .14);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--paper);
}
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
body.is-locked { overflow: hidden; }
button, a, [role="button"] {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button { color: inherit; font: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(68px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 20px 0;
  border-bottom: 1px solid rgba(24,24,22,.08);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-logo { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; border-radius: 50%; background: #d4d4d4; color: #666; font-size: 12px; font-weight: 800; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand strong { display: block; font-size: 19px; line-height: 1; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; letter-spacing: .16em; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.admin-button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.icon-button { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: #e5e5e5; cursor: pointer; }
.icon-button span { position: absolute; top: 0; right: 0; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; color: var(--ink); background: var(--accent); font-size: 10px; font-weight: 800; }

main { overflow: clip; }
.hero { padding: 36px 22px 34px; }
.eyebrow { margin: 0 0 14px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .18em; }
.hero h1 { max-width: 680px; margin: 0; font-size: clamp(22px, 6vw, 34px); font-weight: 700; line-height: 1.35; letter-spacing: -.02em; }
.hero-copy { max-width: 620px; margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.catalog { min-height: calc(100dvh - 170px); padding: 32px 16px calc(112px + env(safe-area-inset-bottom, 0px)); background: #e9e9e9; border-radius: 26px 26px 0 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; padding: 0 6px; }
.section-heading h2, .sheet h2 { margin: 0; font-size: 29px; font-weight: 700; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 8px; margin: 25px 0 18px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: 0 0 auto; min-height: 38px; padding: 0 20px; border: 1px solid #c7c7c7; border-radius: 20px; background: transparent; font-size: 12px; cursor: pointer; }
.filter.is-active { border-color: var(--ink); color: var(--white); background: var(--ink); }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.product-card { min-width: 0; }
.product-media { position: relative; overflow: hidden; aspect-ratio: 9 / 19.5; border-radius: 16px; background: #d7d7d7; cursor: pointer; }
.product-media::after { content: "小也\AIMAGE"; white-space: pre; position: absolute; inset: 0; display: grid; place-items: center; color: #9a9a9a; font-size: 13px; line-height: 1.7; letter-spacing: .13em; text-align: center; }
.product-media img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.product-index { position: absolute; z-index: 2; top: 10px; left: 10px; padding: 5px 8px; border-radius: 20px; background: rgba(245,245,245,.88); backdrop-filter: blur(8px); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.product-info { padding: 12px 2px 18px; }
.product-info h3 { margin: 0 0 5px; font-size: 17px; font-weight: 700; }
.product-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.product-meta p { min-width: 0; margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.product-meta strong { flex: 0 0 auto; font-size: 14px; }
.add-button { width: 100%; min-height: 38px; margin-top: 10px; border: 1px solid var(--ink); border-radius: 10px; background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; transition: transform 120ms ease-out, background 120ms; }
.add-button:active { transform: scale(.97); background: var(--accent); }

.floating-cart { position: fixed; z-index: 30; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 14px; display: flex; align-items: center; gap: 11px; min-height: 68px; padding: 9px 12px; border: 0; border-radius: 18px; color: var(--white); background: var(--ink); box-shadow: 0 14px 40px rgba(24,24,22,.28); cursor: pointer; transform: translateY(120px); transition: transform 320ms cubic-bezier(.2,.8,.2,1); }
.floating-cart.is-visible { transform: translateY(0); }
.floating-cart:active { transform: translateY(0) scale(.98); }
.floating-cart-icon { position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: var(--ink); background: var(--accent); }
.floating-cart-icon i { position: absolute; top: -4px; right: -4px; display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; border: 2px solid var(--ink); border-radius: 10px; color: white; background: #555; font-size: 10px; font-style: normal; font-weight: 800; }
.floating-cart > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; align-items: flex-start; }
.floating-cart small { color: #aaa8a3; font-size: 9px; }
.floating-cart strong { margin-top: 2px; font-size: 17px; }
.floating-cart > b { padding: 10px 13px; border-radius: 10px; color: var(--ink); background: white; font-size: 11px; }

.overlay { position: fixed; z-index: 50; inset: 0; background: rgba(13,13,12,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet { position: fixed; z-index: 60; right: 0; bottom: 0; left: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding: 28px 18px calc(26px + env(safe-area-inset-bottom, 0px)); border-radius: 26px 26px 0 0; background: var(--paper); box-shadow: var(--shadow); animation: sheet-in 280ms cubic-bezier(.2,.8,.2,1); }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { position: absolute; top: 9px; left: 50%; width: 38px; height: 4px; border-radius: 2px; background: #c6c3bd; transform: translateX(-50%); }
.sheet-close { position: sticky; z-index: 3; top: 0; float: right; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #e3e3e3; font-size: 24px; line-height: 1; cursor: pointer; }
.detail-gallery { display: flex; gap: 9px; margin: 18px -18px 24px; padding: 0 18px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.detail-gallery::-webkit-scrollbar { display: none; }
.detail-slide { position: relative; flex: 0 0 78%; overflow: hidden; aspect-ratio: 9 / 19.5; border-radius: 18px; background: #d7d7d7; scroll-snap-align: center; }
.detail-slide::after { content: "小也\AIMAGE"; white-space: pre; position: absolute; inset: 0; display: grid; place-items: center; color: #9a9a9a; font-size: 13px; line-height: 1.8; letter-spacing: .13em; text-align: center; }
.detail-slide img, .detail-slide video { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; background: #1b1b19; }
.detail-slide.video-placeholder.is-loading::before { content: "视频加载中…"; position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; color: #555; background: rgba(245,245,245,.88); font-size: 12px; }
.detail-title-row { display: flex; align-items: start; justify-content: space-between; gap: 16px; clear: both; }
.detail-title-row h2 { font-size: 34px; }
.detail-title-row strong { padding: 8px 10px; border-radius: 8px; background: var(--accent); font-size: 16px; white-space: nowrap; }
.detail-description { margin: 14px 0 20px; color: #555; font-size: 13px; line-height: 1.75; }
.detail-points { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.detail-points li { position: relative; padding: 12px 0 12px 18px; border-bottom: 1px solid var(--line); color: #505050; font-size: 12px; line-height: 1.55; }
.detail-points li::before { content: "✓"; position: absolute; left: 0; color: #555; font-weight: 800; }
.price-options { display: grid; gap: 9px; margin: 22px 0; }
.price-option { display: flex; align-items: center; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.price-option.is-special { border-color: #bcbcbc; background: #eeeeee; }
.price-option span { display: flex; flex-direction: column; }
.price-option strong { font-size: 13px; }
.price-option small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.price-option b { font-size: 18px; }
.primary-button, .secondary-button, .danger-button { min-height: 50px; border-radius: 13px; font-size: 13px; font-weight: 800; cursor: pointer; }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .58; }
.primary-button { border: 0; color: white; background: var(--ink); }
.secondary-button { border: 1px solid var(--ink); background: transparent; }
.danger-button { width: 100%; margin-top: 24px; border: 1px solid #c7c7c7; color: #444; background: #ededed; }
.detail-sheet > .primary-button { width: 100%; }

.cart-heading, .editor-heading { padding: 10px 44px 20px 2px; }
.cart-heading p:last-child, .editor-heading p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.cart-items { border-top: 1px solid var(--line); }
.cart-item { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-thumb { display: grid; place-items: center; width: 50px; height: 70px; overflow: hidden; border-radius: 9px; color: #999; background: #d7d7d7; font-size: 9px; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info strong { display: block; font-size: 13px; }
.cart-item-info small { color: var(--muted); font-size: 10px; }
.quantity { display: flex; align-items: center; gap: 5px; }
.quantity button { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; }
.quantity span { width: 18px; text-align: center; font-size: 12px; }
.empty-cart { display: flex; align-items: center; flex-direction: column; padding: 54px 0 40px; color: var(--muted); }
.empty-cart > span { font-size: 42px; }
.empty-cart strong { margin-top: 9px; color: var(--ink); font-size: 15px; }
.empty-cart p { margin: 6px 0 0; font-size: 11px; }
.summary-wrap { margin-top: 22px; }
.summary-wrap > img { display: block; width: 100%; border-radius: 16px; box-shadow: 0 10px 35px rgba(24,24,22,.12); }
.summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }

.upload-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 72px; padding: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; cursor: pointer; }
.upload-row span { display: flex; min-width: 0; flex-direction: column; }
.upload-row strong { font-size: 13px; }
.upload-row small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.upload-row b { flex: 0 0 auto; padding: 9px 10px; border-radius: 8px; background: #e5e5e5; font-size: 10px; }
.upload-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.add-product-button { width: 100%; min-height: 46px; margin-top: 12px; border: 1px dashed #aaa69e; border-radius: 12px; color: var(--ink); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.add-product-button:hover { background: #e5e5e5; }
.editor-products { display: grid; gap: 10px; margin-top: 12px; }
.editor-product { min-width: 0; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.editor-product.is-dragging { z-index: 2; border-color: #777; box-shadow: 0 12px 30px rgba(0,0,0,.16); opacity: .82; }
.editor-product legend { width: 100%; padding: 0 5px; }
.editor-product-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 750; }
.editor-product-heading { display: flex; min-width: 0; align-items: center; gap: 7px; }
.editor-drag-handle { display: grid; flex: 0 0 auto; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid #d5d5d5; border-radius: 8px; color: #686868; background: #f0f0f0; font-size: 11px; line-height: .72; cursor: grab; touch-action: none; }
.editor-drag-handle:active, body.is-reordering .editor-drag-handle { cursor: grabbing; }
.editor-drag-handle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.delete-product-button { flex: 0 0 auto; padding: 5px 8px; border: 0; border-radius: 7px; color: #444; background: #ededed; font-size: 10px; font-weight: 800; cursor: pointer; }
.editor-field { display: grid; gap: 6px; margin-top: 11px; }
.editor-field > span, .login-form label > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.editor-field input, .editor-field textarea, .login-form input { width: 100%; padding: 11px 12px; border: 1px solid #d5d1ca; border-radius: 9px; outline: none; color: var(--ink); background: var(--paper); font: inherit; font-size: 13px; line-height: 1.5; }
.editor-field input:focus, .editor-field textarea:focus, .login-form input:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(24,24,22,.08); }
.editor-field textarea { resize: vertical; }
.editor-price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.editor-category { margin-top: 11px; }
.editor-category > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.editor-category-options { display: flex; gap: 18px; }
.editor-category-options label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.editor-category-options input { width: 17px; height: 17px; accent-color: var(--ink); }
.editor-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.editor-upload-grid label { position: relative; display: grid; place-items: center; min-height: 44px; overflow: hidden; border: 1px dashed #c8c4bc; border-radius: 9px; color: var(--muted); font-size: 10px; cursor: pointer; }
.editor-upload-grid input { position: absolute; opacity: 0; }
.upload-status { display: block; min-height: 16px; margin-top: 8px; color: #555; font-size: 9px; line-height: 1.5; }
.editor-actions { position: sticky; bottom: calc(-26px - env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin: 18px -18px calc(-26px - env(safe-area-inset-bottom, 0px)); padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 7px; }
.login-form .primary-button { margin-top: 4px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 9px; color: #333; background: #dedede; font-size: 11px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(98px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 40px); padding: 11px 15px; border-radius: 10px; color: white; background: rgba(24,24,22,.92); font-size: 11px; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity 180ms, transform 180ms; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }

@media (min-width: 720px) {
  .site-header { padding-right: max(28px, calc((100vw - 900px) / 2)); padding-left: max(28px, calc((100vw - 900px) / 2)); }
  .hero, .catalog { max-width: 900px; margin-right: auto; margin-left: auto; }
  .hero { padding-top: 48px; padding-bottom: 42px; }
  .catalog { padding-right: 24px; padding-left: 24px; }
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .sheet { top: 50%; right: 28px; bottom: auto; left: auto; width: min(520px, calc(100vw - 56px)); max-height: calc(100dvh - 56px); border-radius: 24px; transform: translateY(-50%); animation: desktop-sheet-in 240ms ease-out; }
  @keyframes desktop-sheet-in { from { opacity: 0; transform: translateY(calc(-50% + 14px)); } to { opacity: 1; transform: translateY(-50%); } }
  .floating-cart { right: 24px; left: auto; width: 350px; }
}

@media (hover: hover) and (pointer: fine) {
  .product-media img { transition: transform 420ms cubic-bezier(.2,.8,.2,1); }
  .product-media:hover img { transform: scale(1.035); }
  .add-button:hover { color: var(--ink); background: var(--accent); }
  .icon-button:hover, .sheet-close:hover { background: #d9d9d9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
