:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6560;
  --line: #e7e0d6;
  --accent: #c8a882;
  --accent-ink: #3d2e1e;
  --wa: #25d366;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(26, 26, 26, 0.06);
  --max: 720px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }

.wrap {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 16px 96px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(247, 244, 239, 0.92);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand strong { font-size: 1.05rem; letter-spacing: 0.02em; }
.brand span { font-size: 0.75rem; color: var(--muted); }
.pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: #efe3d4;
  border: 1px solid #e0d0ba;
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.hero {
  padding: 20px 0 8px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  line-height: 1.2;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
}
.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (min-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: #eee;
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
}
.ph-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(255,255,255,0.9);
  color: #666;
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 6px;
}
.card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card-body h2 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.3;
}
.meta {
  color: var(--muted);
  font-size: 0.75rem;
}
.price {
  margin-top: auto;
  font-weight: 700;
  color: var(--accent-ink);
  font-size: 0.9rem;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 14px 0 8px;
}
.gallery {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.gallery-main {
  aspect-ratio: 4 / 5;
  background: #eee;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}
.thumbs button {
  border: 2px solid transparent;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  width: 64px;
  height: 80px;
  background: #eee;
  flex: 0 0 auto;
}
.thumbs button.active { border-color: var(--ink); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

.detail {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.detail h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}
.detail .idline {
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.detail p { margin: 0 0 12px; color: var(--muted); }
.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}
.size {
  min-width: 44px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 600;
  background: #faf8f5;
}
.kv {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
}
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}
.kv span:first-child { color: var(--muted); }
.notice {
  margin-top: 12px;
  background: #fff7e8;
  border: 1px solid #f0dfb8;
  color: #6a5428;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.cta-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + var(--safe-bottom));
  backdrop-filter: blur(8px);
}
.cta-inner {
  width: min(100%, var(--max));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.cta-inner.has-wa { grid-template-columns: 1fr 1fr; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-align: center;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-wa {
  background: var(--wa);
  color: #fff;
}
.btn-ghost {
  background: #efe3d4;
  color: var(--accent-ink);
}

.empty, .loading, .error {
  text-align: center;
  color: var(--muted);
  padding: 48px 12px;
}
.footer {
  margin-top: 28px;
  padding: 18px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.hidden { display: none !important; }
