  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --rose: #f472b6;
    --turquoise: #2dd4bf;
    --purple: #a78bfa;
    --yellow: #fbbf24;
    --coral: #fb7185;
    --mint: #6ee7b7;
    --card-bg: rgba(255,255,255,0.06);
    --card-border: rgba(255,255,255,0.1);
    --text: #fff;
    --text-muted: rgba(255,255,255,0.5);
    --text-dim: rgba(255,255,255,0.25);
  }

  html, body { min-height: 100vh; font-family: 'Sora', sans-serif; }

  body {
    background: #0a0818;
    color: var(--text);
    overflow-x: hidden;
  }

  /* ── BG ── */
  .bg-gradient {
    position: fixed; inset: 0; z-index: 0;
    background: linear-gradient(135deg, #0f0520, #08111e, #071510, #0f0520);
    background-size: 400% 400%;
    animation: bgShift 15s ease infinite;
  }
  @keyframes bgShift {
    0%{background-position:0% 50%} 33%{background-position:100% 0%} 66%{background-position:50% 100%} 100%{background-position:0% 50%}
  }

  canvas { position: fixed; top:0; left:0; width:100%; height:100%; pointer-events:none; }
  #rainbowCanvas { z-index:1; opacity:0.2; }
  #starsCanvas   { z-index:2; }

  .sparkle {
    position: fixed; pointer-events: none; z-index: 3;
    animation: sparklePop var(--dur) ease-in-out infinite;
    animation-delay: var(--delay);
    font-size: var(--size); left: var(--x); top: var(--y); opacity: 0;
  }
  @keyframes sparklePop {
    0%,100%{opacity:0;transform:scale(0.3) rotate(0deg)}
    50%{opacity:1;transform:scale(1) rotate(180deg)}
  }

  /* ── LAYOUT ── */
  .app { position: relative; z-index: 10; min-height: 100vh; display: flex; flex-direction: column; }

  /* ── HEADER ── */
  .header {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky; top: 0; z-index: 50;
  }
  .header-logo {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    background: linear-gradient(90deg, var(--rose), var(--purple), var(--turquoise));
    background-size: 200% 100%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    animation: textShimmer 4s linear infinite;
  }
  .header-right {
    margin-left: auto;
  }

  .header-logo {
    font-family: 'Fraunces', serif;
    font-size: 1.1rem;
    background: linear-gradient(90deg, var(--rose), var(--purple), var(--turquoise));
    background-size: 200% 100%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    animation: textShimmer 4s linear infinite;
  }
  @keyframes textShimmer { 0%{background-position:0%} 100%{background-position:200%} }

  .header-right { display: flex; align-items: center; gap: 12px; }

  .header-name {
    font-family: 'Fraunces', serif;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(90deg, #f472b6, #a78bfa, #5eead4, #fbbf24, #f472b6);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 6s ease-in-out infinite;
  }

  @keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
  }

  .btn-logout {
    font-size: 0.75rem;
    color: var(--text-dim);
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 5px 12px;
    cursor: pointer;
    font-family: 'Sora', sans-serif;
    transition: all 0.2s;
  }
  .btn-logout:hover { border-color: var(--coral); color: var(--coral); }

  /* ── MAIN ── */
  .main { flex: 1; padding: 1.5rem 1rem 3rem; max-width: 720px; margin: 0 auto; width: 100%; }
  .main.wide { max-width: 1200px; }

  /* ── WELCOME BANNER ── */
  .welcome-banner {
    background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(45,212,191,0.1));
    border: 1px solid rgba(167,139,250,0.25);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: cardIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  @keyframes cardIn {
    from{opacity:0;transform:translateY(20px) scale(0.97)}
    to{opacity:1;transform:translateY(0) scale(1)}
  }

  .welcome-emoji { font-size: 2.5rem; flex-shrink: 0; animation: float 4s ease-in-out infinite; }
  @keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

  .welcome-text h1 {
    font-family: 'Fraunces', serif;
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 4px;
  }

  .welcome-text p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }

  .level-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    background: rgba(251,191,36,0.15);
    color: var(--yellow);
    border: 1px solid rgba(251,191,36,0.3);
    margin-top: 6px;
    letter-spacing: 0.05em;
  }

  /* ── TABS ── */
  .tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    animation: cardIn 0.6s 0.1s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  .tabs::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex: 1;
    min-width: fit-content;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Sora', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .tab-btn.active {
    background: linear-gradient(135deg, rgba(167,139,250,0.35), rgba(45,212,191,0.25));
    color: #fff;
    box-shadow: 0 2px 12px rgba(167,139,250,0.2);
  }

  .tab-count {
    background: rgba(255,255,255,0.1);
    border-radius: 99px;
    padding: 1px 7px;
    font-size: 0.7rem;
  }
  .tab-btn.active .tab-count { background: rgba(255,255,255,0.2); }

  /* ── TAB PANELS ── */
  .tab-panel { display: none; animation: fadeIn 0.3s ease; }
  .tab-panel.active { display: block; }
  @keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }

  /* ── SECTION TITLE ── */
  .section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    margin-top: 1.25rem;
    padding-left: 2px;
  }
  .section-title:first-child { margin-top: 0; }

  /* ── CARD ── */
  .card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
  }
  .card:hover { border-color: rgba(255,255,255,0.18); }

  /* ── MESSAGE CARD ── */
  .message-card {
    background: linear-gradient(135deg, rgba(167,139,250,0.12), rgba(45,212,191,0.08));
    border: 1px solid rgba(167,139,250,0.25);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
  }

  .message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
  }

  .message-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rose), var(--purple));
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
  }

  .message-meta { flex: 1; }
  .message-from { font-size: 0.82rem; font-weight: 600; color: #fff; }
  .message-date { font-size: 0.72rem; color: var(--text-muted); }
  .message-body { font-size: 0.85rem; color: rgba(255,255,255,0.75); line-height: 1.7; white-space: pre-wrap; }

  /* ── MATERIAL CARD ── */
  .material-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s;
  }

  .material-header {
    display: flex; align-items: center; gap: 12px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    min-height: 64px;
    color: #F4F0FA;
    text-decoration: none;
  }

  .material-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
  }
  .material-icon.pdf       { background: rgba(248,113,113,0.15); }
  .material-icon.texto     { background: rgba(251,191,36,0.15); }
  .material-icon.ejercicio { background: rgba(110,231,183,0.15); }
  .material-icon.juego     { background: rgba(167,139,250,0.15); }
  .material-icon.video     { background: rgba(96,165,250,0.15); }
  .material-icon.ficha     { background: rgba(244,114,182,0.15); }

  .material-info { flex: 1; min-width: 0; }
  .material-title {
    font-size: 0.9rem; font-weight: 500; color: #F4F0FA;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 3px;
  }
  .material-meta {
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
    color: #B8AECB;
  }

  .badge {
    font-size: 0.65rem; font-weight: 600; padding: 2px 8px;
    border-radius: 99px; letter-spacing: 0.04em;
  }
  .badge-level { background: rgba(251,191,36,0.15); color: var(--yellow); }
  .badge-usage { background: rgba(255,255,255,0.08); color: var(--text-muted); }
  .badge-done  { background: rgba(45,212,191,0.15); color: var(--turquoise); }
  .badge-pending { background: rgba(251,191,36,0.15); color: var(--yellow); }

  .material-chevron { font-size: 1.2rem; color: var(--text-dim); transition: transform 0.2s; flex-shrink: 0; }
  .material-card.open .material-chevron { transform: rotate(90deg); }

  .material-body {
    display: none;
    border-top: 1px solid var(--card-border);
    padding: 1.25rem;
  }
  .material-card.open .material-body { display: block; }

  /* ── BUTTONS ── */
  .btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: 10px;
    font-family: 'Sora', sans-serif; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; text-decoration: none;
    background: linear-gradient(135deg, var(--purple), var(--turquoise));
    color: #fff; transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 6px;
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(167,139,250,0.3); }

  .btn-block { display: flex; width: 100%; margin-top: 10px; }

  /* ── EXERCISE ── */
  .ex-input {
    border: none; border-bottom: 2px solid var(--purple);
    background: transparent; color: #fff;
    font-size: 0.9rem; width: 120px; outline: none;
    text-align: center; padding: 2px 4px;
    font-family: 'Sora', sans-serif;
  }

  .ex-opt {
    display: inline-block; padding: 5px 14px; border-radius: 99px;
    border: 1.5px solid rgba(255,255,255,0.15); background: transparent;
    font-family: 'Sora', sans-serif; font-size: 0.82rem; color: var(--text-muted);
    cursor: pointer; transition: all 0.15s; margin: 2px;
  }
  .ex-opt:hover { border-color: var(--purple); color: var(--purple); }
  .ex-opt.selected { background: var(--purple); border-color: var(--purple); color: #fff; }

  .ex-textarea {
    width: 100%; min-height: 120px; padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; color: #fff;
    font-family: 'Sora', sans-serif; font-size: 0.85rem;
    resize: vertical; outline: none;
  }
  .ex-textarea:focus { border-color: rgba(167,139,250,0.5); }

  /* ── FEEDBACK CARD ── */
  .feedback-card {
    background: rgba(251,191,36,0.06);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
  }
  .feedback-date { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 6px; }
  .feedback-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
  .feedback-tag { font-size: 0.65rem; padding: 2px 8px; border-radius: 99px; background: rgba(251,191,36,0.15); color: var(--yellow); }
  .feedback-text { font-size: 0.85rem; color: rgba(255,255,255,0.75); line-height: 1.7; white-space: pre-wrap; }

  /* ── EMPTY STATE ── */
  .empty {
    text-align: center; padding: 2.5rem 1rem;
    color: var(--text-dim); font-size: 0.85rem; line-height: 2;
  }
  .empty-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

  /* ── LOADING ── */
  .loading { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 0.85rem; }

  /* ── PDF FRAME ── */
  .pdf-frame { width: 100%; height: 380px; border: 1px solid var(--card-border); border-radius: 10px; margin-top: 10px; }
  @media(min-width:600px){ .pdf-frame{height:520px;} }

  .video-frame { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 10px; margin-top: 10px; }

  /* ── CORRECTION BOX ── */
  .correction-box {
    background: rgba(45,212,191,0.08);
    border: 1px solid rgba(45,212,191,0.25);
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 12px;
  }
  .correction-grade { font-size: 0.82rem; font-weight: 600; color: var(--turquoise); margin-bottom: 4px; }
  .correction-feedback { font-size: 0.82rem; color: rgba(255,255,255,0.65); line-height: 1.6; }

  @media(min-width:600px){
    .main { padding: 2rem 1.5rem 3rem; }
    .welcome-banner { padding: 1.75rem; }
    .welcome-text h1 { font-size: 1.6rem; }
  }

  .header-menu-btn,
.header-icon-btn,
.header-avatar-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.header-menu-btn:hover,
.header-icon-btn:hover,
.header-avatar-btn:hover {
  background: rgba(167,139,250,0.2);
  border-color: #a78bfa;
}

.header-avatar-btn {
  font-size: 1.3rem;
}

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-link-btn {
  position: relative;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 999px;
  height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.2s;
}
.new-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f472b6;
  border: 2px solid #160F24;
  box-shadow: 0 0 6px rgba(244,114,182,0.7);
}
.header-link-btn:hover {
  background: rgba(167,139,250,0.2);
  border-color: #a78bfa;
}
.header-link-btn-public {
  background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(244,114,182,0.15));
  border-color: rgba(251,191,36,0.3);
}
.header-link-btn-public:hover {
  background: linear-gradient(135deg, rgba(251,191,36,0.28), rgba(244,114,182,0.28));
  border-color: rgba(251,191,36,0.55);
}
@media (max-width: 700px) {
  .header-link-btn-text { display: none; }
  .header-link-btn { width: 34px; height: 34px; padding: 0; justify-content: center; }

  /* Logo + nombre + 2 botones de recursos + 3 iconos no caben en ~375px aunque los
     botones de recursos ya colapsen a solo icono — sigue sobrando bastante ancho. */
  .header { padding: 1rem 0.85rem; gap: 0.5rem; }
  .header-logo { font-size: 0.95rem; }
  .header-name { display: none; }
  .header-right { gap: 6px; }
  .header-icon-btn, .header-avatar-btn { width: 34px; height: 34px; }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: rgba(20,10,30,0.98);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--card-border);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
}
.sidebar-title {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  color: #fff;
}
.sidebar-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.6;
}
.sidebar-close:hover {
  opacity: 1;
}
.sidebar-nav {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-link {
  display: block;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.2s;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
}
.sidebar-link.active {
  background: rgba(167,139,250,0.2);
  color: #a78bfa;
}
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 0.5rem 0;
}
.sidebar-logout {
  color: #f472b6;
}

