/* Théa Studio — pantalla de salón, plano real del salón.
   Reformer: 2 columnas de 4 camas con pasillo central (1-4 izq, 5-8 der).
   Barre: 18 estaciones en 2 filas (arriba 10→18, abajo 9→1), coach izq, entrada der.
   Mundo: plano de tinta sobre papel de algodón, acento lavanda #EBDCFF. */

:root {
  --paper: #F7F4EE;           /* papel de algodón (brief) */
  --ink: #26232B;
  --ink-soft: #6B6572;
  --rule: #D8D2C4;
  --accent: #EBDCFF;           /* lavanda (marca Fitune) */
  --accent-deep: #7A5FA8;
  --taupe: #9C8C7C;            /* taupe del logo THÉA */
  --empty: #B8B2A6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ---------- Header ---------- */
#topbar {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 2vw;
  padding: 2vh 3vw;
  border-bottom: 3px solid var(--ink);
  /* Margen de seguridad contra overscan de TVs (R5) */
  width: 97%;
  max-width: 97vw;
  margin: 0 auto;
}

.brand .logo {
  height: 8.5vh;
  width: auto;
  display: block;
  /* PNG con transparencia real y taupe ya oscurecido en píxeles: sin filtros */
}

.brand .room {
  display: block;
  margin-top: 0.4vh;
  font-size: 2.2vh;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--ink-soft);
}

