:root {
  --bg: #fffaf3;
  --surface: #ffffff;
  --ink: #2b2240;
  --muted: #6e6787;
  --line: #ece4d8;
  --brand: #ff6b3d;
  --brand-ink: #ffffff;
  --accent: #3dc1a8;
  --accent-soft: #e2f7f2;
  --warn: #d6455d;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(43, 34, 64, 0.07);
  --tile-1: #ffe3d6; --tile-2: #dff3ff; --tile-3: #efe4ff; --tile-4: #e2f7f2; --tile-5: #fff3c4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17131f; --surface: #221c2e; --ink: #f3eefb; --muted: #a79fbd; --line: #352d45;
    --accent-soft: #1d3a35; --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    --tile-1: #4a2c22; --tile-2: #213a4a; --tile-3: #33284a; --tile-4: #1d3a35; --tile-5: #4a4120;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.logo { font-weight: 900; font-size: 1.25rem; text-decoration: none; white-space: nowrap; }
.logo span { color: var(--brand); }
.nav { display: flex; gap: 8px; margin-left: auto; }
.nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; color: var(--muted);
}
.nav a.active { background: var(--accent-soft); color: var(--ink); }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }

.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: 0 0 6px; font-weight: 900; }
.hero p { color: var(--muted); margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 24px 0 16px; }
.toolbar input[type=search] { flex: 1 1 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 0.9rem;
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer; border: 1px solid var(--line);
  transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-3px); }
.thumb {
  aspect-ratio: 1 / 1; display: grid; place-items: center; font-size: 4.5rem; position: relative;
  background: var(--tile-1); overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge {
  position: absolute; top: 10px; left: 10px; font-size: 0.75rem; font-weight: 800;
  background: rgba(0,0,0,0.65); color: #fff; padding: 3px 8px; border-radius: 999px;
}
.card-body { padding: 12px 14px 16px; }
.card-body h3 { margin: 0 0 2px; font-size: 1.05rem; }
.meta { color: var(--muted); font-size: 0.88rem; }
.price { font-weight: 900; color: var(--brand); font-size: 1.1rem; }
.was { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.hero .sale-banner {
  display: inline-block; margin: 12px 0 0; padding: 8px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); font-weight: 800;
}
.sale-banner[hidden] { display: none; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* Buttons & forms */
.btn {
  font: inherit; font-weight: 800; border: 0; border-radius: 999px; padding: 10px 18px;
  background: var(--brand); color: var(--brand-ink); cursor: pointer;
}
.btn.secondary { background: var(--accent-soft); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }

input, textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-weight: 700; margin-bottom: 4px; font-size: 0.92rem; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Seller layout */
.seller { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 14px; font-size: 1.2rem; }
.dropzone {
  border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center;
  color: var(--muted); cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 10px; }
.preview { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--tile-2); }
.preview img, .preview video { width: 100%; height: 100%; object-fit: cover; }
.preview button {
  position: absolute; top: 4px; right: 4px; border: 0; border-radius: 999px; width: 22px; height: 22px;
  background: rgba(0,0,0,0.65); color: #fff; cursor: pointer; line-height: 1;
}
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .mini { width: 56px; height: 56px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 1.8rem; overflow: hidden; background: var(--tile-3); }
.list-item .mini img { width: 100%; height: 100%; object-fit: cover; }
.list-item .grow { flex: 1; min-width: 0; }
.status { font-size: 0.75rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--line); }
.status.listed { background: var(--accent-soft); color: var(--accent); }
.status.sold { background: var(--tile-1); color: var(--brand); }

