:root {
  --inst: #1B2353;
  --acento: #1A82C4;
  --ruta: #F7731F;
  --claro: #B9D2EA;
  --fondo: #F4F6F9;
  --texto: #1C2233;
  --tenue: #5E6779;
  --linea: #DDE3EC;
  --blanco: #FFFFFF;
  --aviso: #8A4A0F;
  --aviso-fondo: #FFE9D8;
  --escena: #121A3F;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #0B1029;
  color: var(--texto);
  font-family: Roboto, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* El tótem siempre se arma en proporción vertical 9:16. */
#kiosco {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  background: var(--fondo);
  container-type: size;
  display: flex; flex-direction: column;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: .5cqw solid var(--acento); outline-offset: .4cqw; }

/* ---------- barra superior: como la web de la facultad ---------- */
.cab {
  flex: none; height: 7cqh; background: var(--blanco); position: relative;
  display: flex; align-items: center; gap: 2.5cqw; padding: 0 5cqw;
  border-bottom: .25cqw solid var(--linea);
}
.cab img { height: 3.2cqw; width: auto; }
.cab .inst-txt b { font-size: 3.2cqw; color: var(--inst); }
.cab .hora { margin-left: auto; font-size: 3.4cqw; font-weight: 700; color: var(--inst); font-variant-numeric: tabular-nums; }
/* las esquinas de color de las piezas de fmed.uba.ar */
.cab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.9cqw; height: .9cqw;
  background: linear-gradient(90deg, var(--ruta) 0 8%, var(--claro) 8% 14%, transparent 14%);
}

main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- inicio ---------- */
.saludo { padding: 3.4cqh 5cqw 1.6cqh; }
.saludo h1 { font-size: 7cqw; line-height: 1.05; letter-spacing: -.015em; color: var(--inst); font-weight: 700; }
.saludo p { margin-top: 1cqh; font-size: 2.9cqw; color: var(--tenue); }

