/* ============================================================================
 * style.css — Super Multiplicaciones
 * Diseño infantil, alegre y moderno. Mobile-first, responsive, con tokens de
 * color, componentes reutilizables y animaciones suaves.
 * Secciones: 1) Fuentes  2) Tokens  3) Base  4) Layout/HUD/Nav  5) Botones
 * 6) Avatar  7) Pantallas (welcome/home/learn/quiz/challenge/boss/avatar/
 * progress/settings)  8) Efectos/animaciones  9) Toast  10) Responsive/A11y
 * ==========================================================================*/

/* ============================ 1) FUENTES ================================= */
@font-face {
  font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/Poppins-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins'; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url('../assets/fonts/Poppins-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../assets/fonts/Nunito-Regular.woff2') format('woff2');
}

/* ============================ 2) TOKENS ================================== */
:root {
  --azul: #4F9CF9;   --verde: #58CC02;  --amarillo: #FFD93D;
  --naranja: #FF9F1C; --morado: #9B5DE5; --rosa: #FF70A6;

  --ink: #2b2d42;       /* texto principal */
  --ink-soft: #6b7280;  /* texto secundario */
  --bg: #eef4ff;        /* fondo de la app */
  --card: #ffffff;
  --line: #e8edf5;

  --r-sm: 12px; --r-md: 18px; --r-lg: 26px; --r-pill: 999px;
  --shadow-sm: 0 4px 12px rgba(33, 71, 140, .10);
  --shadow-md: 0 10px 26px rgba(33, 71, 140, .14);
  --shadow-lg: 0 18px 40px rgba(33, 71, 140, .20);

  --font-title: 'Fredoka', 'Poppins', system-ui, sans-serif;
  --font-body: 'Nunito', 'Poppins', system-ui, sans-serif;

  --tap: 56px; /* objetivo táctil mínimo */
  --maxw: 560px;
}

/* ============================ 3) BASE =================================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, #d9e8ff 0%, transparent 60%),
    var(--bg);
  overscroll-behavior-y: none;
  -webkit-user-select: none; user-select: none;
}
h1, h2, h3 { font-family: var(--font-title); margin: 0; line-height: 1.1; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
b { font-weight: 700; }

/* ============================ 4) LAYOUT ================================= */
#app {
  display: flex; flex-direction: column;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  min-height: 100dvh; position: relative;
}

