/* ==========================================================
   AulaDigital Panamá — Design System CSS
   ========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Fredoka:wght@500;600;700&family=Fira+Code:wght@400;600&display=swap');

:root {
  /* Paleta */
  --bg:          #0D1117;
  --surface:     #161B22;
  --surface2:    #1C2128;
  --border:      #30363D;
  --border-soft: #21262D;
  --primary:     #4F46E5;
  --primary-h:   #4338CA;
  --primary-glow: rgba(79,70,229,.3);
  --green:       #10B981;
  --yellow:      #F59E0B;
  --red:         #EF4444;
  --cyan:        #06B6D4;
  --pink:        #EC4899;
  --text:        #E6EDF3;
  --text-muted:  #8B949E;
  --text-dim:    #484F58;

  /* Layout */
  --sidebar-w: 220px;
  --header-h:  58px;
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;

  /* Font */
  --f-body:    'Outfit', sans-serif;
  --f-head:    'Fredoka', sans-serif;
  --f-mono:    'Fira Code', monospace;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: var(--f-body); cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
input, textarea, select {
  font-family: var(--f-body);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 9px 13px;
  width: 100%;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Header ────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-flag { font-size: 28px; filter: drop-shadow(0 0 12px rgba(79,70,229,.5)); }
.brand-title { font-family: var(--f-head); font-size: 18px; color: var(--text); }
.brand-sub { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

.top-nav {
  flex: 1;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-tab:hover { background: var(--surface2); color: var(--text); }
.nav-tab.active { background: var(--primary); color: white; border-color: transparent; }
.nav-tab .badge {
  background: var(--red);
  color: white;
  border-radius: 10px;
  font-size: 10px;
  padding: 1px 6px;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.online-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.dot-green {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px 5px 10px;
  font-size: 13px;
  font-weight: 600;
}
.xp-badge {
  background: linear-gradient(135deg, var(--yellow), #F97316);
  color: #0D1117;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
}
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 16px;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--red); color: var(--red); }

/* ── Layout ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  overflow-y: auto;
}

.sidebar-section {}
.section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 0 8px 6px;
}

.side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: all .15s;
}
.side-btn:hover { background: var(--surface2); color: var(--text); }
.side-btn.active { background: rgba(79,70,229,.15); border-color: rgba(79,70,229,.4); color: var(--primary); }
.side-btn .icon { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.side-btn .unread {
  margin-left: auto;
  background: var(--red);
  color: white;
  border-radius: 10px;
  font-size: 10px;
  padding: 1px 6px;
}

/* Users online list */
.user-online-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  transition: background .15s;
  cursor: pointer;
}
.user-online-item:hover { background: var(--surface2); }
.user-online-item .uavatar { font-size: 18px; }
.user-online-item .ustatus {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-left: auto;
  flex-shrink: 0;
}
.user-online-item.offline .ustatus { background: var(--text-dim); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px;
  min-height: calc(100vh - var(--header-h));
}

/* ── Screens ────────────────────────────────────────────── */
.screen { display: none; animation: fadeUp .25s ease; }
.screen.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-family: var(--f-head);
  font-size: 19px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: all .15s;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-h); transform: translateY(-1px); box-shadow: 0 4px 15px var(--primary-glow); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-green { background: rgba(16,185,129,.15); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.btn-green:hover { background: var(--green); color: #0D1117; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; font-weight: 700; border-radius: var(--r); }

/* ── Home Dashboard ─────────────────────────────────────── */
.welcome-hero {
  background: linear-gradient(135deg, #1a1060 0%, #312E81 50%, #1e3a5f 100%);
  border: 1px solid rgba(79,70,229,.35);
  border-radius: var(--r-lg);
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.welcome-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(79,70,229,.25), transparent 70%);
  border-radius: 50%;
}
.welcome-hero h2 { font-family: var(--f-head); font-size: 28px; margin-bottom: 6px; }
.welcome-hero p { color: #93C5FD; font-size: 14px; max-width: 500px; }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.mod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  cursor: pointer;
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mod-card:hover {
  border-color: var(--primary);
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(79,70,229,.15);
}
.mod-icon { font-size: 36px; }
.mod-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
}
.mod-title { font-family: var(--f-head); font-size: 16px; }
.mod-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── SimuMail ────────────────────────────────────────────── */
.mail-layout { display: grid; grid-template-columns: 218px 1fr; gap: 0; height: calc(100vh - 140px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.mail-sidebar { border-right: 1px solid var(--border); padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.mail-main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Dirección propia: se resaltan las tres partes usuario / @ / dominio */
.my-addr { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 12px; }
.my-addr-val { font-family: var(--f-mono); font-size: 11.5px; margin-top: 2px; word-break: break-all; }
.my-addr-val .ad-user { color: var(--cyan); }
.my-addr-val .ad-at   { color: var(--yellow); font-weight: 700; }
.my-addr-val .ad-dom  { color: var(--text-muted); }

.mail-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.mail-folder-title { font-family: var(--f-head); font-size: 17px; }
.mail-toolbar input[type="search"] { width: 220px; max-width: 40vw; font-size: 13px; padding: 7px 12px; }

.mail-list { flex: 1 1 40%; overflow-y: auto; min-height: 90px; }
.mail-item {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background .12s;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}
.mail-item:hover { background: var(--surface2); }
.mail-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.mail-item.unread { border-left-color: var(--primary); background: rgba(79,70,229,.04); }
.mail-item.unread .mail-sender { font-weight: 700; color: var(--text); }
.mail-item-main { min-width: 0; }
.mail-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.mail-sender { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.mail-subject { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-time { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.mail-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .5px; background: rgba(6,182,212,.15); color: var(--cyan); border-radius: 5px; padding: 1px 5px; }
.mail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: 100%; min-height: 180px; color: var(--text-muted); text-align: center; padding: 20px; }
.spin { font-size: 30px; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Visor */
.mail-view { flex: 1 1 60%; overflow-y: auto; padding: 22px 24px; border-top: 1px solid var(--border); background: var(--bg); }
.mv-head { display: flex; align-items: flex-start; gap: 12px; }
.mv-subject { font-family: var(--f-head); font-size: 20px; flex: 1; word-break: break-word; }
.mv-star.on { border-color: var(--yellow); }
.mv-meta { font-size: 12.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; margin: 12px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.mv-label { display: inline-block; min-width: 46px; font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: .6px; color: var(--text-dim); }
.mv-addr { font-family: var(--f-mono); font-size: 11.5px; color: var(--cyan); }
.mv-body { white-space: pre-wrap; line-height: 1.75; font-size: 14.5px; word-break: break-word; }
.mv-attach {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-sm); text-decoration: none; color: var(--text); font-size: 13px;
}
.mv-attach:hover { border-color: var(--primary); }
.mv-attach.static { cursor: default; }
.mv-attach-ico { font-size: 20px; }
.mv-attach small { display: block; color: var(--text-muted); font-size: 11px; }
.mv-attach-dl { margin-left: auto; color: var(--primary); font-weight: 600; font-size: 12px; }
.mv-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ── Redactar + asistente de netiqueta ───────────────────── */
.modal-back {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.compose-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  width: 900px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.compose-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.compose-body { display: grid; grid-template-columns: 1fr 262px; gap: 0; overflow: hidden; flex: 1; }
.compose-form { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); }

.c-row { display: grid; grid-template-columns: 66px 1fr; gap: 12px; align-items: start; }
.c-row > label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-dim); padding-top: 9px; }
.c-from { font-size: 13.5px; padding-top: 7px; }
.c-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }
.c-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; background: var(--surface2);
  border: 1px solid var(--border); color: var(--text-muted); font-size: 9px; cursor: help;
}
.c-note { font-size: 12px; background: rgba(6,182,212,.08); border: 1px solid rgba(6,182,212,.25); color: var(--cyan); border-radius: var(--r-sm); padding: 8px 12px; }
.c-file-info { font-size: 12px; margin-top: 6px; }
.cc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.cc-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 3px 6px 3px 10px;
}
.cc-chip button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 11px; padding: 0 3px; }
.cc-chip button:hover { color: var(--red); }
#c-body { font-family: var(--f-body); font-size: 14px; line-height: 1.65; resize: vertical; min-height: 190px; }

.coach { border-left: 1px solid var(--border); background: var(--bg); padding: 16px; overflow-y: auto; }
.coach-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.coach-ring {
  width: 54px; height: 54px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface2);
  transition: background .25s;
}
.coach-ring > span {
  width: 42px; height: 42px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-family: var(--f-head); font-size: 16px;
}
.coach-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.coach-list li { display: flex; gap: 8px; font-size: 12.5px; align-items: flex-start; }
.coach-list li .ck { flex-shrink: 0; }
.coach-list li.ok { color: var(--text-muted); }
.coach-list li.ok strong { color: var(--green); }
.coach-list li.warn strong { color: var(--yellow); }

/* Resultado del envío */
.result-card { width: 420px; max-width: 100%; text-align: center; }
.result-score { font-family: var(--f-head); font-size: 40px; line-height: 1; margin-bottom: 14px; }
.result-score small { display: block; font-size: 12px; color: var(--text-muted); font-family: var(--f-body); }
.result-list { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin-bottom: 14px; }
.result-list li.no { color: var(--text-muted); }
.result-xp { font-family: var(--f-head); color: var(--green); font-size: 15px; }
.result-badges { margin-top: 8px; font-size: 13px; color: var(--yellow); }

/* ── Detective del Correo ────────────────────────────────── */
.quiz-intro, .quiz-result { padding: 26px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.quiz-intro h3, .quiz-result h3 { font-family: var(--f-head); font-size: 22px; }
.quiz-intro p { font-size: 13.5px; color: var(--text-muted); max-width: 560px; line-height: 1.6; }
.flag-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; text-align: left; width: 100%; max-width: 720px; margin: 6px 0; }
.flag-legend-item { display: flex; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; }

.quiz-wrap { padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.quiz-progress { height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.quiz-progress > div { height: 100%; background: var(--primary); transition: width .3s; }
.quiz-mail { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; }
.qm-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; font-size: 13px; }
.qm-subject { font-family: var(--f-head); font-size: 17px; }
.quiz-flags { display: flex; flex-direction: column; gap: 8px; }
.flag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.flag-btn {
  font-size: 12px; padding: 6px 11px; border-radius: 20px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted);
  transition: all .15s;
}
.flag-btn:hover { color: var(--text); border-color: var(--primary); }
.flag-btn.on { background: rgba(245,158,11,.18); border-color: var(--yellow); color: var(--yellow); }
.quiz-actions { display: flex; gap: 12px; justify-content: center; margin-top: 4px; }
.quiz-actions .btn { min-width: 170px; justify-content: center; }

.quiz-review { display: flex; flex-direction: column; gap: 10px; text-align: left; width: 100%; max-width: 720px; margin-top: 8px; }
.qr-item { border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--r-sm); padding: 11px 14px; background: var(--surface2); }
.qr-item.ok { border-left-color: var(--green); }
.qr-item.no { border-left-color: var(--red); }
.qr-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 4px; flex-wrap: wrap; }
.qr-verdict { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.qr-flags { margin-top: 7px; font-size: 11px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qr-flags span { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1px 8px; }
.qr-flags span.hit { border-color: var(--green); color: var(--green); }

/* ── Challenges / Leaderboard ─────────────────────────────── */
.challenge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.challenge-card .ch-icon { font-size: 32px; flex-shrink: 0; }
.challenge-card .ch-info { flex: 1; }
.challenge-card .ch-title { font-family: var(--f-head); font-size: 16px; }
.challenge-card .ch-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.challenge-card .ch-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.status-waiting { background: rgba(245,158,11,.15); color: var(--yellow); }
.status-active  { background: rgba(16,185,129,.15); color: var(--green); animation: glowPulse 2s infinite; }
.status-finished{ background: rgba(139,92,246,.15); color: #A78BFA; }
@keyframes glowPulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(16,185,129,.4); } 50%{ box-shadow: 0 0 0 6px rgba(16,185,129,0); } }

.leaderboard { list-style: none; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 6px;
  background: var(--surface2);
  border: 1px solid var(--border-soft);
  transition: all .15s;
}
.lb-row.top-1 { border-color: var(--yellow); background: rgba(245,158,11,.08); }
.lb-row.top-2 { border-color: #9CA3AF; }
.lb-row.top-3 { border-color: #CD7C2F; }
.lb-rank { font-family: var(--f-head); font-size: 18px; width: 28px; text-align: center; }
.lb-avatar { font-size: 24px; }
.lb-name { flex: 1; font-weight: 600; font-size: 14px; }
.lb-score { font-family: var(--f-mono); font-size: 15px; color: var(--green); font-weight: 600; }

/* ── MecaSprint ──────────────────────────────────────────── */
.meca-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.meca-head h2 { font-size: 22px; }
.meca-head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted);
  white-space: nowrap;
}
.pill-live { background: rgba(16,185,129,.15); color: var(--green); border-color: transparent; }
@keyframes xpBump { 0%{ transform: scale(1); } 40%{ transform: scale(1.28); } 100%{ transform: scale(1); } }
.xp-bump { animation: xpBump .45s ease; }

.meca-bar { display: flex; gap: 14px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row-modes { margin-left: auto; }
.chip {
  padding: 6px 13px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border-soft);
  color: var(--text-muted); transition: all .15s; white-space: nowrap;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-mode.on { background: var(--green); border-color: var(--green); color: #0D1117; }
.meca-hint {
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px;
  padding-left: 2px; min-height: 19px;
}

.typing-stats { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 16px; text-align: center; flex: 1; min-width: 88px;
}
.stat-val { font-family: var(--f-head); font-size: 30px; color: var(--primary); line-height: 1.1; }
.stat-lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }

/* Texto a escribir: ventana de 3 líneas que se desplaza sola */
.typing-display {
  --tsize: 23px;
  --tlh: 40px;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 26px;
  font-family: var(--f-mono);
  font-size: var(--tsize);
  line-height: var(--tlh);
  letter-spacing: 1px;
  cursor: text;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.typing-display.big { --tsize: 30px; --tlh: 52px; letter-spacing: 3px; }
.typing-display.focused { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
/* Recorta exactamente 3 líneas: sin este contenedor el overflow se corta en el
   borde del padding y asoma media cuarta línea. */
.t-clip { height: calc(var(--tlh) * 3); overflow: hidden; }
.t-flow { transition: transform .18s ease; will-change: transform; }
.tw { display: inline-block; white-space: pre; }
.tc { color: var(--text-dim); border-radius: 3px; transition: color .1s; }
.tc.ok   { color: var(--green); }
.tc.ok.soft { color: var(--yellow); }        /* correcto pero sin tilde */
.tc.bad  { color: var(--red); background: rgba(239,68,68,.16); text-decoration: underline wavy var(--red); }
.t-caret {
  position: absolute; left: 26px; top: 22px; width: 2px;
  background: var(--primary); border-radius: 2px;
  transition: transform .07s linear;
  animation: caretBlink 1.1s steps(1) infinite;
}
@keyframes caretBlink { 0%,55% { opacity: 1; } 56%,100% { opacity: .15; } }
.t-focus-note {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(13,17,23,.7); backdrop-filter: blur(2px);
  font-family: var(--f-body); font-size: 14px; color: var(--text-muted);
  transition: opacity .2s; border-radius: var(--r-lg);
}
.typing-display.focused .t-focus-note { opacity: 0; pointer-events: none; }
.t-progress { height: 4px; background: var(--surface2); border-radius: 4px; overflow: hidden; margin: 8px 0 18px; }
.t-progress > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .15s; }
.t-catch { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}
.shake { animation: shake .3s ease !important; }

/* ── Guía: manos + teclado ───────────────────────────────── */
.meca-guide { display: flex; gap: 18px; align-items: center; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.hands { display: flex; gap: 6px; flex-shrink: 0; }
.hand { width: 82px; height: auto; }
.hand .palm, .hand .fg {
  fill: #1E2533; stroke: #2C3446; stroke-width: 2; transition: fill .12s, filter .12s;
}
.hand .fg.on { stroke: none; }
.hand .fg[data-f$="pinky"].on  { fill: var(--pink);    filter: drop-shadow(0 0 6px var(--pink)); }
.hand .fg[data-f$="ring"].on   { fill: var(--yellow);  filter: drop-shadow(0 0 6px var(--yellow)); }
.hand .fg[data-f$="middle"].on { fill: var(--green);   filter: drop-shadow(0 0 6px var(--green)); }
.hand .fg[data-f$="index"].on  { fill: var(--cyan);    filter: drop-shadow(0 0 6px var(--cyan)); }
.hand .fg[data-f$="thumb"].on  { fill: var(--primary); filter: drop-shadow(0 0 6px var(--primary)); }
.hand-lbl { fill: var(--text-dim); font-size: 11px; font-family: var(--f-body); text-anchor: middle; }

.vkbd {
  background: #0A0E16;
  border-radius: var(--r-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 460px;
  max-width: 660px;
  border: 1px solid var(--border);
}
.vkbd-row { display: flex; gap: 5px; }
.vkey {
  position: relative;
  flex: var(--w, 1) 1 0;
  min-width: 0;
  height: 40px;
  padding: 0 2px;
  background: #1E2533;
  border: none;
  border-top: 2px solid transparent;
  border-bottom: 3px solid #060910;
  border-radius: 6px;
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background .08s, transform .08s, box-shadow .08s;
  user-select: none;
}
.vk-main { line-height: 1; }
.vk-sub { font-size: 9px; color: var(--text-dim); line-height: 1; margin-bottom: 1px; }
.vkey-mod { font-size: 10px; color: var(--text-muted); }
.vkey-home::after {
  content: ''; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 2px; border-radius: 2px; background: var(--text-dim);
}
.vkey.pressed { background: var(--primary-h); transform: translateY(2px); border-bottom-width: 1px; box-shadow: 0 0 10px var(--primary-glow); }
.vkey.target { background: var(--yellow); color: #0D1117; border-bottom-color: #B45309; animation: keyPulse .55s infinite alternate; z-index: 1; }
.vkey.target .vk-sub { color: #7C4A05; }
.vkey.target-mod { background: rgba(245,158,11,.28); color: var(--yellow); border-bottom-color: #B45309; }
@keyframes keyPulse { from { transform: scale(1); } to { transform: scale(1.08); } }
/* Banda de color del dedo que corresponde a cada tecla */
.f-pinky  { border-top-color: var(--pink); }
.f-ring   { border-top-color: var(--yellow); }
.f-middle { border-top-color: var(--green); }
.f-index  { border-top-color: var(--cyan); }
.f-thumb  { border-top-color: var(--primary); }

.finger-legend {
  display: flex; justify-content: center; gap: 18px;
  font-size: 12px; color: var(--text-muted); flex-wrap: wrap;
}
.finger-legend span { display: flex; align-items: center; gap: 5px; }
.fl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Resultados ──────────────────────────────────────────── */
.meca-results { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(6,9,16,.72); backdrop-filter: blur(4px); }
.meca-results.hidden { display: none; }
.res-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 26px 30px; max-width: 480px; width: 100%; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  animation: resPop .28s cubic-bezier(.2,1.3,.5,1);
  max-height: 92vh; overflow-y: auto;
}
@keyframes resPop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.res-emoji { font-size: 46px; line-height: 1; }
.res-card h3 { font-size: 21px; margin: 6px 0 18px; }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.res-grid > div { background: var(--surface2); border-radius: var(--r-sm); padding: 10px 6px; }
.res-grid b { display: block; font-family: var(--f-head); font-size: 24px; color: var(--text); }
.res-grid span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.res-xp b { color: var(--green); }
.res-note { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; text-align: left; }
.res-worst { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; font-size: 12.5px; color: var(--text-muted); margin-bottom: 16px; }
.res-worst i { font-style: normal; color: var(--red); font-size: 11px; margin-right: 4px; }
kbd {
  display: inline-block; min-width: 22px; padding: 2px 6px; background: var(--surface2);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  font-family: var(--f-mono); font-size: 12px; color: var(--text);
}
.res-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.lb-bar { flex: 1; background: var(--surface); border-radius: 20px; height: 8px; overflow: hidden; margin: 0 10px; }
.lb-bar > div { height: 100%; background: var(--green); border-radius: 20px; transition: width .3s; }
.lb-row.lb-me { border-color: var(--primary); background: rgba(79,70,229,.1); }

@media (max-width: 860px) {
  .hands { display: none; }
  .typing-display { --tsize: 19px; --tlh: 34px; padding: 16px 18px; }
  .typing-display.big { --tsize: 24px; --tlh: 42px; }
  .t-caret { left: 18px; top: 16px; }
  .vkey { height: 34px; font-size: 11px; }
  .vk-sub { display: none; }
  .res-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mouse Maestro ───────────────────────────────────────── */
.mouse-canvas-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  cursor: crosshair;
}
#mouse-canvas { display: block; width: 100%; height: 100%; }

.mouse-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 15px;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  animation: mousePop .7s ease-out forwards;
  z-index: 5;
}
.mouse-pop.perfect { color: var(--green); font-size: 18px; }
.mouse-pop.good    { color: var(--yellow); }
.mouse-pop.ok      { color: #F59E0B; }
.mouse-pop.miss    { color: var(--red); font-size: 20px; }
@keyframes mousePop {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.8); }
  30%  { transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

/* ── Audio Studio ────────────────────────────────────────── */
.audio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.waveform-canvas { background: #0A0E16; border-radius: var(--r); border: 1px solid var(--border); display: block; width: 100%; height: 80px; }
.btn-record-big {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--red);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(239,68,68,.4);
  transition: transform .15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-record-big.recording { animation: recordPulse 1s infinite alternate; }
@keyframes recordPulse { from { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,.5); } to { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(239,68,68,0); } }

/* ── Call Overlay ────────────────────────────────────────── */
.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 600px;
  max-width: 95vw;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,.5);
}
.call-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 32px;
}
.call-partner-name { font-family: var(--f-head); font-size: 18px; }
.call-status { font-size: 12px; color: var(--text-muted); }
.call-videos {
  background: #000;
  position: relative;
  aspect-ratio: 16/9;
}
#video-remote { width: 100%; height: 100%; object-fit: cover; }
/* Llamada solo de voz: avatar en vez de un rectángulo negro */
.call-remote-ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; background: var(--surface2);
}
.call-remote-ph span { font-size: 72px; }
.call-remote-ph small { font-size: 12px; color: var(--text-muted); }
.video-local-pip {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 140px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border);
  object-fit: cover;
}
.call-controls {
  padding: 14px;
  display: flex;
  justify-content: center;
  gap: 16px;
}
.btn-call-ctrl {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 22px;
  transition: all .15s;
}
.btn-call-ctrl:hover { transform: scale(1.1); }
.btn-call-ctrl.off { background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.4); }
.btn-call-ctrl:disabled { opacity: .4; cursor: not-allowed; }
.btn-call-ctrl:disabled:hover { transform: none; }
.end-btn { background: var(--red); border-color: var(--red); }
.end-btn:hover { background: #B91C1C; }

/* ── Incoming call ───────────────────────────────────────── */
.incoming-call {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 600;
  box-shadow: 0 20px 40px rgba(0,0,0,.4);
  animation: slideIn .3s cubic-bezier(.34,1.56,.64,1);
  min-width: 320px;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
.ic-avatar { font-size: 36px; }
.ic-info { flex: 1; }
.ic-name { font-weight: 700; font-size: 15px; }
.ic-sub  { font-size: 12px; color: var(--text-muted); }
.btn-accept { background: var(--green); color: #0D1117; border: none; border-radius: var(--r-sm); padding: 8px 14px; font-weight: 700; font-size: 13px; }
.btn-reject { background: var(--red); color: white; border: none; border-radius: var(--r-sm); padding: 8px 14px; font-weight: 700; font-size: 13px; }

/* ── Floating Call Bar (Persistente en Segundo Plano) ───── */
.floating-call-bar {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 480;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(79, 70, 229, 0.2);
  animation: floatIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 95vw;
}
@keyframes floatIn {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.fcb-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  white-space: nowrap;
}
.fcb-dot {
  width: 9px;
  height: 9px;
  background: var(--green);
  border-radius: 50%;
  animation: fcbPulse 1.6s infinite;
}
@keyframes fcbPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50%      { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.fcb-speaking {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 110px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fcb-speaking.is-speaking {
  color: var(--green);
  font-weight: 700;
}
.fcb-speaking.is-speaking #fcb-speaking-avatar {
  animation: bounceSpeaker 0.6s infinite alternate;
}
@keyframes bounceSpeaker {
  from { transform: scale(1); }
  to   { transform: scale(1.25); }
}

.fcb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-fcb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-fcb:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.08);
}
.btn-fcb.fcb-muted {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #F87171;
}
.btn-fcb.fcb-hand-up {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
  animation: handWave 1.4s infinite;
}
.btn-fcb.fcb-end {
  background: rgba(239, 68, 68, 0.85);
  border-color: transparent;
}
.btn-fcb.fcb-end:hover {
  background: #DC2626;
}

/* ── AulaCall (pantalla) ─────────────────────────────────── */
.btn-yellow { background: rgba(245,158,11,.18); color: var(--yellow); border: 1px solid rgba(245,158,11,.4); }
.btn-yellow:hover { background: var(--yellow); color: #0D1117; }

.room-card { background: linear-gradient(135deg, rgba(79,70,229,.10), transparent); margin-bottom: 20px; }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.room-sub { font-size: 13px; color: var(--text-muted); margin: 6px 0 14px; min-height: 19px; }
.room-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Medidor de voz propio */
.mic-meter { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.mic-meter-ico { font-size: 18px; }
.mic-bar {
  flex: 1; height: 10px; max-width: 320px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden;
}
.mic-bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--green), #34D399);
  transition: width .07s linear;
}
.mic-bar > i.hot { background: linear-gradient(90deg, var(--yellow), var(--red)); }
.mic-meter-label { font-size: 12px; color: var(--text-muted); }

/* Malla de participantes */
.room-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 14px; margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}
.ptile {
  text-align: center; padding: 14px 8px;
  background: var(--surface2); border: 2px solid transparent;
  border-radius: var(--r); transition: border-color .15s, box-shadow .15s;
}
.ptile.is-me { border-color: rgba(79,70,229,.5); }
/* El anillo verde indica quién está hablando ahora mismo */
.ptile.speaking { border-color: var(--green); box-shadow: 0 0 0 4px rgba(16,185,129,.18); }
.ptile-av { font-size: 38px; line-height: 1.1; position: relative; display: inline-block; }
.ptile-hand, .ptile-mute {
  position: absolute; bottom: -2px; right: -12px; font-size: 17px;
}
.ptile-hand { animation: handWave 1.4s ease-in-out infinite; }
@keyframes handWave { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
.ptile-name {
  margin-top: 6px; font-weight: 600; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ptile-status { font-size: 10.5px; color: var(--text-dim); margin-top: 2px; }

/* Lista de llamada directa */
.call-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.call-user {
  display: flex; align-items: center; gap: 14px; padding: 13px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
}
.cu-av { font-size: 30px; }
.cu-info { flex: 1; min-width: 0; }
.cu-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-status { color: var(--green); font-size: 11px; font-weight: 700; }
.btn-call {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%; border: 1px solid rgba(16,185,129,.35);
  background: rgba(16,185,129,.15); color: var(--green); font-size: 16px;
  transition: all .15s;
}
.btn-call:hover { background: var(--green); transform: scale(1.08); }
.empty-inline { grid-column: 1/-1; padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Normas */
.rules-list { list-style: none; display: grid; gap: 12px; }
.rules-list li { display: flex; gap: 12px; align-items: flex-start; }
.rule-ico { font-size: 20px; line-height: 1.3; flex-shrink: 0; }
.rules-list b { display: block; font-size: 13.5px; font-weight: 600; }
.rules-list small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.rules-kinder { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.rule-k {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px; text-align: center;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
}
.rule-k span { font-size: 40px; }
.rule-k b { font-family: var(--f-head); font-size: 14px; }

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  z-index: 700;
  box-shadow: 0 10px 25px rgba(0,0,0,.3);
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── Admin panel ─────────────────────────────────────────── */
.user-table { width: 100%; border-collapse: collapse; }
.user-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--text-dim); padding: 8px 12px; border-bottom: 1px solid var(--border); }
.user-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.user-table tr:hover td { background: var(--surface2); }

/* ── Utilities ────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.font-head { font-family: var(--f-head); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .audio-grid { grid-template-columns: 1fr; }
  .call-box { width: 100%; border-radius: 0; }

  /* SimuMail en pantalla estrecha: la barra lateral pasa a ser una fila
     desplazable arriba. Antes se ocultaba y el módulo quedaba sin
     "Redactar" ni carpetas, es decir, inservible en tablet. */
  .mail-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - 120px); }
  .mail-sidebar {
    flex-direction: row; align-items: center; gap: 8px;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 10px 12px; overflow-x: auto; overflow-y: hidden;
  }
  .mail-sidebar .btn { width: auto !important; margin: 0 !important; flex-shrink: 0; }
  .mail-sidebar .side-btn { width: auto; flex-shrink: 0; white-space: nowrap; }
  .mail-sidebar .section-label, .mail-sidebar .my-addr { display: none; }

  .mail-toolbar { flex-wrap: wrap; padding: 10px 14px; }
  .mail-toolbar input[type="search"] { width: 100%; max-width: none; }
  .compose-body { grid-template-columns: 1fr; }
  .coach { border-left: none; border-top: 1px solid var(--border); }
  .c-row { grid-template-columns: 1fr; gap: 4px; }
  .c-row > label { padding-top: 0; }
  .quiz-actions { flex-direction: column; }
  .quiz-actions .btn { width: 100%; }
}

/* ── PixelPad (Kinder–3°) ──────────────────────────────────────────────────
   Objetivos táctiles grandes a propósito: el público son niños de 5 a 9 años
   que todavía están afinando el control del mouse. */
.pp-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.pp-head h2 { font-size: 22px; }
.pp-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }

