:root {
  --verde:    #8cc63f;
  --verde-v:  #a2f435;
  --azul:     #2da7df;
  --azul-v:   #06b1ff;
  --rosa:     #ec008c;
  --rojo:     #ed1c24;
  --amarelo:  #ffee44;
  --escuro:   #1a1a3e;
  --radius:   16px;
  --shadow:   0 8px 24px rgba(0,0,0,.15);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:16px; -webkit-font-smoothing:antialiased; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f4f4f8;
  color: #222;
  overflow-x: hidden;
}

/* ======================================================
   HERO
   ====================================================== */
.hero {
  width: 100%; min-height: 100svh;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  justify-content: flex-end; align-items: center;
  background: var(--escuro);
}
.hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.hero-img.placeholder { z-index: 1; }
.hero-img.gif { z-index: 2; opacity: 0; transition: opacity .6s ease-in-out; }
.hero-img.gif.loaded { opacity: 1; }

.hero-shimmer {
  position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.07) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.hero-dots {
  position: absolute; inset: 0; z-index: 4;
  background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,.72) 100%);
  z-index: 5;
}
.hero-content {
  position: relative; z-index: 6;
  text-align: center; color: white;
  padding: 2rem 1.5rem 3.5rem; width: 100%;
  display: flex; flex-direction: column; align-items: center;
}
.hero-ano {
  font-size: clamp(5rem, 20vw, 10rem);
  font-weight: 900; line-height: .9;
  background: linear-gradient(135deg, var(--verde-v), var(--azul-v), var(--rosa));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .5rem;
}
.hero-titulo { font-size: clamp(1.2rem, 4vw, 1.8rem); font-weight: 700; color: white; margin-bottom: .25rem; }
.hero-subtitulo { font-size: .95rem; color: rgba(255,255,255,.7); margin-bottom: .75rem; }
.hero-countdown {
  display: inline-block;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(6px);
  padding: .3rem .9rem; border-radius: 999px;
  font-size: .82rem; font-weight: 700;
  color: rgba(255,255,255,.9);
  margin-bottom: 1.75rem;
  letter-spacing: .5px;
}
.hero-countdown.en-curso {
  background: rgba(162,244,53,.2);
  border-color: rgba(162,244,53,.4);
  color: var(--verde-v);
}
.hero-scroll {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: rgba(255,255,255,.6);
  animation: bounce 2s ease-in-out infinite;
  text-decoration: none; border: none; background: none; cursor: pointer;
}
.hero-scroll span { font-size: 1.2rem; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ======================================================
   PROGRAMA
   ====================================================== */
.programa-section {
  padding: 2rem 1rem 3rem;
  max-width: 640px; margin: 0 auto;
}
.programa-titulo {
  font-size: 1.5rem; font-weight: 800;
  color: var(--escuro); margin-bottom: .5rem;
  text-align: center;
}

.cards-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .9rem; margin-bottom: .9rem;
}
.card-info { grid-column: 1 / -1; }
.card-dia {
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative; min-height: 130px;
  display: flex; flex-direction: column;
  justify-content: flex-end; border: none; text-align: left;
}
.card-dia:hover, .card-dia:focus {
  transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,.2); outline: none;
}
.card-dia:active { transform: translateY(0); }
.card-dia-bg { position: absolute; inset: 0; z-index: 0; }
.card-dia-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 20%, rgba(0,0,0,.45) 100%);
  z-index: 1;
}
.card-dia-body { position: relative; z-index: 2; padding: 1rem; color: white; }
.card-dia-emoji { font-size: 1.6rem; margin-bottom: .3rem; display: block; }
.card-dia-num { font-size: 1.5rem; font-weight: 900; line-height: 1; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.card-dia-semana { font-size: .75rem; opacity: .9; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.card-hoxe {
  position: absolute; top: .6rem; right: .6rem; z-index: 3;
  background: white; color: #222;
  font-size: .65rem; font-weight: 800;
  padding: .25rem .55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 1px;
  animation: pulseHoxe 1.5s ease-in-out infinite;
}
@keyframes pulseHoxe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.5); }
  50% { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}
