/* Aprovaré — sistema de diseño */
:root {
  --violet: #6C5CE7; --violet-deep: #5246C9; --violet-ink: #3B30A8; --violet-soft: #ECE9FF; --violet-tint: #F6F4FF;
  --lime: #A3E635; --lime-deep: #7CBF12; --lime-soft: #F0FBD9;
  --mint: #00B894; --mint-deep: #009A7B; --mint-soft: #DDF8F0;
  --coral: #FF7675; --coral-deep: #E25554; --coral-soft: #FFE6E6;
  --sun: #FDCB6E; --sun-deep: #E0A82F; --sun-soft: #FFF4D6;
  --sky: #74B9FF; --sky-deep: #4A9BF0; --sky-soft: #E3F1FF;
  --bg: #FBF9FF; --surface: #FFFFFF; --surface-2: #F4F2FB; --line: #E8E4F5;
  --text: #221D45; --text-2: #5F5A80; --text-3: #9793B5;
  --shadow: 0 1px 2px rgba(34,29,69,.05), 0 8px 24px -12px rgba(108,92,231,.25);
  --r: 20px; --r-sm: 14px; --r-xs: 10px;
  --nav-h: 64px; --head-h: 60px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --violet: #8B7CFF; --violet-deep: #6C5CE7; --violet-ink: #B8AEFF; --violet-soft: #2A2552; --violet-tint: #1F1B3D;
    --lime-soft: #26321A; --mint-soft: #11302A; --coral-soft: #3A1F23; --sun-soft: #3A3120; --sky-soft: #1B2B3F;
    --bg: #14122A; --surface: #1D1A38; --surface-2: #272348; --line: #332E58;
    --text: #F1EEFF; --text-2: #B8B3D9; --text-3: #7F7AA6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.5; min-height: 100dvh; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--violet-ink); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 900; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: var(--violet-soft); }

/* ── layout ── */
.app { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.head {
  position: sticky; top: 0; z-index: 30; height: var(--head-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.head .in { max-width: 1100px; margin: 0 auto; padding: 0 16px; height: 100%; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.25rem; color: var(--text); }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--violet), #A29BFE); display: grid; place-items: center; color: #fff; font-weight: 900; box-shadow: 0 3px 0 var(--violet-deep); }
.head .stat { display: flex; align-items: center; gap: 5px; font-weight: 800; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }
.head .stat.fire { color: #E8590C; }
.head .stat.fire.off { color: var(--text-3); filter: grayscale(1); }
.head .stat.xp { color: var(--violet-ink); }
.head .spacer { flex: 1; }
.head .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--violet-soft); display: grid; place-items: center; font-size: 1.2rem; border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--line); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: center;
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 800; color: var(--text-3); padding: 6px 14px; border-radius: 12px; min-width: 70px; }
.nav a svg { width: 26px; height: 26px; }
.nav a.on { color: var(--violet); }
.nav a.on svg { filter: drop-shadow(0 2px 6px rgba(108,92,231,.4)); }
.nav .badge { position: absolute; margin-left: 26px; margin-top: -4px; background: var(--coral); color: #fff; font-size: .65rem; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 230px; }
  .nav { top: 0; bottom: auto; left: 0; right: auto; width: 230px; height: 100dvh; flex-direction: column; justify-content: flex-start; padding: 84px 14px 20px; gap: 6px; border-top: 0; border-right: 1px solid var(--line); }
  .nav a { flex-direction: row; width: 100%; gap: 12px; font-size: 1rem; padding: 12px 14px; }
  .nav a.on { background: var(--violet-soft); }
  .nav .badge { position: static; margin: 0 0 0 auto; }
  .head { left: 230px; }
  .brand-nav { position: absolute; top: 18px; left: 22px; }
}
@media (max-width: 899px) {
  .nav a.brand-nav { display: none; }
  .tabs { gap: 2px; padding: 3px; }
  .tabs a { font-size: .8rem; padding: 8px 6px; flex: 1 0 auto; }
  .head .brand-txt { display: none; }
}

main { padding: 20px 0 32px; }
.section { margin-top: 28px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-h h2 { font-size: 1.15rem; }
.section-h a, .link { font-weight: 800; color: var(--violet); font-size: .9rem; }
.muted { color: var(--text-2); } .tiny { font-size: .8rem; } .small { font-size: .9rem; }
.row { display: flex; align-items: center; gap: 10px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .right { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; }

/* ── cards ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card.pad-sm { padding: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ── botones (estilo chunky) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 16px; border: 0; font-weight: 900; font-size: 1rem; cursor: pointer; user-select: none;
  background: var(--violet); color: #fff; box-shadow: 0 4px 0 var(--violet-deep); transition: transform .06s, box-shadow .06s, filter .15s;
  text-transform: none; white-space: nowrap;
}
.btn:active, .btn.pressed { transform: translateY(4px); box-shadow: 0 0 0 var(--violet-deep); }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.lime { background: var(--lime); color: #27400A; box-shadow: 0 4px 0 var(--lime-deep); }
.btn.lime:active { box-shadow: 0 0 0 var(--lime-deep); }
.btn.mint { background: var(--mint); box-shadow: 0 4px 0 var(--mint-deep); }
.btn.mint:active { box-shadow: 0 0 0 var(--mint-deep); }
.btn.coral { background: var(--coral); box-shadow: 0 4px 0 var(--coral-deep); }
.btn.coral:active { box-shadow: 0 0 0 var(--coral-deep); }
.btn.sun { background: var(--sun); color: #4A3600; box-shadow: 0 4px 0 var(--sun-deep); }
.btn.sun:active { box-shadow: 0 0 0 var(--sun-deep); }
.btn.sky { background: var(--sky); color: #0B2E55; box-shadow: 0 4px 0 var(--sky-deep); }
.btn.sky:active { box-shadow: 0 0 0 var(--sky-deep); }
.btn.ghost { background: var(--surface); color: var(--text); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.ghost:active { box-shadow: 0 0 0 var(--line); }
.btn.soft { background: var(--violet-soft); color: var(--violet-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--violet-soft) 70%, var(--violet)); }
.btn.soft:active { box-shadow: none; }
.btn.sm { padding: 8px 14px; font-size: .9rem; border-radius: 12px; box-shadow-width: 3px; }
.btn.xs { padding: 5px 10px; font-size: .8rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { padding: 10px; width: 42px; height: 42px; border-radius: 12px; }
.btn .spin { display: none; }
.btn.loading .spin { display: inline-block; } .btn.loading .lbl { opacity: .6; }
.spin { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.ghost .spin, .btn.lime .spin, .btn.sun .spin, .btn.sky .spin { border-color: rgba(0,0,0,.15); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }

.iconbtn { background: transparent; border: 0; padding: 6px; border-radius: 10px; cursor: pointer; color: var(--text-3); display: inline-grid; place-items: center; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 20px; height: 20px; }

/* ── chips y barras ── */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--surface-2); color: var(--text-2); }
.chip.violet { background: var(--violet-soft); color: var(--violet-ink); }
.chip.mint { background: var(--mint-soft); color: var(--mint-deep); }
.chip.coral { background: var(--coral-soft); color: var(--coral-deep); }
.chip.sun { background: var(--sun-soft); color: #8A5A00; }
.chip.sky { background: var(--sky-soft); color: #1B5FA8; }
.chip.lime { background: var(--lime-soft); color: #4A7A05; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--violet); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar.lime > i { background: var(--lime); } .bar.mint > i { background: var(--mint); } .bar.sun > i { background: var(--sun); }
.bar.thick { height: 14px; }

/* ── formularios ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 800; font-size: .85rem; color: var(--text-2); }
.input, textarea.input, select.input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px var(--violet-soft); }
textarea.input { min-height: 110px; resize: vertical; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick label { cursor: pointer; }
.emoji-pick input { display: none; }
.emoji-pick span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); font-size: 1.25rem; border: 2px solid transparent; }
.emoji-pick input:checked + span { border-color: var(--violet); background: var(--violet-soft); }
.color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.color-pick label { cursor: pointer; }
.color-pick input { display: none; }
.color-pick span { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 2px var(--surface) inset; }
.color-pick input:checked + span { border-color: var(--text); }

/* ── modal ── */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-end; justify-content: center; background: rgba(20,16,50,.45); backdrop-filter: blur(4px); padding: 0; }
.modal.open { display: flex; }
.modal .box { background: var(--surface); width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow: auto; animation: up .25s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 700px) { .modal { align-items: center; padding: 20px; } .modal .box { border-radius: 24px; animation: pop .2s cubic-bezier(.2,.8,.2,1); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }
.modal h2 { margin-bottom: 14px; }

/* ── toasts & xp ── */
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 800; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: pop .2s; pointer-events: auto; }
.toast.err { background: var(--coral); color: #fff; }
.toast.ok { background: var(--mint); color: #fff; }
.xp-pop { position: fixed; z-index: 100; font-weight: 900; color: var(--violet); font-size: 1.3rem; pointer-events: none; animation: xpfly 1.1s ease-out forwards; text-shadow: 0 2px 0 #fff; }
@keyframes xpfly { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 20% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-50px) scale(1); } }
.bump { animation: bump .4s; }
@keyframes bump { 30% { transform: scale(1.25); } }

/* ── home ── */
.hero { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .hero { grid-template-columns: 1.3fr 1fr; } }
.goal { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--lime) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-weight: 900; font-size: 1.1rem; }
.ring.done { background: conic-gradient(var(--lime) 100%, var(--lime) 0); }
.ring.done span { font-size: 1.8rem; }
.week { display: flex; gap: 6px; align-items: flex-end; height: 70px; }
.week .d { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week .d i { display: block; width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px; background: var(--surface-2); min-height: 4px; }
.week .d.met i { background: var(--lime); }
.week .d.some i { background: var(--sun); }
.week .d b { font-size: .7rem; color: var(--text-3); }
.week .d.today b { color: var(--violet); }
.level-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.level-row .lv { font-weight: 900; color: var(--violet-ink); background: var(--violet-soft); padding: 2px 10px; border-radius: 999px; font-size: .85rem; white-space: nowrap; }
.cta-review { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--violet), #A29BFE); color: #fff; border-radius: var(--r); padding: 18px; box-shadow: 0 6px 0 var(--violet-deep); }
.cta-review .n { font-size: 2.2rem; font-weight: 900; line-height: 1; }
.cta-review .btn { background: #fff; color: var(--violet-ink); box-shadow: 0 4px 0 #D9D4FF; }
.cta-review.calm { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); }
.cta-review.calm .btn { background: var(--violet-soft); color: var(--violet-ink); box-shadow: 0 4px 0 #D9D4FF; }

.subject { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 130px; color: var(--text); overflow: hidden; }
.subject .em { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; background: var(--c-soft); }
.subject h3 { font-size: 1.1rem; }
.subject .foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.subject::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--c); opacity: .12; }
.subject.add { border-style: dashed; align-items: center; justify-content: center; color: var(--text-3); font-weight: 800; cursor: pointer; background: transparent; box-shadow: none; }
.subject.add:hover { color: var(--violet); border-color: var(--violet); }

.exam { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.exam .days { font-weight: 900; font-size: 1.3rem; min-width: 56px; text-align: center; padding: 6px 4px; border-radius: 12px; background: var(--sun-soft); color: #8A5A00; line-height: 1; }
.exam .days small { display: block; font-size: .6rem; font-weight: 800; margin-top: 3px; }
.exam .days.urgent { background: var(--coral-soft); color: var(--coral-deep); }

/* ── tema ── */
.topic-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); }
.topic-row .bar { width: 100%; margin-top: 6px; }
.topic-row .pct { font-weight: 900; color: var(--violet-ink); min-width: 44px; text-align: right; }
.hero-topic { display: flex; flex-direction: column; gap: 8px; }
.tabs { display: flex; gap: 4px; margin: 18px 0 16px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--surface-2); border-radius: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1; text-align: center; padding: 9px 12px; border-radius: 12px; font-weight: 800; color: var(--text-2); white-space: nowrap; font-size: .9rem; }
.tabs a.on { background: var(--surface); color: var(--violet-ink); box-shadow: var(--shadow); }
.pane { display: none; } .pane.on { display: block; animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 26px 18px; text-align: center; background: var(--surface); transition: .15s; }
.drop.over { border-color: var(--violet); background: var(--violet-tint); }
.drop .big { font-size: 2.4rem; }
.drop .btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.doc .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-size: 1.2rem; flex: none; }
.doc .name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .st { font-size: .78rem; font-weight: 800; }
.doc .st.listo { color: var(--mint-deep); } .doc .st.procesando, .doc .st.pendiente { color: var(--sun-deep); } .doc .st.error { color: var(--coral-deep); }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

.prose { line-height: 1.65; }
.prose h1, .prose h2, .prose h3 { margin: 1.1em 0 .4em; } .prose h2 { font-size: 1.15rem; } .prose h3 { font-size: 1rem; }
.prose p { margin: .5em 0; } .prose ul, .prose ol { padding-left: 1.3em; margin: .4em 0; } .prose li { margin: .2em 0; }
.prose strong { color: var(--violet-ink); }
.prose table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: .6em 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 6px; font-size: .9em; }
.prose blockquote { border-left: 3px solid var(--violet-soft); margin: .6em 0; padding: .2em .8em; color: var(--text-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.prose > :first-child { margin-top: 0; }
.prose .tex[data-display="1"], .tex .katex-display { margin: .6em 0; overflow-x: auto; overflow-y: hidden; }
.katex { font-size: 1.08em; }
.frac-pic { display: inline-flex; align-items: center; gap: 10px; margin: 6px 0; padding: 8px 12px; border-radius: 14px; background: var(--violet-tint); border: 1px solid var(--violet-soft); vertical-align: middle; }
.frac-pic svg { display: block; max-width: 100%; height: auto; }
.frac-pic b { font-weight: 900; color: var(--violet-ink); font-size: 1.05rem; }
details.sol { margin: .5em 0 .9em; border: 2px dashed var(--line); border-radius: 14px; padding: 8px 14px; background: var(--surface-2); }
details.sol summary { cursor: pointer; font-weight: 900; color: var(--violet-ink); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.sol summary::before { content: "🔒"; } details.sol[open] summary::before { content: "🔓"; }
details.sol summary::-webkit-details-marker { display: none; }
details.sol[open] { background: var(--mint-soft); border-color: var(--mint); }
details.sol > :not(summary) { margin-top: .4em; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { padding: 9px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 800; cursor: pointer; font-size: .9rem; }
.seg button.on { border-color: var(--violet); background: var(--violet-soft); color: var(--violet-ink); }

.flash-list .fc { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 14px; }
@media (min-width: 700px) { .flash-list .fc { grid-template-columns: 1fr 1fr; gap: 14px; } }
.flash-list .q { font-weight: 800; } .flash-list .a { color: var(--text-2); }
.flash-list .ops { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
.flash-list textarea { min-height: 60px; }

.empty { text-align: center; padding: 34px 16px; color: var(--text-2); }
.empty .big { font-size: 2.6rem; margin-bottom: 8px; }

/* ── chat ── */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 40vh; }
.msg { max-width: 88%; padding: 12px 15px; border-radius: 18px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--violet); color: #fff; border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.bot.streaming { white-space: pre-wrap; }
.msg.bot.streaming::after { content: "▍"; animation: pulse .8s infinite; color: var(--violet); }
.chat-input { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); display: flex; gap: 8px; margin-top: 14px; background: var(--bg); padding-top: 8px; }
@media (min-width: 900px) { .chat-input { bottom: 12px; } }
.chat-input .input { border-radius: 999px; padding-left: 18px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; }
.suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 800; cursor: pointer; color: var(--text-2); }
.suggest button:hover { border-color: var(--violet); color: var(--violet-ink); }

/* ── repaso (flip cards) ── */
.session { max-width: 560px; margin: 0 auto; }
.session .top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.session .top .bar { flex: 1; }
.flip { perspective: 1200px; min-height: 300px; cursor: pointer; }
.flip .inner { position: relative; width: 100%; min-height: 300px; transition: transform .5s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.flip.flipped .inner { transform: rotateY(180deg); }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 22px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 1.25rem; font-weight: 800; }
.flip .face.back { transform: rotateY(180deg); background: var(--violet-tint); border-color: var(--violet-soft); font-weight: 700; font-size: 1.1rem; }
.flip .face .tag { position: absolute; top: 14px; left: 16px; font-size: .72rem; font-weight: 900; color: var(--text-3); letter-spacing: .08em; }
.flip .face .tap { position: absolute; bottom: 14px; font-size: .78rem; color: var(--text-3); font-weight: 800; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.grades .btn { padding: 12px 6px; flex-direction: column; gap: 2px; font-size: .9rem; }
.grades .btn small { font-weight: 700; opacity: .8; font-size: .7rem; }
.hint { margin-top: 12px; text-align: center; color: var(--text-2); font-size: .95rem; min-height: 1.4em; }
.finish { text-align: center; padding: 30px 16px; }
.finish .big { font-size: 3.5rem; }
.finish h2 { font-size: 1.6rem; margin: 10px 0 6px; }
.finish .nums { display: flex; justify-content: center; gap: 24px; margin: 18px 0; }
.finish .nums b { display: block; font-size: 1.6rem; color: var(--violet-ink); }

/* ── test ── */
.qnum { font-size: .8rem; font-weight: 900; color: var(--text-3); letter-spacing: .08em; }
.q-text { font-size: 1.2rem; font-weight: 800; margin: 8px 0 16px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--line); transition: .1s; }
.opt:active { transform: translateY(3px); box-shadow: none; }
.opt.sel { border-color: var(--violet); background: var(--violet-soft); color: var(--violet-ink); box-shadow: 0 3px 0 var(--violet); }
.opt.ok { border-color: var(--mint); background: var(--mint-soft); color: var(--mint-deep); box-shadow: 0 3px 0 var(--mint); }
.opt.bad { border-color: var(--coral); background: var(--coral-soft); color: var(--coral-deep); box-shadow: 0 3px 0 var(--coral); }
.feedback { margin-top: 12px; padding: 12px 14px; border-radius: 14px; font-size: .95rem; }
.feedback.ok { background: var(--mint-soft); color: var(--mint-deep); } .feedback.bad { background: var(--coral-soft); color: var(--coral-deep); }
.score-big { font-size: 3rem; font-weight: 900; color: var(--violet-ink); line-height: 1; }

/* ── progreso ── */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { padding: 14px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.tile b { display: block; font-size: 1.6rem; font-weight: 900; color: var(--violet-ink); line-height: 1.1; }
.tile span { font-size: .8rem; color: var(--text-2); font-weight: 800; }
.month { display: flex; gap: 3px; align-items: flex-end; height: 90px; }
.month i { flex: 1; background: var(--violet); border-radius: 4px 4px 2px 2px; min-height: 3px; opacity: .85; }
.month i.zero { background: var(--surface-2); }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 700px) { .badges { grid-template-columns: repeat(6, 1fr); } }
.bdg { text-align: center; padding: 12px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.bdg .em { font-size: 2rem; }
.bdg b { display: block; font-size: .8rem; margin-top: 4px; }
.bdg small { display: block; font-size: .68rem; color: var(--text-3); line-height: 1.2; margin-top: 2px; }
.bdg.locked { opacity: .45; filter: grayscale(1); }
.bdg.new { animation: bump .6s; border-color: var(--sun); }

/* ── login ── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 50% -10%, var(--violet-soft), transparent), var(--bg); }
.login .card { width: 100%; max-width: 400px; padding: 30px 26px; }
.login .logo-big { width: 72px; height: 72px; border-radius: 22px; background: linear-gradient(135deg, var(--violet), #A29BFE); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 2.2rem; margin: 0 auto 14px; box-shadow: 0 6px 0 var(--violet-deep); }
.err { background: var(--coral-soft); color: var(--coral-deep); padding: 10px 14px; border-radius: 12px; font-weight: 800; font-size: .9rem; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-size: .75rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; }
.hidden { display: none !important; }
