/* ============ Identidad corporativa GaeliKA (Light Blue) ============ */
:root {
  --azul: #4FA3D1;        /* Azul Claro GaeliKA */
  --verde: #6BC46D;       /* Verde Innovación */
  --azul-profundo: #1F4E79;
  --gris: #4A4A4A;        /* Gris técnico: texto */
  --gris-claro: #E9EEF2;  /* Fondos suaves */
  --blanco: #FFFFFF;
  --rojo-suave: #E36B6B;
  --amarillo: #F0C24B;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(31, 78, 121, 0.10);
  --shadow-lg: 0 10px 32px rgba(31, 78, 121, 0.16);
}

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

body {
  font-family: 'Montserrat', 'Inter', sans-serif;
  background: linear-gradient(180deg, #F4F9FC 0%, var(--blanco) 340px);
  color: var(--gris);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 1020px; margin: 0 auto; padding: 18px 16px 60px; }

h1, h2, h3 { color: var(--azul-profundo); font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }

button { font-family: inherit; cursor: pointer; border: none; }

/* ============ Marca ============ */
.wordmark { font-weight: 800; font-size: 1.9rem; letter-spacing: -0.5px; }
.wordmark .gael { color: var(--azul); }
.wordmark .ka { color: var(--verde); }
.wordmark.small { font-size: 1.25rem; }

.boot { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.boot-logo { text-align: center; }
.boot-logo p { margin-top: 10px; color: var(--gris); }
.trisquel { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Cabecera ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.userchip {
  display: flex; align-items: center; gap: 12px; background: var(--blanco);
  border: 2px solid var(--gris-claro); border-radius: 999px; padding: 6px 16px 6px 8px;
  box-shadow: var(--shadow);
}
.userchip .avatar { font-size: 1.7rem; background: var(--gris-claro); border-radius: 50%; width: 44px; height: 44px; display: grid; place-items: center; }
.userchip .uinfo { line-height: 1.25; }
.userchip .uname { font-weight: 700; color: var(--azul-profundo); font-size: 0.95rem; }
.userchip .ulevel { font-size: 0.75rem; color: var(--azul); font-weight: 600; }
.streak { font-weight: 700; color: #E8862D; font-size: 0.95rem; white-space: nowrap; }

.xpbar { width: 120px; height: 8px; background: var(--gris-claro); border-radius: 4px; overflow: hidden; }
.xpbar > div { height: 100%; background: linear-gradient(90deg, var(--azul), var(--verde)); border-radius: 4px; transition: width 0.6s ease; }

.btn-ghost {
  background: var(--blanco); color: var(--azul-profundo); border: 2px solid var(--gris-claro);
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 0.88rem;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--azul); color: var(--azul); }

/* ============ Selección de usuario ============ */
.hero { text-align: center; padding: 40px 0 26px; }
.hero .trisquel { width: 84px; height: 84px; }
.hero h1 { margin: 12px 0 6px; font-size: 1.9rem; }
.hero p { color: var(--gris); max-width: 460px; margin: 0 auto; }

.user-cards { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin-top: 34px; }
.user-card {
  background: var(--blanco); border: 3px solid var(--gris-claro); border-radius: 24px;
  padding: 30px 40px; text-align: center; width: 250px; transition: all 0.18s;
  box-shadow: var(--shadow);
}
.user-card:hover { transform: translateY(-6px); border-color: var(--azul); box-shadow: var(--shadow-lg); }
.user-card .big-avatar { font-size: 4rem; }
.user-card h2 { margin: 10px 0 2px; font-size: 1.5rem; }
.user-card .grade { color: var(--azul); font-weight: 600; }
.user-card .mini-stats { margin-top: 12px; font-size: 0.85rem; color: var(--gris); display: flex; justify-content: center; gap: 12px; }

/* ============ Grid de asignaturas ============ */
.smart-card {
  background: linear-gradient(120deg, var(--azul-profundo), var(--azul));
  color: var(--blanco); border-radius: var(--radius); padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; box-shadow: var(--shadow-lg); flex-wrap: wrap;
}
.smart-card h2 { color: var(--blanco); margin-bottom: 4px; }
.smart-card p { opacity: 0.9; font-size: 0.9rem; max-width: 480px; }
.btn-primary {
  background: var(--verde); color: var(--blanco); font-weight: 700;
  padding: 13px 26px; border-radius: 999px; font-size: 1rem;
  box-shadow: 0 4px 14px rgba(107, 196, 109, 0.45); transition: all 0.15s;
}
.btn-primary:hover { transform: scale(1.04); }
.btn-primary:disabled { opacity: 0.5; transform: none; cursor: default; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.subject-card {
  background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; gap: 15px; transition: all 0.16s;
  box-shadow: var(--shadow); text-align: left; width: 100%;
}
.subject-card:hover { border-color: var(--azul); transform: translateY(-3px); }
.subject-card .icon { font-size: 2.1rem; }
.subject-card .name { font-weight: 700; color: var(--azul-profundo); font-size: 1.02rem; }
.subject-card .meter { margin-top: 7px; height: 7px; background: var(--gris-claro); border-radius: 4px; overflow: hidden; width: 100%; }
.subject-card .meter > div { height: 100%; background: var(--verde); border-radius: 4px; }
.subject-card .grow { flex: 1; }
.subject-card .pct { font-size: 0.8rem; font-weight: 600; color: var(--gris); }

/* ============ Temas ============ */
.topic-list { display: grid; gap: 12px; margin-top: 18px; }
.topic-row {
  background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: 14px;
  padding: 14px 18px; display: flex; align-items: center; gap: 14px; transition: all 0.15s;
  width: 100%; text-align: left;
}
.topic-row:hover { border-color: var(--azul); }
.topic-row .icon { font-size: 1.5rem; }
.topic-row .tname { font-weight: 600; color: var(--azul-profundo); flex: 1; }
.topic-row .meter { width: 130px; height: 8px; background: var(--gris-claro); border-radius: 4px; overflow: hidden; }
.topic-row .meter > div { height: 100%; background: var(--verde); }
.section-head { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.section-head .icon { font-size: 2rem; }
.back-link { background: none; color: var(--azul); font-weight: 600; font-size: 0.9rem; padding: 6px 0; }
.back-link:hover { text-decoration: underline; }

/* ============ Sesión de ejercicios ============ */
.session-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.dots { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.dot { width: 13px; height: 13px; border-radius: 50%; background: var(--gris-claro); transition: background 0.2s; }
.dot.now { background: var(--azul); box-shadow: 0 0 0 3px rgba(79,163,209,0.25); }
.dot.ok { background: var(--verde); }
.dot.ko { background: var(--rojo-suave); }

.exercise-card {
  background: var(--blanco); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 30px 28px; max-width: 720px; margin: 0 auto;
}
.exercise-card .subject-tag {
  display: inline-flex; align-items: center; gap: 6px; background: var(--gris-claro);
  color: var(--azul-profundo); font-size: 0.78rem; font-weight: 700; border-radius: 999px;
  padding: 4px 12px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.4px;
}
.exercise-card .question { font-size: 1.25rem; font-weight: 600; color: var(--azul-profundo); line-height: 1.5; white-space: pre-line; }

.options { display: grid; gap: 11px; margin-top: 22px; }
.option {
  background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: 13px;
  padding: 14px 18px; font-size: 1.05rem; font-weight: 500; color: var(--gris);
  text-align: left; transition: all 0.13s; width: 100%;
}
.option:hover:not(:disabled) { border-color: var(--azul); background: #F4F9FC; }
.option.selected { border-color: var(--azul); background: #EAF4FA; color: var(--azul-profundo); font-weight: 600; }
.option.reveal-ok { border-color: var(--verde); background: #EFF9EF; color: #2E7D32; font-weight: 700; }
.option.reveal-ko { border-color: var(--rojo-suave); background: #FCEEEE; color: #B84A4A; }
.option:disabled { cursor: default; }

.input-answer { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.input-answer input {
  flex: 1; min-width: 200px; font-family: inherit; font-size: 1.15rem; font-weight: 600;
  padding: 13px 18px; border: 2px solid var(--gris-claro); border-radius: 13px; color: var(--azul-profundo);
  outline: none; transition: border 0.15s;
}
.input-answer input:focus { border-color: var(--azul); }

.session-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; align-items: center; }
.btn-hint {
  background: #FEF7E6; color: #B07D1E; border: 2px solid #F5DFAE; font-weight: 700;
  padding: 11px 20px; border-radius: 999px; transition: all 0.15s;
}
.btn-hint:hover { background: #FDF0D2; }
.hint-box {
  background: #FEF7E6; border: 2px dashed #F0C24B; color: #8A6516; border-radius: 13px;
  padding: 14px 16px; margin-top: 16px; font-size: 0.98rem; line-height: 1.5;
}
.feedback { border-radius: 15px; padding: 18px; margin-top: 20px; line-height: 1.55; }
.feedback.ok { background: #EFF9EF; border: 2px solid var(--verde); }
.feedback.ko { background: #FCEEEE; border: 2px solid var(--rojo-suave); }
.feedback .fb-title { font-weight: 800; font-size: 1.12rem; margin-bottom: 6px; }
.feedback.ok .fb-title { color: #2E7D32; }
.feedback.ko .fb-title { color: #B84A4A; }
.feedback .xp-pill { display: inline-block; background: var(--azul-profundo); color: white; font-weight: 700; font-size: 0.8rem; padding: 3px 11px; border-radius: 999px; margin-left: 8px; }
.ai-box {
  background: #EAF4FA; border: 2px solid var(--azul); border-radius: 13px; padding: 14px 16px;
  margin-top: 12px; font-size: 0.96rem; line-height: 1.55; color: var(--azul-profundo);
}
.ai-box .ai-tag { font-weight: 800; color: var(--azul); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 4px; }
.btn-ai {
  background: var(--blanco); color: var(--azul); border: 2px solid var(--azul); font-weight: 700;
  padding: 10px 18px; border-radius: 999px; font-size: 0.88rem; transition: all 0.15s;
}
.btn-ai:hover { background: #EAF4FA; }

/* ============ Resultados ============ */
.results { text-align: center; padding: 30px 0; }
.results .big-emoji { font-size: 4.5rem; }
.results h1 { margin: 14px 0 8px; }
.score-pills { display: flex; gap: 14px; justify-content: center; margin: 22px 0; flex-wrap: wrap; }
.score-pill { background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: 16px; padding: 14px 26px; box-shadow: var(--shadow); }
.score-pill .v { font-size: 1.7rem; font-weight: 800; color: var(--azul-profundo); }
.score-pill .k { font-size: 0.8rem; color: var(--gris); font-weight: 600; }
.new-badges { margin: 18px auto; max-width: 460px; }
.badge-pop {
  display: flex; align-items: center; gap: 12px; background: #FEF7E6; border: 2px solid var(--amarillo);
  border-radius: 14px; padding: 12px 16px; margin-top: 10px; text-align: left;
  animation: pop 0.5s ease;
}
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.badge-pop .bicon { font-size: 2rem; }
.badge-pop .bname { font-weight: 800; color: #8A6516; }
.badge-pop .bdesc { font-size: 0.83rem; color: #8A6516; }

/* ============ Progreso ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 18px 0; }
.stat-card { background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: 16px; padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-card .v { font-size: 1.8rem; font-weight: 800; color: var(--azul); }
.stat-card .k { font-size: 0.8rem; font-weight: 600; color: var(--gris); }

.subject-progress { background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: 16px; padding: 18px 20px; margin-bottom: 14px; }
.subject-progress .sp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.subject-progress .sp-head .nm { font-weight: 700; color: var(--azul-profundo); flex: 1; }
.subject-progress .sp-head .acc { font-size: 0.85rem; font-weight: 700; color: var(--verde); }
.tp-row { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; margin-top: 7px; }
.tp-row .tn { flex: 1; }
.tp-row .meter { width: 45%; height: 8px; background: var(--gris-claro); border-radius: 4px; overflow: hidden; }
.tp-row .meter > div { height: 100%; border-radius: 4px; }

.daily-chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: 16px; padding: 16px; margin: 14px 0 22px; }
.daily-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.daily-col .bar { width: 70%; max-width: 26px; background: var(--azul); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; }
.daily-col .bar .in { position: absolute; bottom: 0; left: 0; right: 0; background: var(--verde); border-radius: 0 0 0 0; }
.daily-col .dlabel { font-size: 0.62rem; color: var(--gris); font-weight: 600; }

.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.badge-card { background: var(--blanco); border: 2px solid var(--gris-claro); border-radius: 14px; padding: 14px; text-align: center; }
.badge-card.locked { opacity: 0.38; filter: grayscale(1); }
.badge-card .bicon { font-size: 2.1rem; }
.badge-card .bname { font-weight: 700; font-size: 0.85rem; color: var(--azul-profundo); margin-top: 5px; }
.badge-card .bdesc { font-size: 0.72rem; color: var(--gris); margin-top: 3px; }

.weak-box { background: #FEF7E6; border: 2px solid #F5DFAE; border-radius: 16px; padding: 16px 18px; margin: 14px 0 22px; }
.weak-box h3 { color: #8A6516; margin-bottom: 8px; font-size: 1rem; }
.weak-item { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin-top: 6px; }
.weak-item button { margin-left: auto; }
.btn-mini { background: var(--verde); color: white; font-weight: 700; font-size: 0.78rem; padding: 6px 14px; border-radius: 999px; }

/* ============ Confeti ============ */
.confetti { position: fixed; pointer-events: none; font-size: 1.6rem; animation: fall 1.6s ease-in forwards; z-index: 99; }
@keyframes fall { 0% { transform: translateY(-20px) rotate(0); opacity: 1; } 100% { transform: translateY(75vh) rotate(340deg); opacity: 0; } }

.fade-in { animation: fadein 0.3s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.muted { color: var(--gris); font-size: 0.9rem; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--gris-claro); border-top-color: var(--azul); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; }

@media (max-width: 560px) {
  .exercise-card { padding: 22px 18px; }
  .exercise-card .question { font-size: 1.1rem; }
  .userchip .xpwrap { display: none; }
  .topic-row .meter { width: 80px; }
}
