:root {
  --night: #15112b;      /* fondo índigo noche */
  --surface: #1e1940;    /* carpetas y paneles */
  --surface-2: #272152;
  --line: #3b3470;
  --text: #e8e3f8;
  --dim: #9089bc;
  --amber: #ffb547;      /* fósforo ámbar: acento y foco */
  --amber-ink: #2a1a02;

  --f-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --f-text: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: 2.5rem;

  --gap: clamp(1rem, 2.5vw, 1.75rem);
  --edge: clamp(1rem, 5vw, 4rem);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, #231c4d 0%, transparent 60%),
    var(--night);
  color: var(--text);
  font: 400 var(--step-0)/1.6 var(--f-text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 50;
  background: var(--amber); color: var(--amber-ink); padding: .5rem .75rem; border-radius: 4px;
}
.skip:focus { top: 1rem; }

/* ── Cabecera ─────────────────────────────────── */
.masthead { padding: clamp(1.5rem, 5vw, 3.5rem) var(--edge) 0; max-width: 1400px; margin: 0 auto; }
.logo-link { display: block; text-decoration: none; border-radius: 6px; }
.logo { display: block; width: 100%; max-width: 980px; height: clamp(110px, 17vw, 210px); }
.lede { max-width: 58ch; margin: 1.25rem 0 0; color: var(--dim); font-size: var(--step-0); }

main { max-width: 1400px; margin: 0 auto; padding: clamp(2rem, 5vw, 3.5rem) var(--edge) 3rem; }
main:focus, main:focus-visible { outline: none; }

h1, h2 { font-family: var(--f-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: var(--gap); }
.section-head p { margin: 0; color: var(--dim); max-width: 60ch; }

/* ── Carpetas (colecciones) ───────────────────── */
.folders {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: calc(var(--gap) * 1.4) var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.folder { display: block; text-decoration: none; position: relative; padding-top: 22px; }
.folder-tab {
  position: absolute; top: 0; left: 0; height: 24px; width: 44%;
  background: var(--surface-2);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 100%, 0 100%);
  border-radius: 8px 0 0 0;
  transition: background-color .2s ease;
}
.folder-body {
  display: block; position: relative;
  background: var(--surface-2);
  border-radius: 0 10px 10px 10px;
  padding: 10px;
  transition: background-color .2s ease;
}
.folder-body canvas, .wall canvas {
  display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 4px; background: #000;
}
.folder-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .8rem .2rem 0; }
.folder-name { font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); }
.folder-count { color: var(--dim); font-size: var(--step--1); }
.folder-desc { display: block; color: var(--dim); font-size: var(--step--1); padding: .15rem .2rem 0; max-width: 46ch; }
.folder:hover .folder-tab, .folder:hover .folder-body,
.folder:focus-visible .folder-tab, .folder:focus-visible .folder-body { background: var(--amber); }
.folder:focus-visible { outline: none; }
.folder:focus-visible .folder-body { outline: 2px solid var(--amber); outline-offset: 3px; }

/* ── Dentro de una carpeta ───────────────────── */
.crumbs { display: flex; gap: .6rem; align-items: center; color: var(--dim); margin-bottom: 1rem; font-size: var(--step--1); }
.crumbs a { color: var(--amber); text-underline-offset: 3px; }
.walls {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.wall {
  display: block; text-decoration: none; padding: 8px 8px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  transition: border-color .2s ease;
}
.wall canvas { aspect-ratio: 16 / 9; }
.wall:hover { border-color: var(--amber); }
.wall-name { display: block; font-family: var(--f-display); font-weight: 600; font-size: var(--step-1); margin: .75rem .3rem .1rem; }
.wall-desc { display: block; color: var(--dim); font-size: var(--step--1); margin: 0 .3rem; }

.group + .group { margin-top: clamp(3rem, 7vw, 5rem); }
.foot { max-width: 1400px; margin: 0 auto; padding: 0 var(--edge) 2.5rem; color: var(--dim); font-size: var(--step--1); }

/* ── Reproductor ─────────────────────────────── */
.player { position: fixed; inset: 0; z-index: 100; background: #000; }
.player[hidden] { display: none; }
.stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.player.idle { cursor: none; }

.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.28) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
  mix-blend-mode: multiply;
}

.hud {
  position: absolute; left: 50%; bottom: clamp(.75rem, 3vh, 1.75rem); transform: translateX(-50%);
  width: min(1180px, calc(100% - 1.5rem));
  background: rgba(21, 17, 43, .86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 14px;
  padding: .75rem .9rem .55rem;
  transition: opacity .35s ease, transform .35s ease;
}
.player.idle .hud { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.hud-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.hud-nav { display: flex; align-items: center; gap: .4rem; margin-right: auto; }
.hud-title { display: grid; min-width: 11rem; padding: 0 .3rem; line-height: 1.25; }
.hud-title strong { font-family: var(--f-display); font-weight: 600; font-size: var(--step-0); }
.hud-title span { color: var(--dim); font-size: var(--step--1); }

.btn {
  font: 500 var(--step--1)/1 var(--f-text); color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: .6rem .8rem; cursor: pointer;
}
.btn:hover { border-color: var(--amber); }
.btn.icon { font-size: 1.25rem; padding: .3rem .7rem .45rem; }
.btn.primary { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }

.swatches { display: flex; gap: .35rem; }
.swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.swatch[aria-checked="true"] { border-color: var(--text); }

.ctl { display: flex; align-items: center; gap: .5rem; font-size: var(--step--1); color: var(--dim); }
.ctl input[type="range"] { width: 80px; accent-color: var(--amber); }
.chk { display: flex; align-items: center; gap: .35rem; font-size: var(--step--1); color: var(--dim); cursor: pointer; }
.chk input { accent-color: var(--amber); }

.keys { margin: .55rem 0 0; color: var(--dim); font-size: .75rem; display: flex; flex-wrap: wrap; gap: .25rem .4rem; align-items: center; }
kbd {
  font: 500 .7rem/1 var(--f-text); color: var(--text);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: .2rem .35rem;
}
kbd + kbd { margin-left: -.15rem; }
.keys kbd:not(:first-child):not(kbd + kbd) { margin-left: .6rem; }

.toast {
  position: absolute; top: 1.25rem; left: 50%; transform: translateX(-50%);
  margin: 0; padding: .5rem .9rem; border-radius: 8px;
  background: rgba(21, 17, 43, .9); border: 1px solid var(--line);
  font-size: var(--step--1); opacity: 0; transition: opacity .3s ease; pointer-events: none;
}
.toast.show { opacity: 1; }

@media (max-width: 720px) {
  .hud-title { min-width: 0; }
  .ctl input[type="range"] { width: 80px; }
  .keys { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
