/* Diseñado para una sala de ensayo: pantalla lejos, luz mala, instrumento en
   la mano. Todo grande, alto contraste, y un solo acento. */

:root {
  --fondo:      #141021;
  --superficie: #1C1730;
  --superficie2:#262040;
  --tinta:      #EDE9F7;
  --tinta2:     #B5AECB;
  --tinta3:     #837C9C;
  --linea:      #322B4C;
  --acento:     #F0803C;
  --acento-op:  #3A2416;
  --ok:         #6FC8AE;
  --error:      #E06A8C;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--tinta);
  font-family: var(--sans);
  overscroll-behavior: none;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.pantalla {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 16px;
  gap: 16px;
}
.pantalla[hidden] { display: none; }

.marca {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.sutil { color: var(--tinta3); font-size: 14px; margin: 0; }
.centro { text-align: center; }
.error { color: var(--error); font-size: 14px; margin: 0; }
.etiqueta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tinta3);
  margin: 0;
}

/* ---------- puerta ---------- */

.puerta-caja {
  margin: auto;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#form-clave { display: flex; flex-direction: column; gap: 10px; }

input[type="password"], input[type="url"] {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 8px;
  color: var(--tinta);
  font-family: var(--sans);
  font-size: 16px;           /* 16px evita el zoom automático en iOS */
  padding: 14px 16px;
  width: 100%;
}
input:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

.btn-primario {
  background: var(--acento);
  color: #1a0d05;
  border: none;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  padding: 16px;
  cursor: pointer;
}
.btn-primario:active { transform: translateY(1px); }

/* ---------- barra superior ---------- */

.barra {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}
.barra .titulo-tema {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icono {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 10px;
  color: var(--tinta);
  font-size: 22px;
  line-height: 1;
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
}
.btn-icono:active { background: var(--superficie2); }
.btn-icono[data-guardado="si"] { color: var(--ok); border-color: var(--ok); }

/* ---------- lista ---------- */

.canciones { display: flex; flex-direction: column; gap: 10px; }

.tema {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}
.tema:active { background: var(--superficie2); }
.tema-datos { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tema-titulo {
  font-size: 16px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tema-meta { font-family: var(--mono); font-size: 12px; color: var(--tinta3); }
.pastilla {
  font-family: var(--mono); font-size: 11px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--superficie2); color: var(--tinta2);
  white-space: nowrap;
}
.pastilla.lista { background: rgba(111,200,174,.15); color: var(--ok); }
.pastilla.trabajando { background: var(--acento-op); color: var(--acento); }
.pastilla.error { background: rgba(224,106,140,.15); color: var(--error); }
.pastilla.borrador {
  background: var(--acento-op); color: var(--acento);
  margin: 6px auto 0; display: block; width: fit-content;
  font-size: 12px; padding: 5px 12px;
}
.pastilla.borrador[hidden] { display: none; }

/* ---------- identidad del cantante ---------- */

.btn-yo {
  background: var(--acento-op);
  border: 1px solid var(--acento);
  border-radius: 999px;
  color: var(--acento);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 45vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-yo:active { background: var(--superficie2); }

.cantante-op {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 12px;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  width: 100%;
}
.cantante-op:active { background: var(--superficie2); }
.cantante-op[aria-pressed="true"] { border-color: var(--acento); }
.cantante-op .nom { flex: 1; font-size: 17px; font-weight: 600; }
.cantante-op .tipo {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--tinta3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- modo: instrumental o con guía ---------- */

.modo { display: flex; gap: 12px; align-items: flex-end; }

.segmentado {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 12px;
  padding: 4px;
}
.seg {
  background: transparent;
  border: none;
  border-radius: 9px;
  color: var(--tinta2);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  min-height: 46px;
  cursor: pointer;
}
.seg[aria-checked="true"] { background: var(--acento); color: #1a0d05; }
.seg:disabled { opacity: .4; cursor: default; }

.quien { display: flex; flex-direction: column; gap: 5px; }
#selector-cantante {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 12px;
  color: var(--tinta);
  font-family: var(--sans);
  font-size: 15px;
  min-height: 54px;
  padding: 0 12px;
  max-width: 150px;
}
#selector-cantante:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* Aviso cuando la guía de esa tonalidad todavía no existe */
.faltante {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-left: 3px solid var(--acento);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faltante[hidden] { display: none; }
.faltante .btn-primario { padding: 13px; font-size: 15px; }

/* ---------- selector de tonalidad ---------- */

.tono-zona { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.tono-grande {
  font-family: var(--mono);
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  margin: 0;
  color: var(--acento);
  font-variant-numeric: tabular-nums;
}

.tonos {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.tono {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 10px;
  color: var(--tinta2);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  min-height: 56px;           /* objetivo táctil generoso: se usa tocando */
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.tono:active { background: var(--superficie2); }
.tono[aria-pressed="true"] {
  background: var(--acento);
  border-color: var(--acento);
  color: #1a0d05;
}
.tono:disabled { opacity: .3; cursor: default; }
.tono[data-guardado="si"]:not([aria-pressed="true"]) { border-color: var(--ok); }
/* En modo guía: existe la tonalidad pero todavía no se generó esa voz. */
.tono[data-sin-guia="si"]:not([aria-pressed="true"]) {
  opacity: .45;
  border-style: dashed;
}

/* ---------- transporte ---------- */

.transporte {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: auto;
}

.btn-play {
  background: var(--acento);
  border: none;
  border-radius: 50%;
  color: #1a0d05;
  font-size: 34px;
  line-height: 1;
  width: 88px;
  height: 88px;
  cursor: pointer;
}
.btn-play:active { transform: scale(.96); }

.btn-transporte {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: 12px;
  color: var(--tinta2);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  min-width: 68px;
  min-height: 60px;
  cursor: pointer;
}
.btn-transporte:active { background: var(--superficie2); }

.barra-tiempo {
  width: 100%;
  accent-color: var(--acento);
  height: 34px;
}

.tiempos {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--tinta3);
  margin: -8px 0 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- aviso flotante ---------- */

.aviso {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--superficie2);
  border: 1px solid var(--linea);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  max-width: calc(100vw - 32px);
  text-align: center;
  z-index: 10;
}
.aviso[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn-play:active, .btn-primario:active { transform: none; }
}
