/* Somos unos notas. Suelo de compatibilidad: iOS 15 / Chrome 105 (sin :has, sin color-mix, sin dvh). */
:root {
  --morado: #5b2ee0;
  --azul: #1060e0;
  --electrico: #0088e0;
  --marino: #0a1633;
  --gris: #5b6b85;
  --velo: #eef3ff;
  --borde: #e4eaf3;
  --amarillo: #ffc93c;
  --rosa: #ff4f8b;
  --verde: #19c37d;
  --naranja: #ff8a3d;
  --rojo: #f0483e;
  --blanco: #ffffff;
  --sombra: 0 10px 30px rgba(10, 22, 51, 0.18);
  --crema: #fbf7ee;
  --crema2: #f2e8d3;
  --tinta-suave: rgba(10, 22, 51, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--marino);
  background: linear-gradient(160deg, var(--crema) 0%, var(--crema2) 100%) fixed;
  background-color: var(--crema);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; }
.oculto { display: none !important; }

/* ---------- portada (entrar) ---------- */
.portada { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px 16px; position: relative; z-index: 2; }

/* El álbum de cromos de fondo: personajes inventados (nada de fotos ni nombres reales: la portada es pública). */
.album {
  position: fixed; top: -40px; left: -40px; right: -40px; bottom: -40px; z-index: 0; overflow: hidden;
  display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; padding: 10px;
}
.album::after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(251, 247, 238, 0.5); }
.cromo {
  width: 128px; margin: 10px; background: #fffdf5; border-radius: 12px; padding: 6px 6px 7px; color: var(--marino);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3); border: 3px solid #fff; animation: flota 6s ease-in-out infinite alternate;
  position: relative; overflow: hidden;
}
.cromo .cab { display: flex; justify-content: space-between; font-size: 10px; font-weight: 900; color: #fff; border-radius: 7px; padding: 3px 6px; }
.cromo .cara { display: block; width: 100%; height: 92px; border-radius: 8px; margin: 5px 0 4px; }
.cromo .mote { font-weight: 900; font-size: 12px; line-height: 1.15; min-height: 28px; }
.cromo .poder { font-size: 10px; color: var(--gris); line-height: 1.2; margin-top: 2px; min-height: 24px; }
.cromo .pie { display: flex; justify-content: space-between; font-size: 10px; font-weight: 800; margin-top: 4px; }
.cromo .media-cromo { background: var(--marino); color: #fff; border-radius: 6px; padding: 1px 5px; }
.cromo.brillante::before {
  content: ""; position: absolute; top: -50%; left: -60%; width: 60%; height: 200%; transform: rotate(25deg);
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.75), rgba(255,255,255,0));
  animation: brillo 3.5s ease-in-out infinite; z-index: 1;
}
.cromo.brillante { border-color: #ffd54a; background: linear-gradient(160deg, #fffdf5 0%, #fff3c4 50%, #e9f2ff 100%); }
.cromo.limitada { border-color: var(--rosa); }
@keyframes flota { from { transform: translateY(0) rotate(var(--giro, 0deg)); } to { transform: translateY(-8px) rotate(calc(var(--giro, 0deg) * -1)); } }
@keyframes brillo { 0% { left: -60%; } 60%, 100% { left: 130%; } }
@media (prefers-reduced-motion: reduce) { .cromo, .cromo.brillante::before { animation: none; } }
.tarjeta-entrar {
  width: 100%; max-width: 420px; background: var(--blanco); border-radius: 26px; box-shadow: var(--sombra);
  padding: 26px 22px 22px; position: relative; overflow: hidden;
}
.tarjeta-entrar::before {
  content: ""; position: absolute; top: -60px; right: -60px; width: 160px; height: 160px; border-radius: 50%;
  background: var(--amarillo); opacity: 0.35;
}
.tarjeta-entrar::after {
  content: ""; position: absolute; bottom: -50px; left: -40px; width: 120px; height: 120px; border-radius: 50%;
  background: var(--rosa); opacity: 0.18;
}
.logo-grande { display: block; width: 210px; max-width: 70%; margin: 0 auto 8px; position: relative; z-index: 1; }
.nombre-app { text-align: center; font-size: 30px; font-weight: 900; letter-spacing: -0.5px; margin: 6px 0 2px; position: relative; z-index: 1; }
.nombre-app b { color: var(--morado); }
.lema { text-align: center; color: var(--gris); margin: 0 0 16px; font-size: 14px; position: relative; z-index: 1; }
.bocadillo {
  position: relative; z-index: 1; background: var(--velo); border: 2px dashed #b8c8ff; border-radius: 18px;
  padding: 12px 14px; margin: 0 0 18px; font-weight: 700; text-align: center; cursor: pointer; min-height: 48px;
  transition: transform 0.15s;
}
.bocadillo:active { transform: scale(0.98); }
.bocadillo small { display: block; font-weight: 400; color: var(--gris); font-size: 11px; margin-top: 4px; }
.formulario { position: relative; z-index: 1; }
.formulario label { display: block; font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
.campo {
  width: 100%; padding: 12px 14px; border: 2px solid var(--borde); border-radius: 14px; background: #fbfcff;
  font-size: 16px; color: var(--marino); outline: none; transition: border-color 0.15s;
}
.campo:focus { border-color: var(--azul); background: var(--blanco); }
.btn {
  display: inline-block; border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 800; cursor: pointer;
  background: var(--velo); color: var(--marino); transition: transform 0.1s, filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-grande { width: 100%; padding: 14px; font-size: 17px; margin-top: 16px; }
.btn-principal { background: linear-gradient(135deg, var(--morado), var(--azul)); color: var(--blanco); box-shadow: 0 6px 16px rgba(91, 46, 224, 0.35); }
.btn-amarillo { background: var(--amarillo); color: var(--marino); }
.btn-peligro { background: #ffe3e1; color: #b3261e; }
.btn-mini { padding: 7px 11px; border-radius: 11px; font-size: 13px; }
.error-gracioso {
  background: #fff1f0; color: #b3261e; border-radius: 14px; padding: 10px 12px; margin-top: 12px; font-weight: 700;
  font-size: 14px; animation: temblor 0.45s;
}
.letra-pequena { color: var(--gris); font-size: 12px; text-align: center; margin: 14px 0 0; position: relative; z-index: 1; }
@keyframes temblor {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ---------- app ---------- */
.cabecera {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; max-width: 880px;
  margin: 0 auto; color: var(--marino);
}
.logo-mini { height: 40px; background: var(--blanco); border-radius: 12px; padding: 3px 6px; box-shadow: 0 2px 6px rgba(10, 22, 51, 0.08); }
.titulo-app { font-weight: 900; font-size: 20px; margin: 0 10px; flex: 1; text-align: center; }
.titulo-app b { color: var(--morado); }
.chip-yo { background: var(--tinta-suave); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 14px; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pestanas {
  display: flex; max-width: 880px; margin: 0 auto 10px; padding: 0 10px; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pestanas button {
  flex: 1; border: 0; background: var(--tinta-suave); color: var(--marino); font-weight: 800; padding: 10px 8px;
  margin: 0 3px; border-radius: 14px; cursor: pointer; white-space: nowrap; position: relative;
}
.pestanas button.activa { background: var(--blanco); color: var(--morado); box-shadow: 0 3px 10px rgba(10, 22, 51, 0.1); }
.badge { background: var(--rosa); color: var(--blanco); border-radius: 999px; font-size: 11px; padding: 2px 7px; margin-left: 4px; }
main { max-width: 880px; margin: 0 auto; padding: 0 12px 40px; }
.panel { display: none; }
.panel.activa { display: block; animation: aparece 0.25s; }
@keyframes aparece { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tarjeta { background: var(--blanco); border: 1px solid #ebe2cf; border-radius: 22px; padding: 16px; margin-bottom: 12px; box-shadow: 0 6px 18px rgba(80, 60, 20, 0.08); }
.tarjeta h2 { margin: 0 0 10px; font-size: 19px; font-weight: 900; }
.tarjeta h3 { margin: 0; font-size: 17px; font-weight: 800; }
.fila { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.fila > * { margin: 3px 0; }
.barra-herramientas { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.barra-herramientas > * { margin: 0 6px 6px 0; }
.segmentos { display: inline-flex; background: var(--tinta-suave); border-radius: 14px; padding: 3px; }
.segmentos button { border: 0; background: transparent; color: var(--marino); font-weight: 800; padding: 8px 12px; border-radius: 11px; cursor: pointer; }
.segmentos button.activa { background: var(--amarillo); color: var(--marino); }
.selector-curso { border-radius: 12px; border: 1px solid var(--borde); padding: 8px 10px; font-weight: 700; color: var(--marino); background: var(--blanco); }
.vacio { text-align: center; padding: 26px 14px; color: var(--gris); }
.vacio b { display: block; font-size: 18px; color: var(--marino); margin-bottom: 6px; }
.asignatura-cab { display: flex; align-items: center; justify-content: space-between; }
.asignatura-cab h3 { flex: 1; margin-right: 8px; word-break: break-word; }
.notas-lista { display: flex; flex-wrap: wrap; margin-top: 10px; }
.nota-chip {
  border: 0; border-radius: 14px; padding: 7px 11px; margin: 0 7px 7px 0; cursor: pointer; font-weight: 800;
  color: var(--blanco); line-height: 1.15; text-align: left;
}
.nota-chip small { display: block; font-weight: 600; font-size: 11px; opacity: 0.9; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sin-notas { color: var(--gris); font-size: 14px; margin: 10px 0 6px; }
.pildora { display: inline-block; border-radius: 999px; padding: 4px 11px; font-weight: 900; color: var(--blanco); min-width: 48px; text-align: center; }
.n-sus { background: var(--rojo); }
.n-apr { background: var(--naranja); }
.n-bien { background: #e0a800; }
.n-not { background: var(--verde); }
.n-sob { background: var(--morado); }
.n-nada { background: #c4ccda; }

/* medias */
.heroe { text-align: center; padding: 22px 16px; }
.heroe .numero { font-size: 64px; font-weight: 900; line-height: 1; margin: 6px 0; }
.heroe .etiqueta { font-weight: 800; font-size: 17px; }
.c-sus { color: var(--rojo); } .c-apr { color: var(--naranja); } .c-bien { color: #c99500; } .c-not { color: var(--verde); } .c-sob { color: var(--morado); } .c-nada { color: #9aa5b8; }
.trimestres { display: flex; margin: 0 -5px 12px; }
.trimestres .tarjeta { flex: 1; margin: 0 5px; text-align: center; padding: 12px 6px; }
.trimestres .mini { font-size: 12px; color: var(--gris); font-weight: 700; }
.trimestres .valor { font-size: 26px; font-weight: 900; margin-top: 4px; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { font-size: 12px; color: var(--gris); text-align: center; padding: 6px 3px; }
.tabla th:first-child, .tabla td:first-child { text-align: left; }
.tabla td { padding: 8px 3px; border-top: 1px solid var(--borde); text-align: center; font-size: 14px; }
.tabla td:first-child { font-weight: 700; word-break: break-word; }
.barra { height: 8px; border-radius: 99px; background: var(--velo); overflow: hidden; margin-top: 5px; }
.barra span { display: block; height: 100%; border-radius: 99px; }

/* piques */
.reto { border: 2px dashed var(--rosa); background: #fff6f9; }
.reto p { margin: 0 0 10px; font-weight: 700; }
.pique { cursor: pointer; transition: transform 0.12s; }
.pique:active { transform: scale(0.99); }
.pique .detalle { color: var(--gris); font-size: 13px; margin-top: 3px; }
.puesto-grande { font-size: 30px; font-weight: 900; color: var(--morado); text-align: right; line-height: 1; }
.puesto-grande small { display: block; font-size: 12px; color: var(--gris); font-weight: 700; }
.podio { display: flex; align-items: flex-end; justify-content: center; margin: 8px 0 16px; min-height: 170px; }
.podio .escalon { width: 31%; max-width: 130px; margin: 0 4px; text-align: center; }
.podio .bloque { border-radius: 14px 14px 6px 6px; color: var(--blanco); font-weight: 900; font-size: 26px; padding-top: 8px; }
.podio .p1 .bloque { height: 110px; background: linear-gradient(180deg, #ffd54a, #f0a500); }
.podio .p2 .bloque { height: 82px; background: linear-gradient(180deg, #c9d3e3, #8f9bb3); }
.podio .p3 .bloque { height: 62px; background: linear-gradient(180deg, #f2a36b, #c86b2c); }
.podio .quien { font-weight: 800; font-size: 14px; margin-bottom: 4px; word-break: break-all; }
.podio .cuanto { font-size: 12px; color: var(--gris); margin-bottom: 4px; }
.copa { width: 30px; height: 30px; display: block; margin: 0 auto 2px; }
.ranking-fila { display: flex; align-items: center; padding: 9px 4px; border-top: 1px solid var(--borde); }
.ranking-fila .pos { width: 36px; font-weight: 900; font-size: 18px; color: var(--morado); }
.ranking-fila .quien { flex: 1; min-width: 0; }
.ranking-fila .quien b { display: block; word-break: break-all; }
.ranking-fila .quien small { color: var(--gris); }
.ranking-fila.soy-yo { background: #fff9e6; border-radius: 12px; }
.chips { display: flex; flex-wrap: wrap; margin: 6px 0; }
.chip { background: var(--velo); border-radius: 999px; padding: 6px 11px; margin: 0 6px 6px 0; font-weight: 700; font-size: 14px; border: 0; color: var(--marino); }
.chip button { border: 0; background: transparent; font-weight: 900; margin-left: 4px; cursor: pointer; color: var(--gris); }
button.chip { cursor: pointer; }

/* mensajes con la admin */
.espacio-arriba { margin-top: 10px; }
.hilo { cursor: pointer; }
.hilo .detalle { color: var(--gris); font-size: 13px; margin-top: 3px; }
.hilo.nuevo { border-left: 6px solid var(--rosa); }
.estado { display: inline-block; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 800; }
.estado-pendiente, .estado-abierta { background: #fff3c4; color: #8a6100; }
.estado-aprobada { background: #dff7ec; color: #0d7a4c; }
.estado-rechazada, .estado-cerrada { background: #eef1f6; color: var(--gris); }
.conversacion { max-height: 52vh; overflow-y: auto; padding: 4px 2px; margin: 6px 0 10px; }
.burbuja { max-width: 85%; border-radius: 16px; padding: 9px 12px; margin: 6px 0; white-space: pre-wrap; word-wrap: break-word; }
.burbuja small { display: block; font-size: 11px; opacity: 0.75; margin-bottom: 2px; font-weight: 700; }
.burbuja.suya { background: var(--velo); margin-right: auto; }
.burbuja.mia { background: linear-gradient(135deg, var(--morado), var(--azul)); color: var(--blanco); margin-left: auto; }
.burbuja.sistema { background: #fff9e6; margin: 8px auto; text-align: center; font-weight: 700; font-size: 13px; }
textarea.campo { resize: vertical; min-height: 80px; }

/* reglas de contraseña */
.reglas { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.reglas li { color: var(--gris); margin: 3px 0; }
.reglas li::before { content: "\2022"; display: inline-block; width: 16px; font-weight: 900; }
.reglas li.ok { color: var(--verde); font-weight: 700; }
.reglas li.ok::before { content: "\2713"; }
.ayuda { color: var(--gris); font-size: 13px; margin: 4px 0 0; }

/* ventana emergente: solo se cierra con la X, Cancelar o Esc */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(10, 22, 51, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; z-index: 50; }
.modal-caja { background: var(--blanco); border-radius: 24px; width: 100%; max-width: 520px; padding: 20px 18px; position: relative; box-shadow: var(--sombra); animation: aparece 0.2s; }
.modal-caja h2 { margin: 0 34px 12px 0; font-size: 21px; font-weight: 900; }
.cerrar { position: absolute; top: 12px; right: 12px; border: 0; background: var(--velo); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; font-weight: 900; cursor: pointer; color: var(--marino); }
.botones { display: flex; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
.botones .btn { margin: 4px 0 0 8px; }
.botones .izquierda { margin-right: auto; margin-left: 0; }
.aviso {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--marino); color: var(--blanco);
  padding: 12px 18px; border-radius: 16px; font-weight: 700; box-shadow: var(--sombra); z-index: 60; max-width: 92%;
  text-align: center; animation: aparece 0.2s;
}
.aviso.malo { background: #b3261e; }
.confeti { position: fixed; top: -10px; width: 9px; height: 14px; z-index: 70; border-radius: 2px; pointer-events: none; animation: cae 1.6s ease-in forwards; }
@keyframes cae { to { transform: translateY(105vh) rotate(540deg); opacity: 0.7; } }

/* super */
.super-tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.super-tabla th, .super-tabla td { padding: 7px 6px; border-top: 1px solid var(--borde); text-align: left; vertical-align: top; }
.super-tabla th { color: var(--gris); font-size: 12px; }
.super-tabla td .btn { margin: 0 4px 4px 0; }
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cifras { display: flex; flex-wrap: wrap; margin: 0 -5px; }
.cifras .tarjeta { flex: 1 1 120px; margin: 0 5px 10px; text-align: center; }
.cifras .valor { font-size: 30px; font-weight: 900; color: var(--morado); }
.cifras .mini { color: var(--gris); font-size: 12px; font-weight: 700; }
.etiqueta-roja { background: #ffe3e1; color: #b3261e; border-radius: 8px; padding: 2px 7px; font-size: 12px; font-weight: 800; }

.modal-caja label { display: block; font-weight: 700; font-size: 14px; margin: 12px 0 4px; }
.modal-caja .campo + .ayuda { margin-top: 6px; }

/* móvil: las pestañas en dos filas para que se vean todas (Mensajes y Admin no pueden quedar escondidas) */
@media (max-width: 600px) {
  .pestanas { flex-wrap: wrap; overflow-x: visible; padding: 0 8px; }
  .pestanas button { flex: 1 1 22%; margin: 3px; font-size: 14px; padding: 9px 4px; }
  .titulo-app { font-size: 17px; margin: 0 6px; }
  .logo-mini { height: 34px; }
  .chip-yo { font-size: 12px; padding: 5px 9px; }
}

@media (min-width: 700px) {
  .titulo-app { font-size: 24px; }
  .heroe .numero { font-size: 80px; }
}