.class-card {
  display: flex;
  gap: 1rem;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
}
.class-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  min-width: 64px;
}
.class-day {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  color: #fff;
  font-weight: 700;
}
.class-month {
  font-size: 0.75rem;
  color: #fff;
  text-transform: uppercase;
}
.class-info {
  flex: 1;
}
.class-info h3 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  color: #fff;
}
.class-info p {
  margin: 4px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.class-link {
  display: inline-block;
  margin-top: 8px;
  color: #5eead4;
  text-decoration: none;
  font-size: 0.9rem;
}

.avatar-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}
.avatar-popup-overlay.open {
  display: block;
}
.avatar-popup {
  position: fixed;
  top: 70px;
  right: 1.5rem;
  background: rgba(20,10,30,0.98);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1rem;
  width: 280px;
  z-index: 90;
  display: none;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.avatar-popup.open {
  display: block;
}
.avatar-popup-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.avatar-popup-img {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.avatar-popup-header h3 {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  color: #fff;
}
.avatar-popup-header p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.avatar-popup-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 6px;
  text-align: left;
  transition: background 0.2s;
}
.avatar-popup-btn:hover {
  background: rgba(167,139,250,0.15);
}
.avatar-popup-logout {
  color: #f472b6;
}
.settings-section {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}
.main.wide .settings-section { max-width: 100%; }
.settings-section h2 {
  font-family: 'Fraunces', serif;
  color: #fff;
  margin-bottom: 1.5rem;
}
.settings-section h3 {
  font-family: 'Fraunces', serif;
  color: #fff;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}
.settings-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.avatar-option, .avatar-upload {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 0.5rem;
  cursor: pointer;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-option:hover {
  border-color: rgba(167,139,250,0.5);
}
.avatar-option.selected {
  border-color: #a78bfa;
  background: rgba(167,139,250,0.15);
}
.avatar-option img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.avatar-upload {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}
.settings-field {
  margin-bottom: 1rem;
}
.settings-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.settings-field input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: 'Sora', sans-serif;
  box-sizing: border-box;
}
.settings-btn {
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  margin-top: 0.5rem;
}

.btn-back-view {
  background: none;
  border: none;
  color: #a78bfa;
  font-family: 'Sora', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 0;
}
.btn-back-view:hover {
  text-decoration: underline;
}

.msg-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f472b6;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.toast-notification {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  background: rgba(167,139,250,0.95);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 9999;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 70vh;
  max-width: 700px;
  margin: 0 auto;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.chat-header h2 {
  margin: 0;
  font-family: 'Fraunces', serif;
  color: #fff;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 60vh;
  min-height: 300px;
}
.chat-day-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.6rem 0;
}
.chat-day-sep span {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted, #a89bc4);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 999px;
}
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}
.chat-msg.mine {
  justify-content: flex-end;
  flex-direction: row-reverse;
}
.chat-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-msg-col {
  display: flex;
  flex-direction: column;
  max-width: 68%;
}
.chat-msg.mine .chat-msg-col { align-items: flex-end; }
.chat-msg.theirs .chat-msg-col { align-items: flex-start; }
.chat-msg-bubble {
  padding: 0.65rem 1rem;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: break-word;
}
.chat-msg.theirs .chat-msg-bubble {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.09);
  color: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.chat-msg.mine .chat-msg-bubble {
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(167,139,250,0.28);
}
.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 3px;
  padding: 0 4px;
}
.chat-msg-time {
  font-size: 0.68rem;
  color: var(--text-muted, #a89bc4);
}
.chat-msg-actions {
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.chat-msg:hover .chat-msg-actions {
  opacity: 1;
}
.chat-msg-action {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 4px;
  opacity: 0.7;
  line-height: 1;
}
.chat-msg-action:hover {
  opacity: 1;
}
.chat-msg-edited {
  font-size: 0.7rem;
  opacity: 0.85;
  font-style: italic;
}
.chat-msg-bubble.chat-msg-deleted {
  font-style: italic;
  opacity: 0.6;
  background: rgba(255,255,255,0.04);
  box-shadow: none;
}

/* ── Adjuntos en el chat ── */
.chat-attachment-img {
  display: block;
  max-width: 200px;
  max-height: 200px;
  border-radius: 14px;
  cursor: pointer;
  margin-bottom: 4px;
}
.chat-attachment-file {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  color: inherit;
  margin-bottom: 4px;
  max-width: 220px;
}
.chat-attachment-icon { font-size: 1.3rem; flex-shrink: 0; }
.chat-attachment-name {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.chat-attachment-download { opacity: 0.7; flex-shrink: 0; }
.chat-img-viewer-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}
.chat-img-viewer-bg img {
  max-width: 100%; max-height: 100%;
  border-radius: 8px;
}
.chat-attach-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.chat-attach-btn:hover { background: rgba(167,139,250,0.15); }
.chat-msg-edit {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  justify-content: flex-end;
}
.chat-msg-edit-input {
  max-width: 60%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 0.5rem 0.85rem;
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-size: 0.9rem;
}
.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  position: relative;
}
.emoji-picker-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 1101;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-radius: 12px;
  overflow: hidden;
}
.emoji-picker-popover emoji-picker {
  --background: #1c1030;
  --border-color: rgba(255,255,255,0.1);
  --indicator-color: #f472b6;
  --input-border-color: rgba(255,255,255,0.15);
  --input-font-color: #fff;
  --input-placeholder-color: #a89bc4;
  --button-active-background: rgba(167,139,250,0.25);
  --button-hover-background: rgba(167,139,250,0.15);
  --category-font-color: #fff;
  width: min(320px, 80vw);
  height: 350px;
}
.chat-input-area input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: 'Sora', sans-serif;
}
.chat-input-area button {
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  border: none;
  color: #fff;
  padding: 0 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.chat-modal-bg.open { display: flex; }
.chat-modal {
  background: #14092a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  height: 75vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.25rem;
}
@media (max-width: 480px) {
  .chat-modal-bg { padding: 0.5rem; }
  .chat-modal { padding: 0.85rem; height: 85vh; }
  .chat-input-area button { padding: 0 1rem; }
}
.chat-modal .chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.5rem;
}
.chat-modal .chat-header h2 {
  margin: 0;
  font-family: 'Fraunces', serif;
  color: #fff;
  font-size: 1.2rem;
}
.chat-close {
  background: rgba(255,255,255,0.06);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}
