html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:root {
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --primary: #4A90D9;
  --primary-dark: #3574B5;
  --text: #2C3542;
  --muted: #7A8699;
  --exam-color: #E8654B;
  --success: #4CAF50;
  --border: #E3E8EF;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overscroll-behavior: none; /* evita el rebote elástico de iOS que desplaza los elementos fijos */
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  position: fixed;
  width: 100%;
  overflow: hidden; /* el body ya no hace scroll: solo lo hace #mainScroll */
}

.hidden { display: none !important; }

/* --- Auth --- */
#authView {
  height: 100%;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.auth-card h1 { text-align: center; margin-top: 0; color: var(--primary-dark); }
.auth-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 16px;
}
.auth-card button {
  width: 100%; padding: 13px; border: none; border-radius: 10px;
  background: var(--primary); color: white; font-size: 16px; font-weight: 600; cursor: pointer;
}
.auth-switch { text-align: center; margin-top: 14px; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--primary); cursor: pointer; font-weight: 600; }
.error-msg { color: var(--exam-color); font-size: 14px; margin-bottom: 10px; }

.btn-how-it-works {
  width: 100%; padding: 13px; border: none; border-radius: 10px; margin-top: 4px;
  background: var(--primary); color: #FFFFFF; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-how-it-works:hover, .btn-how-it-works:active, .btn-how-it-works:focus {
  background: var(--primary); color: #FFFFFF;
}
.how-it-works-card { max-width: 380px; text-align: left; }
.how-it-works-card h3 { text-align: center; }
.how-it-works-intro { color: var(--text); font-size: 14px; line-height: 1.5; }
.how-it-works-disclaimer {
  background: #FDEEE9; border: 1px solid var(--exam-color); border-radius: 10px;
  padding: 12px 14px; margin-top: 16px; margin-bottom: 4px;
  color: var(--text); font-size: 13px; line-height: 1.5;
}
.how-it-works-example-title { font-weight: 700; color: var(--text); margin-top: 18px; margin-bottom: 6px; }
.how-it-works-steps { padding-left: 20px; margin: 0 0 18px; color: var(--text); font-size: 14px; line-height: 1.6; }
.how-it-works-steps li { margin-bottom: 8px; }

/* --- Layout --- */
#appView {
  height: 100vh;
  height: 100dvh; /* usa la altura real visible en iOS, evita saltos al mostrar/ocultar barras */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* red de seguridad: nada debe desbordar fuera de esta columna fija */
}
header.topbar {
  flex-shrink: 0;
  background: var(--primary);
  color: white;
  padding: 18px 20px;
  padding-top: max(18px, env(safe-area-inset-top));
  display: flex; justify-content: space-between; align-items: center;
}
header.topbar h1 { font-size: 18px; margin: 0; }

main {
  flex: 1;
  min-height: 0; /* imprescindible: si no, el contenido largo empuja el menú fuera de la pantalla en vez de hacer scroll dentro de main */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px; max-width: 720px; margin: 0 auto; width: 100%;
}

nav.tabbar {
  flex-shrink: 0;
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; padding: 6px 2px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
nav.tabbar button {
  flex: 1 1 0; min-width: 0; background: none; border: none; color: var(--muted); font-size: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 1px;
}
nav.tabbar button.active { color: var(--primary); font-weight: 700; }
nav.tabbar span.icon { font-size: 18px; }

/* --- Horario semanal --- */
/* Sin scroll propio: el horario se ajusta al ancho de la pantalla y así no se confunde con el scroll de la página */
.schedule-grid-wrapper { overflow: visible; }
.schedule-grid {
  display: grid;
  grid-template-columns: 32px repeat(7, minmax(38px, 1fr));
  gap: 3px;
  font-size: 11px;
  min-width: 340px;
  margin: 0 auto;
}
.schedule-grid .head { text-align: center; font-weight: 700; padding: 6px 2px; color: var(--muted); }
.schedule-grid .hour { text-align: right; padding-right: 4px; color: var(--muted); font-size: 10px; }
.schedule-cell {
  border-radius: 6px; min-height: 30px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 2px; color: white; font-weight: 600; line-height: 1.15; font-size: 10px;
}
.schedule-cell.exam { outline: 2px solid var(--exam-color); }
.empty-cell { background: transparent; }

.schedule-slot-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; font-size: 14px;
}
.schedule-slot-chip .remove-slot { background: none; border: none; color: var(--exam-color); font-size: 16px; cursor: pointer; padding: 0 4px; }