.card-info {
  grid-column: 1 / -1; min-height: 80px;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative; display: flex; align-items: center; border: none;
}
.card-info:hover, .card-info:focus {
  transform: translateY(-3px); box-shadow: 0 16px 40px rgba(0,0,0,.2); outline: none;
}
.card-info-body {
  position: relative; z-index: 2;
  padding: 1.2rem 1.5rem; color: #333;
  display: flex; align-items: center; gap: 1rem; width: 100%;
}
.card-info-emoji { font-size: 2rem; }
.card-info-texto h3 { font-size: 1.1rem; font-weight: 800; color: #333; }
.card-info-texto p { font-size: .8rem; color: #666; margin-top: .1rem; }
.card-info-arrow { margin-left: auto; font-size: 1.3rem; color: #999; }

/* ======================================================
   MODAL DÍAS
   ====================================================== */
#modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
  backdrop-filter: blur(2px);
}
#modal-overlay.visible { opacity: 1; pointer-events: all; }
#modal-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
  background: white; border-radius: 20px 20px 0 0;
  max-height: 92svh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,1,.32,1);
  overscroll-behavior: contain; pointer-events: none;
}
#modal-panel.visible { transform: translateY(0); pointer-events: all; }
.modal-handle { width: 40px; height: 4px; background: #ddd; border-radius: 2px; margin: .75rem auto .25rem; }
.modal-header {
  padding: 1rem 1.2rem 1rem; color: white;
  position: sticky; top: 0; z-index: 10;
}
.modal-header-top { display: flex; justify-content: space-between; align-items: flex-start; }
.modal-titulo { font-size: 1.4rem; font-weight: 800; }
.modal-subtitulo { font-size: .85rem; opacity: .85; margin-top: .15rem; }
.modal-cerrar {
  background: rgba(255,255,255,.25); border: none; color: white;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.3rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .2s;
}
.modal-cerrar:hover { background: rgba(255,255,255,.4); }
.modal-filtros {
  display: flex; gap: .4rem; padding: .8rem 1.2rem;
  overflow-x: auto; scrollbar-width: none;
  background: white; border-bottom: 1px solid #eee;
}
.modal-filtros::-webkit-scrollbar { display: none; }
.chip-nivel {
  padding: .3rem .85rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  cursor: pointer; border: 2px solid #ddd;
  background: white; color: #666;
  white-space: nowrap; transition: all .15s ease; flex-shrink: 0;
}
.chip-nivel.activo { border-color: currentColor; color: white; }
.chip-nivel[data-nivel="Todos"].activo  { background:#555; border-color:#555; }
.chip-nivel[data-nivel="EI"].activo     { background:#f97316; border-color:#f97316; }
.chip-nivel[data-nivel="EP"].activo     { background:var(--verde); border-color:var(--verde); }
.chip-nivel[data-nivel="ESO"].activo    { background:var(--azul); border-color:var(--azul); }
.chip-nivel[data-nivel="Bach"].activo   { background:var(--rosa); border-color:var(--rosa); }
.modal-body { padding: 1rem 1.2rem 2.5rem; }
.seccion-label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 2px; color: #aaa; margin: 1.5rem 0 .75rem;
  display: flex; align-items: center; gap: .5rem;
}
.seccion-label::after { content: ''; flex: 1; height: 1px; background: #eee; }
.evento {
  display: flex; gap: .85rem;
  padding: .75rem 0; border-bottom: 1px solid #f0f0f0;
  transition: opacity .2s;
}
.evento.oculto { display: none; }
.evento.agora {
  background: linear-gradient(135deg, rgba(140,198,63,.08), rgba(45,167,223,.08));
  border-radius: 10px; padding: .75rem .85rem;
  margin: 0 -.85rem; border-bottom: none;
}
.evento-hora { font-size: .75rem; font-weight: 700; color: #999; min-width: 70px; padding-top: .15rem; white-space: nowrap; }
.evento.agora .evento-hora { color: var(--verde); }
.evento-info { flex: 1; min-width: 0; }
.evento-titulo { font-size: .95rem; font-weight: 600; color: #222; line-height: 1.35; margin-bottom: .2rem; }
.evento-lugar { font-size: .8rem; color: #888; font-style: italic; margin-bottom: .25rem; }
.evento-desc { font-size: .82rem; color: #555; line-height: 1.5; margin-top: .35rem; }
.evento-desc ul { padding-left: 1.2rem; margin-top: .3rem; }
.evento-desc li { margin-bottom: .2rem; }
.evento-desc a { color: var(--azul); font-weight: 600; }
.evento-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.badge { font-size: .65rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .5px; }
.badge-agora   { background: var(--verde); color: white; animation: pulseBadge 1.5s infinite; }
.badge-familias{ background: #e0f2fe; color: #0369a1; }
.badge-ei      { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-ep      { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-eso     { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-bach    { background: #fdf4ff; color: #7e22ce; border: 1px solid #e9d5ff; }
@keyframes pulseBadge { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.empty-nivel { text-align: center; padding: 3rem 1rem; color: #aaa; font-size: .9rem; }

/* ======================================================
   CHAT FAB
   ====================================================== */
.chat-fab {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 200;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--azul); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(45,167,223,.55);
  transition: transform .2s, box-shadow .2s;
}
.chat-fab:hover { transform: scale(1.1); box-shadow: 0 6px 26px rgba(45,167,223,.65); }
#chat-fab-ico { font-size: 1.45rem; transition: transform .25s ease; }
.chat-fab.aberto #chat-fab-ico { transform: rotate(90deg); content: '×'; }

/* ======================================================
   CHAT PANEL
   ====================================================== */
#chat-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 210;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
#chat-overlay.visible { opacity: 1; pointer-events: all; }

#chat-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0; z-index: 211;
  width: 100%; max-width: 100vw; box-sizing: border-box;
  background: white;
  border-radius: 20px 20px 0 0;
  max-height: 88svh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,1,.32,1);
  pointer-events: none;
}
#chat-panel.visible { transform: translateY(0); pointer-events: all; }

.chat-cab {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.2rem;
  background: var(--azul);
  border-radius: 20px 20px 0 0;
  flex-shrink: 0;
}
.chat-cab-info { display: flex; align-items: center; gap: .7rem; }
.chat-cab-av {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.chat-cab-nome { font-weight: 800; color: white; font-size: .95rem; }
.chat-cab-sub { font-size: .72rem; color: rgba(255,255,255,.8); }
.chat-cab-x {
  background: rgba(255,255,255,.2); border: none; color: white;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.chat-cab-x:hover { background: rgba(255,255,255,.35); }

.chat-msgs {
  flex: 1; overflow-y: auto;
  padding: 1rem .9rem .5rem;
  display: flex; flex-direction: column; gap: .6rem;
  overscroll-behavior: contain;
}

.chat-barra {
  display: flex; gap: .5rem;
  padding: .7rem .9rem;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.chat-input {
  flex: 1; padding: .6rem .95rem;
  border: 1.5px solid #ddd; border-radius: 999px;
  font-size: .88rem; outline: none;
  transition: border-color .15s; font-family: inherit;
}
.chat-input:focus { border-color: var(--azul); }
.chat-enviar {
  width: 40px; height: 40px;
  background: var(--azul); color: white;
  border: none; border-radius: 50%; cursor: pointer;
  font-size: .9rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.chat-enviar:hover { background: #1a8fc4; }

/* Mensajes */
.msg {
  display: flex; flex-direction: column;
  max-width: 88%;
  animation: msgEntra .2s ease;
}
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-bot  { align-self: flex-start; align-items: flex-start; }

@keyframes msgEntra {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

.msg-burbuja {
  padding: .6rem .9rem;
  border-radius: 16px;
  font-size: .87rem; line-height: 1.55;
  max-width: 100%;
  word-break: break-word;
}
.msg-user .msg-burbuja {
  background: var(--azul); color: white;
  border-bottom-right-radius: 4px;
}
.msg-bot .msg-burbuja {
  background: #f0f0f6; color: #222;
  border-bottom-left-radius: 4px;
}
.msg-burbuja p { margin: 0 0 .35rem; }
.msg-burbuja p:last-child { margin-bottom: 0; }
.msg-burbuja strong { font-weight: 700; }
.msg-burbuja ul.chat-ul { padding-left: 1.15rem; margin: .25rem 0 0; }
.msg-burbuja ul.chat-ul li { margin-bottom: .2rem; }

/* Quick reply chips */
.msg-chips {
  display: flex; flex-wrap: wrap; gap: .3rem;
  margin-top: .45rem; max-width: 300px;
}
.msg-chip {
  padding: .28rem .65rem;
  border: 1.5px solid var(--azul); border-radius: 999px;
  font-size: .74rem; color: var(--azul);
  background: white; cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.msg-chip:hover { background: var(--azul); color: white; }

/* Evento dentro del chat */
.chat-resp-dia {
  border-left: 3px solid var(--rc, var(--azul));
  padding-left: .7rem; margin: .2rem 0;
}
.crd-titulo {
  font-size: .7rem; font-weight: 800;
  color: var(--rc, var(--azul));
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: .45rem;
}
.crd-mas { font-size: .72rem; color: #999; padding-top: .35rem; font-style: italic; }

.chat-ev {
  display: flex; gap: .5rem;
  padding: .4rem 0;
  border-bottom: 1px solid #eee;
  align-items: flex-start;
}
.chat-ev:last-child { border-bottom: none; }
.cev-dia {
  font-size: .62rem; font-weight: 800;
  padding: .12rem .4rem; border-radius: 5px;
  color: white; white-space: nowrap; flex-shrink: 0;
  margin-top: .1rem;
}
.cev-hora {
  font-size: .7rem; font-weight: 700; color: #aaa;
  min-width: 58px; flex-shrink: 0; padding-top: .1rem;
  white-space: nowrap;
}
.cev-info { flex: 1; min-width: 0; }
.cev-titulo { font-size: .83rem; font-weight: 600; color: #222; line-height: 1.3; }
.cev-lugar { font-size: .73rem; color: #999; margin-top: .1rem; }

.chat-multilista { display: flex; flex-direction: column; gap: .8rem; }
.chat-intro { margin-bottom: .35rem !important; }
.chat-empty { color: #aaa; font-style: italic; font-size: .84rem; margin: 0; }

/* ======================================================
   FOOTER
   ====================================================== */
#footer {
  text-align: center; padding: 1.5rem 1rem;
  background: var(--escuro); color: rgba(255,255,255,.5);
  font-size: .82rem;
}
.footer-sub { font-size: .75rem; margin-top: .25rem; opacity: .6; }

/* ======================================================
   DESKTOP
   ====================================================== */
@media (max-width: 639px) {
  .hero { justify-content: center; padding-top: 25svh; }
  .hero-content { padding: 2rem 1.5rem; }
}

@media (min-width: 640px) {
  .programa-section { padding: 2.5rem 1.5rem 4rem; }
  .cards-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .card-dia { min-height: 160px; }

  #modal-panel {
    bottom: auto; top: 50%; left: 50%; right: auto;
    transform: translate(-50%, -60%);
    width: min(90vw, 680px);
    border-radius: 20px;
    max-height: 88vh; opacity: 0;
    transition: transform .3s cubic-bezier(.32,1,.32,1), opacity .3s ease;
  }
  #modal-panel.visible { transform: translate(-50%, -50%); opacity: 1; }
  .modal-handle { display: none; }

  #chat-panel {
    bottom: 1.5rem; right: 1.5rem;
    left: auto; top: auto;
    width: 370px; max-height: 560px;
    border-radius: 20px;
    transform: translateY(20px) scale(.95);
    opacity: 0;
    transition: transform .3s cubic-bezier(.32,1,.32,1), opacity .25s ease;
  }
  #chat-panel.visible { transform: translateY(0) scale(1); opacity: 1; }
  .chat-cab { border-radius: 20px 20px 0 0; }
}
