:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --text-dim: #888;
  --accent: #fff;
}

* { box-sizing: border-box; margin: 0; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
}

button {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
}

button:hover { opacity: 0.9; }

#catalogo {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding: 32px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}
.product-card:hover { transform: translateY(-4px); }
.product-card img { width: 100%; height: 280px; object-fit: cover; }
.product-card h3, .product-card p { padding: 12px 16px 0; }
.product-card p { padding-bottom: 16px; color: var(--text-dim); }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 600px; width: 90%;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  position: relative;
}

.close {
  position: absolute; top: 12px; right: 16px;
  background: none; color: var(--text); font-size: 24px; padding: 0;
}

.preview-box {
  position: relative; width: 100%; aspect-ratio: 1;
  background: #1a1a1a; border-radius: 10px; overflow: hidden;
}
.preview-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#design-overlay { mix-blend-mode: normal; opacity: 0.95; }

.controls { display: flex; flex-direction: column; gap: 16px; }
.controls label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-dim); }
.controls input, .controls select {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 10px; border-radius: 8px;
}
.price { font-size: 24px; font-weight: 500; }

.cart {
  position: fixed; top: 0; right: 0; width: 360px; height: 100%;
  background: var(--surface); border-left: 1px solid var(--border);
  padding: 24px; z-index: 90; overflow-y: auto;
}
.cart.hidden { transform: translateX(100%); }
.cart h2 { margin-bottom: 20px; }

.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.cart-item button { background: none; color: var(--text-dim); padding: 4px 8px; }
.cart-total { margin-top: 20px; font-size: 18px; }
#checkout-btn { width: 100%; margin-top: 16px; padding: 14px; font-size: 16px; }

@media (max-width: 640px) {
  .modal-content { grid-template-columns: 1fr; }
  .cart { width: 100%; }
}