.chat-close:hover {
  background: rgba(244,114,182,0.3);
}
/* ── EJERCICIOS — sección activa ───────────── */
.active-exercise {
  position: relative;
  background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(244,114,182,0.12));
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 20px;
  padding: 2rem;
  overflow: hidden;
  text-align: center;
}
.active-empty {
  background: linear-gradient(135deg, rgba(45,212,191,0.1), rgba(167,139,250,0.08));
  border-color: rgba(45,212,191,0.25);
}
.active-glow {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 30% 30%, rgba(244,114,182,0.18), transparent 50%);
  pointer-events: none;
}
.active-content { position: relative; z-index: 1; }
.active-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #a78bfa;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.active-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.active-title {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  color: #fff;
  margin: 0 0 0.4rem 0;
}
.active-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}
.active-btn {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  background: linear-gradient(135deg, #a78bfa, #f472b6);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s;
}
.active-btn:hover { transform: scale(1.04); }
.active-more {
  margin-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── DROPZONE GRANDE ───────────────────────── */
.big-dropzone {
  background: rgba(167,139,250,0.06);
  border: 2px dashed rgba(167,139,250,0.4);
  border-radius: 18px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: all 0.25s;
}
.big-dropzone:hover { border-color: #a78bfa; background: rgba(167,139,250,0.1); }
.big-dropzone-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.big-dropzone-btn { font-size: 1rem; padding: 0.8rem 2rem; }
.big-dropzone-hint {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── TIMELINE ──────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, #fbbf24, #f472b6, #a78bfa);
  border-radius: 2px;
}
.tl-item {
  position: relative;
  margin-bottom: 1.2rem;
}
.tl-dot {
  position: absolute;
  left: -1.95rem;
  top: 1.1rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #0f0f1f;
  box-shadow: 0 0 0 2px currentColor;
}
.dot-yellow { background: #fbbf24; color: #fbbf24; }
.dot-pink   { background: #f472b6; color: #f472b6; }
.dot-purple { background: #a78bfa; color: #a78bfa; }
.tl-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 1rem 1.2rem;
}
.tl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.tl-name {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.tl-name:hover { color: #a78bfa; }
.tl-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.tl-feedback {
  margin-top: 0.8rem;
  padding: 0.8rem 1rem;
  background: rgba(167,139,250,0.1);
  border-left: 3px solid #a78bfa;
  border-radius: 8px;
  font-size: 0.9rem;
}
.ex-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.ex-badge-yellow { background: rgba(251,191,36,0.18); color: #fbbf24; }
.ex-badge-pink   { background: rgba(244,114,182,0.18); color: #f472b6; }
.ex-badge-purple { background: rgba(167,139,250,0.18); color: #a78bfa; }

.tl-corrected {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.7rem 1.2rem;
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s;
}
.tl-corrected:hover { transform: scale(1.04); }
.home-greeting {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  color: #fff;
  margin: 0 0 0.4rem 0;
  text-align: center;
}
.home-sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 1rem;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  max-width: 900px;
  margin: 0 auto;
}
.home-card {
  position: relative;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 2rem 1.4rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  overflow: hidden;
}
.home-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(167,139,250,0.08));
  opacity: 0;
  transition: opacity 0.25s;
}
.home-card:hover {
  transform: translateY(-4px);
  border-color: rgba(167,139,250,0.4);
  box-shadow: 0 12px 32px rgba(167,139,250,0.15);
}
.home-card:hover::before { opacity: 1; }
.home-card-files:hover    { border-color: rgba(45,212,191,0.5); }
.home-card-feedback:hover { border-color: rgba(244,114,182,0.5); }
.home-card-classes:hover  { border-color: rgba(251,191,36,0.5); }
.home-card-progress:hover { border-color: rgba(95,214,208,0.5); }
.home-card-whatsapp {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1rem 1.5rem;
  background: rgba(37,211,102,0.12);
  border-color: rgba(37,211,102,0.35);
}
.home-card-whatsapp:hover {
  border-color: rgba(37,211,102,0.6);
  background: rgba(37,211,102,0.18);
}
.home-card-whatsapp .home-card-icon { font-size: 1.6rem; margin-bottom: 0; }
.home-card-whatsapp-text { text-align: left; }
.home-card-whatsapp-text h3 { font-size: 1.05rem; margin: 0; }
.home-card-whatsapp-text p { font-size: 0.82rem; margin: 0; }
.home-card-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
}
.home-card h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  color: #fff;
  margin: 0 0 0.3rem 0;
}
.home-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}
.home-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #f472b6;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 26px;
  height: 26px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  box-shadow: 0 2px 8px rgba(244,114,182,0.5);
}
/* ── Racha diaria de ejercicios ── */
.streak-card {
  position: relative;
  max-width: 640px;
  margin: 0 auto 2.5rem;
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  padding: 1.8rem 1.8rem 2rem;
  overflow: hidden;
}
.streak-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rose), var(--yellow), var(--turquoise), var(--purple));
  background-size: 300% 100%;
  animation: streakBorderDrift 6s linear infinite;
}
@keyframes streakBorderDrift {
  0% { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}

.streak-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.4rem;
}
.streak-flame-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1;
}
.streak-flame {
  font-size: 2.6rem;
  display: inline-block;
  animation: streakFlamePulse 2.2s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(251,146,60,.55));
}
.streak-flame.out {
  animation: none;
  filter: none;
  opacity: 0.35;
}
@keyframes streakFlamePulse {
  0%, 100% { transform: scale(1) rotate(-2deg); filter: drop-shadow(0 0 8px rgba(251,146,60,.5)); }
  50%      { transform: scale(1.12) rotate(2deg); filter: drop-shadow(0 0 18px rgba(251,146,60,.85)); }
}
.streak-count {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 3.4rem;
  line-height: 1;
  background: linear-gradient(135deg, var(--yellow), var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: streakPopIn .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes streakPopIn {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
.streak-count.bump { animation: streakPopIn .45s cubic-bezier(.34,1.56,.64,1); }

.confetti-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  opacity: 0.95;
  animation-name: confettiFall;
  animation-timing-function: cubic-bezier(.25,.6,.4,1);
  animation-fill-mode: forwards;
}
@keyframes confettiFall {
  0%   { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)); opacity: 0; }
}
.streak-label {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.streak-longest {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.streak-done {
  text-align: center;
  padding: 1.4rem 1rem 0.4rem;
}
.streak-done-icon { font-size: 2rem; display: block; margin-bottom: 0.6rem; }
.streak-done p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.streak-exercise-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--turquoise);
  text-align: center;
  margin-bottom: 0.6rem;
}
.streak-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}
.streak-progress-dots {
  display: flex;
  gap: 0.4rem;
}
.streak-progress-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.2);
  transition: all 0.25s;
}
.streak-progress-dot.filled {
  background: var(--turquoise);
  border-color: var(--turquoise);
  box-shadow: 0 0 8px rgba(45,212,191,0.6);
  transform: scale(1.15);
}
.streak-progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.streak-question {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 500;
  color: #fff;
  text-align: center;
  line-height: 1.4;
  margin-bottom: 1.3rem;
  padding: 0 0.5rem;
}
.streak-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.streak-opt-btn {
  font-family: 'Sora', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  padding: 0.7rem 1.3rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.streak-opt-btn:hover:not(:disabled) {
  border-color: var(--turquoise);
  color: var(--turquoise);
  transform: translateY(-2px);
}
.streak-opt-btn:disabled { cursor: default; }
.streak-opt-btn.right { background: var(--turquoise); border-color: var(--turquoise); color: #071510; }
.streak-opt-btn.wrong { background: var(--rose); border-color: var(--rose); color: #2d0b18; }

.streak-fill-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.streak-fill-input {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  min-width: 220px;
  text-align: center;
}
.streak-fill-input:focus { outline: none; border-color: var(--purple); }
.streak-submit-btn {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--rose), var(--purple));
  color: #fff;
  border: none;
  padding: 0.7rem 1.6rem;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.streak-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(167,139,250,0.35);
}
.streak-submit-btn:disabled { opacity: 0.5; cursor: default; }

.streak-feedback {
  text-align: center;
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0.4rem;
}
.streak-feedback.correct {
  background: rgba(45,212,191,0.14);
  border: 1px solid rgba(45,212,191,0.4);
  color: #cffafe;
  animation: streakCorrectFlash .6s ease-out;
}
.streak-feedback.wrong {
  background: rgba(244,114,182,0.14);
  border: 1px solid rgba(244,114,182,0.4);
  color: #ffe4ef;
  animation: streakShake .5s;
}
.streak-feedback b { display: block; font-size: 1rem; margin-bottom: 0.2rem; }
.streak-next-btn {
  display: block;
  margin: 0.8rem auto 0;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  background: linear-gradient(135deg, var(--rose), var(--purple));
  color: #fff;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.streak-next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(167,139,250,0.35);
}
@keyframes streakCorrectFlash {
  0%   { box-shadow: 0 0 0 0 rgba(45,212,191,.55); }
  100% { box-shadow: 0 0 0 22px rgba(45,212,191,0); }
}
@keyframes streakShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}
.streak-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.6rem 0 0.2rem;
}

