/* Shibuya Pixel 2002: día pastel y noche técnica */
:root {
  --bg-page: #E8F0F8;
  --grid-line: rgba(148, 163, 184, 0.28);
  --bg-panel: #FAFAFA;
  --bg-panel-alt: #F1F5F9;
  --bg-header-blue: #DCE8F5;
  --bg-header-pink: #FFD6E8;
  --bg-header-mint: #D1FAE5;
  --bg-header-lav: #E8DDF5;
  --text-main: #1E293B;
  --text-muted: #475569;
  --border-solid: #1E293B;
  --border-dashed: #94A3B8;
  --shadow-hard: 4px 4px 0px #CBD5E1;
  --shadow-btn: 2px 2px 0px #1E293B;
  --pill-bg: #FFFFFF;
  --status-green: #10B981;
  --error: #9F1239;
  --f-pixel: 'Silkscreen', 'DotGothic16', monospace;
  --f-mono: 'Share Tech Mono', ui-monospace, monospace;
  --f-texto: 'Plus Jakarta Sans', Verdana, Geneva, sans-serif;
  color-scheme: light;
}

html[data-mode="night"] {
  --bg-page: #0B1120;
  --grid-line: rgba(51, 65, 85, 0.35);
  --bg-panel: #111827;
  --bg-panel-alt: #1E293B;
  --bg-header-blue: #1E3A5F;
  --bg-header-pink: #4A1D34;
  --bg-header-mint: #064E3B;
  --bg-header-lav: #2E1065;
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --border-solid: #475569;
  --border-dashed: #475569;
  --shadow-hard: 4px 4px 0px #020617;
  --shadow-btn: 2px 2px 0px #020617;
  --pill-bg: #0F172A;
  --status-green: #34D399;
  --error: #FDA4AF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background-color: var(--bg-page); }

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 48px;
  background-color: var(--bg-page);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 16px 16px;
  color: var(--text-main);
  font: 12.5px/1.5 var(--f-texto);
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--bg-header-pink); color: var(--text-main); }
:focus-visible { outline: 2px solid var(--text-main); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.saltar {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--bg-header-mint);
  color: var(--text-main);
  border: 1px solid var(--border-solid);
  font-family: var(--f-pixel);
}
.saltar:focus { top: 12px; }

.mono { font-family: var(--f-mono); }
.negrita { font-weight: 700; }
.suave { color: var(--text-muted); }
.chico { font-size: 10.5px; }

/* ---------- Estructura ---------- */
.contenedor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 880px; margin: 16px auto 0; padding: 0 12px; }
.columnas { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.lado, .principal { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mitades { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.cuerpo { padding: 10px; }
.pila { display: grid; gap: 10px; }

@media (min-width: 640px) {
  .mitades { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .columnas { grid-template-columns: 250px minmax(0, 1fr); }
}

/* ---------- Ventanas ---------- */
.ventana {
  position: relative;
  background-color: var(--bg-panel);
  border: 1px solid var(--border-solid);
  box-shadow: var(--shadow-hard);
}
.ventana:focus { outline: none; }

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-solid);
  font: 10.5px/1.4 var(--f-pixel);
  letter-spacing: .02em;
  user-select: none;
  -webkit-user-select: none;
}
.cab-izq, .cab-der { display: flex; align-items: center; gap: 8px; }
.azul { background-color: var(--bg-header-blue); }
.rosa { background-color: var(--bg-header-pink); }
.menta { background-color: var(--bg-header-mint); }
.lavanda { background-color: var(--bg-header-lav); }
.punto { width: 8px; height: 8px; background: var(--status-green); border: 1px solid var(--border-solid); }

.ctrl { display: flex; gap: 4px; }
.ctrl i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 11px;
  height: 11px;
  border: 1px solid var(--border-solid);
  background-color: var(--bg-panel);
  font: 8px/1 var(--f-mono);
  font-style: normal;
}

.punteada { border: 1px dashed var(--border-dashed); background-color: var(--bg-panel-alt); }

/* ---------- Botones y píldoras ---------- */
.boton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-solid);
  background-color: var(--bg-panel);
  color: var(--text-main);
  font: 10.5px/1.4 var(--f-pixel);
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  transition: transform .08s ease, background-color .12s ease;
}
.boton:hover { background-color: var(--bg-header-blue); transform: translate(-1px, -1px); }
.boton:active { transform: translate(1px, 1px); box-shadow: none; }
.boton[aria-current="true"] { background-color: var(--bg-header-pink); font-weight: 700; }
.boton[aria-disabled="true"] { cursor: progress; opacity: .7; }
.primario { background-color: var(--bg-header-mint); font-weight: 700; }
.primario:hover { background-color: var(--bg-header-pink); }
.ancho { width: 100%; }
.centro { justify-content: center; }
.entre { justify-content: space-between; }
.boton.chico { padding: 4px 8px; font-size: 10px; }

