:root {
  --bg: #f5f1ea;
  --card: #fffdf9;
  --ink: #2b2117;
  --muted: #7a6c5a;
  --accent: #8a5a2b;
  --accent-dark: #6e4621;
  --line: #e3d9c8;
  --good: #3f7d4f;
  --shadow: 0 1px 3px rgba(60, 40, 20, 0.12), 0 6px 18px rgba(60, 40, 20, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--accent); }

.hidden { display: none !important; }

/* ---- Gate (login) ---- */
#gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #efe7d8, #e2d4bd);
  padding: 20px;
  z-index: 50;
}
.gate-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px;
  width: 100%;
  max-width: 380px;
}
.gate-card h1 { margin: 0 0 4px; font-size: 1.5rem; }
.gate-card p { margin: 0 0 18px; color: var(--muted); font-size: 0.95rem; }

label { display: block; font-size: 0.82rem; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }

input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

textarea { resize: vertical; min-height: 64px; }

button {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 9px;
  padding: 11px 16px;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s;
}
button:hover { background: var(--accent-dark); }
button.secondary { background: transparent; color: var(--accent); padding: 8px 10px; }
button.secondary:hover { background: rgba(138, 90, 43, 0.08); }

.error { color: #b3261e; font-size: 0.88rem; margin-top: 10px; min-height: 1.1em; }

/* ---- Header ---- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 241, 234, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1 { font-size: 1.15rem; margin: 0; flex: 1; }
header .who { color: var(--muted); font-size: 0.85rem; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 18px; }

.intro { color: var(--muted); margin: 4px 0 18px; }

/* ---- Category + grid ---- */
.cat-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  margin: 26px 0 10px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 5px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, box-shadow 0.12s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(60,40,20,.16), 0 12px 28px rgba(60,40,20,.12); }

.card .thumb {
  aspect-ratio: 4 / 3;
  background: #ece4d6 center/cover no-repeat;
  position: relative;
}
.card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(43, 33, 23, 0.78);
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
}
.card .flag {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
}
.flag-new { background: #b3261e; }
.flag-activity { background: #c4781f; }

/* "Since your last visit" panel */
.updates-panel {
  background: #fff8ec;
  border: 1px solid #e7cfa3;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.updates-panel h3 { margin: 0 0 8px; font-size: 1rem; color: var(--accent-dark); }
.updates-panel ul { margin: 0; padding-left: 18px; }
.updates-panel li { margin-bottom: 4px; }
.updates-panel a { color: var(--ink); text-decoration: none; }
.updates-panel a:hover { color: var(--accent); text-decoration: underline; }
.card .body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .body h3 { margin: 0; font-size: 0.98rem; line-height: 1.25; }
.card .price { font-weight: 700; color: var(--accent-dark); }
.card .meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.8rem; }

/* ---- Detail modal ---- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(30, 22, 14, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  z-index: 40;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 640px;
  margin: auto;
  overflow: hidden;
}
.modal .close {
  position: sticky;
  top: 0;
  float: right;
  background: rgba(255,255,255,.85);
  color: var(--ink);
  border-radius: 999px;
  width: 34px; height: 34px;
  padding: 0;
  margin: 10px;
  font-size: 1.2rem;
  line-height: 1;
}
.carousel { background: #15100b; text-align: center; }
.carousel img { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; }
.carousel .strip { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: #1d160f; }
.carousel .strip img { height: 52px; width: 70px; object-fit: cover; border-radius: 5px; opacity: .6; cursor: pointer; }
.carousel .strip img.active { opacity: 1; outline: 2px solid var(--accent); }

.detail-body { padding: 18px 20px 22px; }
.detail-body h2 { margin: 0 0 4px; }
.detail-body .price { font-size: 1.25rem; font-weight: 700; color: var(--accent-dark); margin-bottom: 8px; }
.detail-body .desc { color: var(--ink); margin: 10px 0 4px; }
.detail-body .cond { color: var(--muted); font-size: 0.88rem; }

.pricing { margin-bottom: 10px; }
.pricing .price { font-size: 1.35rem; font-weight: 700; color: var(--accent-dark); margin-bottom: 6px; }
.price-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { font-size: 0.8rem; padding: 3px 9px; border-radius: 999px; }
.tag-used { background: rgba(63, 125, 79, 0.14); color: var(--good); font-weight: 600; }
.tag-new { background: #f0e8da; color: var(--muted); }
.tag-new a { font-weight: 600; white-space: nowrap; }
.price-note { color: var(--muted); font-size: 0.84rem; margin-top: 6px; font-style: italic; }

.includes { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.includes h4 { margin: 0 0 8px; }
.includes ul { margin: 0; padding-left: 18px; }
.includes li { margin-bottom: 5px; line-height: 1.4; }
.includes .inc-price { color: var(--muted); font-size: 0.85rem; }
.includes a { text-decoration: none; }

.comments { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.comments h4 { margin: 0 0 10px; }
.comment {
  padding: 10px 12px;
  background: #faf6ee;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}
.comment .top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.comment .name { font-weight: 700; color: var(--ink); }
.comment .offer { color: var(--good); font-weight: 700; }
.comment .body { margin-top: 3px; white-space: pre-wrap; }

.comment-form { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.comment-form .row { display: flex; gap: 8px; align-items: center; }
.comment-form .row input { flex: 1; }

.empty { color: var(--muted); font-style: italic; }

footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 30px 0; }
