/* =============================================================
   Aula Virtual — identidad visual
   Verde institucional #006633 · Verde vivo #00B23B · Dorado #FFCC00
   Base clara y limpia; navegación oscura con acentos de malla digital.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Instrument+Sans:wght@400;500;600&display=swap');

:root {
  --green-deep: #006633;
  --green: #00b23b;
  --green-soft: #e3f4e9;
  --gold: #ffcc00;
  --ink: #17251d;
  --ink-soft: #51645a;
  --paper: #f5f8f6;
  --surface: #ffffff;
  --line: #dde8e1;
  --danger: #c0392b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 37, 29, .05), 0 6px 24px -8px rgba(0, 102, 51, .12);
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.2rem;  font-weight: 600; }
h3 { font-size: 1.02rem; font-weight: 600; }
p  { margin: 0 0 .8rem; }
a  { color: var(--green-deep); }

/* ---------- Malla digital (red animada en canvas) ---------- */
.mesh {
  position: relative;
  overflow: hidden;
  background-color: #03150c;
  background-image:
    radial-gradient(at 15% 20%, rgba(0, 178, 59, .20) 0, transparent 45%),
    radial-gradient(at 85% 80%, rgba(0, 87, 43, .50) 0, transparent 55%),
    radial-gradient(at 50% 120%, rgba(0, 0, 0, .55) 0, transparent 60%);
}

.mesh-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.mesh > *:not(.mesh-canvas) { position: relative; z-index: 1; }

/* ---------- Pantalla de ingreso ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .55);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.4rem;
}

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--green-deep), var(--green));
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  flex: none;
}

.brand-mark-img {
  width: 42px; height: 42px;
  flex: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35));
}

.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.brand-sub  { font-size: .78rem; color: var(--ink-soft); }

/* ---------- Avatar de usuario (foto o iniciales de respaldo) ---------- */
.avatar {
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--green-deep), var(--green));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 30px; height: 30px; font-size: .78rem; }
.avatar.md { width: 44px; height: 44px; font-size: .95rem; }
.avatar.lg { width: 96px; height: 96px; font-size: 2rem; border: 3px solid var(--surface); box-shadow: var(--shadow); }

.avatar-upload { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.avatar-upload label.btn { cursor: pointer; }

.teacher-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: linear-gradient(135deg, var(--green-soft), #fff 70%);
  border: 1px solid #bfe6cd;
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.teacher-card .avatar { box-shadow: 0 6px 16px -6px rgba(0, 102, 51, .4); }
.teacher-card-role {
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 700;
  color: var(--green-deep);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .2rem;
}
.teacher-card-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; color: var(--ink); }
.teacher-card-bio { font-size: .89rem; color: var(--ink-soft); line-height: 1.55; margin: .4rem 0 0; white-space: pre-wrap; }

/* ---------- Datos legales / institucionales ---------- */
.institution-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.3rem;
  box-shadow: var(--shadow);
}
.institution-card img { width: 58px; height: 58px; object-fit: contain; flex: none; }
.institution-meta { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: .3rem; font-size: .85rem; color: var(--ink-soft); }
.institution-meta b { color: var(--ink); font-weight: 600; margin-right: .25rem; }

.legal-footer {
  margin-top: 2.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}

.login-legal {
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: .74rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}