/* Modal */
dialog {
  border: 0; border-radius: 20px; padding: 0; max-width: 760px; width: calc(100% - 32px);
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(20, 15, 30, 0.55); }
.modal-grid { display: grid; grid-template-columns: 1.1fr 1fr; }
.gallery-main { aspect-ratio: 1; background: var(--tile-2); display: grid; place-items: center; font-size: 6rem; overflow: hidden; }
.gallery-main img, .gallery-main video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.gallery-thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.gallery-thumbs button { border: 2px solid transparent; padding: 0; border-radius: 8px; width: 56px; height: 56px; overflow: hidden; flex: none; cursor: pointer; background: var(--tile-3); }
.gallery-thumbs button.active { border-color: var(--brand); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.modal-info { padding: 20px; }
.modal-info h2 { margin: 0; }
.close { position: absolute; top: 10px; right: 12px; border: 0; background: var(--surface); border-radius: 999px; width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer; z-index: 2; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; }

@media (max-width: 760px) {
  .seller, .modal-grid { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}

[hidden] { display: none !important; }
.lock { max-width: 420px; margin-top: 20px; }

/* Sign-in */
.signin { max-width: 440px; }
.signin .panel { margin-top: 12px; }
.privacy { max-width: 720px; }
.privacy .panel { margin-top: 12px; }
.privacy .panel h2 { margin: 22px 0 8px; scroll-margin-top: 80px; }
.privacy .panel h2:first-child { margin-top: 0; }
.privacy ul { margin: 0; padding-left: 20px; }
.privacy li + li { margin-top: 6px; }
.privacy a { color: var(--brand); font-weight: 700; overflow-wrap: anywhere; }
.btn.wide { width: 100%; padding: 12px 18px; font-size: 1.05rem; }
.error { color: var(--warn); font-size: 0.85rem; font-weight: 700; margin: 6px 0 0; }
input.invalid { border-color: var(--warn); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.who { display: flex; align-items: center; gap: 8px; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--line); font-size: 0.9rem; }
.who:empty { display: none; }
.who-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.who .signout { color: var(--muted); font-weight: 700; text-decoration: none; white-space: nowrap; }
.who .signout:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 480px) {
  .nav a { padding: 8px 10px; }
  .who-name { max-width: 72px; }
}

.social-btn { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.social-btn svg { flex: none; }
.social-btn.google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
.social-btn.facebook { background: #1877f2; color: #fff; }
@media (prefers-color-scheme: dark) {
  .social-btn.google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
}
.or { display: flex; align-items: center; gap: 10px; margin: 12px 0 14px; color: var(--muted); font-size: 0.85rem; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.signed-as { margin: 0 0 14px; font-size: 0.92rem; }

/* Cart & orders */
main.narrow { max-width: 760px; }
.cart-link { position: relative; }
.badge-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 2px;
  border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 0.72rem; font-weight: 900; line-height: 1;
}
.cart-item { align-items: flex-start; }
.cart-item .note { margin-top: 6px; font-size: 0.88rem; padding: 6px 10px; }
.cart-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.cart-controls .qty { width: 64px; padding: 6px 8px; text-align: center; }
.cart-total { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 1.1rem; }
.pickup { border: 0; margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); min-width: 0; }
.pickup legend { font-weight: 900; font-size: 1.05rem; padding: 0; float: left; width: 100%; margin-bottom: 6px; }
.pickup-spots { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; clear: both; }
.pickup-spot {
  display: flex; gap: 10px; align-items: center; margin: 0; padding: 12px 14px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 14px; background: var(--surface);
}
.pickup-spot input { width: auto; margin: 0; accent-color: var(--accent); }
.pickup-spot:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pickup-spot:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.pickup-spot .meta { display: block; font-weight: 400; }
.pickup-when select:disabled { opacity: 0.6; }
.order-pickup { margin-top: 4px; font-weight: 700; font-size: 0.9rem; }
.order { padding: 14px 0; border-bottom: 1px solid var(--line); }
.order:last-child { border-bottom: 0; }
.order-items { margin: 8px 0; padding-left: 18px; }
.order-items li { margin: 2px 0; }
.status.order-placed { background: var(--tile-5); color: var(--ink); }
.status.order-confirmed { background: var(--tile-2); color: var(--ink); }
.status.order-done { background: var(--accent-soft); color: var(--accent); }
.status.order-cancelled { background: var(--line); color: var(--muted); }
@media (max-width: 480px) {
  .cart-item { flex-wrap: wrap; }
  .cart-controls { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; }
}
.order .btn { white-space: nowrap; }

/* Photo suggestions */
.suggest-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.suggest-row .hint { flex: 1 1 200px; }
