/* Vilamates · app de l'alumne */
:root {
  --bg: #fbf5ea;
  --card: #ffffff;
  --ink: #2b2118;
  --muted: #7b6a58;
  --brown: #7a3f0c;
  --orange: #e07a1f;
  --green: #2e8b3a;
  --green-d: #1f6a2a;
  --blue: #2f6db5;
  --red: #c0392b;
  --gold: #e3a400;
  --line: #eadcc6;
  --radius: 16px;
  --shadow: 0 3px 0 rgba(122, 63, 12, 0.12), 0 8px 24px rgba(122, 63, 12, 0.06);
  --fs: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body.vm-body { background: var(--bg); color: var(--ink); font-family: "Atkinson Hyperlegible", system-ui, sans-serif; font-size: var(--fs); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.vm-font-dislexia { font-family: "Lexend", "Atkinson Hyperlegible", sans-serif; letter-spacing: 0.02em; word-spacing: 0.08em; line-height: 1.75; }
body.vm-mida-gran { --fs: 19px; }
body.vm-mida-molt-gran { --fs: 22px; }
a { color: var(--blue); }
h1, h2, h3, .vm-h1 { font-family: Fredoka, "Atkinson Hyperlegible", sans-serif; color: var(--brown); line-height: 1.15; }
.vm-h1 { font-size: 1.9em; margin: 0.2em 0 0.4em; }
.vm-lead { font-size: 1.05em; color: var(--muted); max-width: 60ch; }
.vm-muted { color: var(--muted); }
.vm-small { font-size: 0.85em; }
.vm-center { text-align: center; }
.vm-loading { padding: 60px 20px; text-align: center; font-size: 1.2em; color: var(--muted); }
.vm-tr { display: block; font-size: 0.72em; color: var(--blue); opacity: 0.9; line-height: 1.2; }
.vm-btn .vm-tr, .vm-nav a.on .vm-tr, .vm-tabs button.on .vm-tr { color: inherit; opacity: 0.8; font-weight: 400; }

/* ---------- botons ---------- */
.vm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; background: var(--green); color: #fff; font: inherit; font-weight: 700; padding: 0.55em 1em; cursor: pointer; text-decoration: none; box-shadow: 0 4px 0 var(--green-d); transition: transform 0.08s, box-shadow 0.08s; }
.vm-btn:hover { filter: brightness(1.05); }
.vm-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-d); }
.vm-btn[disabled] { background: #c9c0b3; box-shadow: 0 4px 0 #a99f92; cursor: not-allowed; }
.vm-btn-big { font-size: 1.15em; padding: 0.7em 1.4em; }
.vm-btn-sm { font-size: 0.85em; padding: 0.35em 0.7em; box-shadow: 0 3px 0 var(--green-d); }
.vm-btn-ghost { background: #fff; color: var(--brown); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line); }
.vm-btn-ghost:active { box-shadow: 0 1px 0 var(--line); }
.vm-btn-go { width: 100%; background: var(--orange); box-shadow: 0 4px 0 #a9560f; }
.vm-icon-btn { border: 0; background: #fff; border-radius: 10px; padding: 4px 8px; cursor: pointer; font-size: 1.1em; box-shadow: 0 2px 0 var(--line); }

/* ---------- capçalera i navegació ---------- */
.vm-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: #fffaf2; border-bottom: 3px solid var(--line); }
.vm-top-av { width: 46px; height: 56px; display: block; flex: none; }
.vm-top-av svg { width: 100%; height: 100%; }
.vm-top-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.vm-top-who b { font-family: Fredoka, sans-serif; font-size: 1.1em; color: var(--brown); }
.vm-top-who small { color: var(--muted); font-size: 0.8em; }
.vm-xpbar { height: 8px; background: #efe3d0; border-radius: 6px; max-width: 220px; overflow: hidden; margin-top: 3px; }
.vm-xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); }
.vm-top-stats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.vm-chip { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 2px 10px; font-weight: 700; color: var(--ink); text-decoration: none; position: relative; }
.vm-chip-tarda { background: #fff1d6; border-color: #f2c47a; }
.vm-chip-deute { background: #fdeceb; border-color: var(--red); color: var(--red); font-weight: 700; }
.vm-chip-mail em, .vm-nav-ic em { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-style: normal; font-size: 0.7em; border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.vm-nav-ic em { width: 10px; height: 10px; min-width: 0; padding: 0; top: -2px; right: -4px; }
.vm-layout { display: grid; grid-template-columns: 104px 1fr; min-height: calc(100vh - 75px); }
.vm-nav { display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; background: #fffaf2; border-right: 3px solid var(--line); position: sticky; top: 75px; height: calc(100vh - 75px); overflow-y: auto; }
.vm-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; text-decoration: none; color: var(--ink); font-size: 0.78em; text-align: center; line-height: 1.15; }
.vm-nav a.on { background: #fde9c8; color: var(--brown); font-weight: 700; }
.vm-nav-ic { font-size: 1.6em; position: relative; }
.vm-main { padding: 18px 22px 90px; max-width: 1120px; width: 100%; }
@media (max-width: 760px) {
  .vm-layout { grid-template-columns: 1fr; }
  .vm-nav { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-top: 3px solid var(--line); z-index: 30; padding: 4px; }
  .vm-nav a { min-width: 64px; font-size: 0.68em; }
  .vm-main { padding: 12px 14px 110px; }
  .vm-top-who small, .vm-xpbar { display: none; }
}

/* ---------- targetes i barres ---------- */
.vm-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.vm-card p { margin: 0.3em 0; }
.vm-bar { height: 10px; background: #efe3d0; border-radius: 6px; overflow: hidden; margin: 4px 0; }
.vm-bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; transition: width 0.4s; }
.vm-bar-gold i { background: linear-gradient(90deg, var(--gold), var(--orange)); }
.vm-note { background: #fff6dc; border-radius: 10px; padding: 8px 12px; }

/* ---------- triar personatge ---------- */
.vm-choose { max-width: 1000px; margin: 0 auto; padding: 20px; }
.vm-choose h1 { font-size: 2.2em; text-align: center; }
.vm-choose .vm-lead { margin: 0 auto 10px; text-align: center; }
.vm-choose-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.vm-choose-card { background: #fff; border: 4px solid transparent; border-radius: 18px; padding: 6px; cursor: pointer; box-shadow: var(--shadow); transition: transform 0.15s; }
.vm-choose-card:hover { transform: translateY(-4px); }
.vm-choose-card.on { border-color: var(--orange); background: #fff6e8; }
.vm-choose-card svg { width: 100%; height: 190px; }
.vm-choose-go { position: sticky; bottom: 12px; text-align: center; margin-top: 18px; }

/* ---------- inici ---------- */
/* L'inici ocupa tota l'amplada: el paisatge creix amb la pantalla i les targetes van a la dreta de tot. */
.vm-main-inici { max-width: none; }
.vm-home { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 26vw, 440px); gap: 16px; align-items: start; }
.vm-scene { position: relative; width: 100%; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); background: #8fd3ff; aspect-ratio: 16 / 9; min-height: 300px; max-height: calc(100vh - 130px); }
.vm-scene .vm-scene-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.vm-scene-hero { position: absolute; left: 4%; bottom: 3%; height: 84%; animation: vm-breathe 4s ease-in-out infinite; }
.vm-scene-hero svg { height: 100%; width: auto; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.18)); }
.vm-scene-hello { position: absolute; left: 16px; top: 14px; background: rgba(255, 255, 255, 0.92); border-radius: 14px; padding: 6px 14px; font-family: Fredoka, sans-serif; font-size: clamp(1.25em, 1.5vw, 1.9em); color: var(--brown); }
@keyframes vm-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.vm-mini-m { margin: 6px 0; font-size: 0.92em; }
.vm-mini-m small { color: var(--muted); }
.vm-card-tarda { background: linear-gradient(135deg, #fff1d6, #ffe0b8); }
.vm-talent { display: flex; gap: 12px; align-items: center; }
.vm-talent-ic { font-size: 2.4em; }
.vm-talent-secret { background: #f4effa; }
@media (max-width: 900px) { .vm-home { grid-template-columns: minmax(0, 1fr); } }

/* ---------- temporades ---------- */
.vm-seasons { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.vm-season { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.vm-season b { display: block; font-family: Fredoka, sans-serif; font-size: 1.15em; color: var(--brown); }
.vm-season span { display: block; color: var(--muted); font-size: 0.9em; }
.vm-season.locked { opacity: 0.55; background: #f4ede2; box-shadow: none; }
.vm-season-ic { font-size: 2.4em; width: 64px; height: 64px; display: grid; place-items: center; background: #fdf0da; border-radius: 16px; flex: none; }
.vm-season-ic.big { width: 84px; height: 84px; font-size: 3em; }
.vm-season > div:nth-child(2) { flex: 1; }
.vm-season-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.vm-season-head > div:nth-child(2) { flex: 1; }
/* Trofeus de les temporades aprovades (medalla, copes, cava i diamant) */
.vm-trofeu { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vm-trofeu svg { display: block; height: 64px; width: auto; overflow: visible; }
.vm-trofeu.big svg { height: 112px; }
/* amb cava, el dibuix deixa lloc a dalt per a l'escuma: una mica més gran perquè la copa no quedi petita */
.vm-trofeu-or svg { height: 84px; }
.vm-trofeu-or.big svg { height: 146px; }
.vm-trofeu.big small { color: var(--muted); font-size: 0.85em; text-align: center; }
.vm-season .vm-trofeu-txt { display: block; margin-top: 2px; color: #2e7d32; font-weight: 700; }
.vm-trofeu-or svg { filter: drop-shadow(0 0 6px rgba(255, 200, 60, 0.55)); }
.vm-trofeu-diamant svg { filter: drop-shadow(0 0 7px rgba(110, 205, 255, 0.65)); }
.vm-espuma, .vm-brilla { transform-box: fill-box; transform-origin: center; }
.vm-espuma { opacity: 0; animation: vm-espuma 1.6s ease-out infinite; }
.vm-brilla { animation: vm-brilla 2.4s ease-in-out infinite; }
@keyframes vm-espuma { 0% { transform: translate(0, 0) scale(0.3); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1.2); opacity: 0; } }
@keyframes vm-brilla { 0%, 100% { transform: scale(0.25); opacity: 0.15; } 50% { transform: scale(1); opacity: 1; } }
@media (max-width: 520px) { .vm-season-head { flex-wrap: wrap; } .vm-trofeu.big { width: 100%; } }
.vm-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.vm-skill { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.vm-skill b { font-size: 1.05em; }
.vm-skill p { margin: 0; color: var(--muted); font-size: 0.92em; flex: 1; }
.vm-skill-top { display: flex; justify-content: space-between; align-items: center; }
.vm-skill-res { font-size: 1.8em; }
.vm-skill-btns { display: flex; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.vm-stars { color: var(--gold); font-size: 1.2em; letter-spacing: 1px; }
.vm-stars .off { color: #e3d6c3; }
.vm-fira { background: linear-gradient(135deg, #fff, #fff4e4); border: 3px dashed #f0c27a; }
.vm-exams li { margin: 4px 0; }

/* ---------- teoria ---------- */
.vm-theory-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.vm-theory { background: #fff; border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); }
.vm-t-vids { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 16px; }
.vm-vid { display: flex; flex-direction: column; background: #fff; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: var(--ink); transition: border-color 0.15s, transform 0.15s; }
.vm-vid:hover, .vm-vid:focus-visible { border-color: var(--orange); transform: translateY(-2px); }
/* La miniatura de YouTube és 4:3 amb franges negres: la retallem a 16:9. */
.vm-vid-img { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #222; }
.vm-vid-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vm-vid-play { position: absolute; left: 50%; top: 50%; width: 58px; height: 40px; margin: -20px 0 0 -29px; border-radius: 12px; background: rgba(204, 0, 0, 0.9); }
.vm-vid-play::after { content: ""; position: absolute; left: 23px; top: 11px; border-left: 16px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.vm-vid-dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, 0.8); color: #fff; font-size: 0.75em; padding: 0 6px; border-radius: 4px; }
.vm-vid-txt { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; }
.vm-vid-lang { color: var(--orange); font-weight: 700; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.04em; }
.vm-vid-txt b { line-height: 1.25; }
.vm-vid-txt small { color: var(--muted); }
/* Al mòbil, miniatura petita a l'esquerra perquè la teoria no quedi avall de tot. */
@media (max-width: 560px) {
  .vm-vid { flex-direction: row; align-items: center; }
  .vm-vid-img { flex: 0 0 44%; }
  .vm-vid-play { width: 40px; height: 28px; margin: -14px 0 0 -20px; border-radius: 8px; }
  .vm-vid-play::after { left: 15px; top: 7px; border-left-width: 12px; border-top-width: 7px; border-bottom-width: 7px; }
  .vm-vid-dur { right: 3px; bottom: 3px; font-size: 0.65em; padding: 0 4px; }
  .vm-vid-txt { padding: 6px 10px; font-size: 0.9em; }
}
.vm-teoria header h2 { font-size: 1.8em; margin: 0.1em 0; }
.vm-t-kicker { color: var(--orange); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.8em; margin: 0; }
.vm-t-obj { background: #f0f8ee; border-radius: 10px; padding: 8px 12px; }
.vm-t-vocab { background: #eef5ff; border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.vm-teoria { line-height: 1.65; }
.vm-t-b { margin: 26px 0; padding-top: 6px; }
.vm-t-b h3 { font-size: 1.3em; margin: 0 0 10px; }
.vm-t-b li { margin: 10px 0; padding-left: 4px; }
.vm-t-b p { margin: 0.6em 0; }
.vm-t-ganxo { background: #fff8e8; border-radius: 12px; padding: 10px 14px; }
.vm-t-exemple { border-left: 5px solid var(--orange); padding-left: 14px; }
.vm-t-enun { font-weight: 700; }
.vm-t-res { color: var(--green); font-weight: 700; }
.vm-t-errors { background: #fff0ee; border-radius: 12px; padding: 10px 14px; }
.vm-t-aratu details { display: inline-block; margin-left: 8px; }
.vm-t-aratu summary { cursor: pointer; color: var(--blue); }
.vm-t-nota { font-size: 0.85em; color: var(--muted); }
.vm-fig, .vm-teoria .vm-fig { max-width: 100%; height: auto; color: var(--ink); }
/* Només els dibujos (.vm-fig): KaTeX també fa servir SVG per a √ i no s'han de tocar. */
.vm-teoria svg.vm-fig { max-width: 100%; height: auto; display: block; margin: 8px auto; }

/* ---------- pràctica ---------- */
.vm-prac-head { display: flex; justify-content: space-between; align-items: center; }
.vm-prac-stars .vm-stars { font-size: 1.8em; }
.vm-lvls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.vm-lvl { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 0.9em; color: var(--brown); }
.vm-lvl.on { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 700; }
.vm-lvl[disabled] { opacity: 0.5; cursor: not-allowed; }
.vm-lvl-nota { margin: 0 0 10px; font-size: 0.88em; color: var(--muted); }
.vm-rw.vm-rw-ko { color: var(--red); }
.vm-problem { background: #fff; border-radius: 20px; padding: 18px 22px; box-shadow: var(--shadow); max-width: 820px; }
.vm-q-tools { float: right; display: flex; gap: 6px; }
.vm-q { font-size: 1.15em; }
.vm-q p { margin: 0.2em 0; }
.vm-q-tr { color: var(--blue); font-size: 0.85em; background: #eef5ff; border-radius: 8px; padding: 4px 10px; }
.vm-claim { font-size: 1.2em; background: #fff8e8; border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.vm-expr { font-size: 1.35em; text-align: center; margin: 10px 0; overflow-x: auto; }
.vm-problem .vm-fig { display: flex; justify-content: center; margin: 8px 0; }
.vm-problem .vm-fig svg { max-width: 100%; height: auto; }
.vm-ans { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px 0 8px; flex-wrap: wrap; }
.vm-in { font: inherit; font-size: 1.25em; width: 5.5em; padding: 8px 10px; border: 3px solid var(--line); border-radius: 12px; text-align: center; background: #fffdf8; }
.vm-in:focus { outline: none; border-color: var(--orange); }
.vm-in-wide { width: 9em; }
.vm-suffix { font-size: 1.3em; font-weight: 700; }
.vm-frac { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.vm-frac-bar { width: 100%; height: 4px; background: var(--ink); border-radius: 2px; }
.vm-sci span { font-size: 1.3em; font-weight: 700; }
.vm-sci sup .vm-in-exp { width: 3.6em; font-size: 0.95em; vertical-align: 1.2em; }
/* Una sola potència (base i exponent) i radicals (coeficient · ⁿ√ radicand) */
.vm-pot { gap: 2px; }
.vm-pot > .vm-in { width: 5.4em; } /* hi ha de cabre una base entre parèntesis: (-12), (-2/5) */
.vm-pot sup .vm-in-exp { width: 3.6em; font-size: 0.95em; vertical-align: 1.3em; }
.vm-rad { gap: 0; }
.vm-rad .vm-in-coef { width: 3.4em; margin-right: 8px; }
/* El símbol √ és un SVG que s'estira fins a l'altura de la casella i s'enganxa a la ratlla de dalt. */
.vm-rad-arrel { display: inline-flex; align-items: stretch; }
.vm-rad-sym { position: relative; flex: none; width: 22px; color: var(--ink); }
.vm-rad-sym svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.vm-rad-sym sup { position: absolute; left: -3px; top: 20%; font-size: 16px; font-weight: 700; line-height: 1; }
.vm-rad-in { border-top: 3px solid var(--ink); padding: 6px 2px 2px 4px; }
.vm-rad-in .vm-in { width: 4.6em; }
/* Punt del pla: (x, y) escrit, o marcat tocant la quadrícula (mode 'clic') */
.vm-coord { gap: 4px; }
.vm-coord .vm-in { width: 3.8em; }
.vm-coord-p { font-size: 2em; font-weight: 300; line-height: 1; }
.vm-grid-in.on svg { cursor: crosshair; touch-action: manipulation; }
.vm-grid-nota { text-align: center; }
/* Operacions en vertical amb una casella per pas (resposta 'camps') i caselles dins d'una frase («__ < 5,36 < __») */
.vm-camps { flex-wrap: wrap; justify-content: center; font-size: 1.15em; overflow-x: auto; max-width: 100%; }
.vm-op { color: var(--ink); }
.vm-in.vm-in-camp { font-size: 1em; padding: .1em .2em; height: 1.55em; border-width: 2px; border-radius: 6px; text-align: right; box-sizing: border-box; }
.vm-op .vm-in.vm-in-camp { width: 100% !important; padding: .1em .12em; }
.vm-in.vm-in-camp.ok { border-color: #2e8b3a; background: #ecf8ee; color: #1f6a2a; }
.vm-in.vm-in-camp.ko { border-color: #c0392b; background: #fdecea; color: #a12a1e; text-decoration: line-through; }
.vm-iv { gap: 6px; }
.vm-br { font: inherit; font-size: 2.2em; width: 1.4em; border: 3px solid var(--line); background: #fff; border-radius: 12px; cursor: pointer; color: var(--brown); font-weight: 700; line-height: 1.1; }
.vm-iv-slot { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.vm-iv-slot b { font-size: 1.4em; padding: 8px; }
.vm-iv-comma { font-size: 1.8em; font-weight: 700; }
.vm-inf { border: 0; background: #eef5ff; color: var(--blue); border-radius: 8px; font: inherit; font-size: 0.8em; padding: 2px 8px; cursor: pointer; }
.vm-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 16px 0; }
.vm-opt { font: inherit; text-align: left; padding: 12px 14px; border: 3px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font-size: 1.05em; }
.vm-opt:hover:not([disabled]) { border-color: #f0c27a; }
.vm-opt.on { border-color: var(--orange); background: #fff4e4; }
.vm-opt.ok { border-color: var(--green); background: #eaf7ec; }
.vm-opt.ko { border-color: var(--red); background: #fdeceb; }
.vm-opt[disabled] { cursor: default; }
.vm-prac-btns { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.vm-hint { background: #fff8d8; border-radius: 12px; padding: 12px 18px; margin-top: 10px; line-height: 1.6; }
.vm-hint-t { font-weight: 700; color: var(--brown); margin-bottom: 4px; }
.vm-hint p { margin: 0.5em 0; }
.vm-hint .vm-tr { display: block; margin-top: 8px; }
.vm-msg { margin-top: 10px; text-align: center; color: var(--brown); font-weight: 700; }
.vm-result { border-radius: 14px; padding: 12px 16px; margin-top: 14px; text-align: center; }
.vm-result.ok { background: #eaf7ec; }
.vm-result.ko { background: #fdeceb; }
.vm-result-t { font-family: Fredoka, sans-serif; font-size: 1.6em; }
.vm-result.ok .vm-result-t { color: var(--green); }
.vm-result.ko .vm-result-t { color: var(--red); }
.vm-rewards { display: flex; justify-content: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.vm-rw { background: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 1.1em; animation: vm-pop 0.5s ease-out both; }
.vm-rw:nth-child(2) { animation-delay: 0.1s; }
.vm-rw:nth-child(3) { animation-delay: 0.2s; }
@keyframes vm-pop { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.vm-tags { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; font-size: 0.85em; }
.vm-tags span { background: rgba(255, 255, 255, 0.7); border-radius: 999px; padding: 2px 10px; }
.vm-sol { margin-top: 12px; background: #f6faf4; border-radius: 12px; padding: 10px 18px; line-height: 1.6; }
.vm-sol summary { cursor: pointer; font-weight: 700; color: var(--green-d); }
.vm-sol ol { padding-left: 1.4em; }
.vm-sol li { margin: 12px 0; padding-left: 4px; }
.vm-sol svg.vm-fig { max-width: 100%; height: auto; }

/* ---------- glossari ---------- */
.vm-g { font: inherit; background: none; border: 0; padding: 0; color: inherit; border-bottom: 2px dotted var(--blue); cursor: help; }
.vm-gloss-pop { text-align: center; }
.vm-gloss-ca { font-size: 1.6em; font-family: Fredoka, sans-serif; color: var(--brown); }
.vm-gloss-tr { font-size: 1.4em; color: var(--blue); margin: 8px 0; }

/* ---------- masia, mercat, botiga ---------- */
.vm-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.vm-tabs button { font: inherit; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; color: var(--brown); }
.vm-tabs button.on { background: var(--brown); color: #fff; border-color: var(--brown); }
.vm-inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.vm-inv-it { background: #fff; border-radius: 14px; padding: 10px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.vm-inv-ic { font-size: 2.2em; }
.vm-inv-it b { font-size: 1.3em; }
.vm-inv-it small { color: var(--muted); }
.vm-recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.vm-recipe { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; opacity: 0.85; }
.vm-recipe.ok { opacity: 1; border: 3px solid #bfe3c4; }
.vm-recipe-out { display: flex; align-items: center; gap: 8px; font-size: 1.05em; }
.vm-recipe-out { font-size: 1.8em; }
.vm-recipe-out b { font-size: 0.6em; }
.vm-recipe-out small { font-size: 0.45em; color: var(--muted); }
.vm-recipe-in { display: flex; gap: 6px; flex-wrap: wrap; }
.vm-recipe-in span { background: #f6efe3; border-radius: 999px; padding: 2px 8px; }
.vm-recipe-in .miss { background: #fdeceb; }
.vm-recipe-in .have { background: #eaf7ec; }
.vm-builds { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.vm-build { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.vm-build.locked { opacity: 0.5; box-shadow: none; background: #f4ede2; }
.vm-build-ic { font-size: 2.2em; }
.vm-build p { margin: 4px 0; font-size: 0.92em; }
.vm-market { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.vm-market th, .vm-market td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.vm-market th { background: #fdf0da; color: var(--brown); }
.vm-trade { background: #fff; border-radius: 12px; padding: 10px 14px; margin: 8px 0; box-shadow: var(--shadow); }
.vm-trade.small { font-size: 0.9em; box-shadow: none; background: #f8f2e8; }
.vm-trade div { margin-top: 6px; }
.vm-veins { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vm-vei { background: #fff; border-radius: var(--radius); padding: 10px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vm-vei svg { width: 100%; height: 140px; }
.vm-vei small { color: var(--muted); }
.vm-shop-me { width: 180px; margin: 0 auto; }
.vm-shop-me svg { width: 100%; height: auto; }
.vm-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.vm-shop-it { background: #fff; border-radius: var(--radius); padding: 8px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; align-items: center; }
.vm-shop-it.on { border: 3px solid var(--orange); }
.vm-shop-it > svg { width: 100%; height: 130px; }
.vm-shop-it.locked { background: #eef0f2; box-shadow: none; color: #5f666d; }
.vm-shop-it small { line-height: 1.3; }
.vm-pet { margin: 8px 0; font-size: 0.92em; }
.vm-pet > * { display: block; }
.vm-pet small { color: var(--muted); }
.vm-pet-alert, .vm-pet small.vm-pet-alert { color: #b3262b; font-weight: 700; }
.vm-shop-obj { width: 100%; height: 130px; border-radius: 10px; background: #f6eedf; }
.vm-shop-obj svg { width: 100%; height: 100%; display: block; }
.vm-shop-fons { width: 100%; border-radius: 10px; overflow: hidden; }
.vm-shop-fons svg { width: 100%; height: auto; display: block; }

/* ---------- missions, bústia, calendari, perfil ---------- */
.vm-missions { display: flex; flex-direction: column; gap: 8px; }
.vm-mission { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); }
.vm-mission > div { flex: 1; }
.vm-mission p { margin: 2px 0; color: var(--muted); font-size: 0.92em; }
.vm-mission.ready { border: 3px solid var(--gold); background: #fffbea; }
.vm-mission.done { opacity: 0.6; }
.vm-done { font-size: 1.6em; }
.vm-poble { background: linear-gradient(135deg, #fffbea, #fff1d6); }
.vm-mail { display: flex; flex-direction: column; gap: 6px; }
.vm-mail-it { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 8px; text-align: left; font: inherit; border: 0; background: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow); }
.vm-mail-it span { font-size: 1.5em; }
.vm-mail-it b { font-weight: 400; }
.vm-mail-it.new b { font-weight: 700; }
.vm-mail-it.new { border-left: 5px solid var(--orange); }
.vm-mail-it.gift { background: #fffbea; }
.vm-mail-it small { color: var(--muted); }
.vm-mail-open { text-align: left; }
.vm-mail-ic { font-size: 2.6em; text-align: center; }
.vm-exam-res { background: #f6faf4; border-radius: 12px; padding: 12px; margin: 10px 0; }
.vm-big-grade { font-family: Fredoka, sans-serif; font-size: 3em; color: var(--green); text-align: center; }
.vm-exam-res table { width: 100%; }
.vm-exam-res td:nth-child(2) { width: 60%; }
.vm-cal { background: #fff; border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); max-width: 560px; }
.vm-cal-h { font-family: Fredoka, sans-serif; font-size: 1.3em; color: var(--brown); text-align: center; text-transform: capitalize; }
.vm-cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.vm-cal-g b { color: var(--muted); font-size: 0.8em; }
.vm-cal-g span { min-height: 46px; border-radius: 8px; background: #faf5ec; padding: 2px; font-size: 0.9em; }
.vm-cal-g span.today { outline: 3px solid var(--orange); }
.vm-cal-g span.has { background: #fff1d6; font-weight: 700; }
.vm-cal-g i { display: block; font-style: normal; }
.vm-cal-list li { margin: 6px 0; }
.vm-cal-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-transform: none; }
.vm-cal-h span { display: inline-block; }
.vm-cal-h span::first-letter { text-transform: uppercase; }
.vm-cal-nav { border: 0; background: #faf5ec; color: var(--brown); border-radius: 10px; width: 36px; height: 36px; font-size: 1.3em; cursor: pointer; }
.vm-cal-g span.classe { background: #e3f1dd; }
.vm-cal-g span.prova { background: #ffe0b8; box-shadow: inset 0 0 0 2px var(--orange); }
.vm-cal-llegenda { margin: 8px 2px 0; font-size: 0.85em; color: var(--muted); }
.vm-cal-mostra { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: #e3f1dd; vertical-align: -2px; }
/* Triar el dia de la prova de la Fira */
.vm-ask-exam .vm-days { display: grid; gap: 6px; margin: 12px 0; max-height: 50vh; overflow: auto; }
.vm-ask-exam .vm-days label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #faf5ec; cursor: pointer; }
.vm-ask-exam .vm-days label:has(input:checked) { background: #fff1d6; box-shadow: inset 0 0 0 2px var(--orange); }
.vm-ask-exam .vm-days span::first-letter { text-transform: uppercase; }
.vm-profile { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.vm-profile-av { width: 200px; }
.vm-profile-av svg { width: 100%; height: auto; }
.vm-vocab { columns: 2; }
.vm-vocab li { break-inside: avoid; margin: 3px 0; }

/* ---------- modals, avisos, celebracions ---------- */
.vm-modal { position: fixed; inset: 0; background: rgba(43, 33, 24, 0.55); z-index: 100; display: grid; place-items: center; padding: 16px; }
.vm-modal-box { background: #fff; border-radius: 22px; padding: 22px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.vm-modal-box svg.vm-avatar-svg { width: 160px; height: auto; }
.vm-modal-x { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 1.3em; cursor: pointer; }
.vm-form label { display: block; margin: 8px 0; }
.vm-form input, .vm-form select { font: inherit; padding: 6px 8px; border: 2px solid var(--line); border-radius: 8px; margin-left: 6px; }
.vm-form fieldset { border: 2px solid var(--line); border-radius: 12px; margin: 8px 0; }
.vm-toasts { position: fixed; top: 80px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.vm-toast { background: #2b2118; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); transition: opacity 0.5s, transform 0.5s; max-width: 340px; }
.vm-toast.ok { background: var(--green); }
.vm-toast.err { background: var(--red); }
.vm-toast.out { opacity: 0; transform: translateX(30px); }
.vm-celebrate { position: fixed; inset: 0; z-index: 110; background: rgba(43, 33, 24, 0.5); display: grid; place-items: center; overflow: hidden; }
.vm-cel-box { background: #fff; border-radius: 26px; padding: 26px 30px; text-align: center; max-width: 420px; animation: vm-pop 0.5s ease-out; position: relative; z-index: 2; }
.vm-cel-emoji { font-size: 4em; }
.vm-cel-box h2 { margin: 0.2em 0; }
.vm-celebrate i { position: absolute; top: -40px; font-style: normal; font-size: 1.8em; animation: vm-fall 2.6s linear forwards; z-index: 1; }
@keyframes vm-fall { to { transform: translateY(110vh) rotate(540deg); } }
.vm-calc { max-width: 300px; margin: 0 auto; }
.vm-calc-win { position: fixed; z-index: 90; width: min(280px, calc(100vw - 8px)); background: #fff; border-radius: 16px; padding: 0 12px 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.vm-calc-win.dragging { cursor: grabbing; opacity: 0.92; }
.vm-calc-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px; font-weight: 700; color: var(--muted); }
.vm-calc-x { border: 0; background: none; font-size: 1.1em; cursor: pointer; }
.vm-calc-win .vm-calc-d { pointer-events: none; }
.vm-calc-d { width: 100%; font-size: 1.6em; text-align: right; padding: 8px; border: 3px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.vm-calc-k { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.vm-calc-k button { font: inherit; font-size: 1.2em; padding: 10px 0; border: 0; border-radius: 10px; background: #f6efe3; cursor: pointer; }
.vm-calc-k .c { background: #fdeceb; }
.vm-calc-k .eq { background: var(--green); color: #fff; grid-column: span 3; }

/* ---------- accés ---------- */
.vm-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 30% 20%, #fff6e3, #f6e3c3); }
.vm-login-card { background: #fff; border-radius: 26px; padding: 30px 34px; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.vm-login-logo { font-size: 4em; }
.vm-login-card h1 { margin: 0; font-size: 2.4em; }
.vm-login-sub { color: var(--muted); margin-top: 4px; }
.vm-login-card label { display: block; text-align: left; margin: 12px 0; font-weight: 700; color: var(--brown); }
.vm-login-card input { display: block; width: 100%; font: inherit; padding: 10px 12px; border: 3px solid var(--line); border-radius: 12px; margin-top: 4px; }
.vm-login-card .vm-btn { width: 100%; margin-top: 8px; }
.vm-login-err { background: #fdeceb; color: var(--red); border-radius: 10px; padding: 8px; }
.vm-login-help { color: var(--muted); font-size: 0.9em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* l'escuma del cava, quieta a mig camí */
  .vm-espuma { opacity: 0.85; transform: translate(calc(var(--dx) * 0.6), calc(var(--dy) * 0.6)); }
}
