/* Layout: bancada de treino em três zonas. À esquerda o trilho de modos e níveis, no centro o enunciado e o ábaco
   (a peça principal), à direita a gaveta de progresso, aparência e competição. No celular tudo empilha.
   Direção: vitrine de um objeto artesanal. Neutros de tinta fria, um único destaque em latão (a cor das contas),
   superfícies com moldura dupla e sombras tingidas. Escala de espaço 4 / 8 / 12 / 16 / 24 / 32. */
:root {
  --bg: #eceef2;
  --glow: #fbfbfd;
  --surface: #f8f9fb;
  --shell: #e2e5eb;
  --ink: #141925;
  --muted: #535b6e;
  --line: #cdd2dc;
  --accent: #0f766e;
  --accent-deep: #115e59;
  --accent-ink: #ffffff;
  --accent-soft: #cdeee9;
  --good: #17794e;
  --bad: #b93232;
  --hi: rgba(255, 255, 255, .75);
  --lift: rgba(20, 25, 37, .2);

  /* O ábaco é um objeto físico: as cores dele vêm do painel Ábaco e valem nos dois temas. */
  --bead: #b06f30;
  --bead-on: #f0a63a;
  --wood: #5b3519;
  --felt: #232a47;
  --wire-a: #eef0f5;
  --wire-b: #7d8499;
  --beam-a: #fbf5e6;
  --beam-b: #cdbf9f;
  --beam-dot: #2b2118;
  --mark: rgba(255, 196, 92, .3);
  --shade: rgba(0, 0, 0, .45);
  --sheen: rgba(255, 255, 255, .2);

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --r: 12px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --bicone: polygon(0 50%, 21% 2%, 79% 2%, 100% 50%, 79% 98%, 21% 98%);
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.6l3.3 3.2L13 4.6' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f16; --glow: #1a2030; --surface: #141924; --shell: #0f131c; --ink: #eceef4; --muted: #9aa3b8; --line: #262d3c;
    --accent: #2dd4bf; --accent-deep: #0d9488; --accent-ink: #04201c; --accent-soft: #10302c;
    --good: #5fd39f; --bad: #ff8a8a; --hi: rgba(255, 255, 255, .06); --lift: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f16; --glow: #1a2030; --surface: #141924; --shell: #0f131c; --ink: #eceef4; --muted: #9aa3b8; --line: #262d3c;
  --accent: #2dd4bf; --accent-deep: #0d9488; --accent-ink: #04201c; --accent-soft: #10302c;
  --good: #5fd39f; --bad: #ff8a8a; --hi: rgba(255, 255, 255, .06); --lift: rgba(0, 0, 0, .6);
  color-scheme: dark;
}
/* Cores próprias da página: o painel define fundo, texto e destaque; o resto deriva deles. */
:root.custom-page {
  --surface: color-mix(in srgb, var(--bg) 92%, var(--ink));
  --shell: color-mix(in srgb, var(--bg) 96%, var(--ink));
  --line: color-mix(in srgb, var(--bg) 78%, var(--ink));
  --muted: color-mix(in srgb, var(--ink) 72%, var(--bg));
  --glow: color-mix(in srgb, var(--bg) 82%, var(--accent));
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--bg));
  --accent-deep: color-mix(in srgb, var(--accent) 65%, black);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(1200px 520px at 50% -160px, var(--glow), transparent 70%) no-repeat, var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  padding-block: 16px 32px;
  padding-inline: 16px;
}
/* Grão fino por cima de tudo: tira o aspecto de vetor chapado sem pesar na rolagem */
body::after { content: ""; position: fixed; inset: 0; z-index: 40; pointer-events: none; background: var(--grain); opacity: .05; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h2 { margin: 0; font: 600 1.05rem/1.3 var(--display); letter-spacing: -.01em; text-wrap: balance; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.app { position: relative; z-index: 1; max-width: 1640px; margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.main, .side, .rail { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rail { gap: 8px; }
.rail h2 { font: 400 .85rem var(--body); letter-spacing: 0; color: var(--muted); }
.rail h2:has(+ [hidden]) { display: none; }
.main { width: 100%; max-width: 1180px; justify-self: center; animation: settle .7s var(--ease); }
@keyframes settle { from { transform: translateY(10px); opacity: .4; } }

/* Só aparece o que está em uso: o painel lateral é uma gaveta fechada por padrão, e durante o exercício
   o trilho de modos, a ajuda e o rodapé saem de cena. Os números da sessão só aparecem com ela em andamento. */
.side { display: none; padding: 6px; }
body.drawer-open .side { display: flex; animation: settle .45s var(--ease); }
.side-head { display: flex; justify-content: flex-end; }
body.playing .rail, body.playing .help, body.playing .credit { display: none; }
body:not(.playing) .stats, body:not(.playing) #btn-stop { display: none; }
@media (max-width: 1039px) {
  /* Em tela estreita a gaveta sobe de baixo e deixa o ábaco à vista por cima dela */
  .side {
    position: fixed; inset: auto 0 0 0; z-index: 8; max-height: 62vh; overflow-y: auto;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--bg); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0;
    box-shadow: 0 -24px 40px -24px var(--shade);
  }
  body.drawer-open .app { padding-bottom: 62vh; }
}
@media (min-width: 1040px) {
  .app { align-items: start; column-gap: 24px; }
  body.drawer-open .app { grid-template-columns: minmax(0, 1fr) 362px; }
  .top, .rail, .credit { grid-column: 1 / -1; }
  .side { position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 24px); overflow-y: auto; scrollbar-width: thin; }
}
@media (min-width: 1320px) {
  .app { grid-template-columns: 216px minmax(0, 1fr); }
  body.drawer-open .app { grid-template-columns: 216px minmax(0, 1fr) 362px; }
  body.playing .app { grid-template-columns: minmax(0, 1fr); }
  body.playing.drawer-open .app { grid-template-columns: minmax(0, 1fr) 362px; }
  .rail { grid-column: auto; position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); }
  .rail h2 { margin-top: 8px; }
  .rail .picker { flex-direction: column; gap: 4px; }
  .rail .picker button { width: 100%; justify-content: flex-start; border-radius: var(--r); }
}

/* Cabeçalho: uma barra solta do topo com a marca, o progresso e os botões da gaveta */
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 8px 10px 8px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface);
  box-shadow: inset 0 1px 0 var(--hi), 0 20px 36px -28px var(--lift);
}
.brand { display: flex; align-items: center; gap: 12px; }
/* Música ambiente: um botão redondo com a nota; aceso quando está tocando */
.music-btn {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; margin-left: auto; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 50%; background: var(--shell); color: var(--muted);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.music-btn .ico { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.music-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
/* Voltar: um círculo discreto com a seta, igual no ábaco e nos jogos */
.back {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
  transition: transform .2s var(--ease), border-color .2s;
}
.back:active { transform: scale(.94); }
.back .ico { width: 1.2rem; height: 1.2rem; }
.mark { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 6px 8px var(--lift)); }
.brand h1 { margin: 0; font: 800 1.6rem/1 var(--display); letter-spacing: -.035em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.profile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.rank { display: flex; align-items: center; gap: 8px; }
.rank .ico { color: var(--accent); width: 1.3rem; height: 1.3rem; }
.rank strong { font: 700 1.45rem/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.meter { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
a.btn { text-decoration: none; }

/* Controles: mesma família de superfície, sombra tingida e afundar discreto ao toque */
.tgl, .picker button, .btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-family: var(--display); font-weight: 600; letter-spacing: -.005em;
  box-shadow: inset 0 1px 0 var(--hi), 0 1px 2px var(--lift), 0 10px 16px -14px var(--lift);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s, background .2s, color .2s;
}
.tgl:active, .picker button:active, .btn:active { transform: scale(.98) translateY(1px); box-shadow: inset 0 1px 0 var(--hi); }
.tgl { min-height: 36px; padding: 6px 14px 6px 10px; border-radius: 999px; font-size: .9rem; }
/* O indicador é uma conta: apagada quando desligado, acesa quando ligado */
.tgl::before { content: ""; width: 16px; height: 10px; clip-path: var(--bicone); background: var(--line); transition: background .2s; }
.tgl[aria-pressed="true"]::before { background: var(--accent); }
.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.picker button { min-height: 36px; padding: 6px 12px; border-radius: var(--r); font-size: .9rem; }
.picker .ico { width: 1.3em; height: 1.3em; color: var(--muted); transition: color .2s; }
/* Opção escolhida: superfície tingida e ícone em latão; o preenchimento cheio fica só para a ação principal */
.picker button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.picker button[aria-pressed="true"] .ico { color: var(--accent); }
.levels button { min-height: 32px; padding: 4px 12px; font-weight: 500; }
.btn { min-height: 38px; padding: 6px 14px; border-radius: 999px; font-size: .9rem; }
.btn.primary {
  padding-left: 8px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px var(--lift), 0 14px 20px -12px var(--accent-deep);
}
/* Botão dentro do botão: o ícone da ação principal fica num disco próprio */
.btn.primary .ico { box-sizing: content-box; padding: 5px; border-radius: 50%; background: color-mix(in srgb, var(--accent-ink) 18%, transparent); transition: transform .3s var(--ease); }
.btn:disabled { opacity: .5; cursor: default; }
@media (hover: hover) {
  .picker button:hover, .btn:hover, .tgl:hover { border-color: var(--accent); }
  .btn.primary:hover .ico { transform: translateX(2px) scale(1.06); }
  .foot:hover { background: var(--accent-soft); }
}

.label { color: var(--muted); font-size: .88rem; }
.note { color: var(--muted); font-size: .9rem; margin: 0; max-width: 70ch; text-wrap: pretty; }

/* Moldura dupla: casca externa e miolo, como uma peça assentada numa bandeja */
.task, .panel {
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface);
  box-shadow: inset 0 1px 0 var(--hi), 0 0 0 5px var(--shell), 0 0 0 6px var(--line), 0 34px 48px -34px var(--lift);
  margin: 6px;
}

/* Exercício */
.task { padding: 12px 20px 12px; display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 12px; }
.task-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; }
.task-head h2 { font-size: 1.1rem; font-weight: 500; color: var(--muted); }
.chips { display: flex; gap: 8px; align-items: center; }
.timer, .combo { font: 600 1rem var(--display); font-variant-numeric: tabular-nums; }
.timer:not(:empty), .combo:not(:empty) { padding: 2px 12px; border-radius: 999px; background: var(--shell); border: 1px solid var(--line); }
.combo:not(:empty) { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.prompt { min-height: 2.8rem; display: flex; align-items: center; }
.prompt .desc { margin: 0; font-size: 1.02rem; max-width: 60ch; text-wrap: pretty; }
.big { font: 800 clamp(2.2rem, 7vw, 4.2rem)/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.terms { display: flex; flex-wrap: wrap; gap: 6px; font: 700 clamp(1.3rem, 4.2vw, 2.4rem)/1.15 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.term { padding: 4px 12px; border-radius: 14px; border: 1px solid transparent; transition: background .3s var(--ease), color .3s var(--ease); }
.term.cur { background: var(--accent-soft); border-color: var(--accent); }
.term.done { color: var(--good); }
.term.done::after {
  content: ""; display: inline-block; width: .5em; height: .5em; margin-left: .25em;
  background: currentColor; -webkit-mask: var(--check) center / contain no-repeat; mask: var(--check) center / contain no-repeat;
}
.hint { margin: 0; padding: 12px 16px; background: var(--shell); border: 1px solid var(--line); border-radius: var(--r); }
.answer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.answer label { color: var(--muted); }
.answer input, .stack input[type="text"] {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg);
  font: 700 1.2rem var(--display); font-variant-numeric: tabular-nums; min-width: 0;
  box-shadow: inset 0 2px 4px -2px var(--lift);
}
.answer input { width: 11rem; max-width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.feedback { margin: 0; min-height: 1.4em; font-weight: 700; overflow-wrap: anywhere; }
.feedback.good { color: var(--good); animation: rise .4s var(--ease); }
.feedback.bad { color: var(--bad); animation: rise .4s var(--ease); }
@keyframes rise { from { transform: translateY(6px); opacity: .3; } }

/* Régua sob o ábaco: o valor montado à esquerda, os números da sessão à direita */
.ledger { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 32px; padding-inline: 6px; }
.readout { display: flex; flex-direction: column; min-width: 0; }
.readout output { font: 800 clamp(1.5rem, 5vw, 2.3rem)/1.05 var(--display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.stats div { display: flex; flex-direction: column; }
.stats dt { color: var(--muted); font-size: .88rem; }
.stats dd { margin: 0; font: 700 1.3rem/1.2 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.help { padding-inline: 6px; }
summary { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font: 600 1rem var(--display); color: var(--muted); list-style: none; }
summary::-webkit-details-marker { display: none; }
.help ul { margin: 12px 0 0; padding-left: 1.2em; max-width: 65ch; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* Botões do cabeçalho que abrem a gaveta, e os painéis dentro dela */
.tabs { flex: 0 1 400px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 999px; background: var(--shell); border: 1px solid var(--line); }
.tabs button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 8px;
  border: 0; border-radius: 999px; background: none; cursor: pointer; font: 600 .92rem var(--display); color: var(--muted);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.tabs button[aria-expanded="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 1px 0 var(--hi), 0 1px 2px var(--lift), 0 8px 12px -10px var(--lift); }
.tabs button[aria-expanded="true"] .ico { color: var(--accent); }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.panel h2:not(:first-child) { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.count { font: 400 .9rem var(--body); color: var(--muted); letter-spacing: 0; }

/* Conquistas: cada uma é uma conta que acende quando conquistada */
.badges { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.badges li { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 12px; padding-block: 8px; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.badges li + li { border-top: 1px solid var(--line); }
.badges li::before { content: ""; grid-row: 1 / 3; align-self: center; width: 26px; height: 16px; clip-path: var(--bicone); background: color-mix(in srgb, var(--line) 55%, var(--muted)); }
.badges strong { font: 600 .95rem var(--display); }
.badges li.got { color: var(--ink); }
.badges li.got::before { background: linear-gradient(180deg, color-mix(in srgb, var(--bead-on) 60%, white), var(--bead-on) 48%, color-mix(in srgb, var(--bead-on) 60%, black)); }

/* Linhas de ajuste: nome à esquerda, controle à direita, todos na mesma coluna e com a mesma largura */
.custom label, .stack > label { display: grid; grid-template-columns: minmax(0, 1fr) 168px; align-items: center; gap: 8px; min-height: 36px; }
.custom label:has(output) { grid-template-columns: minmax(0, 1fr) 112px 48px; }
.custom label.check { grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 12px; }
.custom label.check input { margin: .15em 0 0; }
.panel select, .custom input[type="number"], .stack > label input[type="text"] { width: 100%; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.custom input[type="range"] { width: 100%; min-width: 0; margin: 0; accent-color: var(--accent); }
.custom input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.custom input[type="color"] { width: 48px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.custom output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
/* Cores: amostra à esquerda e nome à direita, em duas colunas iguais */
.colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.custom .colors label { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; }
.colors label input { order: -1; }
.swatches button { min-height: 36px; padding: 4px 12px 4px 6px; font-weight: 500; font-size: .88rem; border-radius: 999px; }
.chip { width: 22px; height: 22px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }

/* Competição */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack input[type="text"] { flex: 1 1 120px; font-size: 1.05rem; }
.stack > .btn { justify-content: center; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row input[type="text"] { flex: 1 1 80px; width: 6rem; text-transform: uppercase; letter-spacing: .2em; }
.room-code { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.room-code strong { font: 800 2.2rem/1 var(--display); letter-spacing: .16em; }
.room-code .btn { margin-left: auto; align-self: center; }
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: pos; }
.players li { counter-increment: pos; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.players li.me { border-color: var(--accent); background: var(--accent-soft); }
.players .who { font: 600 1rem var(--display); overflow-wrap: anywhere; }
.players .who::before { content: counter(pos) "º  "; color: var(--muted); }
.players .score { font-variant-numeric: tabular-nums; color: var(--muted); }
.players .bar { grid-column: 1 / -1; background: var(--line); }

.credit { text-align: center; color: var(--muted); font-size: .9rem; padding-top: 16px; }
.credit strong { font: 600 1em var(--display); color: var(--ink); }

.toasts {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.toast { max-width: 100%; padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg); font: 600 1rem var(--display); box-shadow: 0 18px 32px -14px var(--shade); animation: rise .5s var(--ease); }

/* Celular: tudo mais compacto para o enunciado e o ábaco caberem juntos na tela */
@media (max-width: 640px) {
  body { padding-block: 8px 32px; }
  .app, .main { gap: 12px; }
  .top { padding: 8px 12px; border-radius: 20px; gap: 8px 16px; }
  .mark { width: 30px; height: 30px; }
  .brand h1 { font-size: 1.3rem; }
  .picker button { min-height: 34px; padding: 5px 10px; font-size: .84rem; }
  /* Modos de treino: só o escolhido mostra o nome; os outros ficam só com o ícone */
  #modes button:not([aria-pressed="true"]) span { display: none; }
  #modes button { min-width: 40px; justify-content: center; }
  #modes .ico { width: 1.45em; height: 1.45em; }
  .btn { min-height: 34px; padding: 5px 11px; font-size: .84rem; }
  .brand p { display: none; }
  .profile { flex-basis: 100%; order: 3; gap: 8px 16px; }
  .rank strong { font-size: 1.2rem; }
  .rank .label { display: none; }
  .tabs { flex: 1 1 130px; max-width: 200px; }
  .top { column-gap: 10px; }
  .music-btn { width: 36px; height: 36px; }
  /* No ábaco o cabeçalho do celular já está cheio: ali a tela clara/escura se escolhe no painel Ábaco */
  .top:has(#tabs) .tema-btn { display: none; }
  .top:has(#tabs) .music-btn { margin-left: auto; }
  .tabs button span { display: none; }
  .tabs .ico { width: 1.35em; height: 1.35em; }
  .rail h2 { display: none; }
  .picker { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
  .picker button { flex: none; }
  .swatches { flex-wrap: wrap; overflow: visible; }
  .task { padding: 12px 16px; gap: 8px; border-radius: 18px; }
  .prompt { min-height: 3rem; }
  .prompt .desc { font-size: 1rem; }
  .btn { padding-inline: 12px; }
  .feedback { font-size: .92rem; }
  .stats { gap: 8px 16px; }
  .stats dd { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tgl, .picker button, .btn, .bar i, .term, .tabs button, .btn.primary .ico { transition: none; }
  .feedback.good, .feedback.bad, .toast, .main, body.drawer-open .side { animation: none; }
}

/* "O que treina", no fim da Ajuda */
.help .treina { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); }
.help .treina strong { color: var(--ink); }

/* Botão de tela clara/escura: mesmo formato do de música, encostado nele */
.tema-btn.music-btn { margin-left: auto; }
.tema-btn.music-btn + .music-btn { margin-left: 0; }
