:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #18171c;
  --muted: #6f6e76;
  --muted-2: #9a99a1;
  --accent: #c23b57;
  --accent-ink: #ffffff;
  --accent-wash: #c23b571a;
  --border: #e7e6e2;
  --claimed-fill: #edece8;
  --radius-card: 18px;
  --radius-input: 10px;
  --radius-pill: 999px;
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */

.site-header {
  padding: 3.5rem 0 2.25rem;
  text-align: center;
}

.mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 1.25rem;
  border-radius: var(--radius-pill);
  background: var(--accent-wash);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.site-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.site-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

/* ---- Wishlist grid ---- */

main {
  flex: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  padding-bottom: 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -16px rgb(24 23 28 / 0.22);
  }
}

.card.claimed {
  background: var(--claimed-fill);
  border-color: var(--claimed-fill);
}

.card.claimed:hover {
  transform: none;
  box-shadow: none;
}

.card img,
.card .img-fallback {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
}

.card .img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, var(--accent-wash), #f1f0ec);
  color: var(--accent);
  font-size: 1.75rem;
}

.card.claimed .img-fallback {
  background: #e3e2dd;
  color: var(--muted-2);
}

.card.claimed img {
  filter: grayscale(45%);
  opacity: 0.75;
}

.card .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}

.card .name a {
  color: var(--ink);
  text-decoration: none;
}

.card .name a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.card .price {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
}

.card.claimed .price {
  color: var(--muted);
}

.card .notes {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.card .claim-btn {
  margin-top: auto;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.7rem 1rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
}

.card .claim-btn:hover {
  opacity: 0.92;
}

.card .claim-btn:active {
  transform: scale(0.97);
}

.card .claim-btn.claimed {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.card .claim-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

.empty-state .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border-radius: var(--radius-pill);
  background: var(--accent-wash);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.empty-state p {
  margin: 0 0 1rem;
}

.empty-state a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* ---- Footer / manage link ---- */

.site-footer {
  padding: 1rem 0 2.5rem;
  text-align: center;
}

.manage-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted-2);
  font-size: 0.85rem;
  text-decoration: none;
}

.manage-link:hover {
  color: var(--accent);
}

/* ---- Builder page ---- */

.builder-header {
  padding: 3rem 0 2rem;
}

.builder-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  margin-bottom: 1rem;
}

.builder-header .back-link:hover {
  color: var(--accent);
}

.builder-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

form.item-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: grid;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

form.item-form input,
form.item-form textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 0.95rem;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

form.item-form input::placeholder,
form.item-form textarea::placeholder {
  color: var(--muted-2);
}

form.item-form input:focus,
form.item-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

form.item-form textarea {
  resize: vertical;
}

form.item-form button {
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
}

form.item-form button:hover {
  opacity: 0.92;
}

form.item-form button:active {
  transform: scale(0.98);
}

.list-heading {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.75rem;
}

.builder-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
}

.builder-row img,
.builder-row .img-fallback {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.builder-row .img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 1.1rem;
}

.builder-row .info {
  flex: 1;
  min-width: 0;
}

.builder-row .info .n {
  font-weight: 600;
  font-size: 0.95rem;
}

.builder-row .info .n .tag {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
}

.builder-row .info .p {
  color: var(--muted);
  font-size: 0.85rem;
}

.builder-row .delete {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted-2);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.builder-row .delete:hover {
  background: var(--accent-wash);
  color: var(--accent);
}

.builder-empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .site-header {
    padding: 2.5rem 0 1.75rem;
  }
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
