/* ===================================================================
   EIDAL — Tutor de Inglés con IA · Hoja de estilos
   Paleta corporativa: azul #0b3aa0 · naranja #f47b20
=================================================================== */
:root {
  --blue: #0b3aa0;
  --blue-d: #082c7a;
  --blue-l: #2c5cc5;
  --orange: #f47b20;
  --orange-d: #d9660f;
  --bg: #eef2f9;
  --card: #ffffff;
  --text: #1b2333;
  --muted: #6b7488;
  --ok: #1f9d63;
  --err: #d64545;
  --warn: #b45309;
  --border: #e3e8f2;
  --radius: 16px;
  --shadow-sm: 0 1px 3px rgba(16, 30, 70, .06), 0 1px 2px rgba(16, 30, 70, .04);
  --shadow-md: 0 8px 24px rgba(16, 30, 70, .10);
  --shadow-lg: 0 24px 60px rgba(11, 58, 160, .28);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.hidden { display: none !important; }
h2 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.2px; }
h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 22px 0 10px; }
h4 { margin: 0 0 14px; font-size: 15px; letter-spacing: -.2px; }

/* ---------- Botones ---------- */
.btn {
  border: 0; border-radius: 11px; padding: 11px 18px; font-size: 14px;
  cursor: pointer; font-weight: 600; transition: transform .12s, box-shadow .12s, background .15s;
  font-family: inherit;
}
.btn.primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  color: #fff; box-shadow: 0 4px 14px rgba(11, 58, 160, .28);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(11, 58, 160, .36); }
.btn.primary:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid transparent; transition: all .18s; }
.btn.ghost:hover { background: rgba(11,58,160,.08); color: var(--blue); border-color: rgba(11,58,160,.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Inputs ---------- */
input, select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 11px; font-size: 14px; background: #fff; font-family: inherit;
  color: var(--text); transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7488' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select:hover { border-color: #c4cee0; }
input:focus, select:focus {
  outline: none; border-color: var(--blue-l);
  box-shadow: 0 0 0 4px rgba(44, 92, 197, .12);
}
input::placeholder { color: #9aa2b4; }
.error { color: var(--err); font-size: 13px; min-height: 18px; text-align: center; }
.hint { color: var(--muted); font-size: 12px; text-align: center; }

/* ===================================================================
   AUTENTICACIÓN
=================================================================== */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(244,123,32,.18), transparent 60%),
    radial-gradient(1000px 700px at 90% 90%, rgba(44,92,197,.35), transparent 55%),
    linear-gradient(135deg, #0b3aa0 0%, #082c7a 100%);
}
.auth-card {
  background: var(--card); border-radius: 22px; padding: 38px 34px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.6);
}
.brand { text-align: center; margin-bottom: 26px; }
.brand .logo { width: 172px; height: auto; }
.brand small {
  display: block; color: var(--muted); margin-top: 10px; font-size: 13px;
  letter-spacing: .3px; text-transform: uppercase; font-weight: 600;
}
.tabs { display: flex; gap: 6px; margin-bottom: 22px; background: var(--bg); padding: 5px; border-radius: 13px; }
.tab {
  flex: 1; padding: 9px; border: 0; background: transparent; border-radius: 9px;
  cursor: pointer; font-weight: 600; color: var(--muted); font-family: inherit; transition: .15s;
}
.tab.active { background: #fff; color: var(--blue); box-shadow: var(--shadow-sm); }
.form { display: flex; flex-direction: column; gap: 13px; }
.form .btn { margin-top: 4px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.check input { width: auto; }

/* ===================================================================
   LAYOUT APP
=================================================================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 26px;
  background: linear-gradient(135deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,.90) 100%);
  backdrop-filter: blur(12px); border-bottom: 1.5px solid var(--border); position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 8px rgba(16, 30, 70, .08);
}
.topbar .logo.small { height: 32px; width: auto; transition: transform .2s; }
.topbar .logo.small:hover { transform: scale(1.05); }
.nav {
  display: flex;
  gap: 4px;
  margin: 0 auto;
  justify-content: center;
  background: rgba(11, 58, 160, 0.04);
  padding: 4px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  align-items: center;
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.nav-btn svg {
  color: var(--muted);
  transition: color .2s, transform .2s;
  flex-shrink: 0;
}
.nav-btn:hover {
  color: var(--blue);
  background: rgba(11, 58, 160, 0.08);
}
.nav-btn:hover svg {
  color: var(--blue);
  transform: translateY(-1px);
}
.nav-btn.active {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(11, 58, 160, 0.25);
}
.nav-btn.active svg {
  color: #fff !important;
}
.user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
#user-name { font-weight: 600; }

.content {
  display: grid; grid-template-columns: 280px 1fr; gap: 20px; padding: 22px;
  max-width: 1240px; margin: 0 auto;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: #fff; border-radius: var(--radius); padding: 22px; height: fit-content;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.sidebar .field { margin-bottom: 16px; }
.sidebar label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 8px; font-weight: 600; }

/* ---------- Widget de estado (nivel + racha) ---------- */
.side-status {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-d) 100%);
  color: #fff; border-radius: 15px; padding: 16px; margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(11,58,160,.28);
}
.ss-level { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ss-lvl-badge {
  background: rgba(255,255,255,.18); backdrop-filter: blur(4px);
  font-weight: 800; font-size: 18px; padding: 4px 14px; border-radius: 10px; letter-spacing: .5px;
}
.ss-lvl-txt { font-size: 13px; opacity: .9; font-weight: 600; }
.ss-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ss-metric {
  background: rgba(255,255,255,.12); border-radius: 11px; padding: 10px; text-align: center;
}
.ss-num { display: block; font-size: 22px; font-weight: 800; line-height: 1; }
.ss-lbl { font-size: 11px; opacity: .9; }

/* ---------- Chips seleccionables ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 13px; border-radius: 11px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: .14s; line-height: 1.1;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip svg { flex-shrink: 0; color: var(--blue); transition: color .14s; }
.chip.active svg { color: #fff; }
.chip:hover { border-color: var(--blue-l); background: #f7f9fd; }
.chip.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  box-shadow: 0 3px 10px rgba(11,58,160,.28);
}

/* ---------- Tip del día ---------- */
.tip-card {
  margin-top: 18px; padding: 14px 16px; border-radius: 13px;
  background: rgba(244,123,32,.08); border: 1px solid rgba(244,123,32,.25);
}
.tip-head { font-size: 12px; font-weight: 800; color: var(--orange-d); text-transform: uppercase; letter-spacing: .4px; }
.tip-card p { margin: 8px 0 0; font-size: 13px; color: var(--text); line-height: 1.5; }
.tip-card b { color: var(--blue); }
.audio-toggle {
  display: flex !important; align-items: center; gap: 12px; margin: 18px 0 0 !important;
  padding: 13px 14px; border-radius: 13px; cursor: pointer;
  color: var(--text) !important; font-weight: 600;
  background: linear-gradient(160deg, #f7f9fd 0%, #eef2f9 100%);
  border: 1.5px solid var(--border); transition: border-color .18s, box-shadow .18s;
}
.audio-toggle:hover { border-color: #c4cee0; }
/* Selector de voz */
.voice-picker { display: flex; align-items: center; gap: 8px; margin: 8px 2px 0; }
.voice-picker small { color: var(--muted); font-weight: 600; white-space: nowrap; }
.voice-picker select {
  flex: 1; min-width: 0; padding: 7px 9px; border-radius: 10px;
  border: 1.5px solid var(--border); background: #fff; color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer; transition: border-color .18s;
}
.voice-picker select:hover { border-color: #c4cee0; }
.voice-picker select:focus { outline: none; border-color: var(--accent, #4a6cf7); }
/* Icono altavoz */
.audio-ico {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--border); color: var(--muted); transition: .18s;
}
.audio-ico .wave { opacity: .35; transition: opacity .2s; }
/* Texto */
.audio-txt { display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
.audio-txt strong { font-size: 13.5px; }
.audio-txt small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
/* Switch */
.audio-toggle input.switch { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.switch-track {
  position: relative; width: 42px; height: 24px; flex-shrink: 0; border-radius: 20px;
  background: #cbd3e2; transition: background .2s; box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28); transition: transform .2s;
}
/* Estado activo */
.audio-toggle:has(input.switch:checked) {
  border-color: var(--blue-l); box-shadow: 0 0 0 4px rgba(44,92,197,.1);
}
.audio-toggle:has(input.switch:checked) .switch-track {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
}
.audio-toggle:has(input.switch:checked) .switch-thumb { transform: translateX(18px); }
.audio-toggle:has(input.switch:checked) .audio-ico {
  color: var(--blue); border-color: var(--blue-l); background: rgba(44,92,197,.08);
}
.audio-toggle:has(input.switch:checked) .audio-ico .wave { opacity: 1; }
.audio-toggle:has(input.switch:checked) .audio-ico .w1 { animation: wave 1.6s ease-in-out infinite; }
.audio-toggle:has(input.switch:checked) .audio-ico .w2 { animation: wave 1.6s ease-in-out .25s infinite; }
@keyframes wave { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
.audio-toggle input.switch:focus-visible + .switch-track { box-shadow: 0 0 0 4px rgba(44,92,197,.25); }

/* ===================================================================
   CHAT
=================================================================== */
.chat-wrap {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
  display: flex; flex-direction: column; height: calc(100vh - 128px);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.messages {
  flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px;
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(44,92,197,.04), transparent 70%),
    #fbfcfe;
}
.placeholder {
  text-align: center;
  margin: auto;
  max-width: 520px;
  padding: 20px;
  background: transparent;
  border: none;
  box-shadow: none;
}
.placeholder:hover {
  transform: none;
  box-shadow: none;
}
.placeholder-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
  animation: slideDown 0.5s ease-out;
}
.ph-logo-small {
  width: 250px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(11,58,160,0.15));
}
.ph-robot {
  width: 220px;
  height: 220px;
  object-fit: contain;
  margin: 0 auto 28px;
  opacity: 1;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(11,58,160,0.2)) drop-shadow(0 0 1px rgba(0,0,0,0.1));
  background-color: transparent !important;
}
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-8px); } }
.ph-logo { width: 150px; height: auto; opacity: .95; margin-bottom: 22px; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.ph-title { font-size: 23px; color: var(--text); font-weight: 700; margin: 0 0 14px; letter-spacing: -.3px; }
.ph-text { color: var(--muted); font-size: 14.5px; line-height: 1.75; margin: 0; }
.msg {
  max-width: 74%; padding: 12px 16px; border-radius: 16px; line-height: 1.5; font-size: 14px;
  box-shadow: var(--shadow-sm); animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user {
  align-self: flex-end; color: #fff; border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
}
.msg.assistant {
  align-self: flex-start; background: linear-gradient(160deg, #fafbfc 0%, #fff 100%); border: 1px solid var(--border);
  border-bottom-left-radius: 5px; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
}
.msg.assistant img {
  display: block;
}
.msg.assistant .msg-content { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.corrections {
  align-self: flex-start; max-width: 74%; background: #fff7ed;
  border: 1px solid #fed7aa; border-radius: 14px; padding: 13px 15px; font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.corrections b { color: var(--warn); display: block; margin-bottom: 6px;
  text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.corrections .c { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #fed7aa; }
.corrections .c:first-of-type { border-top: 0; padding-top: 0; }
.corrections .old { color: var(--err); text-decoration: line-through; }
.corrections .new { color: var(--ok); font-weight: 700; }
.suggestion {
  align-self: flex-start; font-size: 12.5px; color: var(--muted); font-style: italic;
  background: rgba(244,123,32,.08); padding: 8px 12px; border-radius: 10px;
  border-left: 3px solid var(--orange);
}
.chat-form { display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--border); background: #fff; }

/* ===================================================================
   PANELES / TARJETAS / TABLAS
=================================================================== */
.panel {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 26px; grid-column: 2; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; gap: 15px; margin-bottom: 8px; }
.panel-ico {
  width: 52px; height: 52px; flex-shrink: 0; border-radius: 15px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  box-shadow: 0 6px 16px rgba(11,58,160,.3);
}
.panel-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 14px; margin: 20px 0 8px; }
.card {
  background: linear-gradient(160deg, #f7f9fd 0%, #eef2f9 100%);
  border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px;
  position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
  background: linear-gradient(var(--blue), var(--orange));
}
.card .num { font-size: 30px; font-weight: 800; color: var(--blue); letter-spacing: -1px; }
.card .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 600; }
.progress-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
@media (max-width: 700px) { .progress-grid { grid-template-columns: 1fr; gap: 4px; } }
.skill-list { display: flex; flex-direction: column; gap: 14px; }
.skill .skill-top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; font-weight: 600; }
.skill .skill-top b { color: var(--blue); }
.skill .bar { height: 9px; background: var(--bg); border-radius: 20px; overflow: hidden; }
.skill .bar span {
  display: block; height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue-l) 100%);
  transition: width .5s ease;
}
.muted-txt { color: var(--muted); font-size: 13px; }
.pill {
  display: inline-block; background: rgba(11,58,160,.1); color: var(--blue);
  padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.error-list { list-style: none; padding: 0; margin: 0; }
.error-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.error-list li b {
  background: rgba(244,123,32,.12); color: var(--orange-d);
  padding: 2px 10px; border-radius: 20px; font-size: 13px;
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table th {
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  background: var(--bg);
}
.table th:first-child { border-top-left-radius: 10px; }
.table th:last-child { border-top-right-radius: 10px; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f7f9fd; }

/* ===================================================================
   RESPONSIVE
=================================================================== */
@media (max-width: 860px) {
  .topbar { gap: 14px; padding: 10px 16px; }
  .content { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  .panel { grid-column: 1; }
  .chat-wrap { height: calc(100vh - 220px); }
  .msg, .corrections { max-width: 90%; }
  .nav { order: 3; width: 100%; justify-content: center; }
  .user { margin-left: auto; }
}
/* ===================================================================
   AVATAR DE USUARIO (con tarjeta al pasar el ratón)
=================================================================== */
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; cursor: pointer; position: relative; flex-shrink: 0; outline: none;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  box-shadow: 0 3px 10px rgba(11,58,160,.28); transition: all .18s; border: 2px solid rgba(255,255,255,.3);
}
.avatar:hover { transform: scale(1.08); box-shadow: 0 4px 14px rgba(11,58,160,.35); }
.avatar-card {
  position: absolute; top: calc(100% + 12px); right: 0; min-width: 220px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility .16s; z-index: 30; color: var(--text);
}
.avatar:hover .avatar-card, .avatar:focus .avatar-card { opacity: 1; visibility: visible; transform: translateY(0); }
.avatar-card::before {
  content: ""; position: absolute; top: -6px; right: 14px; width: 12px; height: 12px;
  background: #fff; border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.avatar-card strong { font-size: 14px; }
.avatar-card span { font-size: 12.5px; color: var(--muted); }
.av-role {
  margin-top: 6px; align-self: flex-start; background: rgba(11,58,160,.1); color: var(--blue);
  padding: 2px 10px; border-radius: 20px; font-weight: 700; font-size: 11px !important;
  text-transform: uppercase; letter-spacing: .4px;
}

/* ---------- Botón de icono / micrófono ---------- */
.icon-btn {
  width: 46px; height: 46px; flex-shrink: 0; border: 1.5px solid var(--border);
  background: #fff; border-radius: 12px; display: grid; place-items: center;
  cursor: pointer; color: var(--muted); transition: .15s;
}
.icon-btn:hover:not(:disabled) { color: var(--blue); border-color: var(--blue-l); background: #f7f9fd; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn.recording {
  color: #fff; background: var(--orange); border-color: var(--orange);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(244,123,32,.5); }
  70% { box-shadow: 0 0 0 10px rgba(244,123,32,0); }
  100% { box-shadow: 0 0 0 0 rgba(244,123,32,0); }
}

/* ---------- Botón "escuchar" en respuestas del tutor ---------- */
.speak-btn {
  border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer;
  padding: 5px 11px; margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; border-radius: 20px; font-family: inherit;
  transition: .15s;
}
.speak-btn:hover { color: var(--blue); border-color: var(--blue-l); background: #f7f9fd; }
.speak-btn svg { flex-shrink: 0; }
.speak-btn.playing {
  color: #fff; background: linear-gradient(135deg, var(--orange) 0%, var(--orange-d) 100%);
  border-color: transparent;
}
.speak-btn.playing svg { animation: wave 1.1s ease-in-out infinite; }
.msg.assistant { display: flex; flex-direction: row; align-items: flex-start; }
.msg-translation {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
  font-size: 13px; color: var(--muted); font-style: italic;
}

/* ---------- Cabecera y controles del panel lateral ---------- */
.mode-head { display: flex; align-items: center; gap: 13px; margin-bottom: 20px;
  padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.mode-ico {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 13px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  box-shadow: 0 5px 14px rgba(11,58,160,.3);
}
.mode-head h4 { margin: 0; font-size: 15.5px; }
.mode-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.3; }
.btn.primary.start { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; }
.btn.primary.start svg { flex-shrink: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3dae8; border-radius: 10px; border: 2px solid #fbfcfe; }
::-webkit-scrollbar-thumb:hover { background: #b9c3d6; }

/* ---------- Dashboard del Sistema (Admin) ---------- */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin: 24px 0;
}
.dashboard-card {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  border-radius: 16px; padding: 24px; color: #fff; box-shadow: 0 8px 24px rgba(11,58,160,.15);
  display: flex; flex-direction: column; gap: 8px;
}
.dashboard-card-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; opacity: .9; }
.dashboard-card-value { font-size: 32px; font-weight: 700; line-height: 1; }
.dashboard-card-sub { font-size: 12px; opacity: .8; }

/* ---------- Perfil del Alumno ---------- */
.profile-grid, .goals-list, .groups-list, .tasks-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 20px 0;
}
.profile-card, .goal-card, .group-card, .task-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 10px rgba(16, 30, 70, .03);
}
.profile-card {
  border-left: 4.5px solid var(--blue-l);
}
.profile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(11, 58, 160, .08);
}
.profile-card label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; display: block; margin-bottom: 6px; letter-spacing: .4px; }
.profile-value { font-size: 16px; font-weight: 700; color: var(--text); }

/* ---------- Preferencias ---------- */
.preferences-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin: 20px 0;
}
.pref-item {
  display: flex; align-items: center; justify-content: space-between; flex-direction: row-reverse;
  padding: 14px 18px; background: linear-gradient(185deg, #fff 0%, #fbfcfe 100%);
  border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; font-size: 14px;
  transition: all .2s ease; box-shadow: 0 2px 6px rgba(16, 30, 70, .02);
}
.pref-item:hover {
  border-color: var(--blue-l); background: #f4f7fd; transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(11, 58, 160, .05);
}
.pref-item span { font-weight: 600; color: var(--text); flex: 1; padding-right: 12px; }
.pref-item input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 44px; height: 24px;
  background: #cbd5e1; border-radius: 20px; position: relative; outline: none;
  cursor: pointer; transition: background .2s ease; flex-shrink: 0;
}
.pref-item input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
}
.pref-item input[type="checkbox"]::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s ease;
}
.pref-item input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

/* ---------- Gestión de Usuarios (Admin) ---------- */
.users-filters { margin-bottom: 20px; max-width: 300px; }
.users-filters select { width: 100%; }

/* ---------- Configuración (Admin) ---------- */
.settings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 20px 0;
}
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-group label { font-weight: 600; font-size: 14px; color: var(--text); }
.setting-group input, .setting-group select { padding: 10px 12px; }

.export-buttons, .security-section {
  display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0;
}
.export-buttons .btn, .security-section .btn {
  font-size: 13px; padding: 10px 16px;
}

/* ---------- Sistema de Notificaciones ---------- */
.notifications-container {
  position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px;
}
.notification {
  background: var(--card); border-left: 4px solid var(--blue); border-radius: 8px; padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(11,58,160,.15); animation: slideIn .3s ease-out;
  max-width: 350px; min-width: 300px; display: flex; align-items: flex-start; gap: 10px;
}
.notification.success { border-left-color: var(--ok); }
.notification.error { border-left-color: var(--err); }
.notification.warning { border-left-color: var(--warn); }
.notification-icon { font-size: 18px; flex-shrink: 0; }
.notification-content { display: flex; flex-direction: column; gap: 2px; }
.notification-title { font-weight: 600; font-size: 13px; }
.notification-message { font-size: 12px; color: var(--muted); }
.notification-close { cursor: pointer; opacity: .5; margin-left: auto; }
@keyframes slideIn { from { transform: translateX(400px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Búsqueda Global ---------- */
.search-bar {
  flex: 1; max-width: 400px; margin: 0 20px; display: flex; align-items: center; gap: 10px;
  background: rgba(11,58,160,.08); border: 1.5px solid rgba(11,58,160,.15); border-radius: 12px;
  padding: 10px 16px; color: var(--text); transition: all .18s;
}
.search-bar:hover { background: rgba(11,58,160,.12); border-color: rgba(11,58,160,.25); }
.search-bar:focus-within { background: #fff; border-color: var(--blue-l); box-shadow: 0 0 0 3px rgba(44,92,197,.12); }
.search-bar svg { color: var(--muted); transition: color .18s; }
.search-bar:focus-within svg { color: var(--blue); }
.search-bar input {
  background: transparent; border: none; outline: none; color: var(--text); font-size: 13px;
  flex: 1; font-family: inherit;
}
.search-bar input::placeholder { color: var(--muted); }

/* ---------- Botones Small Icon ---------- */
.icon-btn-small {
  width: 38px; height: 38px; border: 1.5px solid rgba(11,58,160,.2); background: rgba(11,58,160,.06);
  border-radius: 10px; color: var(--blue); cursor: pointer; display: grid; place-items: center;
  transition: all .18s; position: relative; flex-shrink: 0;
}
.icon-btn-small:hover { background: rgba(11,58,160,.12); border-color: rgba(11,58,160,.3); transform: translateY(-1px); }
.icon-btn-small:active { transform: translateY(0); }
.notif-badge {
  position: absolute; top: -4px; right: -4px; background: var(--orange); color: #fff;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; border: 2px solid var(--card);
}

/* ---------- Badges y Certificados ---------- */
.badges-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 20px 0;
}
.badge-card-interactive {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: linear-gradient(135deg, rgba(244,123,32,.08) 0%, rgba(11,58,160,.08) 100%);
  border: 1.5px solid var(--border); border-radius: 16px; cursor: pointer;
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .3s ease, filter .3s ease;
  box-shadow: 0 4px 12px rgba(16, 30, 70, .02);
}
.badge-card-interactive:hover:not(.locked) {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(11,58,160,.12);
  border-color: var(--blue-l);
}
.badge-card-interactive.locked {
  filter: grayscale(100%);
  opacity: 0.55;
  background: #f8fafc;
  border-style: dashed;
}
.badge-icon-wrap {
  width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center;
  background: #fff; box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.badge-icon { display: flex; align-items: center; justify-content: center; }
.badge-icon svg { color: var(--blue); transition: transform 0.2s; }
.badge-card-interactive:hover:not(.locked) .badge-icon svg { transform: scale(1.1); color: var(--orange); }
.badge-card-interactive.locked .badge-icon svg { color: var(--muted); }
.badge-info-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.badge-name { font-weight: 700; font-size: 14px; color: var(--text); }
.badge-progress-text { font-size: 11.5px; font-weight: 700; color: var(--blue-l); align-self: flex-end; }
.badge-card-interactive.locked .badge-progress-text { color: var(--muted); }
.badge-progress-bar { height: 6px; background: #e2e8f0; border-radius: 4px; overflow: hidden; width: 100%; }
.badge-progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue) 0%, var(--blue-l) 100%); border-radius: 4px; transition: width .4s ease; }
.badge-card-interactive.locked .badge-progress-fill { background: var(--muted); }

/* Badges para niveles CEFR en tablas/listas */
.level-badge {
  display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: rgba(11, 58, 160, 0.1); color: var(--blue); border: 1px solid rgba(11, 58, 160, 0.2);
}
.level-badge.a1 { background: rgba(52, 211, 153, 0.1); color: #065f46; border-color: rgba(52, 211, 153, 0.3); }
.level-badge.a2 { background: rgba(96, 165, 250, 0.1); color: #1e40af; border-color: rgba(96, 165, 250, 0.3); }
.level-badge.b1 { background: rgba(59, 130, 246, 0.1); color: var(--blue); border-color: rgba(59, 130, 246, 0.3); }
.level-badge.b2 { background: rgba(139, 92, 246, 0.1); color: #6b21a8; border-color: rgba(139, 92, 246, 0.3); }
.level-badge.c1 { background: rgba(244, 123, 32, 0.1); color: var(--orange-d); border-color: rgba(244, 123, 32, 0.3); }
.level-badge.c2 { background: rgba(239, 68, 68, 0.1); color: #b91c1c; border-color: rgba(239, 68, 68, 0.3); }

/* ---------- Estadísticas Mini ---------- */
.stats-mini-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 16px 0;
}
.stat-mini {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  color: #fff; border-radius: 12px; padding: 16px; text-align: center;
  box-shadow: 0 4px 12px rgba(11,58,160,.2);
}
.stat-num { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 11px; margin-top: 8px; opacity: .9; text-transform: uppercase; letter-spacing: .3px; }

/* ---------- Calendario ---------- */
.calendar-wrapper {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 20px 0;
}
.calendar {
  background: var(--card); border-radius: 12px; padding: 16px; border: 1px solid var(--border);
}
.calendar-events {
  background: var(--card); border-radius: 12px; padding: 16px; border: 1px solid var(--border);
}
.calendar-events h4 { margin: 0 0 12px; }
.events-list { display: flex; flex-direction: column; gap: 10px; }
.event-item {
  background: var(--bg); border-left: 3px solid var(--blue); border-radius: 6px; padding: 10px 12px;
  font-size: 13px;
}
.event-time { font-weight: 600; color: var(--blue); }
.event-title { color: var(--text); margin-top: 2px; }

/* ---------- Leaderboard ---------- */
.leaderboard-container { overflow-x: auto; margin: 20px 0; }
.leaderboard-table {
  width: 100%; border-collapse: collapse;
}
.leaderboard-table thead {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  color: #fff;
}
.leaderboard-table th {
  padding: 14px; text-align: left; font-weight: 600; font-size: 13px;
}
.leaderboard-table td {
  padding: 14px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.leaderboard-table tr:hover { background: rgba(11,58,160,.04); }
.rank-1 { color: #FFD700; font-weight: 700; }
.rank-2 { color: #C0C0C0; font-weight: 700; }
.rank-3 { color: #CD7F32; font-weight: 700; }
.points-badge {
  background: linear-gradient(135deg, var(--orange) 0%, #f9a835 100%);
  color: #fff; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* ===================================================================
   CAMBRIDGE — TARJETAS DE PARTES Y DISEÑO ADAPTATIVO
=================================================================== */
.cambridge-level-chips {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px;
}
.cambridge-level-badge {
  display: flex; align-items: center; justify-content: center; padding: 14px 12px;
  border: 2px solid var(--border); background: #fff; border-radius: 12px; font-weight: 700;
  font-size: 15px; cursor: pointer; transition: all .18s; position: relative;
  color: var(--text);
}
.cambridge-level-badge:hover { border-color: var(--blue-l); background: #f7f9fd; }
.cambridge-level-badge.b1 { border-color: #10b981; }
.cambridge-level-badge.b1.active { background: #d1fae5; border-color: #10b981; color: #065f46; }
.cambridge-level-badge.b2 { border-color: var(--blue); }
.cambridge-level-badge.b2.active { background: rgba(11,58,160,.12); border-color: var(--blue); color: var(--blue); }
.cambridge-level-badge.c1 { border-color: var(--orange); }
.cambridge-level-badge.c1.active { background: rgba(244,123,32,.12); border-color: var(--orange); color: var(--orange-d); }
.cambridge-level-badge.c2 { border-color: #ef4444; }
.cambridge-level-badge.c2.active { background: rgba(239,68,68,.12); border-color: #ef4444; color: #7f1d1d; }

.cambridge-part-cards {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 18px 0 20px;
}
.cambridge-part-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 16px;
  border: 2px solid var(--border); background: #fff; border-radius: 14px; cursor: pointer;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1); position: relative; text-align: center;
  min-height: 140px; justify-content: center;
}
.cambridge-part-card:hover {
  border-color: var(--blue-l); background: #f7f9fd; transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(11,58,160,.12);
}
.cambridge-part-card.active {
  border-color: var(--blue); background: linear-gradient(135deg, rgba(11,58,160,.06) 0%, rgba(11,58,160,.03) 100%);
  box-shadow: 0 6px 16px rgba(11,58,160,.2);
}
.cambridge-part-card svg {
  width: 32px; height: 32px; color: var(--blue); transition: color .2s;
}
.cambridge-part-card.active svg { color: var(--orange); }
.cambridge-part-card-title {
  font-size: 14px; font-weight: 700; color: var(--text);
}
.cambridge-part-card-desc {
  font-size: 11px; color: var(--muted); line-height: 1.3; margin-top: 2px;
}

.cambridge-info-box {
  padding: 14px 16px; background: rgba(11,58,160,.06); border: 1px solid rgba(11,58,160,.15);
  border-radius: 12px; margin: 16px 0; font-size: 13px; color: var(--text);
  line-height: 1.5; animation: slideDown .3s ease-out;
}
.cambridge-info-box strong { color: var(--blue); font-weight: 700; }

.chat-context-bar {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  background: linear-gradient(90deg, rgba(11,58,160,.04) 0%, rgba(244,123,32,.04) 100%);
  border-bottom: 1.5px solid rgba(11,58,160,.1); font-size: 13px; font-weight: 600;
  color: var(--text);
}
.context-content {
  display: flex; align-items: center; gap: 8px; margin-left: 0;
}
.context-level {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  background: rgba(11,58,160,.12); border-radius: 8px; color: var(--blue);
  font-weight: 700;
}
.context-dot {
  color: rgba(11,58,160,.3);
}
.context-part {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  background: rgba(244,123,32,.12); border-radius: 8px; color: var(--orange-d);
  font-weight: 700;
}

/* ---------- Controladores de visibilidad por rol ---------- */
/* Se controlan dinámicamente mediante JS usando la clase .hidden */

/* ---------- Animaciones Premium ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }

.panel { animation: fadeIn .4s ease-out; }
.profile-card, .badge, .stat-mini, .event-item {
  animation: slideUp .5s ease-out;
}



/* ---------- Minijuegos ---------- */
.game-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(11,58,160,.2) 0%, rgba(244,123,32,.1) 100%), rgba(0,0,0,.68);
  display: grid; place-items: center; z-index: 999; animation: fadeIn .3s ease-out;
  padding: 20px; backdrop-filter: blur(2px);
}
.game-modal.hidden { display: none; }
.game-modal-content {
  background: linear-gradient(160deg, #fafbfc 0%, var(--card) 100%);
  border-radius: 24px; padding: 24px; max-width: 520px; width: 100%;
  position: relative; box-shadow: 0 30px 80px rgba(11,58,160,.28), 0 0 1px rgba(0,0,0,.08);
  animation: slideUp .4s ease-out; max-height: 90vh; overflow-y: auto;
  border: 1px solid rgba(255,255,255,.8);
}
.game-close {
  position: absolute; top: 18px; right: 18px; background: none; border: none;
  font-size: 24px; cursor: pointer; color: var(--muted); transition: .2s;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.game-close:hover {
  color: var(--text); transform: scale(1.1); background: var(--bg);
}

/* Botones Mini */
.btn-mini {
  padding: 10px 14px; font-size: 13px; border-radius: 10px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; transition: .15s;
  font-weight: 600; white-space: nowrap;
}
.btn-mini.primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  color: #fff; border: none; box-shadow: 0 4px 12px rgba(11,58,160,.25);
}
.btn-mini:hover:not(.primary) { background: var(--bg); border-color: var(--blue); }
.btn-mini.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(11,58,160,.35); }

/* Selector de Dificultad */
.game-difficulty-selector,
.game-setup-container {
  animation: slideUp .4s ease-out;
}
.game-selector-header {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  margin-bottom: 24px;
}
.game-selector-icon-wrap {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center;
  margin-bottom: 12px; box-shadow: var(--shadow-sm);
  background: rgba(11,58,160,.06); border: 1.5px solid rgba(11,58,160,.12);
  transition: transform 0.3s ease;
}
.game-selector-icon-wrap svg { color: var(--blue); }
.game-selector-icon-wrap.hangman-color { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.15); }
.game-selector-icon-wrap.hangman-color svg { color: #059669; }
.game-selector-icon-wrap.quiz-color { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.15); }
.game-selector-icon-wrap.quiz-color svg { color: #2563eb; }
.game-selector-icon-wrap.flashcards-color { background: rgba(139,92,246,.08); border-color: rgba(139,92,246,.15); }
.game-selector-icon-wrap.flashcards-color svg { color: #7c3aed; }
.game-selector-icon-wrap.sentencebuilder-color { background: rgba(249,115,22,.08); border-color: rgba(249,115,22,.15); }
.game-selector-icon-wrap.sentencebuilder-color svg { color: #ea580c; }

.game-selector-title {
  font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text); margin-bottom: 4px;
}
.game-selector-subtitle {
  font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 12px;
  font-weight: 500;
}
.difficulty-grid {
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px;
}
.difficulty-btn {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
  border: 1.5px solid var(--border); border-radius: 16px; background: #fff;
  cursor: pointer; transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(16,30,70,.02); text-align: left; width: 100%;
  position: relative; overflow: hidden;
}
.difficulty-badge {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; font-weight: 900; color: #fff; flex-shrink: 0;
  box-shadow: var(--shadow-sm); transition: transform 0.25s;
}
.difficulty-text {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.difficulty-title {
  font-size: 14.5px; font-weight: 700; color: var(--text); transition: color 0.2s;
}
.difficulty-desc {
  font-size: 11.5px; color: var(--muted); font-weight: 500;
}
.difficulty-arrow {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); opacity: 0.5; transition: transform 0.25s, opacity 0.25s, color 0.2s;
}

/* Color Coding for Badges and Hover states */
.difficulty-btn.a1 .difficulty-badge { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.difficulty-btn.a1:hover { border-color: #10b981; background: rgba(16, 185, 129, 0.04); transform: translateX(4px); }
.difficulty-btn.a1:hover .difficulty-title { color: #059669; }

.difficulty-btn.a2 .difficulty-badge { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.difficulty-btn.a2:hover { border-color: #3b82f6; background: rgba(59, 130, 246, 0.04); transform: translateX(4px); }
.difficulty-btn.a2:hover .difficulty-title { color: #2563eb; }

.difficulty-btn.b1 .difficulty-badge { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }
.difficulty-btn.b1:hover { border-color: #14b8a6; background: rgba(20, 184, 166, 0.04); transform: translateX(4px); }
.difficulty-btn.b1:hover .difficulty-title { color: #0d9488; }

.difficulty-btn.b2 .difficulty-badge { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.difficulty-btn.b2:hover { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.04); transform: translateX(4px); }
.difficulty-btn.b2:hover .difficulty-title { color: #7c3aed; }

.difficulty-btn.c1 .difficulty-badge { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.difficulty-btn.c1:hover { border-color: #f97316; background: rgba(249, 115, 22, 0.04); transform: translateX(4px); }
.difficulty-btn.c1:hover .difficulty-title { color: #ea580c; }

.difficulty-btn.c2 .difficulty-badge { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.difficulty-btn.c2:hover { border-color: #ef4444; background: rgba(239, 68, 68, 0.04); transform: translateX(4px); }
.difficulty-btn.c2:hover .difficulty-title { color: #dc2626; }

.difficulty-btn:hover .difficulty-badge { transform: scale(1.08); }
.difficulty-btn:hover .difficulty-arrow { transform: translateX(2px); opacity: 1; color: inherit; }

/* Juego del Ahorcado */
.hangman-game { text-align: center; animation: slideUp .4s ease-out; }
.hangman-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-right: 40px;
}
.hangman-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hangman-top-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.hangman-hearts-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.heart-icon {
  font-size: 20px;
  display: inline-block;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.15));
}
.heart-icon.empty {
  filter: grayscale(1) opacity(0.4);
}
.heart-icon.just-lost {
  animation: loseHeart 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes loseHeart {
  0% { transform: scale(1.6); filter: grayscale(0) drop-shadow(0 0 10px #ef4444); }
  50% { transform: scale(0.6) rotate(-20deg); filter: grayscale(0.5); }
  100% { transform: scale(1) rotate(0); filter: grayscale(1) opacity(0.4); }
}
.hangman-hint-card {
  background: linear-gradient(135deg, rgba(249, 168, 53, 0.02) 0%, rgba(249, 168, 53, 0.06) 100%);
  border: 1.2px dashed rgba(249, 168, 53, 0.25);
  padding: 5px 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #c27803;
  box-shadow: 0 4px 10px rgba(249, 168, 53, 0.01);
}
.hint-lamp {
  font-size: 14px;
}
.hint-label {
  opacity: 0.8;
  font-weight: 600;
}
.hangman-visual {
  display: flex;
  justify-content: center;
  margin: 6px 0 12px;
}
.hangman-svg-draw {
  width: 90px;
  height: 90px;
  background: rgba(11, 58, 160, 0.02);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 6px;
  box-shadow: inset 0 2px 8px rgba(11,58,160,0.01);
}
.hangman-word-container {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.hangman-letter-slot {
  width: 32px;
  height: 40px;
  border-bottom: 2.5px solid var(--blue);
  background: rgba(11, 58, 160, 0.03);
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  box-shadow: 0 3px 5px rgba(0,0,0,0.01);
  transition: all 0.2s ease;
}
.hangman-letter-slot.filled {
  background: #fff;
  border-bottom-color: #10b981;
  color: #10b981;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.hangman-guesses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 16px auto;
  max-width: 440px;
  background: #1e293b;
  padding: 14px;
  border-radius: 16px;
  box-shadow: 
    inset 0 4px 10px rgba(0,0,0,0.3),
    0 8px 20px -5px rgba(0,0,0,0.1);
  border: 1px solid #334155;
}
.hangman-letter {
  width: 32px;
  height: 32px;
  border: 1px solid #475569;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(to bottom, #334155, #1e293b);
  color: #f1f5f9;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4);
  box-shadow: 0 3px 0 #0f172a;
  transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hangman-letter:hover:not(.used) {
  background: linear-gradient(to bottom, #475569, #334155);
  border-color: #64748b;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #0f172a;
}
.hangman-letter:active:not(.used) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0f172a;
}
.hangman-letter.used {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.hangman-letter.correct {
  background: linear-gradient(to bottom, #10b981, #047857) !important;
  border-color: #10b981 !important;
  color: #fff !important;
  box-shadow: 0 1.5px 0 #064e3b !important;
  transform: translateY(1.5px);
}
.hangman-letter.wrong {
  background: linear-gradient(to bottom, #ef4444, #b91c1c) !important;
  border-color: #ef4444 !important;
  color: #fff !important;
  box-shadow: 0 2px 0 #7f1d1d !important;
  animation: shake 0.4s;
  transform: translateY(2px);
}
.heart-svg-icon {
  width: 28px;
  height: 28px;
  margin: 0 3px;
  transition: all 0.3s ease;
}
.heart-svg-icon.active {
  color: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.5));
  animation: heartPulse 1.5s infinite ease-in-out;
}
.heart-svg-icon.empty {
  color: #cbd5e1;
}
.heart-svg-icon.just-lost {
  animation: loseHeart 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.hangman-message {
  margin-top: 10px;
  min-height: 28px;
}
.hangman-outcome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
  animation: slideUp 0.4s ease-out;
}
.hangman-outcome.win {
  background: rgba(16, 185, 129, 0.06);
  border: 1.5px solid rgba(16, 185, 129, 0.25);
  color: #065f46;
}
.hangman-outcome.lose {
  background: rgba(239, 68, 68, 0.06);
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  color: #991b1b;
}
.outcome-icon {
  font-size: 28px;
}
.outcome-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.outcome-details strong {
  font-size: 15.5px;
  font-weight: 800;
}
.outcome-details span {
  font-size: 13.5px;
  opacity: 0.9;
}
.correct-word {
  font-family: monospace;
  background: rgba(255,255,255,0.7);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 14px;
}
.hangman-outcome.win .correct-word {
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.hangman-outcome.lose .correct-word {
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.outcome-streak-badge {
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(234, 179, 8, 0.3);
  display: flex;
  align-items: center;
  animation: bounce 0.6s ease;
}
.outcome-streak-reset {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.hangman-buttons {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

/* Quiz */
.quiz-game { animation: slideUp .4s ease-out; }
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-right: 40px;
}
.quiz-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.quiz-progress-bar {
  width: 100%; height: 8px; background: linear-gradient(90deg, var(--border) 0%, #e3e8f2 100%);
  border-radius: 4px; overflow: hidden; margin-bottom: 14px; box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}
.quiz-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--blue) 0%, var(--blue-l) 100%);
  transition: width .4s cubic-bezier(.34,.69,.4,.99); border-radius: 4px;
}
.quiz-progress {
  background: linear-gradient(160deg, #f7f9fd 0%, var(--bg) 100%);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 20px;
  font-size: 13px; color: var(--muted); font-weight: 600; border: 1px solid var(--border);
}
.quiz-question {
  font-size: 18px; font-weight: 700; margin-bottom: 22px; color: var(--text);
  line-height: 1.5; padding: 18px; background: linear-gradient(160deg, rgba(11,58,160,.04) 0%, rgba(244,123,32,.02) 100%);
  border-radius: 12px; border-left: 4px solid var(--blue);
}
.quiz-options {
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px;
}
.quiz-option {
  padding: 16px 18px; border: 2px solid var(--border); border-radius: 12px;
  cursor: pointer; background: linear-gradient(160deg, #fafbfc 0%, var(--card) 100%);
  text-align: left; transition: .25s cubic-bezier(.34,.69,.4,.99);
  font-size: 15px; font-weight: 500; position: relative;
}
.quiz-option:hover {
  border-color: var(--blue); background: linear-gradient(160deg, rgba(11,58,160,.04) 0%, rgba(11,58,160,.02) 100%);
  transform: translateX(4px); box-shadow: 0 4px 12px rgba(11,58,160,.1);
}
.quiz-option.selected {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  color: #fff; border-color: var(--blue); box-shadow: 0 4px 12px rgba(11,58,160,.25);
}
.quiz-option.correct {
  background: linear-gradient(135deg, var(--ok) 0%, #27b85f 100%);
  color: #fff; border-color: var(--ok); box-shadow: 0 4px 12px rgba(31,157,99,.25);
}
.quiz-option.wrong {
  background: linear-gradient(135deg, var(--err) 0%, #e85a5a 100%);
  color: #fff; border-color: var(--err); box-shadow: 0 4px 12px rgba(214,69,69,.25);
}

/* Flashcards */
.flashcard-game { text-align: center; animation: slideUp .4s ease-out; }
.flashcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-right: 40px;
}
.flashcard-header .quiz-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.flashcard-footer {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.flashcard-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.flashcard-nav-row .btn-nav {
  padding: 8px 16px !important;
  font-size: 13.5px !important;
  border-radius: 10px !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.flashcard-counter {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  background: rgba(11, 58, 160, 0.05);
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.2px;
  display: inline-block;
  margin: 0 !important;
}
.flashcard-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.flashcard-actions .btn {
  width: 100%;
  padding: 12px 18px !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  border-radius: 14px !important;
  transition: all 0.2s ease;
}
.flashcard-actions .mark-learned-btn {
  box-shadow: 0 4px 12px rgba(11, 58, 160, 0.15);
}
.flashcard-actions .mark-learned-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(11, 58, 160, 0.22);
}
.flashcard-actions .close-game-btn {
  margin-top: 0 !important;
}
.flashcard-info {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.flashcard-level,
.flashcard-learned {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.flashcard-level {
  background: rgba(44, 92, 197, 0.08);
  color: var(--blue);
  border: 1px solid rgba(44, 92, 197, 0.15);
}
.flashcard-learned {
  background: rgba(249, 168, 53, 0.08);
  color: #d97706;
  border: 1px solid rgba(249, 168, 53, 0.2);
  transition: all 0.3s ease;
}
.flashcard-learned.completed {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.flashcard-hint {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none !important;
  background: #f1f5f9 !important;
  color: #94a3b8 !important;
  border-color: #e2e8f0 !important;
}
.completed-btn {
  background: rgba(16, 185, 129, 0.08) !important;
  color: #059669 !important;
  border: 1.5px solid rgba(16, 185, 129, 0.3) !important;
  font-weight: 700 !important;
}
.flashcard-container {
  perspective: 1200px;
  margin: 32px auto;
  width: 100%;
  max-width: 440px;
}
.flashcard {
  width: 100%;
  height: 250px;
  cursor: pointer;
  perspective: 1200px;
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  animation: slideUp .4s ease-out;
}
.flashcard-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  box-shadow: 0 16px 40px rgba(11,58,160,0.15);
  border-radius: 20px;
}
.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard:hover .flashcard-inner {
  box-shadow: 0 20px 48px rgba(11,58,160,0.22);
}
.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.15);
}
.flashcard-front {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  color: #fff;
}
.flashcard-back {
  background: linear-gradient(135deg, var(--orange) 0%, #f9a835 100%);
  color: #fff;
  transform: rotateY(180deg);
}
.flashcard-lang {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 20px;
  opacity: 0.85;
}
.flashcard-word {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.flashcard-counter {
  font-size: 13px; color: var(--muted); margin-top: 16px; font-weight: 600;
}

/* Desafío Diario */
.daily-challenge-game { animation: slideUp .4s ease-out; }
.challenge-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px;
}
.challenge-title {
  font-size: 24px; font-weight: 800;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.challenge-info {
  display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.challenge-level,
.challenge-time {
  background: linear-gradient(160deg, #f7f9fd 0%, var(--bg) 100%);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: var(--muted); border: 1px solid var(--border);
}
.challenge-task {
  background: linear-gradient(160deg, rgba(11,58,160,.04) 0%, rgba(244,123,32,.02) 100%);
  padding: 20px; border-radius: 14px; margin-bottom: 20px;
  border-left: 5px solid var(--blue); border: 2px solid var(--border);
}
.challenge-task-title {
  font-weight: 700; font-size: 15px; margin-bottom: 10px; color: var(--text);
}
.challenge-task-desc {
  font-size: 14px; color: var(--muted); line-height: 1.5;
}
.challenge-reward-box {
  background: linear-gradient(135deg, rgba(244,123,32,.15) 0%, rgba(44,92,197,.15) 100%);
  padding: 20px; border-radius: 14px; border: 2px solid var(--border); margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(244,123,32,.1), 0 0 1px rgba(44,92,197,.1);
}
.reward-item {
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--blue) 0%, var(--orange) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-top: 8px;
}

/* Timer del Desafío */
.challenge-timer-view {
  text-align: center; animation: slideUp .4s ease-out;
}
.timer-display {
  margin: 30px 0;
}
.timer-circle {
  position: relative; width: 200px; height: 200px; margin: 0 auto;
}
.timer-svg {
  transform: rotate(-90deg); width: 100%; height: 100%;
}
.timer-bg {
  fill: none; stroke: var(--border); stroke-width: 8;
}
.timer-progress {
  fill: none; stroke: var(--blue); stroke-width: 8; stroke-dasharray: 565; stroke-dashoffset: 0;
  transition: stroke-dashoffset .5s linear; stroke-linecap: round;
}
.timer-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 48px; font-weight: 700; color: var(--blue);
}
.timer-message {
  font-size: 16px; color: var(--muted); margin: 20px 0;
}

/* Animación Shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ===================================================================
   MINIJUEGOS MODULE
   =================================================================== */
.minigames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  margin-top: 24px;
}
.minigame-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(11, 58, 160, 0.04);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.minigame-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 30px rgba(11, 58, 160, 0.08);
}
.minigame-img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: linear-gradient(135deg, rgba(44, 92, 197, 0.03) 0%, rgba(44, 92, 197, 0.08) 100%);
  border-bottom: 1.5px solid var(--border);
  padding: 16px;
  box-sizing: border-box;
}
.minigame-details {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.minigame-details h3 {
  margin: 0 0 10px 0;
  font-size: 19px;
  color: var(--text);
  font-weight: 700;
}
.minigame-details p {
  margin: 0 0 20px 0;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.6;
  flex-grow: 1;
}
.minigame-details .btn {
  margin-top: auto;
  width: 100%;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

/* ===== SENTENCE BUILDER STYLES - PROFESSIONAL DESIGN ===== */
.sb-container {
  padding: 32px 24px;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

/* Header Section */
.sb-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
  color: white;
}

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

.sb-title {
  font-size: 24px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.5px;
}

.sb-level-badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  backdrop-filter: blur(10px);
}

.sb-header-right {
  display: flex;
  gap: 16px;
}

.sb-stats {
  display: flex;
  gap: 12px;
}

.sb-stat-item {
  background: rgba(255, 255, 255, 0.15);
  padding: 10px 16px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sb-stat-label {
  font-size: 11px;
  opacity: 0.9;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sb-stat-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}

.sb-streak {
  background: rgba(251, 146, 60, 0.3);
  border: 2px solid rgba(251, 146, 60, 0.6);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.4); }
  50% { box-shadow: 0 0 12px 6px rgba(251, 146, 60, 0.2); }
}

/* Progress Bar */
.sb-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

.sb-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}
.sb-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-l) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sb-hint-box {
  background: linear-gradient(135deg, rgba(249, 168, 53, 0.02) 0%, rgba(249, 168, 53, 0.06) 100%);
  border: 1.2px dashed rgba(249, 168, 53, 0.25);
  padding: 6px 14px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #c27803;
  box-shadow: 0 4px 10px rgba(249, 168, 53, 0.01);
  margin-top: 10px;
}
.sb-hint-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}
.sb-hint-text {
  color: #b45309;
  font-size: 13px;
  font-weight: 700;
}
.sb-instruction {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin: 6px 0;
}

/* Words Grid */
.sb-words-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 80px;
  align-content: flex-start;
  padding: 14px;
  background: rgba(44, 92, 197, 0.02);
  border-radius: 16px;
  border: 1.5px dashed rgba(59, 130, 246, 0.25);
  transition: all 0.3s ease;
}
.sb-words-grid:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

/* Word Items */
.sb-word {
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: grab;
  font-weight: 700;
  font-size: 13.5px;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  border: 1.5px solid #cbd5e1;
  position: relative;
}
.sb-word:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  background: rgba(44, 92, 197, 0.03);
  box-shadow: 0 4px 10px rgba(44, 92, 197, 0.08);
}
.sb-word:active {
  cursor: grabbing;
}
.sb-word.sb-dragging {
  opacity: 0.6;
  transform: scale(1.08) rotate(2deg);
  box-shadow: 0 8px 20px rgba(44, 92, 197, 0.25);
  border-color: var(--blue);
  z-index: 1000;
}

/* Result Areas */
.sb-result-area {
  padding: 14px;
  border-radius: 16px;
  text-align: center;
  font-weight: 600;
  min-height: 80px;
  background: #f8fafc;
  border: 1.5px dashed rgba(44, 92, 197, 0.15);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sb-result-area.sb-correct {
  background: rgba(16, 185, 129, 0.05);
  color: #059669;
  border: 1.5px solid rgba(16, 185, 129, 0.25);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.05);
}
.sb-result-area.sb-incorrect {
  background: rgba(239, 68, 68, 0.05);
  color: #dc2626;
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
}

.sb-result-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.sb-streak-popup {
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.sb-result-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Correct Preview */
.sb-result-box {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
  border: 2px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideIn 0.4s ease;
}

.sb-preview-label {
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sb-preview-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  font-style: italic;
}

/* Actions */
.sb-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 12px;
  border-top: 2px solid rgba(0, 0, 0, 0.05);
}

.sb-check-btn {
  flex: 1;
  min-width: 200px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
}

.sb-check-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.sb-check-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sb-next-btn {
  flex: 1;
  min-width: 180px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: white;
}

.sb-level-btn {
  padding: 12px 20px;
  font-size: 14px;
}

/* Results Screen */
.sb-results-screen {
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sb-results-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.sb-results-emoji {
  font-size: 72px;
  animation: bounce 0.6s ease infinite;
}

.sb-results-title {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sb-results-score {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
  border-radius: 16px;
  padding: 32px 24px;
  border: 2px solid rgba(59, 130, 246, 0.2);
}

.sb-results-big-number {
  font-size: 56px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -1px;
}

.sb-results-percentage {
  font-size: 28px;
  font-weight: 700;
  color: #3b82f6;
  margin-top: 8px;
}

.sb-results-performance {
  display: flex;
  justify-content: center;
}

.sb-performance-badge {
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(251, 191, 36, 0.3);
}

.sb-results-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.sb-results-stat {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 150px;
}

.sb-stat-icon {
  font-size: 28px;
}

.sb-results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.sb-results-btn {
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
}

/* ===================================================================
   MÓDULO DE RECURSOS EDUCATIVOS (ESTILOS MEJORADOS & LOGOS)
   =================================================================== */
.resources-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  background: var(--card);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.resources-filters select {
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: #fafbfc;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  min-width: 190px;
  cursor: pointer;
}

.resources-filters select:hover {
  background-color: #f3f4f6;
  border-color: var(--blue-l);
}

.resources-filters select:focus {
  border-color: var(--blue);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(11, 58, 160, 0.12);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 10px;
}

.resource-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s, border-color 0.22s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.resource-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--orange) 100%);
  opacity: 0;
  transition: opacity 0.22s;
}

.resource-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(11, 58, 160, 0.25);
}

.resource-card:hover::before {
  opacity: 1;
}

.resource-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.resource-type-icon {
  font-size: 22px;
  width: 46px;
  height: 46px;
  background: rgba(11, 58, 160, 0.07);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: background-color 0.25s, color 0.25s, transform 0.25s;
}

.resource-card:hover .resource-type-icon {
  background-color: var(--blue);
  color: #fff;
  transform: scale(1.08);
}

.resource-level {
  font-size: 11px;
  font-weight: 700;
  background: rgba(244, 123, 32, 0.12);
  color: var(--orange-d);
  padding: 5px 12px;
  border-radius: 30px;
  letter-spacing: 0.5px;
}

.resource-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.resource-card p {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 24px 0;
  flex-grow: 1;
  line-height: 1.55;
}

.resource-card .btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13.5px;
  background: #f8fafc;
  color: var(--blue);
  border: 1px solid var(--border);
  box-shadow: none;
}

.resource-card:hover .btn {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(11, 58, 160, 0.2);
}

/* ===== NUEVOS MINIJUEGOS ===== */

/* Emparejar Palabras Game */
.matching-game {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.matching-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.matching-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.matching-info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}

.matching-level, .matching-progress {
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 20px;
  color: var(--muted);
}

.matching-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.matching-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f87171 0%, #fb7185 100%);
  transition: width 0.4s ease;
}

.matching-instruction {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}

.matching-content {
  padding: 12px 0;
}

.matching-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matching-item {
  padding: 12px 16px;
  border-radius: 8px;
  background: #f0f4f8;
  border: 2px solid #e2e8f0;
  font-weight: 500;
  font-size: 14px;
  cursor: default;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.matching-item.draggable {
  cursor: grab;
}

.matching-item.draggable:active {
  cursor: grabbing;
}

.matching-item.draggable:hover {
  background: #e8eef7;
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.matching-text {
  pointer-events: none;
}

.matching-item.drag-over {
  background: #fce7e6;
  border: 2px solid #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.matching-item.dragging {
  opacity: 0.7;
  background: #e8eef7;
}

.matching-item.matched {
  opacity: 0.6;
  background: #f0fdf4;
  border-color: #16a34a;
  cursor: default;
}

.matching-item.matched.draggable {
  cursor: not-allowed;
}

.matching-arrow {
  display: inline-block;
  margin-left: 8px;
  font-size: 16px;
  font-weight: 700;
  animation: pulse 0.6s ease;
}

@keyframes match-success {
  0% {
    transform: scale(1);
    background: #f0fdf4;
  }
  50% {
    transform: scale(1.05);
    background: #dcfce7;
  }
  100% {
    transform: scale(1);
    background: #f0fdf4;
  }
}

@keyframes match-error {
  0%, 100% {
    transform: translateX(0) scale(1);
    background: #fee2e2;
  }
  25% {
    transform: translateX(-8px) scale(1.02);
  }
  75% {
    transform: translateX(8px) scale(1.02);
  }
}

.matching-item.match-success {
  animation: match-success 0.6s ease forwards;
  border-color: #16a34a;
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.4);
}

.matching-item.match-error {
  animation: match-error 0.6s ease forwards;
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.matching-item.selected {
  background: #fef3c7;
  border: 2px solid #f97316;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.3);
  font-weight: 600;
}

@keyframes dash {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Pronunciación Game */
.pronunciation-game {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pronunciation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.pronunciation-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.pronunciation-info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}

.pronunciation-level, .pronunciation-score {
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 20px;
  color: var(--muted);
}

.pronunciation-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.pronunciation-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
  transition: width 0.4s ease;
}

.pronunciation-content {
  text-align: center;
  padding: 20px 0;
}

.pronunciation-instruction {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.pronunciation-word {
  font-size: 42px;
  font-weight: 700;
  color: var(--blue);
  margin: 20px 0;
}

.pronunciation-ipa {
  font-style: italic;
  color: var(--muted);
  margin-bottom: 8px;
}

.pronunciation-hint {
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.pronunciation-feedback {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  display: none;
}

.mic-record-btn {
  transition: all 0.3s ease;
}

.mic-record-btn:hover:not(:disabled) {
  transform: scale(1.05);
}

.mic-record-btn:disabled {
  opacity: 0.7;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Modales para Detalles de Recursos */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.25s ease-out;
}

.modal-content {
  background: var(--card);
  width: 92%;
  max-width: 800px;
  max-height: 85vh;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border);
  overflow: hidden;
}

.modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal-header h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--blue-d);
  margin: 0;
}

.modal-close {
  background: #edf2f7;
  border: 0;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
  line-height: 1;
}

.modal-close:hover {
  background-color: var(--err);
  color: #fff;
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex-grow: 1;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

.resource-content {
  font-family: inherit;
}

.resource-content h1 {
  font-size: 24px;
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--blue-d);
  font-weight: 700;
}

.resource-content h2 {
  font-size: 18px;
  margin-top: 28px;
  margin-bottom: 14px;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  font-weight: 600;
}

.resource-content h3 {
  font-size: 15.5px;
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--blue-l);
  font-weight: 600;
}

.resource-content p {
  margin-bottom: 16px;
  color: #334155;
}

.resource-content ul, .resource-content ol {
  padding-left: 24px;
  margin-bottom: 18px;
}

.resource-content li {
  margin-bottom: 8px;
  color: #334155;
}

.resource-content code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

@keyframes slideUp {
  from { transform: translateY(35px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.heart-icon {
  fill: #cbd5e1;
  transition: all 0.3s ease;
  display: inline-block;
  margin: 0 4px;
}
.heart-icon.active {
  fill: #ef4444;
  filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.25));
  animation: heartBeat 1.4s infinite ease-in-out;
}
.heart-icon.lost {
  fill: #cbd5e1;
  animation: heartShatter 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.15); }
  70% { transform: scale(1); }
}

@keyframes heartShatter {
  0% { transform: scale(1.25); fill: #ef4444; filter: drop-shadow(0 2px 8px rgba(239, 68, 68, 0.6)); }
  20% { transform: scale(0.9) rotate(-15deg); fill: #f87171; }
  40% { transform: scale(1.15) rotate(15deg); }
  60% { transform: scale(0.9) rotate(-10deg); }
  80% { transform: scale(1.05) rotate(5deg); }
  100% { transform: scale(1) rotate(0); fill: #cbd5e1; filter: none; }
}

/* ===================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   =================================================================== */

@media (max-width: 992px) {
  .topbar {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
  }
  .topbar > a {
    order: 1;
    flex-shrink: 0;
  }
  .topbar .logo.small {
    height: 24px !important;
    width: auto;
  }
  .nav {
    order: 2;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 65%;
    width: auto;
    margin: 0 auto;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav-btn {
    font-size: 0 !important;
    padding: 8px 12px !important;
    gap: 0 !important;
    flex-shrink: 0;
  }
  .nav-btn svg {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
  }
  .topbar .user {
    order: 3;
    width: auto;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0;
    flex-shrink: 0;
  }
  #logout {
    font-size: 0 !important;
    padding: 8px !important;
    background: transparent;
    border: none;
    color: var(--muted);
    min-width: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #logout:hover {
    background: rgba(239, 68, 68, 0.08);
    border-radius: 8px;
  }
  #logout::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d64545' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
  }
}

@media (max-width: 768px) {
  .content {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .sidebar {
    width: 100%;
  }
  .panel {
    padding: 16px;
  }
  
  /* Formularios y Grids */
  .preferences-grid,
  .settings-grid,
  .progress-grid,
  .resources-filters,
  .users-filters,
  .difficulty-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Listas de tarjetas */
  .cards,
  .games-grid,
  .resources-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Tablas responsivas */
  .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modales */
  .modal-content, 
  .game-container,
  .game-difficulty-selector,
  .game-setup-container {
    width: 95% !important;
    max-width: 100% !important;
    padding: 16px !important;
    margin: 10px auto !important;
  }

  /* Minijuegos */
  .matching-content div[style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 24px !important;
  }
  .matching-item {
    padding: 10px 8px !important;
    font-size: 12.5px !important;
  }
  .matching-column {
    gap: 8px !important;
  }
  
  /* Ajuste de cabecera de juego */
  .game-selector-title {
    font-size: 18px !important;
  }
}

