/* ============================================================================
 * Simulador de una clase — la parte visual de la landing.
 *
 * Las clases .activity-card / .ac-* son un PORT LITERAL de app/globals.css del
 * tutor (merge ca3ad24, FEA-042). No están reinventadas: se copiaron para que
 * lo que se ve acá sea la UI real del producto y no una maqueta parecida. Si
 * allá cambian, acá quedan viejas — es una copia consciente, no un import.
 *
 * La paleta coincide sola: la landing y el tutor salen del mismo DS Lumbre
 * (gold #EEAA11, magenta #BB3381, teal #4FB3B3, purple #3F1D50).
 * ========================================================================= */

.sim-wrap {
  --sim-gold: #EEAA11;
  --sim-magenta: #BB3381;
  --sim-teal: #4FB3B3;
  --sim-purple: #3F1D50;
  --sim-card: #FCFBF9;
  --sim-surface: #F3F1EC;
  --sim-ink: #3F1D50;
  --sim-ink-soft: rgba(63, 29, 80, .62);
  --sim-bd: rgba(63, 29, 80, .12);
  --sim-bds: rgba(63, 29, 80, .25);
}

/* --- Pestañas de escena ------------------------------------------------- */
.sim-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.sim-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
  border-radius: 999px; border: 1.5px solid rgba(231, 228, 222, .22);
  background: transparent; color: rgba(231, 228, 222, .62);
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.sim-tab:hover { color: #E7E4DE; border-color: rgba(231, 228, 222, .45); }
.sim-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.sim-tab-on {
  color: #140A1C; background: var(--sim-gold); border-color: var(--sim-gold);
}

/* --- La "pantalla del alumno" ------------------------------------------- */
.sim-screen {
  position: relative; border-radius: 24px; overflow: hidden;
  border: 1px solid rgba(231, 228, 222, .14);
  background: linear-gradient(180deg, #1F1029 0%, #140A1C 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  min-height: 460px; display: flex; flex-direction: column;
}
.sim-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 18px; border-bottom: 1px solid rgba(231, 228, 222, .12);
  flex-shrink: 0;
}
.sim-bar-l { display: flex; align-items: center; gap: 9px; }
.sim-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(231, 228, 222, .22); }
.sim-bar-tag {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: rgba(231, 228, 222, .55);
}
.sim-bar-live { font-size: 10.5px; font-weight: 800; color: var(--sim-teal); }

.sim-chat {
  flex: 1; min-height: 0; padding: 20px clamp(14px, 3vw, 26px);
  display: flex; flex-direction: column; gap: 13px; justify-content: flex-end;
  overflow: hidden;
}
.sim-msg { animation: sim-in .45s cubic-bezier(.22, 1, .36, 1) both; flex-shrink: 0; max-width: 100%; }
.sim-tutor {
  background: linear-gradient(90deg, var(--sim-teal), var(--sim-purple));
  color: #fff; padding: 12px 16px; border-radius: 16px; border-bottom-left-radius: 4px;
  font-size: 14px; line-height: 1.5; max-width: 82%; width: fit-content;
}
.sim-student {
  background: rgba(231, 228, 222, .14); color: #E7E4DE;
  padding: 12px 16px; border-radius: 16px; border-bottom-right-radius: 4px;
  font-size: 14px; line-height: 1.5; max-width: 78%; width: fit-content; margin-left: auto;
}
.sim-typing {
  display: flex; gap: 5px; align-items: center; background: rgba(231, 228, 222, .1);
  padding: 14px 16px; border-radius: 16px; border-bottom-left-radius: 4px;
  width: fit-content; flex-shrink: 0;
}
.sim-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--sim-teal); animation: sim-dots 1.2s ease-in-out infinite; }
.sim-typing span:nth-child(2) { animation-delay: .18s; }
.sim-typing span:nth-child(3) { animation-delay: .36s; }

