:root {
  --brand: #1E5A43;
  --brand-strong: #154533;
  --brand-soft: #E5F0EA;
  --accent: #F4C35A;
  --accent-soft: #FDF3DC;
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #F1EFE8;
  --text: #1B2420;
  --muted: #5E6B65;
  --line: #E1DED4;
  --ok: #2E8B57;
  --ok-soft: #DDF2E5;
  --bad: #C2483D;
  --bad-soft: #FBE3E0;
  --shadow: 0 1px 2px rgba(20,40,30,.06), 0 6px 20px rgba(20,40,30,.06);
  --radius: 16px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  /* colores de carpetas */
  --c-green: #1E5A43; --c-teal: #1F7A80; --c-blue: #2F5DA8;
  --c-amber: #C7861A; --c-coral: #C9573F; --c-plum: #7A4A8C;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5FBF93; --brand-strong: #7FD3AC; --brand-soft: #1C3229;
    --accent: #F4C35A; --accent-soft: #3A3120;
    --bg: #121715; --surface: #1A211E; --surface-2: #222B27;
    --text: #E9EEEB; --muted: #9AA8A1; --line: #2E3833;
    --ok: #5FC48A; --ok-soft: #1D3527; --bad: #EE7B6F; --bad-soft: #3B2220;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --c-green: #5FBF93; --c-teal: #4FB6BC; --c-blue: #7EA3E6;
    --c-amber: #E3AE4E; --c-coral: #EB8B74; --c-plum: #B88BCB;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); }
button, input, textarea, select { font: inherit; color: inherit; }
code { background: rgba(0,0,0,.12); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { max-width: 1080px; margin: 0 auto; padding: 24px 16px 80px; }
.demo-banner {
  background: var(--accent-soft); color: var(--text); text-align: center;
  font-size: .85rem; padding: 8px 16px; border-bottom: 1px solid var(--line);
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logo { height: 36px; width: auto; }
.brand-logo + .brand-mark { display: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--accent);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.25rem; flex: none;
}
.brand-text { font-size: 1rem; white-space: nowrap; }
.brand-text span { color: var(--muted); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text);
  padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: .9rem; font-weight: 600; max-width: 180px;
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none;
}
.user-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .user-chip .name, .brand-text span { display: none; } }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; padding: 11px 18px;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: transform .08s ease, background .15s ease, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) { .btn:not(.ghost):not(.soft):not(.danger) { color: #0F1F18; } }
.btn:hover { background: var(--brand-strong); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.soft:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand)); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 7px 12px; font-size: .88rem; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; padding: 6px; border-radius: 8px;
  color: var(--muted); display: inline-grid; place-items: center; line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
textarea.input { resize: vertical; min-height: 90px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; margin: 6px 0 16px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 17px; height: 17px; }
.form-error { color: var(--bad); font-size: .9rem; margin: -4px 0 12px; min-height: 0; }
.form-note { color: var(--muted); font-size: .88rem; }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 20px 0; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden;
}
.auth-hero {
  background: var(--brand); color: #fff; padding: 28px 28px 24px; position: relative; overflow: hidden;
}
@media (prefers-color-scheme: dark) { .auth-hero { background: #1E5A43; } }
.auth-hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px;
  border-radius: 50%; background: var(--accent); opacity: .18;
}
.auth-hero .brand-mark { background: var(--accent); color: #1E5A43; margin-bottom: 14px; }
.auth-hero h1 { color: #fff; font-size: 1.7rem; margin-bottom: 4px; }
.auth-hero p { margin: 0; opacity: .85; font-size: .95rem; }
.auth-body { padding: 24px 28px 28px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.tab {
  flex: 1; border: none; background: transparent; padding: 9px; border-radius: 9px;
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; font-size: .9rem; }
.link-btn:hover { text-decoration: underline; }

/* ---------- dashboard ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hello p { color: var(--muted); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 34px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stat .num { font-family: var(--display); font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--brand); }
.stat .lbl { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.stat.accent { background: var(--accent-soft); border-color: transparent; }
.stat.accent .num { color: var(--text); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 14px; flex-wrap: wrap; }
.section-head p { color: var(--muted); margin: 0; font-size: .92rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 36px; }
.folder-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; min-height: 150px;
  transition: transform .12s ease, box-shadow .12s ease; overflow: hidden;
}
.folder-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--fc, var(--brand)); }
.folder-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(20,40,30,.08), 0 12px 28px rgba(20,40,30,.08); }
.folder-card .fc-top { display: flex; align-items: center; gap: 10px; }
.folder-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--fc, var(--brand)) 15%, transparent); color: var(--fc, var(--brand));
}
.folder-icon svg { width: 20px; height: 20px; }
.folder-card h3 { margin: 0; font-family: var(--font); font-weight: 700; font-size: 1.02rem; line-height: 1.3; }
.folder-card .desc { color: var(--muted); font-size: .88rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.folder-card .meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: .82rem; color: var(--muted); gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; background: var(--accent-soft); color: #8A5E05;
}
@media (prefers-color-scheme: dark) { .badge { color: var(--accent); } }
.badge.green { background: var(--brand-soft); color: var(--brand); }
.mastery { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.mastery > i { display: block; height: 100%; background: var(--fc, var(--brand)); border-radius: 999px; transition: width .4s ease; }
.new-card {
  border: 2px dashed var(--line); background: transparent; box-shadow: none; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 600; cursor: pointer; text-align: center;
}
.new-card::before { display: none; }
.new-card:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.new-card .plus { font-size: 2rem; line-height: 1; font-weight: 400; }
.empty {
  text-align: center; padding: 30px 20px; color: var(--muted); background: var(--surface);
  border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 36px;
}

/* ---------- folder page ---------- */
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
.crumb:hover { color: var(--brand); }
.folder-head {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 26px; position: relative; overflow: hidden;
}
.folder-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--fc, var(--brand)); }
.folder-head .row { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.folder-head .desc { color: var(--muted); margin: 0; }
.folder-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.progress-line { display: flex; align-items: center; gap: 12px; margin-top: 18px; font-size: .88rem; color: var(--muted); }
.progress-line .mastery { flex: 1; height: 8px; }

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 12px; margin-bottom: 34px; }
.game-tile {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px 14px;
  cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s;
}
.game-tile:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--brand); }
.game-tile:disabled { opacity: .5; cursor: not-allowed; }
.game-tile .gi { font-size: 1.6rem; line-height: 1; }
.game-tile strong { font-size: .98rem; }
.game-tile small { color: var(--muted); font-size: .8rem; line-height: 1.35; }

