@scope (#commerce) {

:scope {
  --bg:        #FDFAF5;
  --surface:   #F5EDE0;
  --surface2:  #EDE2CC;
  --fg:        #1C1208;
  --fg-muted:  #7B6A54;
  --accent:    #7D1D3A;
  --accent-lt: #A83055;
  --gold:      #B07A18;
  --gold-lt:   #D4A030;
  --border:    rgba(140, 100, 60, 0.15);
  --shadow-sm: 0 2px 8px rgba(80,40,10,.07);
  --shadow:    0 6px 28px rgba(80,40,10,.10);
  --r:         10px;
  --r-lg:      16px;
  --font-d:    'Playfair Display', Georgia, serif;
  --font-th:   'Sarabun', 'Helvetica Neue', sans-serif;
  --font-ui:   'Inter', system-ui, sans-serif;
  color-scheme: light;
}

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

/* ── Topbar ── */
.topbar {
  position: sticky; top: env(safe-area-inset-top,0px); z-index: 100;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(20px, env(safe-area-inset-left,0px));
  height: 60px; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.topbar-logo { font-family: var(--font-d); font-size: 1.3rem; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.topbar-logo span { color: var(--gold-lt); }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav button {
  background: none; border: none; color: rgba(255,255,255,.8); font-family: var(--font-th);
  font-size: .85rem; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: background .2s;
}
.topbar-nav button:hover, .topbar-nav button.active { background: rgba(255,255,255,.18); color: #fff; }
.cart-btn {
  position: relative; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  color: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-family: var(--font-th);
  font-size: .85rem; display: flex; align-items: center; gap: 6px; transition: background .2s; white-space: nowrap;
}
.cart-btn:hover { background: rgba(255,255,255,.28); }
.cart-count {
  position: absolute; top: -6px; right: -6px; background: var(--gold-lt);
  color: #000; border-radius: 50%; width: 18px; height: 18px; font-size: .7rem;
  font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ── Sections ── */
.section { padding: 48px 0; }
.section-header { text-align: center; margin-bottom: 32px; }
.section-header h2 { font-family: var(--font-d); font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 600; }
.section-header p { color: var(--fg-muted); margin-top: 8px; font-size: .95rem; }
.inner { max-width: 1280px; margin: 0 auto; }

/* ── Province selector ── */
.province-hero {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0;
}
.province-tabs {
  display: flex; overflow-x: auto; scrollbar-width: none; gap: 0;
  border-bottom: 1px solid var(--border); max-width: 1280px; margin: 0 auto;
}
.province-tabs::-webkit-scrollbar { display: none; }
.ptab {
  flex: 0 0 auto; padding: 20px 24px; cursor: pointer; border: none;
  background: none; font-family: var(--font-th); font-size: .9rem; color: var(--fg-muted);
  border-bottom: 3px solid transparent; transition: all .25s; white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ptab:hover { color: var(--accent); background: var(--surface2); }
.ptab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ptab-en { font-size: .75rem; opacity: .7; }
.province-info {
  max-width: 1280px; margin: 0 auto;
  padding: 24px 0 20px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.province-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  border-radius: var(--r); font-size: .88rem; font-weight: 500;
  border: 1px solid currentColor;
}
.province-desc { flex: 1; min-width: 200px; }
.province-desc h3 { font-family: var(--font-d); font-size: 1.2rem; font-weight: 600; }
.province-desc p { font-size: .88rem; color: var(--fg-muted); margin-top: 4px; line-height: 1.6; }
.palette-dots { display: flex; gap: 6px; margin-top: 8px; }
.palette-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* ── Filter bar ── */
.filter-bar {
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 12px 0; position: sticky; top: 60px; z-index: 90;
}
.filter-inner { max-width: 1280px; margin: 0 auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-box {
  flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px;
}
.search-box input {
  flex: 1; border: none; background: none; color: var(--fg); font-family: var(--font-th);
  font-size: .88rem; outline: none;
}
.search-box input::placeholder { color: var(--fg-muted); }
.type-filter { display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 6px; min-width: 0; }
.type-btn {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); font-family: var(--font-th); font-size: .82rem; color: var(--fg-muted);
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.type-btn:hover { border-color: var(--accent); color: var(--accent); }
.type-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sort-sel {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--fg); font-family: var(--font-th); font-size: .85rem;
  cursor: pointer; outline: none;
}

/* ── Product grid ── */
.products-section { padding: 32px 0 56px; }
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px; max-width: 1280px; margin: 0 auto;
}
.product-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; transition: transform .25s, box-shadow .25s; cursor: pointer;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-img-wrap {
  aspect-ratio: 4/5; background: var(--surface2); position: relative; overflow: hidden;
}
.product-img {
  width: 100%; height: 100%; object-fit: cover; transition: opacity .3s;
  display: block;
}
.product-img.loading { opacity: 0; }
.product-img-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.placeholder-pattern {
  width: 100%; height: 100%; position: absolute; inset: 0;
  opacity: .15;
}
.placeholder-label { position: relative; z-index: 1; text-align: center; color: var(--fg-muted); font-size: .82rem; padding: 8px; }
.gen-badge {
  position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55);
  color: #fff; font-size: .72rem; padding: 3px 8px; border-radius: 4px; backdrop-filter: blur(4px);
}
.product-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.product-collection {
  font-size: .75rem; color: var(--accent); font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase;
}
.product-name-th { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.product-name-en { font-size: .82rem; color: var(--fg-muted); }
.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; }
.product-price { font-family: var(--font-ui); font-size: 1.05rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.product-price small { font-size: .75rem; font-weight: 400; color: var(--fg-muted); }
.btn-add {
  background: var(--accent); color: #fff; border: none; border-radius: 7px;
  padding: 7px 14px; font-family: var(--font-th); font-size: .82rem; cursor: pointer;
  transition: background .2s;
}
.btn-add:hover { background: var(--accent-lt); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--fg-muted); grid-column: 1/-1; }
.empty-state .es-icon { font-size: 3rem; margin-bottom: 12px; }
.results-count { max-width: 1280px; margin: 0 auto 16px; font-size: .88rem; color: var(--fg-muted); }

/* ── AI Studio ── */
.studio-section { background: var(--surface); padding: 56px 0; }
.studio-inner { max-width: 900px; margin: 0 auto; }
.studio-header { text-align: center; margin-bottom: 36px; }
.studio-header h2 { font-family: var(--font-d); font-size: clamp(1.5rem,2.5vw,2rem); }
.studio-header p { color: var(--fg-muted); margin-top: 8px; }
.studio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 680px) { .studio-grid { grid-template-columns: 1fr; } }
.studio-controls { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .85rem; font-weight: 500; color: var(--fg-muted); }
.form-select, .form-input, .form-textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--fg); font-family: var(--font-th); font-size: .9rem; outline: none;
  transition: border-color .2s;
}
.form-select:focus, .form-input:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { min-height: 90px; resize: vertical; }
.keyword-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kchip {
  padding: 4px 10px; border-radius: 20px; background: var(--surface2); color: var(--fg-muted);
  font-size: .8rem; cursor: pointer; border: 1px solid var(--border); transition: all .2s;
}
.kchip:hover, .kchip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-generate {
  width: 100%; padding: 13px; background: var(--accent); color: #fff; border: none;
  border-radius: 10px; font-family: var(--font-th); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background .2s, transform .15s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-generate:hover { background: var(--accent-lt); }
.btn-generate:active { transform: scale(.98); }
.btn-generate:disabled { opacity: .5; cursor: not-allowed; }
.studio-preview {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
}
.preview-img-wrap { aspect-ratio: 4/5; background: var(--surface2); position: relative; overflow: hidden; }
.preview-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; color: var(--fg-muted);
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preview-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: var(--fg-muted);
}
.preview-empty .pe-icon { font-size: 2.5rem; opacity: .4; }
.preview-body { padding: 14px 16px; }
.preview-prompt-label { font-size: .78rem; color: var(--fg-muted); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.preview-prompt-text { font-size: .82rem; color: var(--fg); line-height: 1.6; max-height: 100px; overflow-y: auto; }
.preview-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-secondary {
  flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--fg); font-family: var(--font-th); font-size: .82rem; cursor: pointer; transition: background .2s;
}
.btn-secondary:hover { background: var(--surface2); }

/* ── Cart drawer ── */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw);
  background: var(--bg); z-index: 201; transform: translateX(100%);
  transition: transform .3s cubic-bezier(.25,.46,.45,.94);
  display: flex; flex-direction: column; box-shadow: -4px 0 24px rgba(0,0,0,.2);
  padding-right: env(safe-area-inset-right,0px);
}
.cart-drawer.open { transform: translateX(0); }
.cart-header {
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.cart-header h3 { font-family: var(--font-d); font-size: 1.15rem; }
.cart-close { background: none; border: none; color: var(--fg-muted); font-size: 1.3rem; cursor: pointer; padding: 4px; }
.cart-items { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.cart-empty { text-align: center; padding: 48px 20px; color: var(--fg-muted); }
.cart-item {
  display: flex; gap: 12px; padding: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); align-items: flex-start;
}
.cart-item-img { width: 56px; height: 70px; object-fit: cover; border-radius: 6px; background: var(--surface2); flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: .88rem; font-weight: 500; line-height: 1.4; }
.cart-item-col { font-size: .78rem; color: var(--accent); }
.cart-item-price { font-size: .88rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.cart-item-qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-btn { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.qty-num { font-size: .88rem; font-variant-numeric: tabular-nums; min-width: 20px; text-align: center; }
.cart-remove { background: none; border: none; color: var(--fg-muted); cursor: pointer; font-size: .85rem; padding: 2px; }
.cart-footer { padding: 16px 20px; border-top: 1px solid var(--border); overflow-y: auto; max-height: 70vh; }
.checkout-fields { display: grid; gap: 8px; }
.checkout-fields label { display: grid; gap: 3px; font-size: .8rem; color: var(--fg-muted); }
.checkout-fields input, .checkout-fields textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--fg); font: inherit; }
.checkout-note, .checkout-error, .checkout-success { font-size: .8rem; margin: 10px 0; }
.checkout-note { color: var(--fg-muted); }
.checkout-error { color: #b42318; }
.checkout-success { color: #167447; overflow-wrap: anywhere; }
.cart-summary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.cart-row { display: flex; justify-content: space-between; font-size: .9rem; }
.cart-total { font-weight: 700; font-size: 1rem; color: var(--accent); }
.btn-checkout {
  width: 100%; padding: 13px; background: var(--accent); color: #fff; border: none;
  border-radius: 10px; font-family: var(--font-th); font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn-checkout:hover { background: var(--accent-lt); }

/* ── Product modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 300;
  opacity: 0; pointer-events: none; transition: opacity .3s; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--bg); border-radius: var(--r-lg); width: 100%; max-width: 760px;
  max-height: 90vh; overflow-y: auto; transform: scale(.95); transition: transform .3s;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .modal-grid { grid-template-columns: 1fr; } }
.modal-img-wrap { aspect-ratio: 4/5; background: var(--surface2); position: sticky; top: 0; }
.modal-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-body { padding: 28px; overflow-y: auto; }
.modal-collection { font-size: .78rem; color: var(--accent); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.modal-name { font-family: var(--font-d); font-size: 1.5rem; font-weight: 600; margin-top: 6px; line-height: 1.3; }
.modal-name-en { color: var(--fg-muted); font-size: .95rem; margin-top: 2px; }
.modal-price { font-size: 1.5rem; font-weight: 700; color: var(--accent); margin: 14px 0; font-variant-numeric: tabular-nums; }
.modal-desc { font-size: .88rem; color: var(--fg-muted); line-height: 1.7; }
.modal-section { margin-top: 20px; }
.modal-section h4 { font-size: .82rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.modal-prompt { font-size: .78rem; line-height: 1.65; color: var(--fg-muted); background: var(--surface); padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.modal-tag { padding: 3px 10px; background: var(--surface2); border-radius: 20px; font-size: .78rem; color: var(--fg-muted); }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-btn-add { flex: 2; padding: 12px; background: var(--accent); color: #fff; border: none; border-radius: 9px; font-family: var(--font-th); font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .2s; }
.modal-btn-add:hover { background: var(--accent-lt); }
.modal-btn-copy { flex: 1; padding: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); border-radius: 9px; font-family: var(--font-th); font-size: .88rem; cursor: pointer; transition: background .2s; }
.modal-btn-copy:hover { background: var(--surface2); }
.modal-close-btn { position: absolute; top: 16px; right: 16px; background: rgba(0,0,0,.4); color: #fff; border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.modal-img-wrap { position: relative; }

/* ── Data Export Panel ── */
.data-panel { background: var(--surface2); border-top: 1px solid var(--border); padding: 40px 0; }
.data-inner { max-width: 900px; margin: 0 auto; }
.data-header { text-align: center; margin-bottom: 24px; }
.data-header h3 { font-family: var(--font-d); font-size: 1.3rem; }
.data-header p { font-size: .88rem; color: var(--fg-muted); margin-top: 6px; }
.data-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.data-btn {
  padding: 10px 20px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--fg); font-family: var(--font-th); font-size: .88rem;
  cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 7px;
}
.data-btn:hover { border-color: var(--accent); color: var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin: 24px 0; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; text-align: center; }
.stat-num { font-family: var(--font-ui); font-size: 1.8rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-label { font-size: .8rem; color: var(--fg-muted); margin-top: 4px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: max(20px, env(safe-area-inset-bottom,0px)); left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--accent); color: #fff; padding: 10px 20px; border-radius: 8px;
  font-family: var(--font-th); font-size: .88rem; z-index: 400;
  transition: transform .3s; white-space: nowrap; box-shadow: var(--shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Footer ── */
.footer { background: var(--fg); color: rgba(255,255,255,.75); padding: 32px 0; text-align: center; }
.footer p { font-size: .82rem; }
.footer strong { color: rgba(255,255,255,.95); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .topbar-nav { display: flex; overflow-x: auto; }
  .province-info { flex-direction: column; align-items: flex-start; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .filter-inner { flex-wrap: wrap; }
  .studio-grid { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr; }
}

.hidden-vis { visibility: hidden; }
img { max-width: 100%; }

:scope { --bg:#f4f6f9; --surface:#fff; --surface2:#eef1f8; --fg:#82314f; --fg-muted:#875269; --accent:#a12659; --accent-lt:#bd3d72; --gold:#b48817; --gold-lt:#f4c430; --border:#dce3ef; --font-d:'Prompt',sans-serif; --font-th:'Sarabun',sans-serif; --font-ui:'Sarabun',sans-serif; color:var(--fg); background:var(--bg); }
.prototype-notice { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; padding:16px 20px; background:#fff0f5; border-bottom:1px solid #f1c7d7; color:#8a1746; text-align:center; font-size:1.125rem; line-height:1.5; }
.prototype-notice strong { font-size:1.35rem; font-weight:700; }
.prototype-notice span { color:#82314f; }
@media(max-width:600px) { .prototype-notice { font-size:1rem; } .prototype-notice strong { font-size:1.15rem; } }
.topbar { position:relative; z-index:auto; top:auto; background:#0b1226; box-shadow:none; padding:16px max(20px, calc((100% - 1280px)/2)); height:auto; min-height:70px; }
.topbar-logo span { color:#f4c430; }
.filter-bar { position:relative; z-index:auto; top:auto; padding:16px max(20px, calc((100% - 1280px)/2)); }
.province-info,.products-section,.studio-section,.data-panel { padding-left:max(20px, calc((100% - 1280px)/2)); padding-right:max(20px, calc((100% - 1280px)/2)); }
.province-info { max-width:none; }
.footer { background:#eef1f8; color:#475569; } .footer strong { color:#1e2b58; }
@media(max-width:600px){ .topbar{flex-wrap:wrap; gap:10px;} .topbar-nav{order:3; width:100%;} .topbar-nav button{white-space:nowrap;} .province-info{padding:20px;} }

.cart-btn { position:relative; flex:0 0 auto; min-height:42px; background:var(--accent); border:1px solid var(--accent); color:#fff; font-weight:600; }
.cart-btn:hover { background:var(--accent-lt); }
.cart-btn:focus-visible { outline:3px solid #b48817; outline-offset:3px; }
@media(max-width:600px) { .search-box { flex:1 1 150px; min-width:0; } .cart-btn { padding:8px 12px; } .type-filter { flex:1 1 100%; min-width:0; } }

.modal-box { max-width: 900px; max-height: min(90vh, 850px); }
.modal-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.modal-img-wrap { min-width: 0; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; }
.modal-img { width: 100%; height: 100%; max-width: 100%; object-fit: contain; }
.modal-body { min-width: 0; overflow-wrap: anywhere; padding: 32px; }
.modal-context { display: flex; gap: 16px; margin-top: 18px; font-size: .9rem; color: var(--fg-muted); }
.modal-context strong { color: var(--fg); font-weight: 600; }
.modal-note { color: var(--fg-muted); font-size: .82rem; line-height: 1.6; margin-top: 16px; }
.modal-prompt-details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .88rem; }
.modal-prompt-details .modal-prompt { margin-top: 10px; overflow-wrap: anywhere; }
.modal-close-btn:focus-visible, .modal-btn-add:focus-visible, .modal-btn-copy:focus-visible, .modal-prompt-details summary:focus-visible { outline: 3px solid #b48817; outline-offset: 3px; }
@media (max-width: 600px) { .modal-overlay { padding: 12px; } .modal-box { max-height: 92vh; } .modal-grid { grid-template-columns: minmax(0, 1fr); } .modal-img-wrap { aspect-ratio: 4 / 3; } .modal-body { padding: 22px; } .modal-actions { flex-wrap: wrap; } .modal-btn-add, .modal-btn-copy { min-width: 140px; } }

.modal-image-zoom { display:block; width:100%; height:100%; padding:0; border:0; background:var(--surface2); cursor:zoom-in; overflow:hidden; position:relative; touch-action:pan-y; }
.modal-image-zoom .modal-img { transition:transform .25s ease; transform:translateX(var(--swipe-x, 0px)); user-select:none; -webkit-user-drag:none; }
.modal-image-zoom .modal-img[hidden] { display:none; }
.gallery-loading { position:absolute; inset:0; display:grid; place-items:center; color:var(--fg-muted); font-size:.9rem; }
.gallery-loading[hidden] { display:none; }
.modal-image-zoom.is-swiping { cursor:grabbing; }
.modal-image-zoom.is-swiping .modal-img { transition:none; }
.modal-image-zoom.is-zoomed { cursor:grab; touch-action:none; }
.modal-image-zoom.is-panning { cursor:grabbing; }
.modal-image-zoom.is-panning .modal-img { transition:none; }
.modal-image-zoom.is-zoomed .modal-img { transform:translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(1.7); }
.zoom-hint { position:absolute; left:12px; bottom:12px; padding:6px 10px; border-radius:6px; background:rgba(11,18,38,.85); color:#fff; font-size:.8rem; }
.modal-image-zoom:focus-visible, .floating-cart:focus-visible { outline:3px solid #b48817; outline-offset:-3px; }
.modal-body { position:relative; }
.modal-body .modal-close-btn { background:var(--accent); }
.zoom-hint { display:none; }
.gallery-controls { display:flex; align-items:center; justify-content:center; gap:18px; padding:10px 16px; background:var(--surface); border-top:1px solid var(--border); }
.gallery-controls[hidden] { display:none; }
.gallery-arrow { width:36px; height:36px; border:1px solid var(--border); border-radius:50%; background:var(--surface); color:var(--accent); font-size:25px; line-height:1; cursor:pointer; }
.gallery-arrow:hover { background:var(--surface2); }
.gallery-arrow:focus-visible { outline:3px solid #b48817; outline-offset:2px; }
.gallery-count { min-width:48px; text-align:center; color:var(--fg); font-size:.85rem; font-variant-numeric:tabular-nums; }
.floating-cart { display:none; }
@media(max-width:767px) { .floating-cart { position:fixed; right:max(16px, env(safe-area-inset-right)); bottom:max(20px, env(safe-area-inset-bottom)); z-index:100; width:56px; height:56px; display:flex; align-items:center; justify-content:center; border:0; border-radius:50%; background:var(--accent); color:#fff; box-shadow:0 4px 16px rgba(11,18,38,.28); } :scope:has(.modal-overlay.open) .floating-cart, :scope:has(.cart-overlay.open) .floating-cart { visibility:hidden; } }
@media(prefers-reduced-motion:reduce) { .modal-image-zoom .modal-img { transition:none; } }

}