/* --- Cursor del chico ---------------------------------------------------- */
.sim-cursor {
  position: absolute; top: 0; left: 0; width: 26px; height: 26px; z-index: 20;
  pointer-events: none; opacity: 0;
  transition: transform .75s cubic-bezier(.33, 1, .68, 1), opacity .3s ease;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .55));
}
.sim-cursor-on { opacity: 1; }
.sim-cursor-tap { animation: sim-tap .34s ease; }

/* --- Pie: aviso de que se puede jugar ------------------------------------ */
.sim-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 14px;
  font-size: 13.5px; color: rgba(231, 228, 222, .60);
}
.sim-foot b { color: rgba(231, 228, 222, .92); font-weight: 700; }
.sim-replay {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px;
  border-radius: 999px; border: 1.5px solid rgba(231, 228, 222, .3);
  background: transparent; color: #E7E4DE; font: inherit; font-size: 13px;
  font-weight: 700; cursor: pointer; transition: background .2s ease, color .2s ease;
}
.sim-replay:hover { background: #E7E4DE; color: #3F1D50; }
.sim-replay svg { width: 15px; height: 15px; }

/* ===== PORT LITERAL de app/globals.css del tutor (ca3ad24) ================ */
.activity-card {
  width: 100%; max-width: 30rem; background: var(--sim-card);
  border: 1px solid var(--sim-bd); border-radius: 18px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  animation: ac-pop-in .35s cubic-bezier(.34, 1.56, .64, 1);
}
.activity-q { font-weight: 700; font-size: 15px; color: var(--sim-ink); line-height: 1.4; }
.activity-explain { font-size: 12.5px; color: var(--sim-ink-soft); }
.ac-opts { display: flex; flex-direction: column; gap: 8px; }
.ac-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--sim-bds); background: var(--sim-surface);
  color: var(--sim-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.ac-opt:not(:disabled):hover { border-color: var(--sim-gold); transform: translateY(-1px); }
.ac-opt:not(:disabled):active { transform: scale(.98); }
.ac-opt-icon { color: var(--sim-teal); width: 18px; height: 18px; flex-shrink: 0; }
.ac-opt-correct { border-color: var(--sim-teal); background: rgba(79, 179, 179, .14); color: #0f6e56; animation: ac-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ac-opt-wrong { border-color: var(--sim-magenta); background: rgba(187, 51, 129, .1); color: #8a2d63; animation: ac-shake .4s ease; }
.ac-opt-dim { opacity: .45; }

.ac-match { position: relative; display: flex; justify-content: space-between; gap: clamp(28px, 7vw, 56px); }
.ac-match-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.ac-match-col { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.ac-match-item {
  position: relative; z-index: 1; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--sim-bds); background: var(--sim-surface);
  color: var(--sim-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), border-color .15s ease, box-shadow .15s ease;
}
.ac-match-right { text-align: center; }
.ac-match-item:not(:disabled):hover { border-color: var(--sim-gold); }
.ac-match-active { border-color: var(--sim-gold); box-shadow: 0 0 0 3px rgba(238, 170, 17, .25); transform: scale(1.04); animation: ac-magnet 1s ease-in-out infinite; }
.ac-match-connected { border-color: var(--sim-teal); background: rgba(79, 179, 179, .1); }
.ac-arrow-path { stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: ac-draw .5s cubic-bezier(.34, 1.4, .64, 1) forwards; fill: none; }
.ac-arrow-dot { transform-box: fill-box; transform-origin: center; }
.ac-arrow-dot-pop { animation: ac-dot-pop .45s cubic-bezier(.34, 1.7, .64, 1) .2s both; }
.ac-arrow-pending .ac-arrow-path { stroke: var(--sim-gold); }
.ac-arrow-pending .ac-arrow-dot { fill: var(--sim-gold); }
.ac-arrow-correct .ac-arrow-path { stroke: var(--sim-teal); }
.ac-arrow-correct .ac-arrow-dot { fill: var(--sim-teal); }
.ac-arrow-wrong .ac-arrow-path { stroke: var(--sim-magenta); }
.ac-arrow-wrong .ac-arrow-dot { fill: var(--sim-magenta); }

.ac-verif { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 14px; border-radius: 999px; align-self: flex-start; animation: ac-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ac-verif b { font-weight: 800; }
.ac-verif svg { width: 18px; height: 18px; }
.ac-verif-ok { background: rgba(79, 179, 179, .14); color: #0f6e56; }

@keyframes ac-pop-in { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ac-pop { 0% { transform: scale(1); } 45% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes ac-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes ac-magnet { 0%, 100% { box-shadow: 0 0 0 3px rgba(238, 170, 17, .25); } 50% { box-shadow: 0 0 0 6px rgba(238, 170, 17, .12); } }
@keyframes ac-draw { to { stroke-dashoffset: 0; } }
@keyframes ac-dot-pop { 0% { transform: scale(0); } 70% { transform: scale(1.4); } 100% { transform: scale(1); } }
/* ===== fin del port ====================================================== */

@keyframes sim-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sim-dots { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes sim-tap { 50% { transform: scale(.7); } }

/* --- Lluvia de cuentas (takeover) ----------------------------------------
 * Calcado de components/student/minigames/MathGame.tsx: base espacial con
 * estrellas, las operaciones CAEN en pastillas y el alumno escribe el
 * resultado. Allá es un canvas; acá es DOM — el texto queda más nítido y es
 * una fracción del código. Colores y tipografía monoespaciada, los del real. */
.sim-math {
  position: absolute; inset: 0; z-index: 5;
  background: radial-gradient(120% 80% at 50% 0%, #1b2547 0%, #0d1024 55%, #0a0713 100%);
  display: flex; flex-direction: column; gap: 10px; padding: 14px clamp(12px, 3vw, 20px);
  animation: sim-takeover-in .45s cubic-bezier(.22, 1, .36, 1);
}
@keyframes sim-takeover-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.sim-math-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-shrink: 0; font-size: 11.5px; font-weight: 800; color: #fcd34d;
  text-transform: uppercase; letter-spacing: .06em;
}
.sim-math-top svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 6px; }
.sim-math-score { color: rgba(252, 211, 77, .65); }
.sim-math-sky { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: 12px; }
.sim-math-star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #dfe8ff; }
.sim-math-pill {
  position: absolute; top: -12%; transform: translateX(-50%);
  background: rgba(40, 28, 10, .92); border: 1px solid rgba(238, 170, 17, .45);
  color: #ffe8c2; font: 800 clamp(15px, 3.4vw, 19px) ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 7px 13px; border-radius: 11px; white-space: nowrap;
  animation-name: sim-fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes sim-fall { to { top: 82%; } }
.sim-math-aim { color: #fff3d6; border-color: #EEAA11; box-shadow: 0 0 0 3px rgba(238, 170, 17, .2); }
.sim-math-boom { animation: sim-boom .4s ease forwards; }
@keyframes sim-boom {
  40% { transform: translateX(-50%) scale(1.25); background: #EEAA11; color: #241a12; }
  to { transform: translateX(-50%) scale(2.1); opacity: 0; }
}
.sim-math-base { position: absolute; left: 5%; right: 5%; bottom: 0; height: 15px; display: flex; gap: 3px; }
.sim-math-seg { flex: 1; background: linear-gradient(180deg, #a9720f, #4a2f05); border-radius: 3px 3px 0 0; }
.sim-math-in { flex-shrink: 0; display: flex; justify-content: center; }
.sim-math-in input {
  width: 100%; max-width: 330px; text-align: center; border-radius: 12px;
  border: 2px solid rgba(238, 170, 17, .55); background: rgba(0, 0, 0, .55);
  color: #fff3d6; font: 800 clamp(17px, 4vw, 21px) ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em; padding: 9px 14px; outline: none;
  transition: border-color .15s ease, box-shadow .2s ease, background .2s ease;
}
.sim-math-in input::placeholder {
  color: rgba(252, 211, 77, .45); font: 400 14px var(--f-body, inherit); letter-spacing: 0;
}
.sim-math-in input:focus { border-color: #EEAA11; }
/* Mientras escribe (guionado o humano): que se VEA que está tecleando. */
.sim-math-typing { border-color: #EEAA11 !important; box-shadow: 0 0 0 4px rgba(238, 170, 17, .18); }
.sim-math-ok { border-color: var(--sim-teal) !important; box-shadow: 0 0 0 4px rgba(79, 179, 179, .25); background: rgba(79, 179, 179, .12) !important; }
.sim-math-err { border-color: var(--sim-magenta) !important; animation: ac-shake .4s ease; }

/* Explosión: la pastilla se agranda y revienta en chispas. */
.sim-math-ring {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; border: 2.5px solid rgba(238, 170, 17, .9);
  pointer-events: none; animation: sim-ring .68s cubic-bezier(.2, .8, .3, 1) forwards;
}
@keyframes sim-ring {
  from { opacity: .95; transform: scale(.5); }
  to { opacity: 0; transform: scale(4.2); border-color: rgba(79, 179, 179, .5); }
}
.sim-math-spark {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, #fff3d6, #EEAA11); pointer-events: none;
  animation: sim-spark .75s ease-out forwards;
}
@keyframes sim-spark {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); }
}
/* +1 que sube donde reventó la cuenta. */
.sim-math-plus {
  position: absolute; transform: translateX(-50%); pointer-events: none;
  color: #7fe3d0; font-weight: 800; font-size: 15px;
  animation: sim-plus .8s ease-out forwards;
}
@keyframes sim-plus {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -34px); }
}
.sim-math-hit .sim-math-seg { animation: sim-hit .45s ease; }
@keyframes sim-hit { 50% { background: var(--sim-magenta); transform: translateY(3px); } }
.sim-math-win {
  display: flex; align-items: center; gap: 9px; align-self: center;
  background: rgba(79, 179, 179, .15); color: #7fe3d0; border-radius: 999px;
  padding: 9px 16px; font-weight: 800; font-size: 13.5px;
  animation: ac-pop .45s cubic-bezier(.34, 1.56, .64, 1);
}
.sim-math-win svg { width: 18px; height: 18px; }

/* --- Ajedrez ------------------------------------------------------------- */
.sim-board { display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; max-width: 280px; margin: 0 auto; border-radius: 10px; overflow: hidden; border: 1px solid var(--sim-bd); }
.sim-sq { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: clamp(15px, 4.4vw, 21px); line-height: 1; position: relative; }
.sim-sq-l { background: #EFE7DA; }
.sim-sq-d { background: #B08D64; }
.sim-sq-hint::after { content: ""; position: absolute; width: 26%; height: 26%; border-radius: 50%; background: rgba(79, 179, 179, .75); animation: ac-pop .5s ease; }
.sim-sq-from { box-shadow: inset 0 0 0 3px var(--sim-gold); }
.sim-piece { transition: transform .5s cubic-bezier(.34, 1.4, .64, 1); color: #241a12; }

/* --- Respeto por "reducir movimiento" ------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .sim-cursor { display: none; }
  .activity-card, .ac-opt-correct, .ac-opt-wrong, .ac-match-active,
  .ac-arrow-path, .ac-arrow-dot-pop, .sim-msg, .sim-math,
  .sim-math-pill, .sim-math-win, .sim-piece { animation: none; transition: none; }
  .ac-arrow-path { stroke-dashoffset: 0; }
}

@media (max-width: 560px) {
  .sim-screen { min-height: 420px; }
  .ac-match { gap: 20px; }
  .ac-match-item { padding: 10px 11px; font-size: 13px; }
}