/* --- Cards --- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card h3 { margin-top: 0; }
.subject-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 20px; color: white; font-weight: 600; margin: 4px 6px 4px 0; font-size: 14px;
}
.subject-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.subject-row:last-child { border-bottom: none; }
.subject-row input[type="color"] {
  width: 32px; height: 32px; padding: 0; border: none; border-radius: 8px; flex-shrink: 0; margin: 0;
}
.subject-row-name { flex: 1; font-size: 15px; font-weight: 500; }
.btn {
  padding: 10px 18px; border: none; border-radius: 10px; background: var(--primary);
  color: white; font-weight: 600; cursor: pointer; font-size: 14px;
}
.btn.secondary { background: var(--border); color: var(--text); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; margin-bottom: 10px; font-family: inherit;
}

.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 4px 0 6px; }

.radio-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.radio-row label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; cursor: pointer; }
.radio-row input[type="radio"] { margin: 0; width: auto; }

.note-check-list { border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; margin-bottom: 10px; max-height: 180px; overflow-y: auto; }
.note-check-item {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.note-check-item:last-child { border-bottom: none; }
.note-check-item input[type="checkbox"] { margin-top: 3px; }
.note-check-item label { min-width: 0; font-size: 14px; line-height: 1.4; cursor: pointer; word-wrap: break-word; overflow-wrap: break-word; }
.note-check-item .note-check-date { display: block; font-size: 12px; color: var(--muted); }

.grade-badge {
  display: inline-block; padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 14px;
  color: white;
}
.grade-good { background: var(--success); }
.grade-mid { background: #F0A93E; }
.grade-bad { background: var(--exam-color); }

.exam-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.exam-item:last-child { border-bottom: none; }

.status-msg { margin-top: 10px; font-size: 14px; }

.question-block { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.option-label {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer;
}
.option-label input[type="radio"] { margin-top: 3px; }
.option-label span { min-width: 0; word-wrap: break-word; overflow-wrap: break-word; line-height: 1.4; }
.option-label:has(input:checked) { border-color: var(--primary); background: #EAF2FB; }

.feedback-box { background: #F0F4F9; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-top: 8px; }

.upload-box {
  border: 2px dashed var(--border); border-radius: 12px; padding: 24px; text-align: center; color: var(--muted);
  cursor: pointer; margin-bottom: 14px;
}

/* --- Suscripción / Paywall --- */
.topbar-sub-badge {
  background: rgba(255,255,255,0.2); border: none; color: white; font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 20px; cursor: pointer;
}
.paywall-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.paywall-card {
  background: var(--card); border-radius: var(--radius); padding: 26px 22px; max-width: 340px; width: 100%;
  text-align: center; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.paywall-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; }
.paywall-card h3 { margin: 8px 0 10px; }
.paywall-card p { color: var(--text); font-size: 14px; margin-bottom: 18px; line-height: 1.4; }

