:root {
  --bg: #0c0c0d;
  --panel: #17171a;
  --panel-2: #1f2023;
  --ink: #f2f0ec;
  --ink-dim: #a8a6a1;
  --accent: #c9a24b;
  --accent-ink: #17171a;
  --line: #2a2b2f;
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brand-collection {
  margin-left: 10px;
  font-size: 12px;
  color: var(--ink-dim);
}
.page-counter {
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- viewer ---------- */
.viewer {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505;
}
.page-stage {
  position: relative;
  height: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-image {
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  background: #050505;
}
.nav-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 15%;
  min-width: 44px;
  background: transparent;
  border: none;
  color: rgba(242,240,236,0.0);
  font-size: 34px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  z-index: 5;
}
.nav-edge:hover { color: rgba(242,240,236,0.6); background: rgba(255,255,255,0.03); }
.nav-prev { left: 0; }
.nav-next { right: 0; }

.hotspot-btn {
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 6;
}
.hotspot-plus { font-size: 16px; line-height: 1; }
.hidden { display: none !important; }

/* ---------- thumb rail ---------- */
.thumbrail {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.thumbrail::-webkit-scrollbar { display: none; }
.thumb {
  flex: 0 0 auto;
  width: 30px;
  height: 40px;
  border-radius: 3px;
  overflow: hidden;
  border: 1.5px solid transparent;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s, border-color 0.15s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { opacity: 1; border-color: var(--accent); }
.thumb.has-hotspot::after {
  content: "";
  display: block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  top: -8px; left: 24px;
}

/* ---------- totalbar ---------- */
.totalbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px calc(12px + var(--safe-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.totalbar-info { font-size: 13px; color: var(--ink-dim); }
.totalbar-total { flex: 1; font-size: 13px; color: var(--ink-dim); }
.totalbar-total strong { color: var(--ink); font-size: 15px; margin-left: 6px; }
.btn-cart {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-cart:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  background: var(--panel);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 20px calc(20px + var(--safe-bottom));
  overflow-y: auto;
  animation: sheet-up 0.2s ease-out;
}
.sheet-tall { max-height: 88vh; }
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 6px auto 10px;
}
.sheet-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 22px;
  cursor: pointer;
}
.sheet-header { margin-bottom: 16px; }
.sheet-ref { font-size: 11px; color: var(--ink-dim); letter-spacing: 0.05em; }
.sheet-title { font-size: 19px; margin: 2px 0 2px; font-weight: 700; }
.sheet-group { font-size: 12px; color: var(--ink-dim); }
.sheet-section { margin-bottom: 18px; }
.sheet-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.color-list { display: flex; flex-wrap: wrap; gap: 8px; }
.color-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-chip.active { border-color: var(--accent); color: var(--accent); }
.color-swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.2); }

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
}
.size-cell {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}
.size-cell.has-qty { border-color: var(--accent); }
.size-label { font-size: 11px; color: var(--ink-dim); margin-bottom: 6px; }
.size-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.qty-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.qty-value { min-width: 18px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }

.sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  bottom: calc(-1 * var(--safe-bottom));
  background: var(--panel);
  padding-top: 12px;
}
.sheet-price { font-size: 16px; font-weight: 700; }
.btn-add {
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.btn-add:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- cart ---------- */
.cart-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.cart-empty { color: var(--ink-dim); font-size: 13px; padding: 20px 0; text-align: center; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--panel-2);
  border-radius: 12px;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title { font-size: 13px; font-weight: 600; }
.cart-item-meta { font-size: 11px; color: var(--ink-dim); }
.cart-item-price { font-size: 13px; font-weight: 700; white-space: nowrap; }
.cart-item-remove {
  background: none; border: none; color: var(--ink-dim);
  font-size: 18px; cursor: pointer; padding: 0 4px;
}
.cart-footer { position: sticky; bottom: 0; }

@media (min-width: 720px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: var(--radius); max-height: 84vh; }
}