.progress-mistakes {
  text-align: left;
}
.streak-mistakes-loading, .streak-mistakes-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.streak-mistakes-group { margin-bottom: 1.2rem; }
.streak-mistakes-group:last-child { margin-bottom: 0; }
.streak-mistakes-theme {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--turquoise);
  margin-bottom: 0.6rem;
}
.streak-mistake-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}
.streak-mistake-item:last-child { margin-bottom: 0; }
.streak-mistake-question {
  color: #fff;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}
.streak-mistake-answer {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}
.streak-mistake-ratio {
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── MI PROGRESO ── */
.progress-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 2rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
}
.progress-section-title {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  margin: 2.2rem 0 1rem;
}
.progress-map { display: flex; flex-direction: column; gap: 0.7rem; }
.progress-level-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 1rem 1.1rem;
}
.progress-level-card summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  list-style: none;
}
.progress-level-card summary::-webkit-details-marker { display: none; }
.progress-level-name {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
  width: 2.4rem;
  flex-shrink: 0;
}
.progress-level-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.progress-level-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5FD6D0, #C874E8);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-level-frac {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 3.2rem;
  text-align: right;
}
.progress-topics-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.5rem;
}
.progress-topic-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.82rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}
.progress-topic-chip-icon { font-size: 0.9rem; flex-shrink: 0; }
.progress-topic-chip.status-not_seen { color: var(--text-dim); }
.progress-topic-chip.status-in_progress {
  color: #FFD166;
  border-color: rgba(255,209,102,0.3);
  background: rgba(255,209,102,0.06);
}
.progress-topic-chip.status-mastered {
  color: #5FD6D0;
  border-color: rgba(95,214,208,0.3);
  background: rgba(95,214,208,0.06);
}

