* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #edf1f4;
  color: #1f2937;
}

.page {
  width: min(1200px, 94%);
  margin: 0 auto;
  padding: 36px 0;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  margin: 0;
  font-size: 34px;
}

.header p {
  margin: 8px 0 0;
  color: #6b7280;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 30px;
}

.badge {
  border: 0;
  padding: 9px 15px;
  border-radius: 999px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
  transition: transform .2s ease, box-shadow .2s ease;
}

.badge:hover {
  transform: translateY(-2px);
}

.badge.active {
  outline: 3px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 4px rgba(17,24,39,.15);
}

.content {
  background: #fff;
  border-radius: 26px;
  padding: 24px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, .12);
}

.family-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.family-header h2 {
  margin: 0;
  text-transform: capitalize;
}

.family-header span {
  color: #6b7280;
  font-size: 14px;
}

.grids-wrapper {
  display: grid;
  gap: 34px;
}

.grid-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  padding: 20px;
}

.palette-wide-card {
  overflow: hidden;
}

.scroll-hint {
  text-align: right;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 14px;
}

.palette-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 18px;
  scroll-behavior: smooth;
}

.palette-scroll::-webkit-scrollbar {
  height: 12px;
}

.palette-scroll::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 999px;
}

.palette-scroll::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
}

.color-grid {
  display: grid;
  gap: 14px;
}

.color-grid-wide {
  width: max-content;
  grid-template-columns: repeat(22, 76px);
}

.color-card {
  width: 76px;
  min-height: 96px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 22px rgba(15, 23, 42, .14);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.color-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 28px rgba(15, 23, 42, .18);
}

.color-swatch {
  height: 52px;
}

.color-info {
  padding: 7px 4px;
  text-align: center;
  line-height: 1.25;
  overflow: hidden;
}

.color-info strong,
.color-info span {
  display: block;
  font-size: 10px;
  white-space: nowrap;
}

.color-info span {
  color: #4b5563;
}

.tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: #111827;
  color: white;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,.22);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease;
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.color-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 20px;
}

.color-modal[hidden] {
  display: none;
}

.color-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .65);
  backdrop-filter: blur(6px);
}

.color-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 92vw);
  background: #fff;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  animation: zoomIn .22s ease;
}

.modal-swatch {
  height: 230px;
}

.modal-info {
  padding: 24px;
  text-align: center;
}

.modal-info h2 {
  margin: 0;
  font-size: 30px;
}

.modal-info p {
  margin: 8px 0;
  font-size: 18px;
  color: #4b5563;
}

.color-modal-close,
.color-modal-close:hover,
.color-modal-close:focus,
.color-modal-close:active {
  position: absolute !important;
  top: 10px !important;
  right: 14px !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: rgba(0,0,0,.65) !important;
  font-size: 34px !important;
  font-weight: 300 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.color-modal-close:hover {
  color: rgba(0,0,0,.9) !important;
  transform: scale(1.08);
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pantallas grandes */
@media (min-width: 1600px) {
  .page {
    width: min(1600px, 92%);
  }

  .color-grid {
    gap: 18px;
  }

  .color-grid-wide {
    grid-template-columns: repeat(22, 88px);
  }

  .color-card {
    width: 88px;
    min-height: 116px;
  }

  .color-swatch {
    height: 68px;
  }

  .color-info strong,
  .color-info span {
    font-size: 11px;
  }
}

/* Tablets y teléfonos */
@media (max-width: 640px) {
  .page {
    width: 96%;
    padding: 22px 0;
  }

  .header h1 {
    font-size: 26px;
  }

  .badges {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .badge {
    flex: 0 0 auto;
  }

  .content {
    padding: 16px;
  }

  .family-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid-card {
    padding: 14px;
  }

  .scroll-hint {
    display: none;
  }

  .palette-scroll {
    overflow-x: visible;
    padding: 0;
  }

  .color-grid-wide {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .color-card {
    width: 100%;
    min-height: 105px;
  }

  .color-swatch {
    height: 64px;
  }
}

/* Teléfonos muy pequeños */
@media (max-width: 380px) {
  .color-grid-wide {
    grid-template-columns: repeat(2, 1fr);
  }
}