/* ---------- Estructura con barra lateral ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: none;
  color: #d9efe1;
  display: flex;
  flex-direction: column;
  padding: 1.1rem .9rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .login-brand { margin: 0 .4rem 1.6rem; }
.sidebar .brand-name  { color: #fff; }
.sidebar .brand-sub   { color: rgba(217, 239, 225, .6); }

.nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .58rem .75rem;
  border-radius: var(--radius-sm);
  color: rgba(230, 246, 236, .82);
  text-decoration: none;
  font-weight: 500;
  font-size: .93rem;
  margin-bottom: .15rem;
}

.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-link:hover { background: rgba(0, 178, 59, .14); color: #fff; }
.nav-link.active {
  background: rgba(0, 178, 59, .22);
  color: #7dffb0;
  box-shadow: inset 2px 0 0 var(--green);
}

.sidebar-user {
  margin-top: auto;
  padding: .8rem .75rem .2rem;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: .85rem;
}
.sidebar-user b { display: block; color: #fff; font-weight: 600; }
.sidebar-user span { color: rgba(217, 239, 225, .65); font-size: .78rem; }

.main { flex: 1; min-width: 0; padding: 1.6rem 2rem 3rem; max-width: 1080px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-head p { color: var(--ink-soft); margin: 0; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.card + .card, .stack > * + * { margin-top: 1rem; }

.grid { display: grid; gap: 1rem; }
.grid > * { min-width: 0; } /* evita que tablas/contenido ancho rompan el ancho de la columna */
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat { padding: 1rem 1.15rem; }
.stat .num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--green-deep); }
.stat .lbl { color: var(--ink-soft); font-size: .85rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 0;
  border-radius: var(--radius-sm);
  padding: .58rem 1.05rem;
  font: 600 .92rem var(--font-body);
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--green-deep);
}
.btn:hover { background: #00552b; }
.btn.gold { background: var(--gold); color: #4a3c00; }
.btn.gold:hover { background: #edbd00; }
.btn.ghost { background: transparent; color: var(--green-deep); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--green); }
.btn.sm { padding: .34rem .7rem; font-size: .84rem; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid var(--line); }

label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }

.field { margin-bottom: .9rem; }
.form-row { display: flex; gap: .8rem; }
.form-row > * { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-family: var(--font-display); font-size: .8rem; font-weight: 600; color: var(--ink-soft); padding: .5rem .6rem; border-bottom: 2px solid var(--line); }
td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block;
  padding: .14rem .6rem;
  border-radius: 99px;
  font-size: .76rem;
  font-weight: 600;
}
.pill.green { background: var(--green-soft); color: var(--green-deep); }
.pill.gold  { background: #fff4c2; color: #6b5600; }
.pill.gray  { background: #edf1ee; color: var(--ink-soft); }
.pill.red   { background: #fde8e5; color: var(--danger); }

.flash {
  background: var(--green-soft);
  border: 1px solid #bfe6cd;
  color: var(--green-deep);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  font-weight: 500;
  margin-bottom: 1rem;
}
.flash.error { background: #fdeceb; border-color: #f2c2bc; color: var(--danger); }

/* ---------- Aula del estudiante ---------- */
.course-hero {
  border-radius: var(--radius);
  color: #fff;
  padding: 1.6rem 1.5rem;
  margin-bottom: 1.3rem;
  overflow: hidden;
}
.course-hero h1 { color: #fff; margin-bottom: .2rem; }
.course-hero p  { color: rgba(233, 248, 238, .85); margin: 0; }

.week {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.week + .week { margin-top: .8rem; }

.week summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .85rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 600;
}
.week summary::-webkit-details-marker { display: none; }
.week[open] summary { border-bottom: 1px solid var(--line); }

.week-no {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: .92rem;
}

.week-body { padding: .6rem 1.1rem .9rem; }

.content-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .3rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}
.content-row:last-child { border-bottom: 0; }
.content-row:hover .content-title { color: var(--green-deep); }
.content-icon { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--green-soft); color: var(--green-deep); }
.content-icon.live { background: #fff4c2; color: #6b5600; }
.content-icon.task { background: #eef2ff; color: #3730a3; }
.content-title { font-weight: 500; }
.content-meta { font-size: .8rem; color: var(--ink-soft); }

.player { border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16 / 9; box-shadow: var(--shadow); }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }

.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* Ranking */
.rank-row { display: flex; align-items: center; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-pos {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: .8rem;
  background: #edf1ee; color: var(--ink-soft);
}
.rank-row:first-child .rank-pos { background: var(--gold); color: #4a3c00; }
.rank-pts { margin-left: auto; font-weight: 600; color: var(--green-deep); font-size: .9rem; }

/* Trivia */
.question { padding: 1rem 1.15rem; }
.question + .question { margin-top: .8rem; }
.q-text { font-weight: 600; margin-bottom: .6rem; }
.option {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .7rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: .45rem;
  cursor: pointer;
  font-weight: 400;
}
.option:hover { border-color: var(--green); background: var(--green-soft); }
.option input { accent-color: var(--green-deep); }

.score-banner {
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.2rem;
}
.score-num { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: var(--gold); }

/* Vista del curso del estudiante: contenido + ranking */
.course-grid { display: grid; gap: 1rem; grid-template-columns: 1fr 290px; align-items: start; }

/* ---------- Medallas ---------- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .8rem;
}

.badge-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem .8rem;
  text-align: center;
  background: var(--surface);
}
.badge-card b { display: block; font-family: var(--font-display); font-size: .9rem; margin: .3rem 0 .15rem; }
.badge-card span { font-size: .78rem; color: var(--ink-soft); display: block; line-height: 1.35; }
.badge-icon { font-size: 2rem; line-height: 1; }

.badge-card.earned {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fffbe8, var(--surface) 70%);
  box-shadow: 0 4px 16px -6px rgba(255, 204, 0, .45);
}

.badge-card.locked { opacity: .55; }
.badge-card.locked .badge-icon { filter: grayscale(1); }

.badge-celebrate {
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff8d6, #fffdf2);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.2rem;
  text-align: center;
}
.badge-celebrate-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #6b5600;
  margin-bottom: .8rem;
}
.badge-celebrate-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .8rem;
}
.badge-celebrate .badge-card { min-width: 160px; max-width: 210px; }

@media (prefers-reduced-motion: no-preference) {
  .badge-card.pop { animation: badge-pop .5s cubic-bezier(.2, 1.6, .4, 1) backwards; }
  .badge-card.pop:nth-child(2) { animation-delay: .12s; }
  .badge-card.pop:nth-child(3) { animation-delay: .24s; }
  @keyframes badge-pop {
    from { transform: scale(.4) rotate(-6deg); opacity: 0; }
    to   { transform: scale(1) rotate(0); opacity: 1; }
  }
}

/* ---------- Juegos de trivia ---------- */
.quiz-game { max-width: 640px; margin: 0 auto; }

.game-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; gap: 1rem; }
.game-progress { display: flex; gap: .35rem; flex-wrap: wrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex: none; }
.dot-current { background: var(--gold); box-shadow: 0 0 0 3px #fff4c2; }
.dot-correct { background: var(--green); }
.dot-wrong { background: #e05a4e; }
.game-streak { font-weight: 700; font-family: var(--font-display); color: #6b5600; font-size: 1.05rem; }

.timer-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 1.1rem; }
.timer-fill { height: 100%; width: 100%; background: var(--green); border-radius: 99px; }

.rush-question {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  text-align: center; padding: 1.4rem 1rem; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.rush-options { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.rush-opt {
  padding: .9rem 1rem; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: #fff; font: 600 .95rem var(--font-body); color: var(--ink); cursor: pointer; text-align: center;
}
.rush-opt:hover:not(:disabled) { border-color: var(--green); background: var(--green-soft); }
.rush-opt:disabled { cursor: default; opacity: .75; }
.rush-opt.opt-correct { background: var(--green-soft); border-color: var(--green); color: var(--green-deep); opacity: 1; }
.rush-opt.opt-wrong { background: #fdeceb; border-color: #e05a4e; color: #a3352b; opacity: 1; }

.game-finish {
  text-align: center; padding: 2.4rem 1rem; font-family: var(--font-display); font-weight: 600;
  background: linear-gradient(135deg, #fff8d6, #fffdf2); border: 2px solid var(--gold); border-radius: var(--radius);
}
.game-finish-icon { font-size: 2.4rem; margin-bottom: .5rem; }

/* Memorama */
.memory-stats { font-size: .88rem; color: var(--ink-soft); font-weight: 600; }
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; perspective: 800px; }
.memory-card {
  position: relative; aspect-ratio: 3 / 4; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  background: transparent; padding: 0; transform-style: preserve-3d; transition: transform .45s;
}
.memory-card.flipped, .memory-card.matched { transform: rotateY(180deg); }
.memory-face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); backface-visibility: hidden; padding: .4rem; text-align: center;
  font-size: .78rem; font-weight: 600; line-height: 1.25; box-shadow: var(--shadow);
}
.memory-front { background: linear-gradient(135deg, var(--green-deep), var(--green)); color: #fff; font-size: 1.4rem; }
.memory-back { background: #fff; color: var(--ink); border: 1.5px solid var(--line); transform: rotateY(180deg); }
.memory-back.has-image { flex-direction: column; gap: .3rem; padding: .3rem; }
.memory-img { width: 100%; height: 62%; object-fit: cover; border-radius: 6px; flex: none; }
.memory-caption { font-size: .74rem; line-height: 1.2; }
.memory-card.matched .memory-back { background: var(--green-soft); border-color: var(--green); color: var(--green-deep); }
.memory-card.shake { animation: memory-shake .5s; }
@keyframes memory-shake {
  20%, 60% { transform: rotateY(180deg) translateX(-6px); }
  40%, 80% { transform: rotateY(180deg) translateX(6px); }
}

/* Ruleta */
.wheel-wrap { position: relative; width: 210px; height: 210px; margin: 0 auto; }
.wheel-disc {
  width: 100%; height: 100%; border-radius: 50%; position: relative;
  border: 6px solid #fff; box-shadow: 0 8px 28px -8px rgba(0,0,0,.4), 0 0 0 3px var(--green-deep);
}
.wheel-icon { position: absolute; left: 50%; top: 50%; font-size: 1.3rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.wheel-pointer {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 1.6rem; color: var(--gold); z-index: 2; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}

/* ---------- Filtro de usuarios por rol ---------- */
.role-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.role-tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font-size: .85rem; font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.role-tab .count {
  background: var(--paper);
  border-radius: 99px;
  padding: .05rem .45rem;
  font-size: .76rem;
  color: var(--ink-soft);
}
.role-tab.active { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.role-tab.active .count { background: rgba(255,255,255,.22); color: #fff; }

.user-actions { display: flex; gap: .4rem; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Paneles de edición desplegables (usuarios y cursos) ---------- */
tr.edit-row { display: none; }
tr.edit-row.open { display: table-row; }
tr.edit-row td { background: var(--paper); padding: 1rem 1.2rem; }

div.edit-row { display: none; }
div.edit-row.open { display: block; }

.edit-row-form .field { margin-bottom: .7rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; top: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .2rem; }
  .sidebar .login-brand { margin: 0 1rem 0 0; }
  .sidebar-user { margin: 0 0 0 auto; border: 0; padding: 0 .5rem; display: flex; align-items: center; gap: .7rem; }
  .sidebar-user form { margin-top: 0 !important; }
  .main { padding: 1.1rem 1rem 2.5rem; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .course-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .institution-card { flex-direction: column; text-align: center; }
  .institution-meta { justify-content: center; }
  .user-actions { justify-content: flex-start; width: 100%; }
  .role-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .2rem; }
  .rush-options { grid-template-columns: 1fr; }
  .memory-grid { grid-template-columns: repeat(3, 1fr); }
  .wheel-wrap { width: 170px; height: 170px; }
  .wheel-icon { font-size: 1.1rem; }
  .page-head { flex-direction: column; align-items: stretch; }
  .course-hero, .card { padding: 1rem 1.05rem; }
  .pdf-frame { height: 65vh; }
  .score-banner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  body { font-size: 15px; }
  h1 { font-size: 1.35rem; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat .num { font-size: 1.35rem; }
  .login-card { padding: 1.6rem 1.25rem; }
  .brand-mark-img { width: 36px; height: 36px; }
  .institution-card img { width: 46px; height: 46px; }
  .btn { width: 100%; justify-content: center; }
  .btn.sm { width: auto; }
  .content-row { flex-wrap: wrap; }
  .nav-link { font-size: .88rem; padding: .5rem .6rem; }
  .teacher-card { flex-direction: column; align-items: center; text-align: center; }
}

/* En pantallas táctiles: inputs a 16px para que iOS no haga zoom al enfocar,
   y objetivos táctiles más generosos */
@media (pointer: coarse) {
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=url], input[type=date], input[type=datetime-local], select, textarea {
    font-size: 16px;
    padding: .65rem .75rem;
  }
  .option { padding: .7rem .8rem; }
  .btn { padding: .68rem 1.1rem; }
  .content-row { padding: .7rem .3rem; }
}

/* Tablas: desplazamiento horizontal en pantallas angostas sin romper el layout */
.card { overflow-x: auto; }
table { min-width: 480px; }
.card > form table, .login-card table { min-width: 0; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-link, .option, input, select { transition: background .15s, border-color .15s, color .15s; }
}
