/* TreinaDev · tema claro e escuro (padrão) em [data-theme="dark"].
   Paleta: verde-menta = progresso, amarelo-mel = dica e moedas, lilás = explicação e XP, coral = erro.
   Cada unidade da trilha tem sua cor, todas com a mesma luminosidade para ficarem em harmonia. */
:root {
  --bg: #F6F8F4; --card: #FFFFFF; --fg: #22302A; --muted: #66746C; --line: #E1E7E2; --line-strong: #CCD6CF;
  --accent: #1FA37A; --accent-dark: #168060; --accent-ink: #FFFFFF; --accent-soft: #E3F5EE; --accent-text: #0F6E56;
  --hint-bg: #FDF3DF; --hint-fg: #7A4E0B; --hint-line: #F0D08F;
  --exp-bg: #F0EFFD; --exp-fg: #443D96; --exp-line: #CBC7F3;
  --ok-bg: #E3F5EE; --ok-fg: #0F6E56; --ok-line: #9ADBC3;
  --err-bg: #FDEDEB; --err-fg: #B03A2E; --err-line: #F2B7AF;
  --lock: #B9C3BD; --lock-bg: #E8ECE9; --lock-dark: #D2D9D4;
  --coin: #E8A93A; --flame: #F07A3A; --xp: #7C73DB;
  /* Editor de código claro */
  --ed-bg: #FAFAF7; --ed-line: #E6E9E3; --ed-fg: #2B3530; --ed-ln: #A8B1AB; --ed-sel: #FFF3D6;
  --k: #6B4FC9; --s: #0E8A63; --n: #C4521E; --f: #1F6FB8; --c: #8F9A93; --o: #B5730E;
  --code-bg: rgba(255, 255, 255, .7); --code-line: rgba(34, 48, 42, .1); --hover: rgba(34, 48, 42, .04);
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
/* Tema escuro: só troca as cores, a estrutura é a mesma */
:root[data-theme="dark"] {
  --bg: #111815; --card: #1A2420; --fg: #E4ECE7; --muted: #9AA9A1; --line: #2B3833; --line-strong: #3B4A44;
  --accent: #26B486; --accent-dark: #1B8A66; --accent-ink: #FFFFFF; --accent-soft: #173A2F; --accent-text: #74DDB6;
  --hint-bg: #352A12; --hint-fg: #F4CF85; --hint-line: #67511F;
  --exp-bg: #22203D; --exp-fg: #C8C2F8; --exp-line: #464089;
  --ok-bg: #143329; --ok-fg: #82E2BE; --ok-line: #2C6B55;
  --err-bg: #3A1D1A; --err-fg: #FFA99E; --err-line: #7A352D;
  --lock: #5F6E67; --lock-bg: #25302C; --lock-dark: #1A2320;
  --ed-bg: #151E1B; --ed-line: #2B3833; --ed-fg: #DCE5E0; --ed-ln: #5F6E67; --ed-sel: #3A3219;
  --k: #B7A8FF; --s: #63D4A9; --n: #FF9F6E; --f: #82BCF2; --c: #73817A; --o: #F0B95E;
  --code-bg: rgba(255, 255, 255, .06); --code-line: rgba(255, 255, 255, .1); --hover: rgba(255, 255, 255, .04);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.app {
  max-width: 460px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: calc(env(safe-area-inset-top, 0px) + 8px) calc(env(safe-area-inset-bottom, 0px) + 32px);
  display: flex; flex-direction: column; gap: 16px; min-height: 100vh;
}
.loading { text-align: center; color: var(--muted); padding-top: 40vh; }
.screen { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Tipografia ---------- */
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
h1 { font-family: var(--display); font-weight: 600; font-size: 24px; line-height: 1.2; margin: 2px 0 4px; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 600; font-size: 19px; line-height: 1.25; margin: 0; text-wrap: balance; }
.lead { color: var(--muted); margin: 0; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, .ic { font-family: var(--mono); font-size: .88em; background: var(--code-bg); color: var(--k); border: 1px solid var(--code-line); padding: 0 5px; border-radius: 5px; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  padding-block: 8px; display: flex; align-items: center; gap: 12px;
}
.iconbtn {
  width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.iconbtn svg { width: 20px; height: 20px; }
.bar { flex: 1; height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .45s ease; }
.bar.xp span { background: var(--xp); }
.card > .bar { flex: none; width: 100%; }
.stat { display: flex; align-items: center; gap: 4px; font-family: var(--display); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat svg { width: 20px; height: 20px; }
.stat.off { color: var(--muted); }
.stat.off svg { filter: grayscale(1); opacity: .5; }
.pop { animation: pop .5s ease; }
@keyframes pop { 40% { transform: scale(1.35); } }
.spacer { flex: 1; }

/* ---------- Cartões e botões ---------- */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cta {
  width: 100%; min-height: 54px; border: none; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
  font-family: var(--display); font-weight: 600; font-size: 18px; cursor: pointer;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, #000);
}
.cta:active { transform: translateY(2px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.cta:disabled { opacity: .55; cursor: progress; }
.btn {
  min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card);
  font-weight: 700; font-size: 14px; cursor: pointer; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger { color: var(--err-fg); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- Login ---------- */
.auth { padding-top: 6vh; }
.logo { width: 72px; height: 72px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.tabs button { border: none; border-radius: 9px; min-height: 40px; background: transparent; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--fg); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 700; }
.field input, .field select, .typing-input {
  min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--fg);
  padding: 0 14px; font: inherit;
}
.form-error { color: var(--err-fg); font-size: 14px; margin: 0; }

/* ---------- Home: cursos ---------- */
.auth-top { display: flex; align-items: flex-start; justify-content: space-between; }
.courses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.course {
  position: relative; text-align: left; cursor: pointer; padding: 14px; border-radius: 18px;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 5px;
  display: flex; flex-direction: column; gap: 6px; min-width: 0; transition: transform .1s;
}
.course:hover { border-color: var(--u); }
.course:active { transform: translateY(2px); }
.course-ic {
  width: 56px; height: 56px; border-radius: 16px; background: var(--u); box-shadow: 0 4px 0 var(--u-dark);
  display: grid; place-items: center; margin-bottom: 6px; flex: none;
}
.course-ic svg { width: 38px; height: 38px; }
.course-name { font-family: var(--display); font-weight: 600; font-size: 18px; line-height: 1.2; }
.course-desc { font-size: 13px; color: var(--muted); line-height: 1.4; flex: 1; }
.course-prog { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.course-prog .bar { flex: none; height: 8px; }
.course-prog .bar span { background: var(--u); }
.course-tag {
  position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px; background: var(--lock-bg); color: var(--muted);
}
.course-tag.on { background: var(--accent-soft); color: var(--accent-text); }
@media (max-width: 340px) { .courses { grid-template-columns: 1fr; } }
.trail-head { display: flex; align-items: center; gap: 12px; }
.trail-head h1 { margin: 0; }
.course-ic.small-ic { width: 48px; height: 48px; border-radius: 14px; margin: 0; box-shadow: none; }
.course-ic.small-ic svg { width: 32px; height: 32px; }

/* ---------- Trilha ---------- */
.hello { display: flex; gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 19px; flex: none; }
.streak-banner { border-radius: 14px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.streak-banner svg { width: 26px; height: 26px; flex: none; }
.streak-banner.risk { background: var(--hint-bg); color: var(--hint-fg); border: 1.5px solid var(--hint-line); }
.streak-banner.safe { background: var(--ok-bg); color: var(--ok-fg); border: 1.5px solid var(--ok-line); }
.avatar svg { width: 100%; height: 100%; }
.avatar.char-av { background: var(--accent-soft); overflow: hidden; padding: 0; }

/* Caminho estilo Duolingo: tudo posicionado em px pelo app.js */
.path { position: relative; width: 100%; }
.path-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.unit {
  position: absolute; left: 0; right: 0; border-radius: 18px; padding: 14px 16px; color: #fff;
  background: var(--u); box-shadow: 0 4px 0 var(--u-dark); display: flex; align-items: center; gap: 12px;
}
.unit .kicker { color: rgba(255, 255, 255, .85); }
.unit h2 { color: #fff; }
.unit p { margin: 2px 0 0; font-size: 13px; color: rgba(255, 255, 255, .9); }
.unit > div { min-width: 0; flex: 1; }
.unit.locked { background: var(--lock-bg); box-shadow: 0 4px 0 var(--lock-dark); color: var(--muted); }
.unit.locked .kicker, .unit.locked h2, .unit.locked p { color: var(--muted); }
.medals { display: flex; gap: 1px; flex: none; }
.medals svg { width: 22px; height: 22px; }
.lvl-label {
  position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap;
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.lvl-label { background: var(--bg); padding: 2px 6px; z-index: 1; }
.lvl-label::before, .lvl-label::after { content: ""; width: 28px; height: 2px; background: var(--line-strong); border-radius: 2px; }
.lvl-label b { color: var(--u-text); }

.node {
  position: absolute; width: 70px; height: 64px; border-radius: 50%; border: none; cursor: pointer; padding: 0;
  transform: translate(-50%, -50%); display: grid; place-items: center;
  background: var(--u); box-shadow: 0 7px 0 var(--u-dark); color: #fff; transition: transform .1s;
}
.node:active { transform: translate(-50%, calc(-50% + 4px)); box-shadow: 0 3px 0 var(--u-dark); }
.node svg { width: 30px; height: 30px; }
.node.locked, .node.soon { background: var(--lock-bg); box-shadow: 0 7px 0 var(--lock-dark); color: var(--lock); cursor: default; }
.node.locked:active, .node.soon:active { transform: translate(-50%, -50%); box-shadow: 0 7px 0 var(--lock-dark); }
.node.done { background: var(--u); }
.node.trophy.done { background: var(--coin); box-shadow: 0 7px 0 #B97F1D; }
.node.current { width: 80px; height: 74px; }
.node.current::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 5px solid var(--u-ring); pointer-events: none;
}
.node.current.soon::after { border-color: var(--lock-bg); }
.bubble {
  position: absolute; transform: translate(-50%, -100%); background: var(--card); color: var(--u-text);
  border: 2px solid var(--line); border-radius: 12px; padding: 5px 12px; font-family: var(--display); font-weight: 600; font-size: 14px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; pointer-events: none; animation: hover 1.6s ease-in-out infinite;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; background: var(--card);
  border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg);
}
@keyframes hover { 50% { transform: translate(-50%, calc(-100% - 5px)); } }

/* Personagem */
.char { position: absolute; width: 58px; height: 84px; transform: translate(-50%, -100%); pointer-events: none; z-index: 2; transition: left .75s ease-in-out, top .75s ease-in-out; }
.char svg { width: 100%; height: 100%; overflow: visible; transform-origin: 50% 100%; animation: breathe 2.4s ease-in-out infinite; }
.char.face-left svg { scale: -1 1; }
.char.walking svg { animation: bob .3s ease-in-out infinite alternate; }
.char .leg, .char .arm { transform-box: fill-box; transform-origin: 50% 0; }
.char.walking .leg-l, .char.walking .arm-r { animation: swing .3s ease-in-out infinite alternate; }
.char.walking .leg-r, .char.walking .arm-l { animation: swing .3s ease-in-out infinite alternate-reverse; }
.char.cheer svg { animation: jump .5s ease 2; }
@keyframes breathe { 50% { transform: scaleY(.97) translateY(1px); } }
@keyframes bob { to { transform: translateY(-3px); } }
@keyframes swing { from { rotate: -22deg; } to { rotate: 22deg; } }
@keyframes jump { 40% { transform: translateY(-16px); } }

/* Escolha do personagem (cadastro e ajustes) */
.gender { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gender button {
  border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); border-radius: 14px; padding: 10px 8px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-weight: 700;
}
.gender button svg { width: 52px; height: 74px; }
.gender button small { font-weight: 400; font-size: 12px; color: var(--muted); }
.gender button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

/* Fases no resultado */
.phase-dots { display: flex; gap: 8px; justify-content: center; }
.phase-dots span { width: 18px; height: 18px; border-radius: 50%; background: var(--lock-bg); box-shadow: inset 0 -3px 0 var(--lock-dark); }
.phase-dots span.on { background: var(--accent); box-shadow: inset 0 -3px 0 var(--accent-dark); }
.phase-dots span.new { animation: pop .6s ease .3s both; }

.nudge { background: var(--exp-bg); border-color: var(--exp-line); color: var(--exp-fg); }
.nudge .btn { background: var(--card); color: var(--fg); }

/* ---------- Lição ---------- */
.editor { background: var(--ed-bg); color: var(--ed-fg); border: 1.5px solid var(--ed-line); border-radius: 14px; padding: 12px 0; font-family: var(--mono); font-size: 14px; line-height: 1.85; overflow-x: auto; box-shadow: 0 2px 0 var(--ed-line); }
.editor .l { padding: 0 16px; white-space: pre; border-left: 3px solid transparent; min-width: max-content; }
.editor .ln { color: var(--ed-ln); display: inline-block; width: 22px; user-select: none; }
.k { color: var(--k); } .s { color: var(--s); } .n { color: var(--n); } .f { color: var(--f); } .c { color: var(--c); font-style: italic; } .o { color: var(--o); }
.slot { display: inline-block; min-width: 40px; text-align: center; border-bottom: 2px dashed var(--o); color: var(--o); }
.slot.ok { border-bottom-style: solid; color: var(--s); border-color: var(--s); background: var(--ok-bg); border-radius: 4px 4px 0 0; }
.tap .l { cursor: pointer; }
.tap .l:hover { background: var(--hover); }
.l.sel { background: var(--ed-sel); border-left-color: var(--coin); }
.l.right { background: var(--ok-bg); border-left-color: var(--accent); }
.l.wrong { background: var(--err-bg); border-left-color: #E2685C; }

.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opt { font-family: var(--mono); font-size: 15px; min-height: 52px; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); cursor: pointer; padding: 6px 8px; overflow-wrap: anywhere; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.opt.right { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-fg); }
.opt.wrong { border-color: var(--err-line); background: var(--err-bg); color: var(--err-fg); }
.opt:disabled { cursor: default; }

.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 10px; min-height: 64px; display: flex; flex-direction: column; gap: 8px; }
.drop .ph { color: var(--muted); font-size: 14px; text-align: center; padding: 10px; }
.bank { display: flex; flex-direction: column; gap: 8px; }
.blk { font-family: var(--mono); font-size: 14px; text-align: left; white-space: pre; background: var(--ed-bg); color: var(--ed-fg); border: 1.5px solid var(--ed-line); border-bottom-width: 4px; border-radius: 12px; padding: 10px 12px; cursor: pointer; overflow-x: auto; }
.blk:active { transform: scale(.98); }
.blk:disabled { cursor: default; }
.coach { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--accent-text); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.coach .hand { font-size: 22px; line-height: 1; animation: tapme 1.2s ease-in-out infinite; }
@keyframes tapme { 50% { transform: translateY(4px) scale(.9); } }
.typing-input { font-family: var(--mono); font-size: 17px; width: 100%; }
.typing-input.right { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-fg); }
.typing-input.wrong { border-color: var(--err-line); background: var(--err-bg); color: var(--err-fg); }

.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool { min-height: 46px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; }
.tool svg { width: 18px; height: 18px; flex: none; }
.t-hint { background: var(--hint-bg); color: var(--hint-fg); border: 1.5px solid var(--hint-line); }
.t-exp { background: var(--exp-bg); color: var(--exp-fg); border: 1.5px solid var(--exp-line); }
.tool:disabled { opacity: .45; cursor: not-allowed; }
.panel { border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.65; }
.panel h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 600; font-size: 17px; }
.panel p { margin: 0 0 6px; } .panel p:last-child { margin: 0; }
.p-hint { background: var(--hint-bg); color: var(--hint-fg); border: 1.5px solid var(--hint-line); }
.p-exp { background: var(--exp-bg); color: var(--exp-fg); border: 1.5px solid var(--exp-line); }
.p-ok { background: var(--ok-bg); color: var(--ok-fg); border: 1.5px solid var(--ok-line); }
.p-err { background: var(--err-bg); color: var(--err-fg); border: 1.5px solid var(--err-line); }
.gain { display: inline-flex; gap: 10px; font-family: var(--display); font-weight: 600; }

/* ---------- Resultado ---------- */
.end { text-align: center; align-items: center; padding-top: 16px; }
.end .big { width: 96px; height: 96px; }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.chip { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 6px; }
.chip b { display: block; font-family: var(--display); font-size: 24px; font-variant-numeric: tabular-nums; }
.chip span { font-size: 12px; color: var(--muted); }
.medal-modal { position: fixed; inset: 0; z-index: 30; background: rgba(10, 14, 12, .55); display: grid; place-items: center; padding: 24px; }
.medal-modal .card { max-width: 360px; text-align: center; align-items: center; }
.medal-modal svg.medal { width: 88px; height: 88px; }

/* ---------- Ajustes ---------- */
.setting { display: flex; align-items: center; gap: 12px; }
.setting > div { flex: 1; min-width: 0; }
.setting > .avatar { flex: none; }
.setting b { display: block; }
.switch { width: 52px; height: 30px; border-radius: 99px; border: none; background: var(--line); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.ios-steps { margin: 0; padding-left: 20px; font-size: 14px; }
.ios-steps li { margin-bottom: 4px; }

/* ---------- Efeitos ---------- */
.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 39; background: #E24B4A; opacity: 0; }
.flash.on { animation: flash .55s ease; }
@keyframes flash { 30% { opacity: .2; } }
.burst { position: fixed; left: 50%; top: 42%; z-index: 41; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 12px; opacity: 0; transform: translate(-50%, -50%); }
.badge { width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 8px 0 rgba(0, 0, 0, .18); }
.badge svg { width: 66px; height: 66px; }
.word { font-family: var(--display); font-weight: 600; font-size: 30px; padding: 4px 20px; border-radius: 99px; background: var(--card); border: 2px solid var(--line); white-space: nowrap; }
.burst.good .badge { background: var(--accent); }
.burst.good .word { color: var(--accent-text); }
.burst.bad .badge { background: #E24B4A; }
.burst.bad .word { color: var(--err-fg); }
.burst.good.on { animation: good 1.5s cubic-bezier(.2, 1.5, .4, 1) forwards; }
.burst.bad.on { animation: bad 1.5s ease forwards; }
@keyframes good {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-25deg); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(6deg); }
  36% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  50% { transform: translate(-50%, -56%) scale(1); }
  62% { transform: translate(-50%, -50%) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(.9); }
}
@keyframes bad {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  26% { transform: translate(-56%, -50%) rotate(-8deg); }
  34% { transform: translate(-44%, -50%) rotate(8deg); }
  42% { transform: translate(-54%, -50%) rotate(-5deg); }
  50% { transform: translate(-50%, -50%) rotate(0); }
  82% { opacity: 1; transform: translate(-50%, -48%); }
  100% { opacity: 0; transform: translate(-50%, -40%) scale(.85); }
}
.shake { animation: shake .45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); z-index: 50;
  background: var(--fg); color: var(--bg); border-radius: 12px; padding: 12px 16px; font-size: 14px; max-width: calc(100% - 32px);
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
