:root {
  --black: #0a0a0a;
  --white: #f7f7f5;
  --gray-1: #1c1c1c;
  --gray-2: #2e2e2e;
  --gray-3: #8a8a8a;
  --gray-4: #d8d8d6;
  --border: #333;
  --radius: 2px;
  --maxw: 1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--black);
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; margin: 0; }

[hidden] { display: none !important; }

button { font-family: inherit; cursor: pointer; }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-dot { color: var(--gray-3); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
}

.brand-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99;
}

.brand-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: var(--gray-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  width: min(280px, calc(100vw - 32px));
}

.brand-popover img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.brand-popover h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.brand-popover p {
  font-size: 0.8rem;
  color: var(--gray-3);
  margin: 0;
}

.popover-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--gray-3);
  font-size: 0.85rem;
  cursor: pointer;
}

.popover-close:hover { color: var(--white); }

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray-4);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tab:hover { border-color: var(--white); color: var(--white); }

.tab.active {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
  font-weight: 600;
}

.model-chip {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray-4);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.model-chip:hover { border-color: var(--white); color: var(--white); }

/* ---------- Gate (pantalla inicial) ---------- */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.gate-inner {
  max-width: 520px;
  width: 100%;
}

.gate-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  cursor: pointer;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--gray-3);
  margin: 0 0 12px;
}

.gate h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin-bottom: 12px;
}

.lede {
  color: var(--gray-4);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 32px;
}

.field { margin-bottom: 28px; }

.field label,
.field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--gray-4);
  margin-bottom: 10px;
}

#modelSelect {
  width: 100%;
  background: var(--gray-1);
  color: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gray-4) 50%),
                     linear-gradient(135deg, var(--gray-4) 50%, transparent 50%);
  background-position: calc(100% - 22px) calc(50% - 3px), calc(100% - 16px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

#modelSelect:focus { outline: 1px solid var(--white); }

.need-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.need-btn {
  background: var(--gray-1);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.need-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.need-btn:not(:disabled):hover {
  border-color: var(--white);
  background: var(--gray-2);
}

.need-title { font-weight: 600; font-size: 0.95rem; }
.need-sub { font-size: 0.78rem; color: var(--gray-3); }

/* ---------- Catalog ---------- */

.panel {
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 76px;
}

.panel-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 20px;
}

.panel h2 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.panel-note {
  color: var(--gray-3);
  font-size: 0.85rem;
  margin: 0 0 28px;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--white);
}

.card-thumb {
  height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--gray-3);
  background: var(--gray-1);
}

.card-thumb.has-image {
  height: 160px;
  padding: 0;
  overflow: hidden;
}

.card-thumb.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.card-compat {
  font-size: 0.72rem;
  color: var(--gray-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-price {
  margin-top: auto;
  font-size: 1.05rem;
  font-weight: 700;
}

.card-note {
  margin-top: -6px;
  font-size: 0.78rem;
  color: var(--gray-3);
}

.empty-state {
  color: var(--gray-3);
  font-size: 0.9rem;
  padding: 24px 0;
}

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  color: var(--gray-3);
  font-size: 0.8rem;
  padding: 32px 20px;
}

@media (max-width: 480px) {
  .need-grid { grid-template-columns: 1fr; }
  .topbar-inner { gap: 12px; }
  .model-chip { margin-left: 0; order: 3; width: 100%; text-align: center; }
}
