:root {
  --blue: #1f5bd8;
  --blue-dark: #1747ad;
  --blue-soft: #e8f0ff;
  --navy: #1b2559;
  --text: #1b2559;
  --muted: #7a83a6;
  --line: #e3e7f0;
  --bg: #f0f2f5;
  --card: #ffffff;
  --green: #58cc02;
  --green-dark: #46a302;
  --red: #ff4b4b;
  --red-soft: #ffe3e3;
  --green-soft: #dff7c8;
  --gold: #ffc800;
  --orange: #ff9600;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(27, 37, 89, 0.06);
  --safe: 44px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #dfe8ff, #c9d6f3 60%, #b8c7ea);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }

/* ---------- Device frame ---------- */
.device {
  position: relative;
  width: 390px; height: 844px;
  flex: 0 0 auto;
  /* El teléfono mantiene su proporción real y se escala para caber (ver fitDevice en app.js) */
  transform: scale(var(--fit, 1)); transform-origin: center center;
  background: var(--bg);
  border-radius: 44px;
  overflow: hidden;
  box-shadow: 0 0 0 10px #111827, 0 30px 80px rgba(16, 24, 64, .35);
  display: flex; flex-direction: column;
}
@media (max-width: 480px) {
  body { background: var(--bg); }
  .device { width: 100vw; height: 100dvh; border-radius: 0; box-shadow: none; transform: none; }
  .statusbar { display: none !important; }
  :root { --safe: max(env(safe-area-inset-top), 10px); }
}
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; height: 44px; padding: 14px 28px 0; pointer-events: none;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; font-size: 15px; z-index: 30;
}
.statusbar.light { color: #fff; }
.statusbar svg { height: 12px; }
#app { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }

/* ---------- Generic screen ---------- */
.screen { padding-top: var(--safe); }
.screen.bleed { padding-top: 0; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: slideIn .28s ease; }
.screen.fade { animation: fadeIn .3s ease; }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.pad { padding: 0 20px; }

.topbar {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  padding: 10px 14px 4px;
}
.topbar h1 { margin: 0; text-align: center; font-size: 21px; font-weight: 900; color: var(--navy); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--navy); }
.icon-btn:hover { background: rgba(27,37,89,.06); }
.icon-btn svg { width: 22px; height: 22px; }
.subtitle { text-align: center; color: var(--navy); font-size: 15.5px; line-height: 1.5; margin: 14px 26px 18px; font-weight: 600; }