.words-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.add-word {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  display: grid; grid-template-columns: 1fr 1.4fr 1.6fr auto; gap: 10px; align-items: end; margin-bottom: 14px;
}
.add-word label.field { margin: 0; }
@media (max-width: 760px) { .add-word { grid-template-columns: 1fr; } }
.search { max-width: 260px; }
.word-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.word-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.word-row:last-child { border-bottom: none; }
.word-row .term { font-weight: 700; }
.word-row .meaning { color: var(--text); font-size: .93rem; }
.word-row .example { color: var(--muted); font-size: .86rem; font-style: italic; }
.word-row .row-actions { display: flex; gap: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.dot.b1, .dot.b2 { background: var(--accent); }
.dot.b3, .dot.b4 { background: color-mix(in srgb, var(--ok) 65%, var(--accent)); }
.dot.b5 { background: var(--ok); }
.dot.hard { background: var(--bad); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- game ---------- */
.game-wrap { max-width: 720px; margin: 0 auto; }
.game-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.game-top .title { flex: 1; min-width: 0; }
.game-top .title strong { display: block; font-size: 1.05rem; }
.game-top .title small { color: var(--muted); }
.game-progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 22px; }
.game-progress > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .3s ease; }
.score-pill { background: var(--accent-soft); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.stage {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: 28px 22px; text-align: center;
}
.prompt-label { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.prompt { font-family: var(--display); font-size: clamp(1.5rem, 5vw, 2.2rem); font-weight: 700; margin-bottom: 8px; word-break: break-word; }
.prompt.small { font-family: var(--font); font-size: clamp(1.05rem, 3.5vw, 1.3rem); font-weight: 600; }
.hint-text { color: var(--muted); font-style: italic; margin-bottom: 18px; }
.speak { margin: 0 auto 14px; }

/* flashcards */
.flashcard { perspective: 1200px; cursor: pointer; margin-bottom: 18px; }
.flashcard-inner {
  position: relative; min-height: 260px; transition: transform .5s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center;
}
.face.back { transform: rotateY(180deg); background: var(--brand-soft); }
.face .tap { position: absolute; bottom: 14px; font-size: .8rem; color: var(--muted); }
.answer-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* options (quiz) */
.options { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.option {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px 16px; cursor: pointer;
  font-weight: 500; transition: border-color .12s, background .12s; display: flex; gap: 12px; align-items: center;
}
.option .key {
  width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; flex: none; color: var(--muted);
}
.option:hover:not(:disabled) { border-color: var(--brand); }
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option:disabled { cursor: default; }

/* feedback */
.feedback { margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-weight: 600; text-align: left; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback .sub { display: block; font-weight: 500; color: var(--text); margin-top: 2px; }

/* spelling */
.type-row { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.type-row .input { text-align: center; font-size: 1.15rem; font-weight: 600; }
.input.ok { border-color: var(--ok); background: var(--ok-soft); }
.input.bad { border-color: var(--bad); background: var(--bad-soft); }
.tools-row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

/* match */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-item {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; cursor: pointer;
  font-size: .92rem; min-height: 54px; display: flex; align-items: center; justify-content: center; text-align: center;
  transition: all .15s ease; word-break: break-word;
}
.match-item.term { font-weight: 700; }
.match-item:hover:not(.done) { border-color: var(--brand); }
.match-item.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.match-item.done { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); cursor: default; opacity: .75; }
.match-item.shake { animation: shake .35s; border-color: var(--bad); background: var(--bad-soft); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* scramble */
.slots, .tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0; }
.slot-word { display: flex; gap: 6px; }
.slot, .tile {
  width: 44px; height: 50px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 700; font-size: 1.25rem; text-transform: uppercase; user-select: none;
}
@media (max-width: 480px) { .slot, .tile { width: 36px; height: 42px; font-size: 1.05rem; } }
.slot { border: 2px dashed var(--line); background: var(--surface-2); cursor: pointer; }
.slot.filled { border-style: solid; border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.slots.ok .slot { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.slots.bad .slot { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); animation: shake .35s; }
.tile { border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; box-shadow: 0 2px 0 var(--line); }
.tile:hover { border-color: var(--brand); }
.tile.used { visibility: hidden; }

/* hangman */
.hang-svg { width: 150px; height: 150px; margin: 0 auto 6px; display: block; }
.hang-svg .part { stroke: var(--text); stroke-width: 4; stroke-linecap: round; fill: none; opacity: 0; transition: opacity .25s; }
.hang-svg .part.show { opacity: 1; }
.hang-svg .base { stroke: var(--muted); stroke-width: 4; stroke-linecap: round; fill: none; }
.mask { display: flex; flex-wrap: wrap; gap: 8px 6px; justify-content: center; margin: 12px 0 18px; font-size: 1.5rem; font-weight: 700; font-family: var(--display); }
.mask .ch { width: 28px; border-bottom: 3px solid var(--text); text-align: center; min-height: 38px; text-transform: uppercase; }
.mask .ch.space { border: none; width: 14px; }
.mask .ch.miss { color: var(--bad); }
.keyboard { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 520px; margin: 0 auto; }
.key-btn {
  width: 38px; height: 42px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 700; cursor: pointer; text-transform: uppercase;
}
.key-btn:hover:not(:disabled) { border-color: var(--brand); }
.key-btn.hit { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.key-btn.miss { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.key-btn:disabled { cursor: default; }
.lives { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }

/* memory */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 540px; margin-inline: auto; }
@media (max-width: 520px) { .mem-grid { grid-template-columns: repeat(3, 1fr); } }
.mem-card { perspective: 900px; aspect-ratio: 3/3.4; cursor: pointer; border: none; background: none; padding: 0; }
.mem-inner { position: relative; width: 100%; height: 100%; transition: transform .4s ease; transform-style: preserve-3d; }
.mem-card.open .mem-inner, .mem-card.done .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; place-items: center; padding: 6px; font-size: .8rem; text-align: center; word-break: break-word; line-height: 1.25;
}
.mem-face.front { background: var(--brand); color: var(--accent); font-family: var(--display); font-size: 1.6rem; font-weight: 700; }
@media (prefers-color-scheme: dark) { .mem-face.front { background: #1E5A43; } }
.mem-face.back { transform: rotateY(180deg); background: var(--surface); border: 1.5px solid var(--line); color: var(--text); }
.mem-face.back.is-term { font-weight: 700; font-size: .95rem; }
.mem-card.done .mem-face.back { border-color: var(--ok); background: var(--ok-soft); }

/* results */
.results { text-align: center; }
.big-score { font-family: var(--display); font-size: 3.4rem; font-weight: 700; color: var(--brand); line-height: 1; margin: 10px 0 4px; }
.results .msg { color: var(--muted); margin-bottom: 22px; }
.review-list { text-align: left; background: var(--surface-2); border-radius: 14px; padding: 6px 14px; margin: 0 0 22px; }
.review-list div { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.review-list div:last-child { border-bottom: none; }
.results .answer-row { margin-top: 6px; }

/* ---------- modal & toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,20,15,.45); z-index: 50; display: grid; place-items: center;
  padding: 16px; animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: 20px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .18s ease;
}
.modal.wide { max-width: 620px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.color-pick { display: flex; gap: 10px; margin-bottom: 16px; }
.color-pick label { cursor: pointer; }
.color-pick input { position: absolute; opacity: 0; pointer-events: none; }
.color-pick span { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; outline: 2px solid transparent; }
.color-pick input:checked + span { outline-color: var(--text); border-color: var(--surface); }
.color-pick input:focus-visible + span { outline-color: var(--brand); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100vw - 32px); text-align: center;
}
.toast.error { background: var(--bad); color: #fff; }

.loading-screen { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.profile-card { max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.muted { color: var(--muted); }
.pre-preview { font-size: .85rem; color: var(--muted); margin: -6px 0 12px; }

/* ajustes de pantallas chicas */
.badge { white-space: nowrap; }
.slot-word { flex-wrap: wrap; justify-content: center; }
@media (max-width: 600px) {
  .folder-head .row { flex-direction: column; }
  .folder-head .actions { width: 100%; }
  .stage { padding: 22px 14px; }
}
@media (max-width: 400px) {
  .slot, .tile { width: 31px; height: 38px; font-size: .95rem; border-radius: 8px; }
  .slots, .tiles, .slot-word { gap: 5px; }
  .key-btn { width: 32px; height: 40px; }
}

/* sugerencias de definición */
.suggest { grid-column: 1 / -1; background: var(--brand-soft); border-radius: 12px; padding: 12px; }
.sug-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .88rem; font-weight: 600; }
.sug-list { display: grid; gap: 8px; margin-top: 10px; }
.sug {
  text-align: left; border: 1.5px solid transparent; background: var(--surface); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: border-color .12s;
}
.sug:hover { border-color: var(--brand); }
.sug.chosen { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.sug-pos { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.sug-text { font-size: .93rem; }
.sug-ex { font-size: .84rem; color: var(--muted); font-style: italic; }
.spinner.small { width: 16px; height: 16px; border-width: 2px; }