/* ---- HUD superior ---- */
.hud {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.hud-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar-chip { padding: 0; border-radius: 50%; box-shadow: var(--shadow-sm); flex: none; }
.hud-level { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hud-level-row { display: flex; align-items: center; gap: 8px; }
.lvl-badge {
  font-family: var(--font-title); font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--morado), var(--azul));
  padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap;
}
.xp-bar { width: 96px; height: 9px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--verde), var(--amarillo)); border-radius: inherit; transition: width .5s cubic-bezier(.2,.9,.3,1); }
.hud-name { font-size: 12px; color: var(--ink-soft); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-right { display: flex; gap: 6px; flex: none; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1.5px solid var(--line);
  padding: 5px 11px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.pill-coin { border-color: #ffe39c; background: #fff9e6; }
.pill-star { border-color: #ffd1e3; background: #fff0f6; }
.pill-big { font-size: 17px; padding: 7px 14px; }

/* ---- Vista (scroll) ---- */
.view {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}

/* ---- Navbar inferior ---- */
.navbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: var(--maxw);
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.navbtn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: var(--r-md);
  color: var(--ink-soft); font-size: 11px; font-weight: 700;
  transition: transform .15s, background .2s, color .2s; min-width: 56px;
}
.navbtn .nav-ic { font-size: 22px; line-height: 1; transition: transform .2s; }
.navbtn.active { color: var(--azul); background: #eaf3ff; }
.navbtn.active .nav-ic { transform: translateY(-2px) scale(1.15); }
.navbtn:active { transform: scale(.92); }

/* ============================ 5) BOTONES ================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 22px; border-radius: var(--r-md);
  font-family: var(--font-title); font-weight: 700; font-size: 17px; color: #fff;
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .2s, filter .2s;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: translateY(2px) scale(.99); filter: brightness(.97); }
.btn-primary { background: linear-gradient(135deg, var(--azul), #3b82f6); }
.btn-soft { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: var(--shadow-sm); }
.btn-coin { background: linear-gradient(135deg, var(--amarillo), var(--naranja)); color: #7a4b00; }
.btn-danger { background: linear-gradient(135deg, #ff6b6b, #e63946); }
.btn-xl { min-height: 64px; font-size: 21px; width: 100%; border-radius: var(--r-lg); }
.btn-mini { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); box-shadow: none; }
.btn-back {
  width: 44px; height: 44px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm); font-size: 22px; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  transition: transform .12s;
}
.btn-back:active { transform: scale(.9); }

/* ============================ 6) AVATAR ================================= */
.avatar {
  position: relative; border-radius: 50%; overflow: hidden; flex: none;
  display: grid; place-items: center; box-shadow: inset 0 -6px 14px rgba(0,0,0,.12);
}
.av-base { line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.av-hat { position: absolute; top: 2%; left: 50%; transform: translateX(-50%); line-height: 1; }
.av-glasses { position: absolute; top: 38%; left: 50%; transform: translateX(-50%); line-height: 1; }
.av-pet { position: absolute; right: 4%; bottom: 4%; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }

/* ============================ 7) PANTALLAS ============================== */
/* Encabezado de sección */
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.section-title { font-size: 26px; color: var(--ink); }
.section-sub { color: var(--ink-soft); font-weight: 600; margin: 0 0 14px; }

/* ---- WELCOME ---- */
.welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 24px 6px 8px; }
.welcome-logo {
  width: 110px; height: 110px; border-radius: 32px; display: grid; place-items: center;
  font-size: 60px; color: #fff; box-shadow: var(--shadow-lg);
  background: linear-gradient(140deg, var(--azul), var(--morado));
}
.welcome-title { font-size: 34px; background: linear-gradient(90deg, var(--azul), var(--morado), var(--rosa)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-sub { font-size: 16px; color: var(--ink-soft); font-weight: 700; margin: -6px 0 2px; }
.welcome-avatars { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.wa-pick {
  width: 58px; height: 58px; border-radius: 50%; font-size: 30px; background: #fff;
  border: 3px solid var(--line); box-shadow: var(--shadow-sm); transition: transform .15s, border-color .2s;
  display: grid; place-items: center;
}
.wa-pick.sel { border-color: var(--azul); transform: scale(1.12); }
.wa-pick:active { transform: scale(.95); }
.name-input {
  width: 100%; max-width: 320px; min-height: var(--tap); text-align: center;
  font-size: 18px; font-weight: 700; color: var(--ink);
  border: 3px solid var(--line); border-radius: var(--r-md); padding: 0 16px; background: #fff;
  outline: none; transition: border-color .2s;
}
.name-input:focus { border-color: var(--azul); }

/* ---- HOME ---- */
.home-hero {
  position: relative; display: flex; align-items: center; gap: 16px;
  background: var(--card); border-radius: var(--r-lg); padding: 18px;
  box-shadow: var(--shadow-md); margin-bottom: 18px; overflow: hidden;
}
.home-hero-bg {
  position: absolute; inset: 0; opacity: .14; z-index: 0;
  background: radial-gradient(circle at 85% 10%, var(--rosa), transparent 45%),
              radial-gradient(circle at 15% 90%, var(--azul), transparent 45%);
}
.home-hero > * { position: relative; z-index: 1; }
.home-hero-info { min-width: 0; flex: 1; }
.home-title { font-size: 19px; color: var(--azul); }
.home-greet { margin: 2px 0 8px; font-weight: 800; color: var(--ink); }
.home-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.home-xp { display: flex; align-items: center; gap: 8px; }
.home-xp-bar { flex: 1; height: 12px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.home-xp-fill { height: 100%; background: linear-gradient(90deg, var(--verde), var(--amarillo)); border-radius: inherit; transition: width .6s; }
.home-xp-label { font-size: 11px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.mode-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 116px; padding: 16px; border-radius: var(--r-lg); color: #fff; text-align: left;
  box-shadow: var(--shadow-md); overflow: hidden; transition: transform .14s, box-shadow .2s;
}
.mode-card::after { content: ''; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px; background: rgba(255,255,255,.18); border-radius: 50%; }
.mode-card:active { transform: translateY(3px) scale(.98); box-shadow: var(--shadow-sm); }
.mode-ic { font-size: 38px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.2)); }
.mode-title { font-family: var(--font-title); font-weight: 700; font-size: 19px; margin-top: auto; }
.mode-sub { font-size: 12px; font-weight: 700; opacity: .92; }

.home-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sec-btn {
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--r-md);
  background: var(--card); box-shadow: var(--shadow-sm); font-weight: 800; color: var(--ink);
  font-size: 15px; transition: transform .12s;
}
.sec-btn:active { transform: scale(.97); }
.sec-ic { font-size: 24px; }
.install-btn { width: 100%; margin-top: 14px; }

/* ---- LEARN (selección) ---- */
.table-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.table-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px; border-radius: var(--r-md); color: #fff; box-shadow: var(--shadow-md);
  transition: transform .14s;
}
.table-card:active { transform: scale(.95); }
.tc-num { font-family: var(--font-title); font-weight: 700; font-size: 30px; }
.tc-obj { font-size: 22px; }
.tc-name { font-size: 11px; font-weight: 800; opacity: .95; }
.tc-master { position: absolute; top: 6px; right: 8px; font-size: 14px; }

/* ---- LEARN (detalle) ---- */
.learn-card { background: var(--card); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-md); border: 3px solid var(--line); margin-bottom: 14px; }
.learn-eq { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-title); font-weight: 700; font-size: 40px; margin-bottom: 14px; }
.learn-eq .eq-x, .learn-eq .eq-eq { color: var(--ink-soft); }
.obj-grid { display: flex; flex-direction: column; gap: 6px; align-items: center; min-height: 60px; }
.obj-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.obj { font-size: 26px; line-height: 1; animation: objPop .35s both; }
.learn-explain { text-align: center; color: var(--ink-soft); font-weight: 600; margin: 14px 0 0; }
.learn-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.learn-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 14px; font-weight: 800; color: var(--ink); transition: border-color .2s, transform .1s;
}
.learn-row.active { border-color: var(--azul); transform: scale(1.02); }
.learn-row:active { transform: scale(.97); }
.lr-eq { font-family: var(--font-title); }
.lr-res { font-family: var(--font-title); font-size: 18px; }
.learn-nav { display: flex; gap: 12px; }
.learn-nav .btn { flex: 1; }

/* ---- QUIZ (práctica/reto/jefe) ---- */
.quiz-card { background: var(--card); border-radius: var(--r-lg); padding: 22px 18px; box-shadow: var(--shadow-md); margin-bottom: 14px; }
.quiz-q { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font-title); font-weight: 700; font-size: 46px; margin-bottom: 22px; }
.quiz-q .q-x, .quiz-q .q-eq { color: var(--ink-soft); }
.quiz-q .q-mark { color: var(--azul); }
.q-a, .q-b { color: var(--ink); }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  min-height: 64px; border-radius: var(--r-md); background: #f4f8ff; border: 2.5px solid #dbe7fb;
  font-family: var(--font-title); font-weight: 700; font-size: 26px; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .1s, background .15s, border-color .15s;
}
.opt:active { transform: scale(.96); }
.opt.revealed { pointer-events: none; }
.opt.correct { background: #e7f8d8; border-color: var(--verde); color: #2f7a00; animation: pulse .4s; }
.opt.wrong { background: #ffe1ec; border-color: var(--rosa); color: #b3145a; animation: shake .4s; }

.practice-stats { display: flex; gap: 8px; margin-bottom: 14px; }
.feedback {
  min-height: 24px; text-align: center; font-weight: 800; font-size: 17px;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.feedback.show { opacity: 1; transform: none; }
.feedback.good { color: var(--verde); }
.feedback.bad { color: var(--rosa); }
.fb-emoji { font-size: 20px; }
.fb-xp { display: block; font-size: 13px; color: var(--naranja); margin-top: 2px; }

/* ---- CHALLENGE ---- */
.challenge-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.ch-time { flex: 1; }
.ch-time-ring {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-title); font-weight: 700; font-size: 24px; color: #fff;
  background: linear-gradient(135deg, var(--naranja), var(--rosa)); box-shadow: var(--shadow-md); margin-bottom: 8px;
}
.ch-time-ring .urgent { animation: pulse .5s infinite; color: #fff3c4; }
.ch-time-bar { height: 10px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.ch-time-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--verde), var(--amarillo), var(--naranja)); border-radius: inherit; transition: width 1s linear; }
.ch-meta { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

/* ---- BOSS (selección) ---- */
.boss-grid { display: flex; flex-direction: column; gap: 12px; }
.boss-card {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--card); box-shadow: var(--shadow-sm); border: 2.5px solid var(--line); transition: transform .12s;
}
.boss-card:active { transform: scale(.98); }
.boss-card.defeated { opacity: .9; background: #f3fff0; }
.boss-emoji { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 30px; box-shadow: var(--shadow-sm); flex: none; }
.boss-info { flex: 1; display: flex; flex-direction: column; }
.boss-table { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.boss-name { font-family: var(--font-title); font-weight: 700; font-size: 18px; color: var(--ink); }
.boss-status { font-size: 22px; }

/* ---- BOSS (combate) ---- */
.boss-scene {
  position: relative; border-radius: var(--r-lg); padding: 22px 18px 18px; margin-bottom: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; overflow: hidden;
}
.boss-avatar { font-size: 78px; line-height: 1; filter: drop-shadow(0 6px 8px rgba(0,0,0,.2)); animation: floaty 2.4s ease-in-out infinite; }
.boss-avatar.hit { animation: bossHit .3s; }
.boss-avatar.attack { animation: bossAttack .5s; }
.boss-hp { width: 80%; max-width: 280px; height: 16px; background: rgba(0,0,0,.12); border-radius: var(--r-pill); overflow: hidden; }
.boss-hp-fill { height: 100%; border-radius: inherit; transition: width .35s; }
.boss-progress { font-family: var(--font-title); font-weight: 700; color: var(--ink); background: rgba(255,255,255,.7); padding: 2px 14px; border-radius: var(--r-pill); }

/* ---- AVATAR / TIENDA ---- */
.avatar-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 16px; }
.avatar-preview .avatar { box-shadow: var(--shadow-lg), inset 0 -8px 18px rgba(0,0,0,.12); }
.preview-coins { font-weight: 800; color: var(--naranja); font-size: 16px; }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.cat-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none;
  padding: 8px 14px; border-radius: var(--r-md); background: var(--card); box-shadow: var(--shadow-sm);
  font-weight: 800; font-size: 12px; color: var(--ink-soft); border: 2px solid transparent; transition: border-color .2s, color .2s;
}
.cat-tab .ct-ic { font-size: 22px; }
.cat-tab.active { border-color: var(--azul); color: var(--azul); }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.shop-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px;
  background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-sm); border: 2.5px solid var(--line);
  transition: border-color .2s, transform .12s;
}
.shop-item.equipped { border-color: var(--verde); background: #f4fff0; }
.si-thumb { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; font-size: 30px; background: #f1f5ff; }
.si-emoji { filter: drop-shadow(0 1px 2px rgba(0,0,0,.15)); }
.si-label { font-size: 12px; font-weight: 800; color: var(--ink); text-align: center; }
.shop-item .btn-mini { width: 100%; }

/* ---- PROGRESS ---- */
.progress-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.sum-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.sum-ic { font-size: 22px; }
.sum-val { font-family: var(--font-title); font-weight: 700; font-size: 19px; color: var(--ink); }
.sum-lbl { font-size: 10px; font-weight: 800; color: var(--ink-soft); text-align: center; }
.chart-card { background: var(--card); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-md); margin-bottom: 16px; }
.chart-card h3 { font-size: 17px; color: var(--ink); margin-bottom: 12px; }
.donut-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut-canvas { width: 180px; height: 180px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.leg-row { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.leg-dot { width: 14px; height: 14px; border-radius: 4px; }
.bars-canvas { width: 100%; height: auto; }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: var(--r-md); background: #f3f6fc; opacity: .55; filter: grayscale(.6); transition: transform .15s; }
.badge.owned { opacity: 1; filter: none; background: linear-gradient(160deg, #fff, #fff6dc); box-shadow: var(--shadow-sm); }
.badge-ic { font-size: 30px; }
.badge-name { font-size: 10px; font-weight: 800; color: var(--ink); text-align: center; line-height: 1.1; }
.ach-list { display: flex; flex-direction: column; gap: 4px; }
.ach-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.ach-row:last-child { border-bottom: none; }
.ach-ic { font-size: 22px; }
.ach-lbl { flex: 1; font-weight: 700; color: var(--ink); }
.ach-val { font-family: var(--font-title); color: var(--azul); }

/* ---- SETTINGS ---- */
.settings-card { background: var(--card); border-radius: var(--r-lg); padding: 8px 18px; box-shadow: var(--shadow-md); margin-bottom: 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); font-weight: 800; color: var(--ink); }
.set-row:last-child { border-bottom: none; }
.set-input { min-height: 44px; border: 2px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; font-weight: 700; color: var(--ink); text-align: right; outline: none; max-width: 180px; }
.set-input:focus { border-color: var(--azul); }
.set-note { color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.app-version { text-align: center; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.toggle { width: 56px; height: 32px; border-radius: var(--r-pill); background: var(--line); position: relative; transition: background .2s; flex: none; }
.toggle.on { background: var(--verde); }
.toggle-knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.toggle.on .toggle-knob { transform: translateX(24px); }

/* ---- Resultado (estrellas) en victoria ---- */
.vs-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-weight: 700; color: var(--ink); }
.vs-row:last-child { border-bottom: none; }
.vs-row b { color: var(--azul); }
.vs-stars { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.vstar { font-size: 34px; filter: grayscale(1); opacity: .35; transform: scale(.85); animation: none; }
.vstar.on { filter: none; opacity: 1; transform: scale(1); animation: starPop .5s both; }
.vstar.on:nth-child(2) { animation-delay: .12s; }
.vstar.on:nth-child(3) { animation-delay: .24s; }

/* ============================ 8) EFECTOS =============================== */
#fx-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 80; }
.fx-star { position: fixed; bottom: 30%; z-index: 81; pointer-events: none; animation: starFly 1.4s ease-out forwards; }

.fx-victory-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px;
  background: rgba(20, 24, 60, .55); backdrop-filter: blur(4px); animation: fadeIn .2s;
}
.fx-victory-overlay.fade-out { animation: fadeOut .25s forwards; }
.fx-victory-card {
  width: 100%; max-width: 360px; background: var(--card); border-radius: var(--r-lg);
  padding: 28px 22px; text-align: center; box-shadow: var(--shadow-lg);
}
.fx-victory-emoji { font-size: 72px; line-height: 1; }
.fx-victory-card h2 { font-size: 26px; color: var(--ink); margin: 8px 0 4px; }
.fx-victory-card p { color: var(--ink-soft); font-weight: 700; margin: 0 0 14px; }
.fx-victory-stats { text-align: left; background: #f6f9ff; border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 18px; }
.fx-victory-btn { width: 100%; }

/* Animaciones keyframes */
@keyframes objPop { from { transform: scale(0) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.bounce { animation: bounce 1.8s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bossHit { 0% { transform: scale(1); filter: drop-shadow(0 6px 8px rgba(0,0,0,.2)); } 50% { transform: scale(.86) rotate(-6deg); filter: brightness(1.6) drop-shadow(0 6px 8px rgba(0,0,0,.2)); } 100% { transform: scale(1); } }
@keyframes bossAttack { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-14px) scale(1.06); } 50% { transform: translateX(14px) rotate(6deg); } 75% { transform: translateX(-8px); } }
@keyframes pop-in { from { transform: scale(0); opacity: 0; } 60% { transform: scale(1.15); } to { transform: scale(1); opacity: 1; } }
.pop-in { animation: pop-in .4s both; }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); } 60% { transform: scale(1.3); } to { transform: scale(1) rotate(0); } }
@keyframes starFly { from { transform: translateY(0) scale(.6); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-60vh) scale(1.2) rotate(40deg); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes viewEnter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view-enter > * { animation: viewEnter .35s both; }

/* ============================ 9) TOAST ================================= */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); z-index: 95; max-width: 90%;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 14px;
  padding: 12px 20px; border-radius: var(--r-pill); box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: linear-gradient(135deg, var(--verde), #3a9e00); }
.toast.bad { background: linear-gradient(135deg, var(--rosa), #e63946); }

/* ============================ 10) RESPONSIVE / A11Y ==================== */
/* Pantallas grandes: ampliar rejillas */
@media (min-width: 480px) {
  .quiz-q { font-size: 54px; }
  .opt { font-size: 30px; }
}
/* Pantallas muy pequeñas */
@media (max-width: 340px) {
  .table-grid, .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .progress-summary { grid-template-columns: repeat(2, 1fr); }
  .quiz-q { font-size: 38px; }
}

/* Foco visible para accesibilidad (teclado) */
:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; }

/* Respeta "reducir movimiento" */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