.progress-dots { display: flex; gap: 6px; justify-content: center; padding: 4px 0 2px; }
.progress-dots span { width: 22px; height: 5px; border-radius: 4px; background: #d3d9e8; }
.progress-dots span.on { background: var(--blue); }
.ob-progress { display: flex; align-items: center; gap: 10px; margin: 2px 24px 4px; }
.ob-progress .bar { flex: 1; height: 6px; background: #dde2ee; border-radius: 6px; overflow: hidden; }
.ob-progress .bar i { display: block; height: 100%; background: var(--blue); border-radius: 6px; transition: width .35s; }
.ob-progress small { color: var(--muted); font-weight: 800; font-size: 12px; white-space: nowrap; }

/* ---------- Bottom CTA (Copilot style) ---------- */
.cta-bar { flex: 0 0 auto; }
.cta-note { background: #fff; text-align: center; color: var(--blue); font-size: 13.5px; padding: 14px 22px; border-radius: 22px 22px 0 0; line-height: 1.45; font-weight: 600; box-shadow: 0 -6px 20px rgba(27,37,89,.06); }
.cta-note b { font-weight: 900; }
.cta {
  width: 100%; background: var(--blue); color: #fff; font-weight: 800; font-size: 18px;
  padding: 22px 16px 30px; transition: background .15s, opacity .15s;
}
.cta:hover { background: var(--blue-dark); }
.cta:disabled { color: rgba(255,255,255,.45); cursor: not-allowed; background: var(--blue); }

/* ---------- Buttons ---------- */
.btn {
  display: block; width: 100%; padding: 15px 18px; border-radius: 16px; font-weight: 900; font-size: 16px;
  letter-spacing: .3px; text-align: center; transition: transform .06s, filter .15s;
}
.btn:active { transform: translateY(3px); }
.btn-white { background: #fff; color: #111; box-shadow: 0 5px 0 #cfd5e3; }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 5px 0 #123f9c; }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 5px 0 var(--green-dark); text-transform: uppercase; }
.btn-green:disabled { background: #e5e5e5; color: #afafaf; box-shadow: 0 5px 0 #cfcfcf; cursor: not-allowed; }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 5px 0 #d33131; text-transform: uppercase; }
.btn-ghost { color: var(--blue); font-weight: 800; padding: 12px; }
.btn-outline { background: #fff; border: 2px solid var(--line); color: var(--navy); box-shadow: 0 4px 0 var(--line); }
.link { color: var(--blue); font-weight: 800; }

/* ---------- Welcome ---------- */
.welcome {
  position: absolute; inset: 0; padding-top: var(--safe);
  background: linear-gradient(180deg, #102a6b 0%, #1f5bd8 55%, #3e86f5 100%);
  color: #fff; display: flex; flex-direction: column; overflow: hidden;
}
.welcome .demo { position: absolute; top: calc(var(--safe) + 14px); right: 22px; font-weight: 800; font-size: 14px; color: #fff; opacity: .9; }
.welcome h1 { font-size: 34px; line-height: 1.1; text-align: center; margin: 70px 20px 6px; font-weight: 900; }
.welcome p.lead { text-align: center; opacity: .85; margin: 0 34px; font-weight: 600; font-size: 15.5px; }
.welcome .stage-carousel { flex: 1; position: relative; }
.welcome .bubble-capi {
  position: absolute; width: 112px; height: 112px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: float 4s ease-in-out infinite;
}
.welcome .bubble-capi img, .welcome .bubble-capi svg { width: 92%; height: 92%; object-fit: contain; }
.welcome .coin { position: absolute; font-size: 26px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.welcome .actions { padding: 0 24px 34px; display: grid; gap: 14px; }
.welcome .login { display: block; width: 100%; color: #fff; text-align: center; font-weight: 700; opacity: .9; font-size: 15px; margin-top: 4px; }

/* ---------- Forms ---------- */
.field { margin: 0 24px 18px; }
.field-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.field-label::before, .field-label::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.input {
  width: 100%; padding: 17px 16px; border-radius: 12px; border: 2px solid transparent; background: #fff;
  font-size: 18px; text-align: center; color: var(--navy); font-weight: 600; outline: none; box-shadow: var(--shadow);
}
.input:focus { border-color: #b7cbff; }
.input::placeholder { color: #a2a9c2; }
.money-input { position: relative; }
.money-input .cur { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 800; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-pad { padding: 18px; }
.section-label { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 4px 10px; }
.section-label h3 { margin: 0; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 900; }
.section-label a, .section-label button { color: var(--muted); font-weight: 700; font-size: 14px; }

/* Risk / terms */
.risk-box { margin: 0 20px; padding: 18px; }
.risk-box h4 { margin: 0 0 8px; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.risk-box ul { margin: 0; padding-left: 18px; color: #3d4670; line-height: 1.55; font-size: 14.5px; }
.risk-box li { margin-bottom: 6px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; margin: 16px 20px 0; padding: 14px 16px; background: #fff; border-radius: 14px; box-shadow: var(--shadow); cursor: pointer; font-weight: 700; font-size: 14.5px; line-height: 1.4; }
.check { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; border: 2px solid #c9d0e2; display: grid; place-items: center; transition: all .15s; }
.check.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Toggle card */
.toggle-card { margin: 0 20px 14px; padding: 22px 18px; text-align: center; }
.toggle-card .emoji { font-size: 34px; }
.toggle-card h4 { margin: 8px 0 4px; font-size: 17px; }
.toggle-card p { margin: 0 0 14px; color: var(--muted); font-weight: 600; font-size: 14.5px; }
.switch { width: 58px; height: 32px; border-radius: 20px; background: #cdd1db; position: relative; transition: background .2s; display: inline-block; vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: var(--blue); }
.switch.on::after { transform: translateX(26px); }
.toggle-row { display: flex; justify-content: center; align-items: center; gap: 14px; color: var(--muted); font-weight: 800; font-size: 13px; }

/* Notif preview */
.notif-preview { margin: 0 34px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.notif-preview .app { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .5px; }
.notif-preview b { display: block; margin: 4px 0 2px; }

/* Choice list */
.choice-list { display: grid; gap: 12px; padding: 0 20px 20px; }
.choice {
  background: #fff; border-radius: 16px; padding: 18px; font-weight: 800; font-size: 16px; text-align: center;
  box-shadow: var(--shadow); border: 2px solid transparent; transition: all .15s;
}
.choice:hover { border-color: #cddcff; }
.choice.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 20px 20px; }
.chip-grid .choice { padding: 18px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14.5px; }
.chip-grid .choice .e { font-size: 30px; }

/* Capi preview (onboarding finance) */
.capi-preview { display: flex; align-items: center; gap: 14px; margin: 4px 20px 16px; padding: 14px; }
.capi-preview .avatar { width: 74px; height: 74px; flex: 0 0 74px; }
.capi-preview .meta small { color: var(--muted); font-weight: 800; letter-spacing: .5px; text-transform: uppercase; font-size: 11px; }
.capi-preview .meta b { display: block; font-size: 18px; }
.capi-preview .meta span { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.health-bar { height: 10px; background: #e9ecf3; border-radius: 10px; overflow: hidden; margin-top: 8px; }
.health-bar i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, #ff9f43, #ffd43b, #58cc02); transition: width .4s; }

/* Avatar */
.avatar { border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; position: relative; }
.avatar img, .avatar svg { width: 100%; height: 100%; object-fit: contain; }
.avatar.ring { box-shadow: 0 0 0 4px var(--ring, var(--blue)); }

/* Loading */
.loading { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px; }
.loading .avatar { width: 150px; height: 150px; margin: 0 auto 20px; animation: float 2.5s ease-in-out infinite; }
.spinner { width: 28px; height: 28px; border: 4px solid #d6def0; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 12px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Main app shell ---------- */
.tabbar {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 2px solid var(--line);
  padding: 8px 6px 22px;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 900; color: #a3abc4; letter-spacing: .4px; text-transform: uppercase; padding: 6px 0; border-radius: 12px; }
.tab .ti { font-size: 24px; filter: grayscale(1) opacity(.55); transition: filter .15s, transform .15s; }
.tab.on { color: var(--blue); background: var(--blue-soft); }
.tab.on .ti { filter: none; transform: scale(1.08); }

/* Dashboard header */
.dash-head { background: linear-gradient(180deg, var(--blue) 0%, #3b7af0 70%, var(--bg) 100%); color: #fff; padding: calc(var(--safe) + 8px) 18px 24px; }
.dash-head .row { display: flex; justify-content: space-between; align-items: center; }
.dash-head h1 { margin: 0; font-size: 30px; font-weight: 900; }
.stat-pills { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.18); padding: 6px 10px; border-radius: 20px; font-weight: 900; font-size: 14px; }
.pill.dark { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.budget-card { margin-top: 18px; padding: 20px 18px 10px; color: var(--navy); text-align: center; }
.budget-card .big { font-size: 30px; font-weight: 900; }
.budget-card .sub { color: var(--muted); font-weight: 700; }
.budget-card .spend-chart svg { width: 100%; height: auto; display: block; margin-top: 8px; overflow: visible; }
.tag-under { display: inline-block; background: var(--green); color: #fff; font-weight: 900; padding: 3px 9px; border-radius: 6px; font-size: 13px; }
.tag-over { background: var(--red); }

/* Capi card */
.capi-card { padding: 16px; display: flex; gap: 14px; align-items: center; }
.capi-card .avatar { width: 92px; height: 92px; flex: 0 0 92px; }
.capi-card h3 { margin: 0; font-size: 19px; }
.capi-card .tagline { color: var(--muted); font-weight: 700; font-size: 13.5px; }
.xpbar { height: 14px; background: #e9ecf3; border-radius: 10px; overflow: hidden; margin: 8px 0 4px; }
.xpbar i { display: block; height: 100%; background: var(--gold); border-radius: 10px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); transition: width .6s; }
.xp-meta { font-size: 12.5px; color: var(--muted); font-weight: 800; display: flex; justify-content: space-between; }

/* Next lesson */
.next-card { padding: 16px; display: flex; gap: 14px; align-items: center; }
.next-card .ico { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; color: #fff; }
.next-card .t small { color: var(--muted); font-weight: 800; font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase; }
.next-card .t b { display: block; font-size: 16.5px; }
.next-card .go { margin-left: auto; background: var(--green); color: #fff; font-weight: 900; padding: 10px 14px; border-radius: 12px; box-shadow: 0 4px 0 var(--green-dark); }

/* Rings */
.rings { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.ring-item { flex: 1 0 96px; text-align: center; }
.ring-item svg { width: 76px; height: 76px; }
.ring-item b { display: block; font-size: 16px; margin-top: 2px; }
.ring-item span { font-size: 13px; color: var(--muted); font-weight: 700; }

/* Missions */
.mission { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.mission + .mission { border-top: 2px solid var(--line); }
.mission .mi { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #fff4d6; font-size: 19px; flex: 0 0 38px; }
.mission .mt { flex: 1; }
.mission .mt b { font-size: 14.5px; }
.mbar { height: 12px; background: #e9ecf3; border-radius: 10px; overflow: hidden; margin-top: 6px; }
.mbar i { display: block; height: 100%; background: var(--gold); border-radius: 10px; }
.mission .mc { font-weight: 900; color: var(--muted); font-size: 13px; }
.mission.done .mi { background: var(--green-soft); }

/* Transactions */
.tx { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.tx + .tx { border-top: 1.5px solid var(--line); }
.tx .name { flex: 1; font-weight: 700; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .amt { font-weight: 900; }
.tx .amt.in { color: #1f9d55; }
.tx .del { color: #c0c6d6; font-size: 18px; padding: 2px 4px; }
.cat-tag { font-size: 11px; font-weight: 900; letter-spacing: .4px; text-transform: uppercase; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-weight: 700; }

/* ---------- Learn path (Duolingo style) ---------- */
.learn-top { display: flex; justify-content: space-between; align-items: center; padding: 6px 18px 10px; border-bottom: 2px solid var(--line); background: var(--bg); position: relative; z-index: 3; }
.learn-top .brand { font-weight: 900; font-size: 22px; color: var(--blue); display: flex; align-items: center; gap: 6px; }
.learn-top .stats { display: flex; gap: 14px; font-weight: 900; }
.learn-top .stats span { display: flex; align-items: center; gap: 4px; }
.st-fire { color: var(--orange); }
.st-xp { color: #c9a300; }
.st-heart { color: var(--red); }
.st-off { color: #b8bfd2 !important; filter: grayscale(1); }

.section-head { margin: 18px 16px 12px; padding: 14px 16px; border: 2px dashed #cfd6e6; border-radius: 16px; display: flex; justify-content: space-between; align-items: center; }
.section-head small { color: #b8860b; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; font-size: 12px; }
.section-head b { display: block; font-size: 18px; }

.unit-banner { margin: 8px 16px 6px; border-radius: 16px; padding: 16px; color: #fff; display: flex; justify-content: space-between; gap: 10px; align-items: center; position: sticky; top: 8px; z-index: 2; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.unit-banner small { font-weight: 900; letter-spacing: 1px; text-transform: uppercase; opacity: .85; font-size: 12px; }
.unit-banner b { display: block; font-size: 19px; margin: 2px 0; }
.unit-banner p { margin: 0; font-size: 13.5px; opacity: .9; font-weight: 600; line-height: 1.35; }
.guide-btn { border: 2px solid rgba(255,255,255,.45); color: #fff; border-radius: 12px; padding: 9px 12px; font-weight: 900; font-size: 13px; white-space: nowrap; letter-spacing: .5px; }
.guide-btn:hover { background: rgba(255,255,255,.12); }

.path { position: relative; padding: 64px 0 18px; min-height: 300px; }
.node-wrap { position: relative; height: 118px; }
.node-wrap.has-tip { margin-top: 40px; }
.node {
  position: absolute; top: 0; width: 72px; height: 66px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px; color: #fff; transform: translateX(-50%);
  transition: transform .08s;
}
.node:active { transform: translateX(-50%) translateY(4px); }
.node.locked { background: #e5e5e5; box-shadow: 0 7px 0 #c4c4c4; color: #afafaf; cursor: not-allowed; }
.node.locked:active { transform: translateX(-50%); }
.node .ring-out { position: absolute; inset: -9px; border-radius: 50%; border: 7px solid #e5e5e5; }
.node.current .ring-out { border-color: rgba(0,0,0,.08); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.node .crown { position: absolute; bottom: -6px; right: -6px; background: var(--gold); color: #7a5c00; font-size: 12px; font-weight: 900; border-radius: 10px; padding: 1px 6px; box-shadow: 0 2px 0 #c99d00; }
.start-tip {
  position: absolute; top: -46px; transform: translateX(-50%); background: #fff; border: 2px solid var(--line); border-radius: 12px;
  padding: 7px 12px; font-weight: 900; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; animation: bob 1.2s ease-in-out infinite; z-index: 1;
}
.start-tip::after { content: ""; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%) rotate(45deg); width: 12px; height: 12px; background: #fff; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); }
@keyframes bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-5px); } }
.node-label { position: absolute; top: 72px; transform: translateX(-50%); width: 118px; font-size: 12px; font-weight: 800; color: var(--muted); white-space: normal; line-height: 1.2; text-align: center; }

/* Columna del capibara: siempre en el lado contrario a los nodos */
.path-mascot { position: absolute; top: 40px; width: 128px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.path-mascot.right { right: 8px; }
.path-mascot.left { left: 8px; }
.path-mascot:not(.talk) { top: 110px; }
.capi-poke { padding: 0; border-radius: 50%; }
.path-mascot .avatar { width: 108px; height: 108px; background: transparent; overflow: visible; mix-blend-mode: multiply; }
.speech { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 9px 11px; font-size: 12.5px; font-weight: 700; width: 128px; line-height: 1.35; color: #3d4670; }
.speech::after { content: ""; position: absolute; bottom: -8px; left: 50%; width: 12px; height: 12px; background: #fff; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }

.popover {
  position: absolute; left: 16px; right: 16px; border-radius: 18px; padding: 16px; color: #fff; z-index: 4;
  box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.popover b { font-size: 18px; display: block; }
.popover p { margin: 4px 0 14px; opacity: .9; font-weight: 700; font-size: 14px; }
.popover .btn { background: #fff; text-transform: uppercase; box-shadow: 0 5px 0 rgba(0,0,0,.18); }

.disclaimer-mini { font-size: 11.5px; color: var(--muted); text-align: center; padding: 8px 26px 20px; font-weight: 600; line-height: 1.4; }

/* ---------- Lesson ---------- */
.lesson { position: absolute; inset: 0; margin-top: 0; background: #fff; display: flex; flex-direction: column; z-index: 20; animation: up .25s ease; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.lesson-top { display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.lesson-top .close { font-size: 26px; color: #afafaf; width: 32px; }
.lbar { flex: 1; height: 16px; background: #e5e5e5; border-radius: 10px; overflow: hidden; }
.lbar i { display: block; height: 100%; background: var(--green); border-radius: 10px; transition: width .35s; box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), inset 0 4px 0 rgba(255,255,255,.3); }
.lesson-top .hearts { font-weight: 900; color: var(--red); display: flex; align-items: center; gap: 4px; }
.lesson-body { flex: 1; overflow-y: auto; padding: 14px 20px; }
.lesson-body h2 { font-size: 22px; line-height: 1.3; margin: 6px 0 20px; }
.q-with-capi { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 18px; }
.q-with-capi .avatar { width: 84px; height: 84px; flex: 0 0 84px; background: transparent; }
.q-with-capi .avatar { mix-blend-mode: multiply; overflow: visible; }
.q-with-capi .qb { border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; font-weight: 800; font-size: 16px; line-height: 1.4; position: relative; }
.options { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line);
  box-shadow: 0 4px 0 var(--line); font-weight: 700; font-size: 16px; background: #fff; transition: all .1s;
}
.opt .k { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 900; color: #afafaf; }
.opt:hover { background: #f7f7f7; }
.opt.sel { border-color: #84d8ff; background: #ddf4ff; color: #1899d6; box-shadow: 0 4px 0 #84d8ff; }
.opt.sel .k { border-color: #84d8ff; color: #1899d6; }
.opt.right { border-color: var(--green); background: #d7ffb8; color: #3f8f00; box-shadow: 0 4px 0 var(--green); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); color: #c62828; box-shadow: 0 4px 0 var(--red); }
.opt[disabled] { cursor: default; }
.tip-card { border-radius: 20px; padding: 24px 20px; text-align: center; background: linear-gradient(180deg, #f4f8ff, #fff); border: 2px solid var(--line); }
.tip-card .e { font-size: 54px; }
.tip-card h3 { margin: 8px 0; font-size: 22px; }
.tip-card p { margin: 0; color: #3d4670; font-size: 16.5px; line-height: 1.55; font-weight: 600; }
.tip-kicker { color: var(--blue); font-weight: 900; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; margin-bottom: 10px; display: block; }
.lesson-foot { padding: 16px 20px 26px; border-top: 2px solid var(--line); transition: background .2s; }
.lesson-foot.ok { background: #d7ffb8; border-color: transparent; }
.lesson-foot.bad { background: var(--red-soft); border-color: transparent; }
.feedback { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.feedback .fi { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 22px; flex: 0 0 44px; }
.feedback b { font-size: 20px; display: block; }
.ok .feedback { color: #3f8f00; }
.bad .feedback { color: #c62828; }
.feedback p { margin: 2px 0 0; font-weight: 700; font-size: 14.5px; line-height: 1.4; }
.lesson-disc { font-size: 11px; color: #a3a9bd; text-align: center; margin-top: 10px; font-weight: 600; }

/* Results */
.result { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.result .avatar { width: 170px; height: 170px; background: transparent; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
.result .avatar { mix-blend-mode: multiply; overflow: visible; }
.result h2 { color: #f5a400; font-size: 28px; margin: 6px 0 18px; }
.result-stats { display: flex; gap: 12px; width: 100%; margin-bottom: 20px; }
.rs { flex: 1; border-radius: 16px; border: 2px solid; overflow: hidden; }
.rs small { display: block; color: #fff; font-weight: 900; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; padding: 5px; }
.rs b { display: block; padding: 12px 6px; font-size: 20px; background: #fff; }
.rs.gold { border-color: var(--gold); } .rs.gold small { background: var(--gold); } .rs.gold b { color: #c99d00; }
.rs.green { border-color: var(--green); } .rs.green small { background: var(--green); } .rs.green b { color: var(--green-dark); }
.rs.blue { border-color: #1cb0f6; } .rs.blue small { background: #1cb0f6; } .rs.blue b { color: #1899d6; }

/* ---------- Profile ---------- */
.profile-head { text-align: center; padding: 10px 20px 4px; }
.profile-head .avatar { width: 130px; height: 130px; margin: 0 auto 10px; }
.profile-head h2 { margin: 0; font-size: 24px; }
.profile-head .tagline { color: var(--muted); font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; display: flex; gap: 10px; align-items: center; }
.stat .e { font-size: 24px; }
.stat b { display: block; font-size: 19px; }
.stat span { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.evo { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.evo + .evo { border-top: 1.5px solid var(--line); }
.evo .avatar { width: 62px; height: 62px; flex: 0 0 62px; }
.evo.locked .avatar { filter: grayscale(1) brightness(.2) opacity(.25); }
.evo .et { flex: 1; }
.evo .et b { font-size: 15.5px; display: block; }
.evo .et span { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.evo .badge { font-size: 11px; font-weight: 900; border-radius: 20px; padding: 4px 9px; letter-spacing: .4px; text-transform: uppercase; }
.badge.now { background: var(--blue); color: #fff; }
.badge.ok { background: var(--green-soft); color: #3f8f00; }
.badge.lock { background: #eef0f5; color: #9aa2b9; }

/* Health gauge */
.gauge { text-align: center; padding: 18px; }
.gauge svg { width: 200px; height: 112px; }
.gauge .score { font-size: 34px; font-weight: 900; margin-top: -48px; }
.gauge .lbl { color: var(--muted); font-weight: 800; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 18px 18px; }
.kv div { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.kv small { display: block; color: var(--muted); font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.kv b { font-size: 16px; }
.edit-grid { display: grid; gap: 12px; padding: 16px; }
.edit-grid label { font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 6px; }
.edit-grid .input { text-align: left; font-size: 16px; padding: 13px 14px; background: var(--bg); box-shadow: none; }

/* Segmented */
.seg { display: flex; background: #e6e9f2; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px; border-radius: 9px; font-weight: 800; color: var(--muted); font-size: 14px; }
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }

/* ---------- Modal ---------- */
.modal-back { position: absolute; inset: 0; background: rgba(15, 22, 52, .5); z-index: 50; display: flex; align-items: flex-end; animation: fadeIn .2s; }
.modal-back.center { align-items: center; justify-content: center; padding: 20px; }
.sheet { background: #fff; width: 100%; border-radius: 26px 26px 0 0; padding: 22px 20px 30px; max-height: 88%; overflow-y: auto; animation: up .25s ease; }
.modal-back.center .sheet { border-radius: 26px; }
.sheet h3 { margin: 0 0 6px; font-size: 21px; }
.sheet .grab { width: 40px; height: 5px; background: #d9dde8; border-radius: 4px; margin: -8px auto 14px; }
.sheet ul { padding-left: 18px; line-height: 1.55; color: #3d4670; font-weight: 600; }
.sheet .btn + .btn { margin-top: 12px; }
.evolve { text-align: center; }
.evolve .avatar { width: 180px; height: 180px; margin: 10px auto; animation: evolve 1s ease; box-shadow: 0 0 0 6px var(--ring), 0 0 40px var(--ring); }
@keyframes evolve { 0% { transform: scale(.3) rotate(-20deg); filter: brightness(3); } 60% { transform: scale(1.1); } 100% { transform: none; filter: none; } }
.evolve small { color: var(--blue); font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.evolve h2 { margin: 4px 0; font-size: 26px; }
.evolve p { color: var(--muted); font-weight: 700; margin: 0 0 18px; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -10px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(900px) rotate(720deg); } }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet .input { text-align: left; font-size: 16px; padding: 13px 14px; background: var(--bg); box-shadow: none; }
.sheet label { font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; display: block; margin: 12px 0 6px; }
select.input { appearance: none; }

/* Toast */
.toast { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 14px; font-weight: 800; font-size: 14px; z-index: 80; white-space: nowrap; animation: up .2s; }

/* =========================================================
   Animaciones de los capibaras
   ========================================================= */
.capi-inner { width: 100%; height: 100%; display: grid; place-items: center; transform-origin: 50% 92%; }
.capi-inner > img, .capi-inner > svg { width: 100%; height: 100%; object-fit: contain; }
.avatar { isolation: auto; }

/* Respiración base + personalidad de cada etapa */
.anim-semilla     { animation: capi-sway 3.2s ease-in-out infinite; }
.anim-obrero      { animation: capi-nod 1.6s ease-in-out infinite; }
.anim-fuerte      { animation: capi-lift 1.1s cubic-bezier(.4,0,.3,1) infinite; }
.anim-emprendedor { animation: capi-type .45s steps(2) infinite, capi-breathe 3s ease-in-out infinite; }
.anim-millonario  { animation: capi-swag 1.4s ease-in-out infinite; }

@keyframes capi-breathe { 0%,100% { scale: 1 1; } 50% { scale: 1.03 .97; } }
@keyframes capi-sway  { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) scale(1.02, .98); } }
@keyframes capi-nod   { 0%,100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(2px) rotate(-3deg); } 60% { transform: translateY(-2px) rotate(2deg); } }
@keyframes capi-lift  { 0%,100% { transform: translateY(0) scale(1.03, .97); } 45% { transform: translateY(-7%) scale(.98, 1.03); } 60% { transform: translateY(-7%) scale(.98, 1.03); } }
@keyframes capi-type  { 0% { translate: 0 0; } 100% { translate: 0 1.5px; } }
@keyframes capi-swag  { 0%,100% { transform: rotate(-5deg) translateX(-2%); } 50% { transform: rotate(5deg) translateX(2%) translateY(-3%); } }

/* Partes animadas de los capibaras dibujados (SVG) */
.c-eyes { transform-box: fill-box; transform-origin: center; animation: capi-blink 4.2s infinite; }
@keyframes capi-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.c-sprout { transform-box: fill-box; transform-origin: 50% 100%; animation: capi-leaf 2s ease-in-out infinite; }
@keyframes capi-leaf { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
.c-coin { transform-box: fill-box; transform-origin: center; animation: capi-coin 2.4s ease-in-out infinite; }
@keyframes capi-coin { 0%,100% { transform: translateY(0) scaleX(1); } 25% { transform: translateY(-6px) scaleX(.2); } 50% { transform: translateY(-8px) scaleX(1); } }
.c-led { animation: capi-led 1s steps(1) infinite; }
@keyframes capi-led { 50% { fill: #1cb0f6; } }
.anim-semilla .c-arm-r { transform-box: fill-box; transform-origin: 50% 10%; animation: capi-wave 1.6s ease-in-out infinite; }
@keyframes capi-wave { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-25deg); } }

/* Efectos flotantes (chispas, sudor, billetes…) */
.capi-fx { position: absolute; font-size: 16%; pointer-events: none; opacity: 0; animation: capi-fx 2.6s ease-out infinite; font-size: clamp(9px, 16%, 22px); }
.capi-fx.fx0 { left: 8%;  top: 18%; }
.capi-fx.fx1 { right: 6%; top: 10%; animation-delay: .9s; }
.capi-fx.fx2 { right: 20%; top: 40%; animation-delay: 1.7s; }
@keyframes capi-fx { 0% { opacity: 0; transform: translateY(8px) scale(.6); } 20% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-18px) scale(1.1); } }
.tab .capi-fx, .evo.locked .capi-fx { display: none; }

/* Reacciones */
.react-happy { animation: capi-jump .8s cubic-bezier(.3,1.6,.5,1); }
.react-sad   { animation: capi-shake .55s ease-in-out; }
.react-poke  { animation: capi-boing .6s cubic-bezier(.3,1.8,.5,1); }
.dance .capi-inner { animation: capi-dance .9s ease-in-out infinite; }
@keyframes capi-jump  { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-22px) scale(1.06, .94) rotate(-6deg); } 60% { transform: translateY(0) scale(1.08, .92); } 100% { transform: none; } }
@keyframes capi-shake { 0%,100% { transform: none; } 20% { transform: translateX(-7px) rotate(-4deg); } 40% { transform: translateX(7px) rotate(4deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
@keyframes capi-boing { 0% { transform: scale(1); } 30% { transform: scale(1.15, .85); } 55% { transform: scale(.92, 1.1) translateY(-10px); } 100% { transform: none; } }
@keyframes capi-dance { 0%,100% { transform: rotate(-8deg) translateY(0); } 25% { transform: rotate(0) translateY(-10px); } 50% { transform: rotate(8deg) translateY(0); } 75% { transform: rotate(0) translateY(-10px); } }

/* La bienvenida: cada burbuja ya flota; el capibara además anima dentro */
.welcome .bubble-capi { position: absolute; }
.welcome .bubble-capi .capi-inner { width: 92%; height: 92%; }

@media (prefers-reduced-motion: reduce) {
  .capi-inner, .capi-fx, .c-eyes, .c-sprout, .c-coin, .c-led, .c-arm-r, .react-happy, .react-sad, .react-poke, .dance .capi-inner { animation: none !important; }
}