.pp-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.pp-tool {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 74px; padding: 10px 8px;
  background: var(--surface2); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: transform .12s, border-color .12s, background .12s;
}
.pp-tool:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--primary); }
.pp-tool.active { border-color: var(--primary); background: var(--primary-glow); }
.pp-tool:disabled { opacity: .35; cursor: not-allowed; }
.pp-tool-ico { font-size: 24px; line-height: 1; }
.pp-tool-lbl { font-size: 12px; font-weight: 600; }

.pp-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.pp-row-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.pp-sizes, .pp-modes { display: flex; align-items: center; gap: 8px; }
.pp-size {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--surface2); border: 2px solid var(--border);
  border-radius: 50%; cursor: pointer;
}
.pp-size.active { border-color: var(--primary); background: var(--primary-glow); }
.pp-dot { background: var(--text); border-radius: 50%; display: block; }
.pp-mode {
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  background: var(--surface2); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--r-sm); cursor: pointer;
}
.pp-mode.active { border-color: var(--primary); background: var(--primary-glow); }

.pp-palette { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pp-color {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--border); cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: transform .12s, border-color .12s;
}
.pp-color:hover { transform: scale(1.12); }
.pp-color.active { border-color: #FFF; transform: scale(1.16); }
.pp-color-name { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-left: 4px; }

.pp-hint {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: 14px;
  background: var(--surface2); border-left: 4px solid var(--yellow);
  border-radius: var(--r-sm);
}
.pp-hint-x {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 14px;
}

.pp-stage {
  position: relative; width: 100%;
  height: clamp(280px, 52vh, 480px);
  background: #FFF; border-radius: var(--r); overflow: hidden;
  box-shadow: inset 0 0 12px rgba(0,0,0,.18);
}
#pp-canvas { display: block; cursor: crosshair; touch-action: none; }
.pp-grid { position: absolute; inset: 0; pointer-events: none; }

.pp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pp-spacer { flex: 1 1 auto; }

.pp-save {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 14px; background: var(--surface2); border-radius: var(--r-sm);
}
.pp-save label { font-size: 14px; font-weight: 600; }
.pp-save input {
  flex: 1 1 200px; padding: 10px 12px; font-size: 15px; font-family: var(--f-body);
  background: var(--surface); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--r-sm);
}
.pp-save input:focus { outline: none; border-color: var(--primary); }