@media (prefers-reduced-motion: reduce) {
  .streak-flame, .streak-count, .streak-feedback.correct, .streak-feedback.wrong, .streak-card::before {
    animation: none !important;
  }
}

a.header-logo {
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
a.header-logo:hover { opacity: 0.85; }
.view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.view-header h2 { margin: 0; }
.btn-home {
  background: linear-gradient(135deg, #fbbf24, #f472b6, #a78bfa, #2dd4bf);
  background-size: 200% 200%;
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(167,139,250,0.3);
  animation: rainbow-shift 3s ease infinite;
  transition: transform 0.2s;
  white-space: nowrap;
}
.btn-home:hover { transform: scale(1.08); }
@keyframes rainbow-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.btn-home:hover { transform: scale(1.05); }
@keyframes rainbow-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.ex-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: start;
}
.ex-col-right {
  position: sticky;
  top: 1rem;
}
.ex-active-wrap { min-height: 200px; }

@media (max-width: 768px) {
  .ex-layout { grid-template-columns: 1fr; }
  .ex-col-right { position: static; }
}
@media (max-width: 768px) {
  .ex-layout .ex-col-right { order: -1; }
}
/* ── Banner de anuncios (panel alumna) ── */
.announce-banner{
  margin-bottom:1.2rem;
  display:flex;
  flex-direction:column;
  gap:.6rem;
}
.announce-banner-item{
  display:flex;
  align-items:flex-start;
  gap:.7rem;
  background:linear-gradient(135deg, rgba(200,116,232,.14), rgba(255,111,145,.1));
  border:1px solid rgba(200,116,232,.28);
  border-radius:14px;
  padding:.85rem 1.1rem;
}
.announce-banner-icon{
  font-size:1.05rem;
  flex-shrink:0;
  line-height:1.4;
}
.announce-banner-msg{
  color:#F5F0FA;
  font-size:.9rem;
  line-height:1.5;
}

/* ── Banner de instalación PWA (panel alumna) ── */
.install-banner{
  margin-bottom:1.2rem;
}
.install-banner-item{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:.7rem;
  background:linear-gradient(135deg, rgba(244,114,182,.16), rgba(167,139,250,.14));
  border:1px solid rgba(244,114,182,.32);
  border-radius:14px;
  padding:.85rem 1.1rem;
}
.install-banner-icon{
  font-size:1.3rem;
  flex-shrink:0;
  line-height:1.4;
}
.install-banner-msg{
  color:#F5F0FA;
  font-size:.9rem;
  line-height:1.5;
  flex:1 1 220px;
}
.install-banner-btn{
  background:linear-gradient(135deg, #f472b6, #a78bfa);
  color:#160F24;
  font-weight:700;
  font-size:.85rem;
  border:none;
  border-radius:999px;
  padding:.5rem 1.1rem;
  cursor:pointer;
  white-space:nowrap;
}
.install-banner-close{
  background:none;
  border:none;
  color:#B3A5CB;
  font-size:1rem;
  cursor:pointer;
  padding:.2rem .4rem;
  line-height:1;
}
.install-banner-close:hover{ color:#F5F0FA; }

.news-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.news-item:last-child { margin-bottom: 0; }
.news-item:hover { border-color: rgba(167,139,250,0.4); }
.news-item.unread {
  border-color: rgba(244,114,182,0.4);
  background: rgba(244,114,182,0.06);
}
.news-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.news-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f472b6;
  box-shadow: 0 0 6px rgba(244,114,182,0.7);
  flex-shrink: 0;
}
.news-item-title {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}
.news-item-date {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin: 0.2rem 0 0.5rem;
}
.news-item-body {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item.expanded .news-item-body {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}