/* --- Estadísticas (solo administrador) --- */
.stats-card { max-width: 440px; text-align: left; }
.stats-card h3 { text-align: center; }
.stats-updated { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.stats-section { margin-top: 14px; }
.stats-section h4 { margin: 0 0 6px; font-size: 14px; color: var(--primary-dark); }
.stats-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.stats-row span:last-child { font-weight: 700; white-space: nowrap; }
.stats-user { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.stats-user small { color: var(--muted); }

.profile-sub-status {
  display: inline-block; padding: 6px 16px; border-radius: 20px; font-weight: 700; font-size: 13px;
}
.profile-sub-status.premium { background: #EAF3DE; color: #27500A; }
.profile-sub-status.free { background: var(--bg); color: var(--muted); }

/* --- Menú hamburguesa --- */
.hamburger-wrap { position: relative; }
.hamburger-btn {
  background: none; border: none; width: 34px; height: 34px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; cursor: pointer; padding: 0;
}
.hamburger-btn span { display: block; width: 22px; height: 2px; background: white; border-radius: 2px; }
.hamburger-menu {
  position: absolute; top: 42px; right: 0; background: var(--card); border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18); overflow: hidden; min-width: 170px; z-index: 500;
}
.hamburger-menu-item {
  display: block; width: 100%; text-align: left; padding: 12px 16px; background: none; border: none;
  font-size: 14px; color: var(--text); cursor: pointer;
}
.hamburger-menu-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.hamburger-menu-item:hover { background: var(--bg); }

/* --- Calendario mensual (Inicio) --- */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-header h3 { margin: 0; }
.cal-nav { background: var(--bg); border: none; border-radius: 8px; width: 32px; height: 32px; font-size: 18px; color: var(--primary); cursor: pointer; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-daylabel { font-size: 11px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal-cell {
  position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 13px; background: var(--bg); cursor: pointer;
}
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.today { background: var(--primary); color: white; font-weight: 700; }
.cal-cell.selected { outline: 2px solid var(--primary); font-weight: 700; }
.cal-cell.has-exam:not(.today) { background: #FDEDE9; color: var(--exam-color); font-weight: 700; }
.cal-dot { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--exam-color); }
.cal-cell.today .cal-dot { background: white; }

/* --- Consentimiento (registro y cuentas existentes) --- */
.consent-box {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 4px 0 12px;
  text-align: left; font-size: 14px;
}
.consent-box legend { font-weight: 700; padding: 0 4px; color: var(--text); }
.consent-box label { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; line-height: 1.35; cursor: pointer; }
.consent-box input[type="radio"],
.consent-box input[type="checkbox"] { width: auto; margin: 2px 0 0; padding: 0; flex-shrink: 0; }
.consent-box a { color: var(--primary); font-weight: 600; }
.consent-check { margin-top: 10px !important; padding-top: 10px; border-top: 1px solid var(--border); }
.consent-minor {
  background: #FDEEE9; border: 1px solid var(--exam-color); border-radius: 8px;
  padding: 8px 10px; margin: 6px 0; font-size: 13px; line-height: 1.4;
}
.remember-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: -2px 0 12px; cursor: pointer; }
.auth-card .remember-row input[type="checkbox"] { width: auto; margin: 0; padding: 0; }
.auth-back { display: inline-block; font-size: 14px; color: var(--muted); cursor: pointer; margin-bottom: 6px; }

/* --- Portada para padres --- */
.landing {
  height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--card); color: var(--text);
}
.landing > * { max-width: 960px; margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; }
.landing-top { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.landing-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--primary-dark); font-size: 17px; }
.landing-brand img { border-radius: 9px; }
.landing-login-link {
  background: none; border: 1px solid var(--border); border-radius: 10px; padding: 8px 16px;
  font-size: 14px; font-weight: 600; color: var(--primary-dark); cursor: pointer;
}

.landing-hero { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 36px; align-items: center; padding-top: 32px; padding-bottom: 40px; }
.landing-hero h1 { font-size: 52px; line-height: 1.05; margin: 0 0 16px; color: #1F3A5F; letter-spacing: -0.5px; }
.landing-lead { font-size: 19px; line-height: 1.5; margin: 0 0 24px; color: #3A4A5C; }
.landing-ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.landing-btn {
  border-radius: 12px; padding: 14px 24px; font-size: 16px; font-weight: 700; cursor: pointer; border: 2px solid var(--primary);
}
.landing-btn.primary { background: var(--primary); color: #FFFFFF; }
.landing-btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.landing-btn.ghost { background: #FFFFFF; color: var(--primary-dark); }
.landing-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }

.landing-mock {
  background: #FFFFFF; border: 1px solid var(--border); border-radius: 18px; padding: 18px;
  box-shadow: 0 14px 40px rgba(31, 58, 95, 0.14); font-size: 14px;
}
.mock-title { font-weight: 700; color: #1F3A5F; margin-bottom: 10px; }
.mock-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.mock-ok { color: var(--success); font-weight: 800; }
.mock-half { color: #B7791F; font-weight: 800; }
.mock-feedback { background: var(--bg); border-radius: 10px; padding: 10px; margin-top: 10px; font-size: 13px; line-height: 1.4; }
.mock-grade { text-align: right; margin-top: 12px; font-size: 15px; }
.mock-grade strong { font-size: 22px; color: #27500A; margin-left: 6px; }

.landing-section { padding-top: 28px; padding-bottom: 28px; border-top: 1px solid var(--border); }
.landing-section h2 { font-size: 28px; margin: 0 0 18px; color: #1F3A5F; }
.landing-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; counter-reset: step; }
.landing-steps li { background: var(--bg); border-radius: 14px; padding: 18px; counter-increment: step; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.landing-steps li::before {
  content: counter(step); width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 4px;
}
.landing-steps strong { font-size: 16px; color: #1F3A5F; }
.landing-steps span { font-size: 14px; color: #3A4A5C; }
.landing-benefits { margin: 0; padding-left: 20px; line-height: 1.6; font-size: 16px; }
.landing-benefits li { margin-bottom: 8px; }
.landing-story p { font-size: 17px; line-height: 1.6; max-width: 680px; margin: 0; }

.landing-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.landing-plan { border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.landing-plan.featured { border: 2px solid var(--primary); background: #F4F8FE; }
.landing-plan h3 { margin: 0 0 4px; color: #1F3A5F; }
.landing-price { font-size: 30px; font-weight: 800; color: #1F3A5F; margin-bottom: 10px; }
.landing-price small { font-size: 15px; font-weight: 600; color: var(--muted); }
.landing-plan ul { margin: 0; padding-left: 18px; line-height: 1.6; font-size: 15px; }

.landing-section details { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; }
.landing-section summary { font-weight: 700; cursor: pointer; color: #1F3A5F; }
.landing-section details p { margin: 10px 0 0; line-height: 1.55; color: #3A4A5C; }
.landing-section details a { color: var(--primary); font-weight: 600; }

.landing-final { text-align: center; padding-top: 36px; padding-bottom: 36px; border-top: 1px solid var(--border); }
.landing-final h2 { font-size: 26px; color: #1F3A5F; margin: 0 0 18px; }
.landing-footer { text-align: center; font-size: 13px; color: var(--muted); padding-top: 18px; padding-bottom: 28px; border-top: 1px solid var(--border); }
.landing-footer a { color: var(--muted); }

@media (max-width: 720px) {
  .landing-hero { grid-template-columns: 1fr; gap: 24px; padding-top: 16px; }
  .landing-hero h1 { font-size: 38px; }
  .landing-lead { font-size: 17px; }
  .landing-btn { flex: 1 1 auto; text-align: center; }
  .landing-steps, .landing-plans { grid-template-columns: 1fr; }
  .landing-section h2 { font-size: 24px; }
}

/* Clases añadidas: botón para desplegar/plegar la lista */
.slots-toggle {
  width: 100%; margin-top: 6px; padding: 10px; border: 1px dashed var(--border); border-radius: 10px;
  background: none; color: var(--primary-dark); font-weight: 600; font-size: 14px; cursor: pointer;
}

/* --- Horario semanal por minutos (cada clase en su posición real) --- */
.tt { display: grid; column-gap: 2px; width: 100%; min-width: 0; font-size: 11px; }
.tt > * { min-width: 0; }
.tt-head { text-align: center; font-weight: 700; padding: 6px 2px 8px; color: var(--muted); }
.tt-hours { position: relative; }
.tt-hours span { position: absolute; right: 3px; transform: translateY(-50%); color: var(--muted); font-size: 10px; white-space: nowrap; }
.tt-day { position: relative; background: var(--bg); border-radius: 6px; }
.tt-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.tt-class {
  position: absolute; left: 1px; right: 1px; border-radius: 6px; color: #FFFFFF; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  line-height: 1.1; padding: 1px; box-sizing: border-box; font-size: 10px; white-space: nowrap;
}
.tt-class strong { font-weight: 700; }
.tt-class small { font-size: 9px; opacity: 0.9; }
.tt-class small.tt-dur { font-weight: 700; opacity: 1; }
.tt-class.exam { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--exam-color); z-index: 1; }

/* Código de promoción (perfil, cuentas gratuitas) */
.promo-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); text-align: left; }
.promo-box .btn { flex-shrink: 0; }

/* Primer examen guiado */
.link-btn { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; padding: 4px; }
#qsForm input[type="text"] { margin-bottom: 10px; }
/* Opciones avanzadas plegadas al generar un examen */
.more-options { margin: 6px 0 12px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.more-options summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--primary-dark); }
.more-options summary span { font-weight: 400; color: var(--muted); font-size: 13px; }
.more-options[open] summary { margin-bottom: 6px; }
.after-upload-btn { margin-top: 10px; width: 100%; }

/* Examen de ejemplo de la portada */
.landing-demo-link {
  margin-top: 14px; background: none; border: none; padding: 0; cursor: pointer;
  color: var(--primary-dark); font-weight: 700; font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
}
.demo-card { max-width: 480px; text-align: left; }
.demo-card h3 { text-align: center; }
.demo-step { font-size: 14px; margin: 10px 0 6px; }
.demo-hint { font-size: 13px; color: var(--muted); text-align: center; margin: 0 0 10px; }
.demo-notes {
  background: #FFFDF2; border: 1px solid #EFE6C2; border-radius: 10px; padding: 12px 14px;
  font-size: 14px; line-height: 1.55; margin-bottom: 8px;
}
.demo-cta { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; }
.demo-cta p { margin: 0 0 10px; }

/* --- Ventanas emergentes en móvil (sobre todo iPhone) ---
   En el Safari actual la barra de abajo flota sobre la página y ni vh ni dvh descuentan esa zona,
   así que la parte de abajo de una ventana alta (con sus botones) quedaba tapada.
   Solución que no depende del alto de pantalla: la ventana no se recorta; es el fondo oscuro el que
   se desplaza, con margen de sobra abajo para poder subir el último botón por encima de la barra. */
.paywall-overlay {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  align-items: flex-start;
  padding: 24px 16px calc(120px + env(safe-area-inset-bottom));
}
.paywall-overlay > .paywall-card {
  margin: auto 0;          /* centrada si cabe; si no, empieza arriba y se desplaza */
  flex-shrink: 0;
  max-height: none;
  overflow: visible;
}
/* Ventanas con texto largo: alineado a la izquierda (antes lo pisaba el text-align:center de .paywall-card) */
.paywall-card.how-it-works-card, .paywall-card.stats-card, .paywall-card.demo-card { text-align: left; }
.paywall-card.how-it-works-card h3, .paywall-card.stats-card h3, .paywall-card.demo-card h3 { text-align: center; }
.paywall-card.how-it-works-card > .btn { width: 100%; }
.paywall-card.how-it-works-card > .btn { width: 100%; }

/* Editar clase (al tocar un bloque del horario) */
.tt-class { cursor: pointer; }
.edit-label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #FFFFFF; box-shadow: 0 0 0 1px var(--border); padding: 0; cursor: pointer; }
.color-swatch.selected { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--text); }
.subject-dot { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.feedback-box .correct-answer { display: inline-block; margin: 4px 0; padding: 4px 8px; border-radius: 6px; background: #E8F5E9; color: #1B5E20; }

/* --- Ver apunte, esquema y "No lo entiendo" --- */
.note-card { cursor: pointer; }
.paywall-card.note-viewer-card { max-width: 560px; width: 100%; text-align: left; }
.note-viewer-card h3 { text-align: left; margin: 0 32px 2px 0; }
.note-meta { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.note-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.note-tabs button { flex: 1; border: none; background: transparent; padding: 9px; border-radius: 8px; font-size: 15px; font-weight: 700; color: var(--muted); cursor: pointer; }
.note-tabs button.active { background: var(--card, #FFFFFF); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.note-text { white-space: pre-wrap; line-height: 1.55; font-size: 15px; }
.note-text .note-h { display: inline-block; font-weight: 700; font-size: 16px; color: var(--text); }
.note-hint, .note-loading { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.note-block { border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; transition: border-color .15s, background .15s; }
.note-block > div[role="button"] { cursor: pointer; }
.note-block.selected { border-color: var(--primary); background: #F0F6FD; }
.note-block-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.note-block-num { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #FFFFFF; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.note-block-badge { margin-left: auto; font-size: 12px; font-weight: 700; background: #FFF4D6; color: #8A6100; border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.note-block ul { margin: 6px 0 2px; padding-left: 22px; }
.note-block li { font-size: 14px; line-height: 1.45; margin: 3px 0; }
.note-exp { background: #FFFBEA; border-left: 4px solid #F5B700; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.note-exp-q { font-size: 13px; color: var(--muted); font-style: italic; margin-bottom: 4px; }
.note-exp-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.note-exp-actions { display: flex; gap: 14px; margin-top: 4px; }
.note-exp-actions .link-btn { padding: 4px 0; font-size: 13px; }
.note-exp-actions .link-btn.muted { color: var(--muted); }
.note-ask { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.note-ask textarea { width: 100%; box-sizing: border-box; font-size: 16px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; resize: vertical; }
.note-free { font-size: 12px; color: var(--muted); margin: 6px 0 0; text-align: center; }
.note-lang { background: var(--bg); border-radius: 12px; padding: 14px; }
.note-lang p { margin: 0 0 10px; }
.note-lang-switch { display: block; margin: -4px 0 10px; color: var(--primary); }
.note-reread { display: block; width: 100%; margin-top: 10px; text-align: center; }
/* Micrófono para dictar la duda */
.note-ask-field { position: relative; }
.note-ask-field textarea { padding-right: 52px; }
.mic-btn { position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--bg); color: var(--primary); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mic-btn.listening { background: #E8654B; color: #FFFFFF; animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 101, 75, 0.5); } 50% { box-shadow: 0 0 0 8px rgba(232, 101, 75, 0); } }
.mic-status { font-size: 12px; color: var(--muted); margin: 4px 0 0; min-height: 0; }
.mic-status:empty { display: none; }
.mic-status.error { color: #C0392B; }
/* Menú de los títulos del esquema y de las explicaciones; lectura en voz alta */
.note-block-title { cursor: pointer; }
.note-block-name { flex: 1; }
.note-menu-dots { color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px; }
.note-exp-head { cursor: pointer; }
.note-block.reading, .note-exp.reading { box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.45); }
.note-menu { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,0.35); display: flex; align-items: flex-end; justify-content: center; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.note-menu-card { background: #FFFFFF; border-radius: 16px; width: 100%; max-width: 480px; padding: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.25); }
.note-menu-title { font-size: 13px; color: var(--muted); text-align: center; padding: 8px 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-menu-item { display: block; width: 100%; border: none; background: none; padding: 14px; font-size: 16px; font-weight: 600; color: var(--text); text-align: left; border-radius: 10px; cursor: pointer; }
.note-menu-item:hover, .note-menu-item:active { background: var(--bg); }
.note-menu-item.cancel { text-align: center; color: var(--muted); font-weight: 500; }
.note-read-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 1050; background: #1F3A5F; color: #FFFFFF; border-radius: 999px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 12px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.25); white-space: nowrap; }
.note-read-bar button { border: none; background: #FFFFFF; color: #1F3A5F; border-radius: 999px; padding: 7px 14px; font-weight: 700; cursor: pointer; }