.pp-activities { margin-top: 16px; }
.pp-activities h3 { font-size: 17px; margin-bottom: 4px; }
.pp-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.pp-act-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.pp-act {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; text-align: center;
  background: var(--surface2); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: transform .12s, border-color .12s;
}
.pp-act:hover { transform: translateY(-3px); border-color: var(--primary); }
.pp-act.active { border-color: var(--yellow); background: rgba(245,158,11,.12); }
.pp-act-ico { font-size: 28px; line-height: 1; }
.pp-act-lbl { font-size: 12px; font-weight: 600; }

.pp-gallery-card { margin-top: 16px; }
.pp-gallery-card h3 { font-size: 17px; margin-bottom: 12px; }
.pp-gal-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.pp-gal {
  position: relative; margin: 0;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}
.pp-gal img { display: block; width: 100%; height: 120px; object-fit: contain; background: #FFF; }
.pp-gal figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.pp-gal figcaption b { font-size: 13px; }
.pp-gal figcaption small { font-size: 11px; color: var(--text-muted); }
.pp-gal-del {
  position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(13,17,23,.78); color: #FFF;
  border: none; cursor: pointer; font-size: 13px; opacity: 0; transition: opacity .15s;
}
.pp-gal:hover .pp-gal-del, .pp-gal-del:focus { opacity: 1; }
.pp-gal-note { grid-column: 1 / -1; margin: 0; }

@media (max-width: 640px) {
  .pp-tool { min-width: 62px; padding: 8px 6px; }
  .pp-tool-ico { font-size: 20px; }
  .pp-color { width: 36px; height: 36px; }
  .pp-row { gap: 14px; }
  .pp-actions .btn { flex: 1 1 auto; }
}

/* ── CodeBot / RoboLab ───────────────────────────────────── */
.codebot-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1.2fr) minmax(320px, 1fr);
  gap: 20px;
}
@media (max-width: 768px) {
  .codebot-layout { grid-template-columns: 1fr; }
}

/* ── FileMaster OS ───────────────────────────────────────── */
.btn-side-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-side-nav:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.btn-side-nav.active {
  background: rgba(79, 70, 229, 0.18);
  border-color: rgba(79, 70, 229, 0.4);
  color: #fff;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  transform: translateY(-2px);
}
.file-item.selected {
  background: rgba(79, 70, 229, 0.25) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-glow);
}