.now { text-align: center; }
.now .klass {
  font-family: 'Archivo Black', sans-serif;
  font-size: 4.6vh;
  line-height: 1.05;
}
.now .meta {
  margin-top: 0.6vh;
  font-size: 2.6vh;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.now .meta #klass-time { font-weight: 600; color: var(--ink); margin-right: 1.5vw; }
.now .occupancy {
  margin-top: 0.4vh;
  font-family: 'Archivo Black', sans-serif;
  font-size: 2.6vh;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.clock { text-align: right; }
.clock .time {
  font-size: 5.4vh;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.clock .countdown {
  margin-top: 0.6vh;
  font-size: 2.2vh;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-deep);
}

/* ---------- Board (plano del salón) ---------- */
#board {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2.4vh 2.5vw 1.6vh;
  min-height: 0;
  /* Margen de seguridad contra overscan de TVs (R5) */
  width: 97%;
  max-width: 97vw;
  margin: 0 auto;
}

.room-map {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: 1.2vw;
}

/* ===== Zonas verticales (Barre: coach / entrada) ===== */
.zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1vh;
  flex: 0 0 auto;
}
.zone .vlabel {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: 'Archivo Black', sans-serif;
  letter-spacing: 0.32em;
  font-size: 3vh;
  white-space: nowrap;
}
.zone .vname {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 2.2vh;
  font-weight: 600;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
.zone.coach {
  background: var(--ink);
  color: var(--paper);
  width: 6vw;
  padding: 2vh 0;
}
.zone.coach .vname { color: var(--paper); }
.zone.entrance {
  border: 2px dashed var(--rule);
  color: var(--ink-soft);
  width: 4.5vw;
}
.zone.entrance .vlabel { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 2.4vh; }

/* ===== Piso ===== */
.floor {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Barre: dos filas de estaciones ---------- */
.floor.barre { justify-content: space-between; }

/* ---------- Barre: tapetes junto a la barra de ballet ---------- */
.floor.barre { justify-content: flex-start; gap: 0.6vh; }

/* Barra de ballet: riel continuo con soportes */
.barre-rail {
  position: relative;
  height: 2.8vh;
  flex: 0 0 auto;
  margin: 0 1vw;
}
.barre-rail::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  border-top: 6px solid var(--ink);
  border-radius: 3px;
}
.barre-rail.top::before { top: 0.3vh; }
.barre-rail.bottom::before { bottom: 0.3vh; }
.barre-rail .support {
  position: absolute;
  width: 4px;
  height: 1.5vh;
  background: var(--ink);
  border-radius: 2px;
}
.barre-rail.top .support { top: 0.3vh; }     /* cuelgan hacia el tapete */
.barre-rail.bottom .support { bottom: 0.3vh; }

.station-row {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.8vw;
  flex: 0 0 auto;
}

.station {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5vh;
  min-width: 0;
  background: transparent;
}

/* Tapete de yoga visto cenital: cápsula alargada (proporción ~1:3) */
.station .mat {
  width: 3.4vw;
  height: 17vh;
  border: 2.5px solid var(--rule);
  border-radius: 1.7vw; /* extremos redondeados de tapete */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 1.2vh;
  background: transparent;
}
.station .num {
  font-family: 'Archivo Black', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 4.4vh;
  line-height: 1;
  color: var(--ink-soft);
}
.station .name {
  font-size: 2.9vh;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap; /* solo nombre de pila: una línea */
  text-overflow: ellipsis;
}

/* Ocupada: tapete lavanda */
.station.taken .mat { background: var(--accent); border-color: var(--accent-deep); }
.station.taken .num { color: var(--accent-deep); }
.station.taken .name { color: var(--ink); }

/* Libre: borde dashed como código visual activo (R3) — sin colores nuevos */
.station.free .mat { border: 2px dashed var(--rule); }
.station.free .name { color: var(--ink-soft); font-weight: 500; }

/* Pasillo Barre: línea central del piso */
.aisle-h {
  flex: 1;
  display: flex;
  align-items: center;
}
.aisle-h .line {
  width: 100%;
  border-top: 2px dashed var(--rule);
}

/* ---------- Reformer: dos columnas de camas con pasillo ---------- */
.floor.reformer {
  display: grid;
  grid-template-columns: 1fr 14vw 1fr;
  grid-template-rows: repeat(4, 1fr);
  gap: 1.8vh 1.6vw;
}

.aisle-v {
  grid-column: 2;
  grid-row: 1 / 5;
  display: flex;
  justify-content: center;
}
.aisle-v .line {
  height: 100%;
  border-left: 2px dashed var(--rule);
}

/* Cama reformer: glifo + número + nombre */
.bed {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6vh;
  min-height: 0;
  min-width: 0;
}
.bed .unit {
  position: relative;
  width: 100%;
  max-width: 34vw;
  flex: 1;
  min-height: 0;
}
.bed svg { width: 100%; height: 100%; display: block; }

/* Número en placa centrada sobre la cama (como el plano) */
.bed .num {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  border: 2px solid var(--rule);
  padding: 0.2vh 1.2vw;
  font-family: 'Archivo Black', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 7vh;
  line-height: 1.1;
  color: var(--ink-soft);
}
.bed .name {
  font-size: 2.8vh;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Ocupada: sello lavanda */
.bed.taken .num {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: var(--accent-deep);
}
.bed.taken svg .bed-body { fill: var(--accent); stroke: var(--accent-deep); }
.bed.taken .name { color: var(--ink); }

/* Libre: número con borde dashed como código visual activo (R3) */
.bed.free .num {
  border: 2px dashed var(--rule);
  color: var(--ink-soft);
}
.bed.free .name { color: var(--ink-soft); font-weight: 500; }

/* ---------- Sin lugar asignado / siguiente ---------- */
.unassigned, .next-inline {
  margin-top: 1.4vh;
  padding-top: 1.2vh;
  border-top: 1px solid var(--rule);
  font-size: 2.3vh;
  color: var(--ink-soft);
}
.unassigned .label {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 1.8vh;
  margin-right: 1.5vw;
  color: var(--ink);
}
.unassigned .person + .person::before { content: " · "; }
.next-inline { font-weight: 600; color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.unassigned + .next-inline { border-top: none; margin-top: 0; padding-top: 0.6vh; }

/* ---------- Media (entre clases) ---------- */
/* Overlay a pantalla completa: cubre TODO el viewport (incluido el encabezado),
   sin márgenes ni barras. object-fit: cover rellena sin deformar (recorta
   proporcionalmente el sobrante). Fondo negro. */
#media-stage {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  min-height: 0;
}
#media-slot {
  position: absolute;
  inset: 0;
}
#media-slot video, #media-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.next-class {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2.4vh 3vw;
  background: rgba(23, 21, 27, 0.85);
  color: var(--paper);
  font-size: 3.4vh;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.next-class .accent { color: var(--ink-soft); }

/* ---------- Flash de cambio ---------- */
.flash {
  position: fixed; inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.flash.on { opacity: 0.55; transition: none; }