.pildoras { display: flex; flex-wrap: wrap; gap: 5px; }
.pildora {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border: 1px solid var(--border-solid);
  background-color: var(--pill-bg);
  font: 11px/1.5 var(--f-mono);
}

.etiqueta {
  display: inline-block;
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--border-solid);
  color: var(--text-main);
  font: 10px/1.4 var(--f-pixel);
}
.rotulo { display: block; margin-bottom: 4px; font: 9.5px/1.4 var(--f-pixel); }

/* ---------- Barra superior ---------- */
.modo {
  padding: 1px 7px;
  border: 1px solid var(--border-solid);
  background: var(--bg-panel);
  font: 10px/1.4 var(--f-pixel);
  cursor: pointer;
}
.modo:hover { background: var(--bg-header-pink); }
.modo[aria-pressed="true"] { background: var(--bg-header-lav); }
.reloj { padding: 0 6px; border: 1px solid var(--border-solid); background: var(--bg-panel); font-size: 11px; }

.estado-barra { display: flex; align-items: center; gap: 8px; padding: 6px 10px; overflow: hidden; background: var(--bg-panel-alt); }
.estado-barra .etiqueta { font-size: 9.5px; }
.marquesina { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.marquesina-cinta { display: flex; gap: 48px; width: max-content; font-size: 12px; animation: deslizar 26s linear infinite; }
.marquesina:hover .marquesina-cinta { animation-play-state: paused; }
@keyframes deslizar { to { transform: translateX(calc(-50% - 24px)); } }

/* ---------- Perfil ---------- */
.perfil { display: flex; align-items: center; gap: 12px; }
.avatar { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border: 1px solid var(--border-solid); background: var(--bg-header-blue); }
.avatar svg { width: 56px; height: 56px; }
.perfil-datos { min-width: 0; }
.perfil h1 { font-size: 14px; line-height: 1.2; }
.perfil p { font-size: 11px; line-height: 1.4; }
.pastilla-estado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  padding: 1px 6px;
  border: 1px solid var(--border-solid);
  color: var(--text-main);
  font: 700 9.5px/1.4 var(--f-mono);
}
.pastilla-estado i { width: 6px; height: 6px; border-radius: 50%; background: var(--status-green); }
.bio { padding: 8px; font-size: 11.5px; line-height: 1.6; }
.menu { display: grid; gap: 6px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- BGM ---------- */
.bgm { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; background: var(--bg-panel-alt); }
.bgm-izq { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bgm-boton {
  flex: none;
  padding: 1px 8px;
  border: 1px solid var(--border-solid);
  background: var(--bg-header-pink);
  color: var(--text-main);
  font: 9.5px/1.6 var(--f-pixel);
  cursor: pointer;
}
.bgm-boton:hover { background: var(--bg-header-blue); }
.bgm-boton:active { transform: translate(1px, 1px); }
.bgm-nombre { overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.eq { display: flex; align-items: flex-end; gap: 2px; flex: none; height: 14px; padding: 0 4px; }
.eq i { width: 3px; height: 30%; background-color: var(--text-main); }
.eq.sonando i { animation: pulso .45s ease-in-out infinite; }
.eq.sonando i:nth-child(2) { animation-delay: .2s; }
.eq.sonando i:nth-child(3) { animation-delay: .12s; }
.eq.sonando i:nth-child(4) { animation-delay: .28s; }
.eq.sonando i:nth-child(5) { animation-delay: .08s; }
@keyframes pulso { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* ---------- Visor ---------- */
.pestanas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 10px 6px;
  border-bottom: 1px dashed var(--border-dashed);
  background: var(--bg-panel-alt);
}
.pestana {
  padding: 3px 8px;
  border: 1px solid var(--border-solid);
  background: var(--bg-panel);
  color: var(--text-main);
  font: 10px/1.4 var(--f-pixel);
  cursor: pointer;
}
.pestana:hover { background: var(--bg-header-blue); }
.pestana[aria-selected="true"] { background: var(--bg-header-pink); }
[role="tabpanel"]:focus-visible { outline-offset: -4px; }

.tarjeta { display: grid; gap: 10px; padding: 12px; }
.tarjeta-cab, .tarjeta-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tarjeta-nombre { display: flex; align-items: center; gap: 8px; }
.tarjeta h3 { font-size: 14px; }
.tarjeta-cab .mono { font-size: 12px; }
.koto { display: flex; align-items: center; gap: 12px; }
.koto img { flex: none; width: 88px; height: auto; padding: 4px; border: 1px solid var(--border-solid); background: #F5FBFF; }
.koto p { font-size: 12px; line-height: 1.65; }

/* Libro */
.libro { display: grid; gap: 10px; padding: 12px; }
.libro-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border-dashed); font-size: 12px; }
.campo {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-solid);
  border-radius: 0;
  background: var(--bg-panel);
  color: var(--text-main);
  font: 12px/1.4 var(--f-texto);
}
textarea.campo { min-height: 64px; resize: vertical; }
.campo[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.libro-fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.aviso { min-height: 1.5em; color: var(--error); font-size: 12px; font-weight: 700; }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.desplaza {
  overflow-y: auto;
  scrollbar-color: var(--bg-header-blue) var(--bg-panel-alt);
}
.desplaza::-webkit-scrollbar { width: 8px; }
.desplaza::-webkit-scrollbar-track { background: var(--bg-panel-alt); border-left: 1px solid var(--border-solid); }
.desplaza::-webkit-scrollbar-thumb { background: var(--bg-header-blue); border: 1px solid var(--border-solid); }

.firmas { display: grid; gap: 6px; max-height: 260px; margin-top: 10px; }
.firma, .firma-aviso { padding: 8px 10px; border: 1px dashed var(--border-dashed); background: var(--bg-panel-alt); }
.firma.fijada { border-style: solid; background: var(--bg-header-blue); }
.firma-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.firma b { font-size: 12.5px; }
.firma time, .firma small { color: var(--text-muted); font: 11px var(--f-mono); }
.firma p { margin-top: 2px; overflow-wrap: anywhere; }
.firma-aviso { color: var(--text-muted); }

/* Contacto */
.contacto { display: grid; gap: 8px; }
.contacto-fila { display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-decoration: none; font-size: 13px; }
.contacto-fila .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.contacto-fila:hover { background: var(--bg-header-blue); }

/* ---------- Historial ---------- */
.registro { display: grid; gap: 6px; max-height: 115px; padding: 10px; font-size: 12px; }
.registro li { display: flex; align-items: baseline; gap: 8px; }
.registro .etiqueta { font: 700 12px/1.4 var(--f-mono); }

/* ---------- Contador ---------- */
.digitos { display: flex; gap: 3px; }
.digitos span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 32px;
  border: 1px solid var(--border-solid);
  background: var(--bg-panel-alt);
  box-shadow: 2px 2px 0 var(--border-dashed);
  font: 22px/1 var(--f-mono);
}

/* ---------- Pie ---------- */
.pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; }
.pie p { font-size: 12px; }
.insignias { display: flex; flex-wrap: wrap; gap: 6px; }
.insignia {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 31px;
  border: 1px solid var(--border-solid);
  color: #0F172A;
  font: 7.5px/1.15 var(--f-pixel);
  text-align: center;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .18);
  user-select: none;
}
.insignia.oscura { background: #0F172A; color: #6EE7B7; }

/* Movimiento reducido: marquesina y ecualizador quietos */
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  .marquesina-cinta, .eq.sonando i { animation: none; }
  .eq.sonando i { height: 70%; }
  .eq.sonando i:nth-child(even) { height: 40%; }
  .boton, .boton:hover, .boton:active { transition: none; transform: none; }
}