.buscador { padding: 0 5cqw; }
.campo {
  display: flex; align-items: center; gap: 2cqw;
  height: 7cqh; padding: 0 2.2cqw 0 3.4cqw;
  background: var(--blanco); border: .45cqw solid var(--inst); border-radius: 1.4cqw;
}
.campo svg { width: 4.6cqw; height: 4.6cqw; flex: none; color: var(--inst); }
.campo .texto { font-size: 4.6cqw; font-weight: 700; white-space: nowrap; overflow: hidden; color: var(--inst); }
.campo .ayuda { font-size: 3.4cqw; color: #8C95A6; }
.campo .cursor { width: .4cqw; height: 5cqw; background: var(--ruta); animation: tit 1s steps(1) infinite; }
@keyframes tit { 50% { opacity: 0; } }
.campo .limpiar {
  margin-left: auto; flex: none; height: 5cqh; padding: 0 2.6cqw; border-radius: 1cqw;
  background: #E8EDF4; font-size: 2.7cqw; font-weight: 700; color: var(--inst);
}

.zona { flex: 1; min-height: 0; overflow-y: auto; padding: 2cqh 5cqw 1.4cqh; overscroll-behavior: contain; }
.zona-titulo { font-size: 2.6cqw; color: var(--tenue); margin-bottom: 1cqh; }

.filas { list-style: none; display: grid; gap: 1cqh; }
.fila {
  width: 100%; display: flex; align-items: center; gap: 3cqw; text-align: left;
  min-height: 6cqh; padding: .8cqh 3cqw; border-radius: 1.4cqw;
  background: var(--blanco); border: .25cqw solid var(--linea);
}
.fila:active, .fila.pulsada { background: #E6F1FA; border-color: var(--acento); }
.fila .ico {
  flex: none; width: 7.6cqw; height: 7.6cqw; border-radius: 1.2cqw; position: relative; overflow: hidden;
  display: grid; place-items: center; background: var(--inst); color: #fff;
}
.fila .ico::after { content: ""; position: absolute; right: 0; bottom: 0; width: 2cqw; height: 2cqw; background: var(--ruta); }
.fila .ico svg { width: 4.6cqw; height: 4.6cqw; }
.fila .txt { flex: 1; min-width: 0; }
.fila .txt b { display: block; font-size: 3.3cqw; line-height: 1.15; color: var(--inst); }
.fila .txt span { display: block; margin-top: .3cqh; font-size: 2.5cqw; color: var(--tenue); }
.fila .piso {
  flex: none; min-width: 8.4cqw; height: 8.4cqw; padding: 0 1.2cqw; border-radius: 1.2cqw;
  display: grid; place-items: center; text-align: center; line-height: 1;
  border: .35cqw solid var(--inst); color: var(--inst);
}
.fila .piso small { display: block; font-size: 1.8cqw; }
.fila .piso strong { font-size: 4cqw; }
.fila .piso.fuera { border-color: var(--tenue); color: var(--tenue); }
.fila .piso.fuera strong { font-size: 2.3cqw; }
.sin-resultados { font-size: 3cqw; padding: 1cqh 0 2.4cqh; }
.sin-resultados b { display: block; font-size: 3.8cqw; margin-bottom: .6cqh; color: var(--inst); }

.marca {
  display: inline-block; margin-left: 1cqw; vertical-align: .2em; padding: .3cqh 1.4cqw; border-radius: 99cqw;
  background: var(--aviso-fondo); color: var(--aviso); font-size: 2.1cqw; font-weight: 700;
}

/* ---------- teclado ---------- */
.teclado { flex: none; background: #DCE3EC; padding: 1.4cqh 2.4cqw 1.8cqh; display: grid; gap: .9cqh; }
.teclado .f { display: flex; gap: 1cqw; justify-content: center; }
.tecla {
  flex: 0 0 8.6cqw; height: 5.6cqh; border-radius: 1.2cqw;
  background: var(--blanco); box-shadow: 0 .35cqw 0 #A7B3C4;
  font-size: 4.1cqw; font-weight: 500; color: var(--inst);
  display: grid; place-items: center;
}
.tecla.num { height: 4.6cqh; font-size: 3.3cqw; background: #F2F5F9; }
.tecla.ancha { flex-basis: 18.2cqw; }
.tecla.espacio { flex-basis: 46cqw; height: 4.8cqh; font-size: 3cqw; }
.tecla:active, .tecla.pulsada { transform: translateY(.3cqw); box-shadow: 0 .05cqw 0 #A7B3C4; background: #E6F1FA; }
.tecla svg { width: 4.6cqw; height: 4.6cqw; }

/* ---------- ficha ---------- */
.ficha { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ficha-cuerpo { flex: 1; min-height: 0; overflow-y: auto; padding: 2.8cqh 5cqw 1cqh; }
.ficha h1 { font-size: 5.4cqw; line-height: 1.08; letter-spacing: -.01em; color: var(--inst); }
.ficha .sub { margin-top: .5cqh; font-size: 2.7cqw; color: var(--tenue); }

/* el cartel del piso: el número cuenta mientras sube el ascensor */
.cartel {
  margin-top: 1.6cqh; display: flex; align-items: stretch; position: relative;
  background: var(--inst); color: #fff; border-radius: 1.6cqw; overflow: hidden;
}
.cartel::before { content: ""; position: absolute; right: 0; top: 0; width: 6cqw; height: 6cqw; background: var(--ruta); }
.cartel::after { content: ""; position: absolute; right: 6cqw; top: 0; width: 3.4cqw; height: 3.4cqw; background: var(--claro); }
.cartel .num {
  flex: none; width: 19cqw; background: #fff; color: var(--inst);
  margin: 1.3cqw; border-radius: 1cqw;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.cartel .num small { font-size: 2.5cqw; font-weight: 500; }
.cartel .num strong { font-size: 10.5cqw; letter-spacing: -.03em; font-weight: 700; font-variant-numeric: tabular-nums; }
.cartel .num strong.chico { font-size: 7.6cqw; }
.cartel .num.contando strong { color: var(--ruta); }
.cartel .det { padding: 1.6cqh 10cqw 1.6cqh 1.4cqw; display: flex; flex-direction: column; justify-content: center; gap: .6cqh; }
.cartel .det b { font-size: 5.2cqw; line-height: 1.05; }
.cartel .det .sector { font-size: 2.8cqw; color: var(--claro); }
.cartel .det .linea2 { font-size: 3.2cqw; font-weight: 700; color: #FFC49D; }
.cartel.fuera .det b { font-size: 4.2cqw; line-height: 1.15; }

/* pestañas */
.pestanas { margin-top: 1.8cqh; display: grid; grid-template-columns: 1fr 1fr; background: #E3E8F0; border-radius: 1.4cqw; padding: .6cqw; gap: .6cqw; }
.pestanas button { height: 5.6cqh; border-radius: 1cqw; font-size: 3.2cqw; font-weight: 700; color: var(--tenue); }
.pestanas button.on { background: var(--blanco); color: var(--inst); box-shadow: 0 .3cqw 1cqw rgba(27,35,83,.12); }

.panel { margin-top: 1.8cqh; }
.panel[hidden] { display: none; }

/* cómo llegar: escena + pasos */
.camino { display: grid; grid-template-columns: 56cqw 1fr; gap: 2.4cqw; align-items: start; }
.camino.sin-escena { grid-template-columns: 1fr; }
.escena-caja {
  position: relative; border-radius: 1.6cqw; overflow: hidden;
  background: radial-gradient(120% 80% at 30% 20%, #22306A 0%, var(--escena) 60%, #0B1029 100%);
}
.escena-caja::before { /* grilla de fondo, como un plano técnico */
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(rgba(185,210,234,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(185,210,234,.08) 1px, transparent 1px);
  background-size: 3cqw 3cqw;
}
.escena-caja svg.escena { position: relative; display: block; width: 100%; height: auto; max-height: 44cqh; }
.repetir {
  position: absolute; right: 1.4cqw; top: 1.4cqw;
  height: 4.4cqh; padding: 0 2cqw; border-radius: 99cqw;
  background: rgba(255,255,255,.12); color: #fff; font-size: 2.3cqw; font-weight: 500;
  display: flex; align-items: center; gap: 1cqw; border: .2cqw solid rgba(255,255,255,.25);
}
.repetir svg { width: 3cqw; height: 3cqw; }
.esquema { margin-top: .6cqh; font-size: 1.9cqw; color: #8C95A6; }

.lado { display: grid; gap: 2cqh; }
.pasos { list-style: none; counter-reset: p; display: grid; gap: 1.2cqh; }
.pasos li {
  counter-increment: p; display: grid; grid-template-columns: 5cqw 1fr; gap: 1.6cqw;
  font-size: 2.7cqw; line-height: 1.3; color: var(--tenue); transition: color .3s;
}
.pasos li::before {
  content: counter(p); width: 4.6cqw; height: 4.6cqw; border-radius: 50%;
  background: #C9D1DE; color: #fff; font-weight: 700; font-size: 2.4cqw; display: grid; place-items: center;
  transition: background .3s, transform .3s;
}
.pasos li.hecho { color: var(--texto); }
.pasos li.hecho::before { background: var(--inst); }
.pasos li.activo { color: var(--inst); font-weight: 700; }
.pasos li.activo::before { background: var(--ruta); transform: scale(1.12); }

.qr { background: var(--blanco); border: .25cqw solid var(--linea); border-radius: 1.4cqw; padding: 1.6cqw; display: flex; gap: 2cqw; align-items: center; }
.qr svg { width: 15cqw; height: auto; display: block; flex: none; }
.qr p { font-size: 2.4cqw; font-weight: 700; line-height: 1.2; color: var(--inst); }
.qr small { display: block; margin-top: .6cqh; font-size: 1.9cqw; color: var(--aviso); font-weight: 400; }

.direccion-fuera { background: var(--blanco); border: .25cqw solid var(--linea); border-radius: 1.4cqw; padding: 2cqw 2.6cqw; font-size: 3cqw; }

/* información (ventanilla) */
.info { display: grid; grid-template-columns: 1.15fr 1fr; gap: 2.6cqw; align-items: start; }
.info h2 { font-size: 2.4cqw; font-weight: 700; color: var(--acento); margin-bottom: .8cqh; }
.info .bloque + .bloque { margin-top: 2cqh; }
.info p { font-size: 2.6cqw; line-height: 1.4; color: var(--texto); }
.autoridades { list-style: none; display: grid; gap: .9cqh; }
.autoridades li { background: var(--blanco); border-left: .7cqw solid var(--inst); border-radius: .8cqw; padding: 1cqh 2cqw; }
.autoridades small { display: block; font-size: 2cqw; color: var(--tenue); }
.autoridades b { font-size: 2.6cqw; color: var(--inst); font-weight: 500; }
.contactos { list-style: none; display: grid; gap: .7cqh; }
.contactos li { display: grid; grid-template-columns: 4.2cqw 1fr; gap: 1.4cqw; align-items: center; font-size: 2.6cqw; overflow-wrap: anywhere; }
.contactos svg { width: 3.6cqw; height: 3.6cqw; color: var(--acento); }
.fuente { margin-top: 1.6cqh; font-size: 1.9cqw; color: #8C95A6; }
.info .qr { margin-top: 2cqh; }

/* ---------- barra de acciones ---------- */
.acciones { flex: none; display: flex; gap: 2.4cqw; padding: 1.6cqh 5cqw 2.4cqh; background: var(--fondo); border-top: .25cqw solid var(--linea); }
.accion {
  flex: 1; height: 7cqh; border-radius: 1.4cqw; font-size: 3.4cqw; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 2cqw;
  background: var(--blanco); border: .35cqw solid var(--inst); color: var(--inst);
}
.accion.principal { background: var(--inst); color: #fff; }
.accion svg { width: 4.2cqw; height: 4.2cqw; }
.accion:active, .accion.pulsada { filter: brightness(.92); }

/* ---------- listado ---------- */
.lista-cab { padding: 3cqh 5cqw 1.4cqh; }
.lista-cab h1 { font-size: 6.2cqw; color: var(--inst); }
.lista-cab p { margin-top: .8cqh; font-size: 2.8cqw; color: var(--tenue); }

.entra { animation: entra .25s ease-out; }
@keyframes entra { from { opacity: 0; transform: translateY(1cqh); } }
@media (prefers-reduced-motion: reduce) { .entra { animation: none; } .campo .cursor { animation: none; } }
