:root {
  color-scheme: dark;
  --base: #141312;
  --panel: #1c1a18;
  --line: #36312d;
  --text: #f3eee7;
  --muted: #b7ada3;
  --accent: #ffa87c;
  --action: #f48d64;
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px));
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  background: var(--base);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img { display: block; width: 100%; object-fit: cover; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 7vw, 3.6rem); line-height: 1.05; letter-spacing: -.055em; }
h2 { font-size: 1.12rem; line-height: 1.3; }
strong { font-variant-numeric: tabular-nums; }

.container { width: min(100% - 40px, 984px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); padding-top: var(--tg-content-safe-area-inset-top, 0px); }
.header-inner { height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 760; text-transform: uppercase; letter-spacing: .045em; font-size: .84rem; }
.mark { font-size: 1.75rem; line-height: 1; color: var(--accent); }
.demo-label { color: var(--muted); border: 1px solid var(--line); padding: 5px 10px; border-radius: 20px; font-size: .75rem; }
.main { padding-block: clamp(26px, 5vw, 60px) calc(108px + var(--safe-bottom)); }
.catalog-heading, .page-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.collection-label { margin-bottom: 3px; color: var(--accent); font-size: .79rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.muted, .sample-note { color: var(--muted); }
.sample-note { font-size: .79rem; margin-top: 24px; }
.notice { padding: 12px 16px; margin-bottom: 20px; border-left: 3px solid var(--accent); background: var(--panel); }
.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.product-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.product-card a { display: block; }
.product-card a:focus-visible { outline-offset: -3px; }
.product-image { position: relative; background: #262320; aspect-ratio: 1; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.product-image img { position: absolute; inset: 0; height: 100%; transition: scale 160ms ease; }
.product-card a:hover img { scale: 1.025; }
.product-meta { padding: 17px 16px 8px; display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.product-meta strong { white-space: nowrap; color: var(--accent); }
.catalog-sizes { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; font-size: .74rem; color: var(--muted); }
.catalog-sizes span { min-width: 24px; text-align: center; }
.sold-out { text-decoration: line-through; opacity: .55; }

.bottom-nav { position: fixed; bottom: 0; inset-inline: 0; border-top: 1px solid var(--line); background: #191715; padding-bottom: var(--safe-bottom); z-index: 2; }
.nav-inner { display: flex; justify-content: center; }
.nav-inner a { position: relative; display: flex; flex: 0 1 140px; gap: 6px; min-height: 65px; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); font-size: .75rem; font-weight: 650; }
.nav-inner a[aria-current], .nav-inner a:hover { color: var(--accent); }
.nav-icon { position: relative; width: 18px; height: 17px; border: 1.5px solid currentColor; border-radius: 3px; }
.grid::before, .grid::after, .bag::before, .receipt::before { content: ''; position: absolute; }
.grid::before { inset: 0 50% 0 auto; border-left: 1px solid; }
.grid::after { inset: 50% 0 auto; border-top: 1px solid; }
.bag { height: 14px; margin-top: 3px; }
.bag::before { width: 8px; height: 5px; top: -6px; left: 3.5px; border: 1px solid; border-bottom: 0; border-radius: 5px 5px 0 0; }
.receipt { width: 15px; }
.receipt::before { inset: 4px 3px; border-block: 1px solid; }
.count { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 16px; padding: 1px 4px; border-radius: 12px; background: var(--action); color: #1a1511; font-size: .67rem; text-align: center; }

.back { display: inline-flex; align-items: center; min-height: 40px; margin: -10px 0 13px; color: var(--muted); font-size: .88rem; }
.back:hover, .text-button:hover, .item-name:hover { color: var(--accent); }
.product-detail, .split { display: grid; gap: 22px; align-items: start; }
.product-detail { grid-template-columns: 1.2fr 1fr; }
.split { grid-template-columns: 1.42fr 1fr; }
.gallery { display: flex; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; scroll-snap-type: x mandatory; }
.gallery > * { flex: 0 0 100%; aspect-ratio: 1; scroll-snap-align: start; }
.details { padding: 12px 0; }
.details h1 { font-size: clamp(1.85rem, 5vw, 3.25rem); }
.price { margin: 12px 0 20px; font-size: 1.3rem; font-weight: 725; color: var(--accent); }
.description { margin-bottom: 24px; color: var(--muted); line-height: 1.55; }
.size-picker { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; border: 0; margin: 0 0 22px; }
.size-picker legend { margin-bottom: 10px; padding: 0; font-weight: 680; }
.size-picker label { position: relative; }
.size-picker input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.size-picker span { min-width: 49px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; font-size: .9rem; }
.size-picker input:checked + span { border-color: var(--accent); background: #33231d; color: var(--accent); }
.size-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.size-picker input:disabled + span { text-decoration: line-through; color: #93877d; border-style: dashed; }
.size-picker input:disabled { cursor: default; }
.button { width: 100%; min-height: 48px; display: inline-grid; place-items: center; padding: 10px 15px; border: 0; border-radius: 8px; background: var(--action); color: #1a1511; font-weight: 750; text-align: center; line-height: 1.2; }
.button:hover { background: var(--accent); }
.button:disabled { background: var(--line); color: var(--muted); }
.text-button { min-height: 37px; padding: 5px 0; border: 0; color: var(--muted); background: transparent; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.summary, .checkout-fields, .empty { padding: 20px; }
.summary h2, .checkout-fields h2 { margin-bottom: 14px; }
.summary-line, .summary-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.summary-line { font-size: .9rem; margin-bottom: 12px; }
.summary-total { border-top: 1px solid var(--line); padding-top: 13px; margin: 14px 0; }
.summary-total:first-child { border: 0; padding: 0; margin-top: 0; }
.summary p, .checkout-fields p { font-size: .88rem; line-height: 1.55; margin-bottom: 15px; }
.empty { display: grid; justify-items: start; gap: 16px; }
.empty .button { width: auto; }
.cart-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: start; gap: 14px; padding: 15px; }
.cart-row + .cart-row, .order-row + .order-row { border-top: 1px solid var(--line); }
.cart-thumb { width: 100%; display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; background: #2a2724; overflow: hidden; }
.cart-info { min-width: 0; display: grid; gap: 4px; }
.cart-info .muted, .stock-warning { font-size: .83rem; }
.item-name { font-weight: 650; }
.stock-warning { color: var(--accent); }
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 4px; font-size: .86rem; }
.stepper button { min-width: 31px; min-height: 32px; background: #2a2623; color: var(--text); border: 1px solid var(--line); border-radius: 5px; }
.stepper button:disabled { opacity: .5; }
.stepper span { min-width: 20px; text-align: center; }
.stepper .remove { background: transparent; border-color: transparent; color: var(--muted); }
.line-total { white-space: nowrap; font-size: .93rem; }
.field { margin-top: 15px; }
.field label { display: block; font-size: .85rem; margin-bottom: 6px; }
.field input, .field select { width: 100%; min-width: 0; min-height: 45px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--base); color: var(--text); }
.errorlist { color: var(--accent); font-size: .85rem; padding-left: 18px; }
.address, .order-row > div { display: grid; gap: 5px; }
.address span, .order-row .muted { color: var(--muted); font-size: .88rem; }
.order-row { display: flex; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.order-row > div:last-child { text-align: right; }
.order-row:hover { background: #292420; }
.order-ref { overflow-wrap: anywhere; }
.payment-actions { display: grid; gap: 6px; }

@media (max-width: 640px) {
  .container { width: calc(100% - 32px); }
  .header-inner { height: 57px; }
  .wordmark { letter-spacing: .025em; }
  .product-grid { gap: 10px; }
  .product-meta { flex-direction: column; align-items: start; gap: 6px; padding: 11px 10px 7px; }
  .product-meta h2 { font-size: .95rem; overflow-wrap: anywhere; }
  .catalog-sizes { gap: 5px; padding: 0 10px 10px; }
  .catalog-sizes span { min-width: 16px; }
  .product-detail, .split { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .cart-row { grid-template-columns: 62px 1fr auto; gap: 9px; padding: 12px; }
  .stepper .remove { padding-left: 0; }
  .summary, .checkout-fields, .empty { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .product-image img { transition: none; }
}
