:root {
  --bg: #f5f5f5;
  --card: #fff;
  --ink: #1c1c1c;
  --muted: #8d8d8d;
  --line: #efefef;
  --orange: #ff5000;
  --orange-deep: #ff2e00;
  --peach: #fff3eb;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  font-family: "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
/* Explicit layout display rules must not override hidden panel state. */
[hidden] { display: none !important; }
html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}
body.lock { overflow: hidden; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
img {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
}
button { cursor: pointer; }

.page {
  width: 90%;
  max-width: none;
  margin: 0 auto;
  padding: 16px 0 40px;
}

.store-card {
  display: grid;
  width: 100%;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: #f7f4ef;
}
.avatar img { width: 100%; height: 100%; object-fit: contain; object-position: center; background: #fff; }
.store-name { font-size: 22px; font-weight: 700; }
.store-meta, .store-score { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.store-score { display: flex; gap: 8px; align-items: center; }
.store-score strong { color: #8a8a8a; font-weight: 700; }
.stars { color: #d0d0d0; letter-spacing: 1px; }
.stars .on { color: #ffb400; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.badges li {
  background: #f7f7f7;
  color: #666;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}
.store-copy { min-width: 0; }
.store-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: center; min-width: 0; }

.btn {
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #333;
  border-radius: 999px;
  padding: 8px 14px;
  position: relative;
  white-space: nowrap;
  flex: none;
}
.btn.ghost.is-current { color: var(--orange); border-color: #ffd7c4; background: var(--peach); }
.btn.follow { color: var(--orange); border-color: #ffc7ad; }
.btn.follow.is-on { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn em {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--orange);
  color: #fff;
  font-style: normal;
  font-size: 11px;
  line-height: 16px;
}
.btn.buy {
  background: linear-gradient(90deg, #ff9000, #ff5000);
  color: #fff;
  border: 0;
  font-weight: 700;
}
.btn.coupon { color: var(--orange); border-color: #ffb088; background: #fff8f4; }
.btn.cart { min-width: 72px; }
.btn.fav.is-on { color: var(--orange); border-color: var(--orange); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  margin-top: 16px;
}
.layout > * { min-width: 0; }
.cats, .sortbar, .catalog { }
.cats {
  width: 156px;
  flex: none;
  background: #fff;
  border-radius: var(--radius);
  padding: 8px;
  align-self: start;
  display: flex;
  flex-direction: column;
}
.cats button, .sortbar button, .chips button, .tabs button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  color: #444;
}
.cats button.is-on { background: var(--peach); color: var(--orange); font-weight: 700; }
.catalog { display: flex; flex: 1; flex-direction: column; gap: 12px; width: 100%; min-width: 0; }
.sortbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: var(--radius);
  padding: 8px;
}
.sortbar button.is-on { background: var(--peach); color: var(--orange); font-weight: 700; }
.sortbar .count { margin-left: auto; color: var(--muted); font-size: 13px; padding-right: 8px; }

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}
.card {
  flex: 1 1 calc(50% - 8px);
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.shot { aspect-ratio: 1; background: #f6f6f6; overflow: hidden; min-width: 0; }
.shot img, .hero img, .thumbs img, .gallery-grid img { width: 100%; height: 100%; object-fit: cover; }
.shot img { object-position: center 20%; }
.card h2 {
  margin: 10px 12px 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  min-height: 2.8em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-note, .ship { margin: 6px 12px 0; color: var(--muted); font-size: 12px; }
.card .price { margin: 8px 12px 12px; color: var(--orange); font-size: 20px; font-weight: 700; }
.card .price small { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }

.detail {
  margin-top: 16px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: start;
}
.detail > * { min-width: 0; }
.thumbs { flex: none; display: flex; flex-direction: column; gap: 8px; }
.gallery { flex: 1 1 360px; min-width: 0; }
.detail > .buy { flex: 1 1 320px; min-width: 0; }
.thumbs button, .hero, .gallery-grid button {
  border: 1px solid transparent;
  padding: 0;
  background: #f6f6f6;
  border-radius: 8px;
  overflow: hidden;
}
.thumbs button { position: relative; width: 76px; height: 76px; }
.thumbs button.is-on, .gallery-grid button:hover { border-color: var(--orange); }
.hero {
  display: block;
  width: 100%;
  height: clamp(280px, calc(100svh - 300px), 620px);
  background: #f4f1ed;
}
.hero video, .gallery-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #111;
}
.gallery-video {
  grid-column: 1 / -1;
  aspect-ratio: 9 / 16;
  max-height: 720px;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
}
.play-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.play-mark::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  border-style: solid;
  border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent #fff;
}
/* Portrait product photos must remain visible in full. */
.hero img, .thumbs img, .gallery-grid img {
  object-fit: contain;
  object-position: center;
}
.tabs { display: flex; gap: 8px; margin-top: 12px; }
.tabs button.is-on { color: var(--orange); font-weight: 700; box-shadow: inset 0 -2px 0 var(--orange); border-radius: 0; }
.tab-panel { padding: 8px 0 4px; }
.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery-grid button { aspect-ratio: 1; }
.specs { width: 100%; border-collapse: collapse; font-size: 14px; }
.specs th, .specs td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.specs th { width: 38%; color: var(--muted); font-weight: 500; }
.ship-copy p { margin: 0 0 8px; line-height: 1.5; }

.buy { min-width: 0; }
.buy h1 { margin: 0; font-size: 18px; line-height: 1.45; overflow-wrap: anywhere; }
.sold { color: var(--muted); margin: 8px 0; }
.price.big { margin: 0; color: var(--orange); font-size: 32px; font-weight: 800; }
.price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tip-btn { border: 0; background: transparent; color: #888; text-decoration: underline; }
.tip {
  flex: 1 1 100%;
  background: #2b2b2b;
  color: #fff;
  border-radius: 10px;
  padding: 12px;
}
.tip p { margin: 0 0 8px; font-size: 13px; }
.tip button { border: 0; background: var(--orange); color: #fff; border-radius: 999px; padding: 4px 10px; }
.credit { color: #666; }
.coupon-note { color: var(--orange); font-size: 13px; }
.facts { margin: 12px 0; padding: 0; list-style: none; color: #555; }
.facts li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.option { margin-top: 14px; }
.option-label, .qty-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.qty-row { justify-content: space-between; }
.option-label span, .qty-row > span { color: #888; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { border: 1px solid #e6e6e6; border-radius: 8px; }
.chips button.is-on { border-color: var(--orange); color: var(--orange); background: var(--peach); font-weight: 700; }
.swatches { display: flex; gap: 10px; margin-top: 8px; }
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  background: var(--swatch);
}
.swatch.is-on { outline: 2px solid var(--orange); outline-offset: 2px; }
.fit { color: var(--muted); font-size: 13px; }
.qty { display: inline-flex; align-items: center; border: 1px solid #e5e5e5; border-radius: 8px; }
.qty button { width: 32px; height: 32px; border: 0; background: #fff; }
.qty span { min-width: 28px; text-align: center; }
.qty-row em { color: #3c9a4a; font-style: normal; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.actions .buy { flex: 1; min-width: 140px; padding: 12px 18px; }

.member {
  background: #3a332c;
  color: #f6e7cf;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.member button { border: 0; background: transparent; color: #fff; flex: none; }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: #fff;
  z-index: 21;
  display: flex;
  flex-direction: column;
}
.drawer-head, .cart-foot, .modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2, .modal h2 { margin: 0; font-size: 18px; }
.drawer-head button, .zoom-close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
}
.chat { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { margin: 0; max-width: 85%; padding: 10px 12px; border-radius: 12px; line-height: 1.45; }
.bubble.shop { background: #f6f6f6; }
.bubble.me { background: var(--peach); margin-left: auto; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; border: 1px solid #e5e5e5; border-radius: 999px; padding: 10px 14px; }
.cart-body { flex: 1; overflow: auto; padding: 8px 16px 16px; }
.cart-line { display: grid; grid-template-columns: 72px 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.cart-line h3 { margin: 0 0 4px; font-size: 14px; }
.cart-line p { margin: 0; color: var(--muted); font-size: 12px; }
.cart-foot { border-bottom: 0; border-top: 1px solid var(--line); }
.cart-foot strong { color: var(--orange); font-size: 20px; margin-left: 8px; }
.modal {
  position: fixed;
  z-index: 22;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100% - 32px));
  background: #fff;
  border-radius: 16px;
  padding: 20px;
}
.order-list { padding-left: 18px; }
.order-total { font-size: 18px; }
.muted { color: var(--muted); }
.zoom-img { width: 100%; max-height: calc(100svh - 100px); object-fit: contain; border-radius: 12px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 30;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 900px) {
  .card { flex-basis: calc(25% - 12px); }
}
@media (min-width: 1200px) {
  .card { flex-basis: calc(20% - 12px); }
}
@media (min-width: 1500px) {
  .card { flex-basis: calc(16.666% - 12px); }
}
@media (max-width: 980px) {
  .store-card { grid-template-columns: 72px minmax(0, 1fr); }
  .store-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .cats { width: 132px; }
  .card { flex-basis: calc(50% - 8px); }
  .thumbs { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .page { padding: 12px 12px 32px; }
  .layout { flex-direction: column; }
  .cats { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .card { flex-basis: calc(50% - 8px); }
  .gallery, .buy { flex-basis: 100%; }
  .actions .buy { width: 100%; }
}

/* Layout refresh: keep the storefront inside a readable, responsive frame. */
:root {
  --bg: #f3f1ed;
  --card: #fffdfb;
  --ink: #242321;
  --muted: #8a8782;
  --line: #ebe7e1;
  --orange: #e95620;
  --orange-deep: #c94012;
  --peach: #fff0e8;
  --shadow: 0 14px 34px rgba(74, 53, 37, 0.08);
  --radius: 18px;
  font-family: "Avenir Next", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

html { background: var(--bg); }
body { overflow-x: hidden; }
.page {
  width: min(1440px, calc(100% - 48px));
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 0 64px;
}
.store-card {
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 20px;
  padding: 22px 24px;
  border: 1px solid rgba(213, 204, 194, .65);
  box-shadow: 0 10px 30px rgba(73, 56, 42, .07);
}
.avatar { width: 84px; height: 84px; border-radius: 16px; }
.store-name { font-size: clamp(22px, 2vw, 28px); letter-spacing: -0.03em; }
.store-meta { font-size: 14px; }
.store-score { margin-top: 8px; }
.badges { gap: 7px; margin-top: 12px; }
.badges li { padding: 5px 10px; background: #f4f1ed; }
.store-actions { max-width: 390px; }
.btn { transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.btn:hover { transform: translateY(-1px); border-color: #f2b59d; }
.btn:active { transform: translateY(0); }
.layout {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}
.cats {
  width: auto;
  position: sticky;
  top: 20px;
  padding: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(73, 56, 42, .04);
}
.cats button { padding: 12px 13px; font-size: 14px; }
.catalog { gap: 14px; }
.sortbar {
  min-height: 58px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(73, 56, 42, .04);
}
.sortbar button { padding: 11px 14px; font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.card {
  min-width: 0;
  max-width: none;
  border: 1px solid rgba(227, 221, 214, .9);
  box-shadow: 0 5px 14px rgba(73, 56, 42, .04);
}
.card:hover { box-shadow: 0 16px 28px rgba(73, 56, 42, .12); }
.shot { aspect-ratio: 1 / 1.03; }
.card h2 { margin-top: 13px; font-size: 15px; line-height: 1.35; }
.card-note { line-height: 1.45; min-height: 2.9em; }
.card .price { margin-top: 12px; }
.ship { padding-bottom: 14px; }

@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .store-card { grid-template-columns: 76px minmax(0, 1fr); }
  .avatar { width: 76px; height: 76px; }
  .store-actions { grid-column: 1 / -1; max-width: none; justify-content: flex-start; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .page { width: min(100% - 24px, 620px); padding-top: 12px; }
  .store-card { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .avatar { width: 64px; height: 64px; }
  .store-name { font-size: 20px; }
  .badges { max-height: 52px; overflow: hidden; }
  .layout { grid-template-columns: 1fr; gap: 14px; }
  .cats { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sortbar { overflow-x: auto; }
  .sortbar .count { margin-left: auto; white-space: nowrap; }
}
@media (max-width: 430px) {
  .page { width: calc(100% - 20px); }
  .grid { grid-template-columns: 1fr; }
  .store-actions .btn { flex: 1 1 auto; }
}

/* Wide viewport fix: use the available window width instead of leaving a capped white rail. */
.page {
  width: calc(100% - 48px);
  max-width: none;
}
.layout {
  width: 100%;
}
.grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
@media (max-width: 760px) {
  .page { width: calc(100% - 24px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .page { width: calc(100% - 20px); }
  .grid { grid-template-columns: 1fr; }
}

/* Keep filtered results at the same card size instead of stretching one item across the row. */
.grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
  justify-content: start;
}
.card { width: 100%; }
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .grid { grid-template-columns: 1fr; }
}

/* Large product albums keep thumbnails inside a scrollable rail. */
.thumbs { max-height: 620px; overflow-y: auto; padding: 2px; }
.thumbs button { flex-shrink: 0; }
@media (max-width: 980px) {
  .thumbs { width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; max-height: none; }
}
