:root { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: #03050a; color: #f2f3f8; }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; }

/* ---------- palco: o Show em tela cheia ---------- */
.palco { position: fixed; inset: 0; background: #03050a; }
#show {
  position: absolute; left: 0; right: 0; top: env(safe-area-inset-top);
  width: 100%; height: calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: block; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  image-rendering: pixelated;
}
.palco-btn {
  position: absolute; z-index: 2;
  border: 1px solid rgb(255 255 255 / 0.16); background: rgb(4 5 10 / 0.6); color: rgb(255 255 255 / 0.75);
  border-radius: 999px; padding: 6px 12px; font: 600 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.palco-btn.ajuda { left: 12px; top: calc(env(safe-area-inset-top) + 8px); width: 30px; padding: 6px 0; }

/* ---------- play: em cima da Sona enquanto a música está parada ---------- */
.tocar {
  position: absolute; z-index: 1; transform: translate(-50%, -50%); padding: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  border: 0; background: rgb(4 5 10 / 0.6); color: #fff;
  -webkit-tap-highlight-color: transparent; transition: scale 0.12s ease;
}
.tocar svg { width: 46%; height: 46%; fill: currentColor; }
.tocar:hover { background: rgb(4 5 10 / 0.7); }
.tocar:active { scale: 0.94; }

/* ---------- tutorial: mesmo retângulo do canvas, para usar as posições do layout ---------- */
.tut {
  position: absolute; left: 0; right: 0; top: env(safe-area-inset-top); bottom: env(safe-area-inset-bottom);
  z-index: 2; pointer-events: none;
}
.tut-alvo {
  position: absolute; transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid rgb(255 255 255 / 0.9);
  animation: alvo 1.3s ease-in-out infinite;
}
@keyframes alvo { 50% { scale: 1.12; opacity: 0.5; } }
.tut.no-ritmo .tut-alvo { animation: none; } /* no ritmo da música: o tutorial.js anima */
.tut-cartao {
  position: absolute; left: 50%; transform: translate(-50%, -100%);
  width: min(340px, calc(100% - 32px)); padding: 12px 16px 6px; border-radius: 14px;
  background: rgb(4 5 10 / 0.88); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 13px; line-height: 1.45; color: rgb(255 255 255 / 0.8); display: grid; gap: 6px;
}
.tut-cartao.fim { transform: translate(-50%, -50%); }
.tut-texto { display: grid; gap: 8px; }
.tut-cartao p, .tut-cartao ul { margin: 0; }
.tut-cartao ul { padding-left: 16px; display: grid; gap: 4px; }
.tut-cartao b { color: #fff; }
.tut-passo, .tut-acoes button {
  font: 600 10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgb(255 255 255 / 0.5);
}
.tut-cartao.ok .tut-passo { color: #4ee244; }
.tut-tecla { font-size: 12px; color: rgb(255 255 255 / 0.6); }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 4px; border-radius: 4px; text-align: center;
  border: 1px solid rgb(255 255 255 / 0.25); background: rgb(255 255 255 / 0.06);
  font: 600 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #fff;
}
.tut-acoes { display: flex; justify-content: space-between; pointer-events: auto; }
.tut-acoes button { background: none; border: 0; padding: 6px 2px; cursor: pointer; }
.tut-acoes button:last-child { margin-left: auto; color: rgb(255 255 255 / 0.85); }

/* ---------- carregando: até o começo da música chegar (no máximo 8 s) ---------- */
.carregando {
  position: absolute; inset: 0; z-index: 3; background: #03050a;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  font: 600 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em; text-transform: uppercase; color: rgb(255 255 255 / 0.55);
  transition: opacity 0.4s ease;
}
.carregando.saiu { opacity: 0; pointer-events: none; }
/* só aparece se demorar: carregamento rápido não pisca */
.carregando > * { animation: aparece 0.3s 0.25s both; }
.carregando p { margin: 0; }
.eq { display: flex; align-items: center; gap: 5px; height: 34px; }
.eq i { width: 6px; height: 100%; border-radius: 2px; background: #1bf9dc; animation: eq 0.94s ease-in-out infinite; }
.eq i:nth-child(2) { background: #19cfd2; animation-delay: -0.4s; }
.eq i:nth-child(3) { background: #96f4f3; animation-delay: -0.75s; }
.eq i:nth-child(4) { background: #19cfd2; animation-delay: -0.2s; }
.eq i:nth-child(5) { background: #1773c2; animation-delay: -0.55s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
@keyframes aparece { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .eq i { animation: none; transform: scaleY(0.6); }
  .tut-alvo { animation: none; }
}
