* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --bg: #f5f7f1;
  --surface: #ffffff;
  --surface-strong: #fdfbf7;
  --text: #211f1d;
  --muted: #6d6760;
  --line: #ded9d1;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #d8f3ed;
  --price: #b42318;
  --price-soft: #ffe3df;
  --warn: #8a5a00;
  --warn-soft: #fff0c2;
  --shadow: 0 18px 50px rgba(33, 31, 29, .12);
  --radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
html.wide-frame-document, body.wide-frame-document { height: 100%; overflow: hidden; }
body { min-height: 100vh; }
button { border: 0; cursor: pointer; font: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.app { background: var(--bg); color: var(--text); min-height: 100vh; }
.app.wide-frame-active { background: #111; height: 100vh; overflow: hidden; position: relative; }
.shell { margin: 0 auto; max-width: 1100px; padding: 10px 12px 32px; }
.wide-frame-bg { background-image: var(--wide-frame-image); background-position: center; background-repeat: no-repeat; background-size: 100% 100%; inset: 0; position: fixed; z-index: 0; }
.wide-frame-focus-layer { inset: 0; pointer-events: none; position: fixed; z-index: 1; }
.wide-frame-focus-soft .wide-frame-focus-layer { background: linear-gradient(90deg, rgba(0,0,0,.16), transparent 15%, transparent 85%, rgba(0,0,0,.16)); backdrop-filter: blur(1px); }
.wide-frame-focus-medium .wide-frame-focus-layer { background: linear-gradient(90deg, rgba(0,0,0,.26), transparent 18%, transparent 82%, rgba(0,0,0,.26)), linear-gradient(180deg, rgba(0,0,0,.18), transparent 16%, transparent 86%, rgba(0,0,0,.18)); backdrop-filter: blur(2px); }
.wide-frame-focus-strong .wide-frame-focus-layer { background: linear-gradient(90deg, rgba(0,0,0,.34), transparent 21%, transparent 79%, rgba(0,0,0,.34)), linear-gradient(180deg, rgba(0,0,0,.24), transparent 18%, transparent 84%, rgba(0,0,0,.24)); backdrop-filter: blur(3px); }
.topbar { align-items: center; background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line); display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; left: 0; padding: 10px 12px; position: sticky; right: 0; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.wide-frame-active .topbar { background: transparent; border-bottom: 0; position: fixed; }
.wide-frame-active .brand-title { opacity: 0; pointer-events: none; }
.brand-title { display: grid; gap: 2px; min-width: 0; }
.brand-title strong { font-size: 19px; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-title span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-entry { align-items: center; background: var(--accent); border-radius: 999px; color: #fff; display: inline-flex; font-weight: 900; gap: 7px; justify-content: center; min-height: 38px; min-width: 88px; padding: 8px 11px; }
.cart-entry .count { background: rgba(255,255,255,.18); border-radius: 999px; min-width: 22px; padding: 2px 6px; text-align: center; }
.cart-entry--icon_count { gap: 4px; min-width: 52px; padding: 7px 9px; }
.cart-icon { display: block; height: 20px; width: 20px; }
.hero { display: grid; gap: 10px; padding: 14px 2px 8px; }
.error-banner { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); border-radius: var(--radius); color: var(--warn); font-size: 13px; font-weight: 800; margin: 10px 2px 0; padding: 10px; }
.semantic-row { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.semantic { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 4px; min-height: 72px; padding: 10px; }
.semantic strong { font-size: 13px; line-height: 1.2; }
.semantic p { color: var(--muted); font-size: 12px; line-height: 1.3; }
.section { margin-top: 10px; }
.section-head { align-items: end; display: flex; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.section-head h2 { font-size: 18px; line-height: 1.2; }
.section-head p { color: var(--muted); font-size: 12px; max-width: 60ch; }
.product-rail { overflow: hidden; position: relative; }
.product-row { --cards-current: var(--cards-mobile, 2.1); display: grid; gap: var(--card-gap, 10px); grid-auto-columns: clamp(var(--card-min, 124px), calc((100% - (var(--card-gap, 10px) * (var(--cards-current) - 1))) / var(--cards-current)), var(--card-max, 190px)); grid-auto-flow: column; overflow-x: auto; overscroll-behavior-inline: contain; padding: 2px 2px 12px; scroll-padding-inline: 2px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.product-row::-webkit-scrollbar { display: none; }
.rail-zone { align-items: center; background: transparent; bottom: 12px; color: var(--text); display: flex; justify-content: center; opacity: .14; position: absolute; top: 2px; width: 52px; z-index: 5; }
.rail-zone:hover, .rail-zone:focus-visible { opacity: .42; }
.rail-zone--left { background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 92%, transparent), transparent); left: 0; }
.rail-zone--right { background: linear-gradient(270deg, color-mix(in srgb, var(--bg) 92%, transparent), transparent); right: 0; }
.rail-zone::before { border-color: currentColor; border-style: solid; border-width: 0 2px 2px 0; content: ""; height: 10px; width: 10px; }
.rail-zone--left::before { transform: rotate(135deg); }
.rail-zone--right::before { transform: rotate(-45deg); }
.product-wrap { background: var(--surface); border: var(--card-border-width, 1px) solid color-mix(in srgb, var(--line) 42%, transparent); border-radius: var(--radius); box-shadow: var(--card-shadow, 0 12px 28px rgba(33,31,29,.16)); display: grid; padding: var(--card-inset, 1px); scroll-snap-align: start; transition: box-shadow .16s ease, transform .16s ease; }
.product-wrap:has(.product-card:hover) { box-shadow: var(--card-shadow-hover, 0 16px 34px rgba(33,31,29,.2)); transform: translateY(-1px); }
.product-card { background: transparent; color: inherit; display: block; padding: 0; text-align: left; width: 100%; }
.photo-surface { aspect-ratio: 4 / 5; background: var(--surface-strong); border: var(--photo-border-width, 1px) solid var(--line); border-radius: 4px; box-shadow: var(--photo-shadow, 0 4px 12px rgba(33,31,29,.1)); display: block; overflow: hidden; position: relative; width: 100%; }
.image-frame { background: var(--surface-strong); display: block; overflow: hidden; position: relative; width: 100%; }
.image-frame::before { background-image: var(--image-backdrop, none); background-position: center; background-size: cover; content: ""; filter: blur(14px); inset: -10px; opacity: .34; position: absolute; transform: scale(1.04); }
.image-frame.is-broken::before { display: none; }
.image-frame--preview, .image-frame--modal { aspect-ratio: 4 / 5; border-radius: 4px; }
.image-frame--thumb, .image-frame--cart { aspect-ratio: 1; border-radius: 4px; }
.image-frame img { display: block; height: 100%; object-fit: contain; object-position: center; padding: var(--image-padding, 2px); position: relative; width: 100%; z-index: 1; }
/* Photo scale is intentionally limited to preview cards; modal/gallery views should preserve the full product image. */
.image-frame--preview img { transform: scale(var(--image-scale, 1)); transform-origin: center; }
.image-skeleton { animation: shimmer 1.1s linear infinite; background: linear-gradient(90deg, var(--surface-strong), var(--line), var(--surface-strong)); inset: 0; position: absolute; z-index: 2; }
.image-broken { align-items: center; background: var(--warn-soft); color: var(--warn); display: none; font-size: 18px; font-weight: 950; inset: 0; justify-content: center; position: absolute; z-index: 2; }
.image-frame.is-loaded .image-skeleton { display: none; }
.image-frame.is-broken .image-skeleton, .image-frame.is-broken img { display: none; }
.image-frame.is-broken .image-broken { display: flex; }
.sr-only { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px; }
.price-line { align-items: center; display: flex; flex-wrap: wrap; gap: 5px; }
.price-chip { bottom: 7px; max-width: calc(100% - 14px); position: absolute; right: 7px; z-index: 2; }
.price-badge { -webkit-backdrop-filter: blur(10px) saturate(1.15); backdrop-filter: blur(10px) saturate(1.15); background: var(--price-chip-bg, rgba(33,31,29,.58)); border: 1px solid var(--price-chip-border, rgba(255,255,255,.2)); border-radius: 7px; box-shadow: var(--price-chip-shadow, 0 7px 18px rgba(33,31,29,.22)); color: var(--price-chip-text, #fff); display: inline-flex; font-size: 12px; font-weight: 950; line-height: 1; max-width: 100%; overflow: hidden; padding: 6px 8px; text-overflow: ellipsis; white-space: nowrap; }
.price-old { color: var(--muted); font-size: 11px; text-decoration: line-through; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); padding: 16px; }
.sheet-backdrop { animation: backdrop-in .16s ease-out; background: rgba(33, 31, 29, .48); inset: 0; pointer-events: none; position: fixed; z-index: 40; }
.sheet { animation: sheet-in .18s ease-out; background: var(--surface); border-radius: 14px; bottom: max(12px, env(safe-area-inset-bottom)); box-shadow: var(--shadow); left: 0; margin: 0 auto; max-height: calc(100vh - 32px); overflow: auto; padding: 12px; position: fixed; right: 0; width: min(calc(100% - 24px), 720px); z-index: 41; }
.sheet--product { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.sheet-header { align-items: center; display: flex; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
.sheet-header h2 { font-size: 18px; line-height: 1.2; }
.icon-button { align-items: center; background: var(--surface-strong); border: 1px solid var(--line); border-radius: 999px; color: var(--text); display: inline-flex; font-weight: 900; height: 38px; justify-content: center; min-width: 38px; padding: 0 10px; }
.modal-grid { display: grid; gap: 12px; }
.sheet--product .modal-grid { overflow: auto; padding-bottom: 8px; }
.modal-gallery { display: grid; gap: 8px; position: relative; }
.modal-gallery .image-frame--modal { max-height: 58vh; }
.gallery-counter { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 900; padding: 5px 8px; position: absolute; right: 8px; top: 8px; }
.gallery-thumbs { display: grid; gap: 8px; grid-auto-columns: 54px; grid-auto-flow: column; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.gallery-thumbs::-webkit-scrollbar { display: none; }
.gallery-thumb { background: var(--surface-strong); border: 1px solid var(--line); border-radius: 7px; padding: 3px; }
.gallery-thumb.is-active { border-color: var(--accent); }
.modal-copy { display: grid; gap: 10px; }
.modal-copy p { color: var(--muted); font-size: 14px; line-height: 1.45; }
.sheet-actions { background: var(--surface); display: flex; justify-content: flex-end; padding: 10px 0 max(14px, env(safe-area-inset-bottom)); position: relative; z-index: 4; }
.sheet-actions .primary--icon { border-radius: 999px; height: 46px; min-height: 46px; min-width: 46px; padding: 0; width: 46px; }
.sheet-actions .cart-icon { height: 22px; width: 22px; }
.primary { align-items: center; background: var(--accent); border-radius: var(--radius); color: #fff; display: inline-flex; font-weight: 950; gap: 8px; justify-content: center; min-height: 44px; padding: 11px 14px; }
.primary:hover { background: var(--accent-strong); }
.secondary { background: var(--surface-strong); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-weight: 900; min-height: 38px; padding: 9px 12px; }
.cart-items { display: grid; gap: 9px; }
.cart-item { align-items: center; background: var(--surface-strong); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 8px; grid-template-columns: 58px minmax(0, 1fr); padding: 8px; }
.cart-item .product-card { min-height: 0; }
.cart-item .image-frame { width: 58px; }
.cart-item h3 { font-size: 13px; line-height: 1.25; }
.cart-meta { color: var(--muted); font-size: 12px; }
.qty-row { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.qty-row .icon-button { height: 32px; min-width: 32px; }
.brand-group { background: var(--accent-soft); border-radius: var(--radius); color: var(--accent-strong); display: grid; gap: 7px; margin-top: 10px; padding: 10px; }
.progress { background: rgba(15, 118, 110, .18); border-radius: 999px; height: 10px; overflow: hidden; }
.progress span { background: var(--accent); display: block; height: 100%; }
.auth-box { background: var(--warn-soft); border-radius: var(--radius); color: var(--warn); display: grid; gap: 8px; margin-top: 12px; padding: 12px; }
.state { display: grid; gap: 12px; min-height: 100vh; padding: 24px; place-items: center; text-align: center; }
.state .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-width: 440px; padding: 20px; }
.footer-action { background: color-mix(in srgb, var(--surface) 92%, transparent); border-top: 1px solid var(--line); bottom: 0; display: grid; gap: 8px; left: 0; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); position: fixed; right: 0; z-index: 30; backdrop-filter: blur(12px); }
.footer-action .primary { width: 100%; }
@media (min-width: 1440px) {
  .wide-frame-active .shell--wide-frame {
    bottom: auto;
    height: var(--wide-frame-height);
    left: var(--wide-frame-x);
    margin: 0;
    max-width: none;
    overflow: hidden;
    padding: 0;
    position: fixed;
    top: var(--wide-frame-y);
    width: var(--wide-frame-width);
    z-index: 3;
  }
  .wide-frame-active .section {
    margin-top: 0;
  }
  .wide-frame-active .section + .section {
    margin-top: var(--card-gap, 10px);
  }
  .wide-frame-active .product-row {
    --cards-current: 5;
    padding: 0;
  }
  .wide-frame-active .product-wrap {
    background: transparent;
  }
  .wide-frame-active .rail-zone {
    bottom: 0;
    top: 0;
  }
  .wide-frame-active .rail-zone--left {
    background: linear-gradient(90deg, rgba(0,0,0,.22), transparent);
  }
  .wide-frame-active .rail-zone--right {
    background: linear-gradient(270deg, rgba(0,0,0,.22), transparent);
  }
}
@media (min-width: 700px) {
  .shell { padding-left: 24px; padding-right: 24px; }
  .product-row { --cards-current: var(--cards-tablet, 4); }
  .modal-grid { grid-template-columns: .85fr 1fr; }
  .footer-action { display: none; }
  .sheet { border-radius: 14px; max-height: calc(100vh - 48px); width: min(calc(100% - 48px), 720px); }
}
@media (min-width: 1024px) {
  .product-row { --cards-current: var(--cards-desktop, 7); }
}
@media (max-width: 520px) {
  .semantic-row { grid-template-columns: 1fr; }
  .semantic { min-height: auto; }
  .section-head { align-items: flex-start; flex-direction: column; }
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sheet-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
  .product-wrap:has(.product-card:hover) { transform: none; }
}
