/* ---------- Variables (paleta y fuente) ---------- */
:root {
  --bg-light: #9ca0c8;
  --bg-mid: #3a5a33;
  --bg-dark: #1a1a17;
  --text: #e8e8e0;
  --yellow: #f5e642;
  --pink: #d28ae8;
  --orange: #d9532e;
  --ink: #161b24;
  --paper: #f4f0df;
  --blue: #263cf4;
  --green: #2fbf5b;
  --font: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- Base ---------- */
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 40%, var(--bg-light) 0%, var(--bg-mid) 70%, var(--bg-dark) 100%);
  color: #b6b1b1;
  font-family: var(--font);
}

/* ---------- Cabecera ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 1.5rem;
}

.header-left p {
  font-size: 0.9rem;
}

.logo {
  height: 44px;
  width: auto;
  display: block;
  filter: url(#boil);
}

/* ---------- Grilla estilo memory card ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 24px;
  max-width: 900px;
  margin: 40px auto 200px;
}

@media (min-width: 760px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
  }
}

.item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px solid var(--text);
  color: var(--text);
  text-decoration: none;
  text-shadow: 2px 2px 0 #000;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Cuadrados con icono ---------- */
.item.has-icon {
  aspect-ratio: auto;
  min-height: 150px;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  padding: 10px 4px;
  border-color: transparent;
}

.item.has-icon span {
  font-size: 0.8rem;
}

.icon {
  width: auto;
  max-width: 90%;
  height: 84px;
  object-fit: contain;
  image-rendering: pixelated;
  transition: transform 0.2s ease, filter 0.2s ease;
}

@media (min-width: 760px) {
  .icon {
    height: 104px;
  }
}

/* portada como icono en el listado de packs */
.icon.cover-img {
  image-rendering: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid var(--text);
}

/* ---------- Respuesta al mouse y al toque (todo abre de un click) ---------- */
.item:active {
  transform: scale(0.96);
  opacity: 0.85;
}

.item:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 4px;
}

@media (hover: hover) {
  .item:hover {
    border-color: var(--yellow);
    color: var(--yellow);
    transform: scale(1.06);
    animation: glow 1.6s ease-in-out infinite;
  }

  .item:hover .icon {
    transform: scale(1.08);
    filter: drop-shadow(0 0 12px rgba(245, 230, 66, 0.8));
  }

  .grid:has(.item:hover) .item:not(:hover) {
    opacity: 0.55;
  }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 12px rgba(245, 230, 66, 0.4); }
  50%      { box-shadow: 0 0 26px rgba(245, 230, 66, 0.85); }
}

@media (prefers-reduced-motion: reduce) {
  .item:hover {
    animation: none;
    box-shadow: 0 0 20px rgba(245, 230, 66, 0.6);
  }
}

/* ---------- Barra de abajo ---------- */
.bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(to top, rgba(26, 26, 23, 0.9), rgba(26, 26, 23, 0));
}

.bar-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 6px;
}

.bar-links a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 4px;
}

.bar-links a:hover,
.bar-links a:active {
  color: var(--yellow);
}

.bar small {
  color: var(--text);
  opacity: 0.5;
  font-size: 0.7rem;
}

/* ---------- Pagina de un pack ---------- */
.pack {
  max-width: 900px;
  margin: 24px auto 140px;
  padding: 0 24px;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .pack {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }
}

.pack-info {
  display: grid;
  gap: 20px;
  justify-items: start;
}

.cover {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  border: 2px solid var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.lower-third p {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  text-shadow: 2px 2px 0 #000;
}

.lower-third p:last-child {
  color: var(--yellow);
}

/* ---------- Reproductor (estilo MTV / Y2K) ---------- */
.panel {
  background: #c7c8c1;
  color: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 4px 4px 0 #000;
}

.track-head {
  display: flex;
  justify-content: space-between;
  padding: 12px 13px 10px;
  background: var(--yellow);
  border-bottom: 2px solid var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.track-list {
  max-height: 360px;
  overflow-y: auto;
}

.track {
  width: 100%;
  display: grid;
  grid-template-columns: 2em minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid rgba(22, 27, 36, 0.2);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.track:hover {
  background: rgba(255, 255, 255, 0.4);
}

.track.is-active {
  background: var(--blue);
  color: var(--yellow);
  box-shadow: inset 5px 0 var(--yellow);
}

.track .name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track time {
  font-size: 0.7rem;
  text-align: right;
}

.controls {
  padding: 13px 12px 12px;
  background: linear-gradient(145deg, #e2e0d6, #b9bcb7);
  border-top: 2px solid var(--ink);
}

.transport {
  display: flex;
  gap: 8px;
}

.btn {
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font: 700 0.75rem var(--font);
  cursor: pointer;
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.btn.play {
  flex: 1;
  background: var(--yellow);
  font-size: 0.85rem;
  text-transform: uppercase;
}

a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* boton de compra sin enlace todavia */
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.scrub {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.scrub time {
  font-size: 0.7rem;
  font-weight: 700;
}

.scrub time:last-child {
  text-align: right;
}

.scrub input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  margin: 0;
  border: 1px solid var(--ink);
  background: linear-gradient(to right,
    var(--green) 0%, var(--green) var(--played, 0%),
    #f8f6e9 var(--played, 0%), #f8f6e9 100%);
  cursor: pointer;
}

.scrub input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 22px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.scrub input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 18px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 0;
}

.status {
  margin: 14px 0 0;
  padding-top: 9px;
  border-top: 1px dashed rgba(22, 27, 36, 0.45);
  color: #424650;
  font-size: 0.65rem;
  text-transform: uppercase;
}

.panel button:focus-visible,
.panel input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.track:focus-visible {
  outline-color: var(--yellow);
  outline-offset: -3px;
}

/* ---------- Pagina free (lista de loops) ---------- */
.free {
  max-width: 560px;
  margin: 24px auto 140px;
  padding: 0 24px;
}

.loop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #c7c8c1;
  border: 2px solid var(--text);
  box-shadow: 4px 4px 0 #000;
}

.loop {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(22, 27, 36, 0.2);
  color: var(--ink);
  background-image: linear-gradient(var(--green), var(--green));
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: var(--played, 0%) 4px;
}

.loop.is-playing {
  background-color: var(--blue);
  color: var(--yellow);
}

.loop-name {
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loop time {
  font-size: 0.7rem;
}

.loop .btn {
  min-height: 40px;
  padding: 6px 10px;
}

.free-note {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text);
  text-shadow: 1px 1px 0 #000;
}

@media (max-width: 480px) {
  .loop {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .loop time {
    display: none;
  }
}

/* ---------- Aviso para navegadores internos de Instagram / TikTok ---------- */
.inapp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--yellow);
  color: var(--ink);
  border-bottom: 2px solid #000;
  font-size: 0.75rem;
}

.inapp-banner button {
  border: 2px solid var(--ink);
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 4px 10px;
  cursor: pointer;
}
