/* ============================================================
   Metrônomo — só celular. Mesma lua vermelha do resto do app;
   o latão (peso, haste, botões girados) é o único metal da tela.
   ============================================================ */
.pagina-metronomo {
  --latao: #d4a24c;
  --latao-claro: #f0cd85;
  --latao-escuro: #8a6425;
  --laca: #120d09;
}

.pagina-metronomo .toolbar { justify-content: space-between; }

.met-relogio {
  font-family: var(--font-mono);
  font-size: .95rem;
  font-weight: 500;
  color: var(--fog);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.met-relogio.ativo { color: var(--paper); }
.met-relogio.acabando { color: var(--ember-bright); }

.met-pagina {
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: .25rem 1rem 1.5rem;
  display: grid;
  gap: 1rem;
}

/* Clarão de tela cheia (opção "piscar a tela") */
.met-clarao {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 60, 80, .55), rgba(196, 23, 42, .25) 60%, transparent 85%);
}

/* ---------- Palco ---------- */
.met-palco {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: .75rem .5rem .25rem;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(196, 23, 42, .28), transparent 65%),
    linear-gradient(180deg, rgba(21, 17, 13, .78), rgba(10, 9, 8, .88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 18px 40px -22px rgba(0, 0, 0, .9);
  overflow: hidden;
}
.met-palco svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(33vh, 16.5rem);
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: ns-resize;
}
.met-marca-corpo {
  font-family: var(--font-display);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .32em;
  fill: var(--ember-dim);
}
.met-escala-numero {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  fill: var(--latao);
  opacity: .75;
}
.met-peso { cursor: grab; }
.met-peso:active { cursor: grabbing; }
.met-peso.arrastando path:first-child { filter: drop-shadow(0 0 6px rgba(240, 205, 133, .8)); }

/* ---------- Painel de BPM ---------- */
.met-painel {
  display: grid;
  gap: .9rem;
  justify-items: center;
}
.met-bpm-linha {
  width: 100%;
  display: grid;
  grid-template-columns: 3.6rem 1fr 3.6rem;
  align-items: center;
  gap: .5rem;
}
.met-bpm-bloco {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  min-width: 0;
}
.met-bpm {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.6rem, 21vw, 5rem);
  letter-spacing: -.045em;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 0 rgba(255, 36, 56, 0);
  transition: color .12s ease;
}
.met-bpm.batida { color: #fff; text-shadow: 0 0 26px rgba(255, 36, 56, .75); }
.met-bpm-rotulo {
  margin-top: .55rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fog);
}
.met-bpm-rotulo b { color: var(--latao-claro); font-weight: 700; }

.met-passo {
  width: 3.6rem;
  height: 3.6rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 18px -10px #000, inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .08s ease, border-color .15s ease, box-shadow .15s ease;
}
.met-passo:active { transform: scale(.92); border-color: var(--ember); box-shadow: var(--shadow-ember); }

/* Slider (BPM e volume) — trilho preenchido em brasa, botão de latão */
.met-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2.2rem;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  touch-action: pan-y;
  --p: 50%;
}
.met-slider:focus { outline: none; box-shadow: none; }
.met-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ember) var(--p), var(--surface-2) var(--p));
  box-shadow: inset 0 0 0 1px var(--line);
}
.met-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ember) var(--p), var(--surface-2) var(--p));
  box-shadow: inset 0 0 0 1px var(--line);
}
.met-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.7rem;
  height: 1.7rem;
  margin-top: calc((6px - 1.7rem) / 2);
  border-radius: 50%;
  border: 2px solid var(--latao-escuro);
  background: radial-gradient(circle at 35% 30%, var(--latao-claro), var(--latao) 55%, var(--latao-escuro));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
}
.met-slider::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--latao-escuro);
  background: radial-gradient(circle at 35% 30%, var(--latao-claro), var(--latao) 55%, var(--latao-escuro));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
}
.met-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255, 36, 56, .5); }

/* ---------- Barras de pulso (também editam o acento) ---------- */
.met-barras {
  --n: 4;
  width: 100%;
  min-height: 3.4rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(.25rem, calc(9vw / var(--n)), .6rem);
  padding: 0 .25rem;
}
.met-barra {
  --nivel: 3;
  flex: 0 1 2.6rem;
  min-width: 0;
  height: calc(.7rem + var(--nivel) * .95rem);
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  position: relative;
  transition: height .18s cubic-bezier(.3, 1.4, .5, 1), background .12s ease, box-shadow .12s ease, border-color .12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.met-barra[data-nivel="3"] { border-color: var(--ember-dim); background: linear-gradient(180deg, #7c1220, var(--ember-dim)); }
.met-barra[data-nivel="2"] { border-color: #4a3d30; background: linear-gradient(180deg, #4a3d30, #2c231b); }
.met-barra[data-nivel="1"] { background: var(--surface-2); }
.met-barra[data-nivel="0"] {
  --nivel: 0;
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
}
.met-barra.ativa[data-nivel="3"] { background: linear-gradient(180deg, #ff5a68, var(--ember-bright)); border-color: #ff8a94; box-shadow: 0 0 22px rgba(255, 36, 56, .7); }
.met-barra.ativa[data-nivel="2"] { background: linear-gradient(180deg, #fff6e6, var(--paper)); border-color: var(--paper); box-shadow: 0 0 18px rgba(241, 235, 224, .45); }
.met-barra.ativa[data-nivel="1"] { background: var(--paper-dim); border-color: var(--paper-dim); box-shadow: 0 0 12px rgba(207, 198, 184, .35); }
.met-barra.ativa[data-nivel="0"] { border-color: var(--fog); }
.met-barra.contagem.ativa { background: linear-gradient(180deg, var(--latao-claro), var(--latao)); border-color: var(--latao-claro); box-shadow: 0 0 18px rgba(240, 205, 133, .55); }
.met-barra:focus-visible { outline: 2px solid var(--ember-bright); outline-offset: 2px; }

.met-dica {
  margin: 0;
  min-height: 1.1rem;
  font-size: .78rem;
  color: var(--fog);
  text-align: center;
}
.met-dica.destaque { color: var(--latao-claro); font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Comandos ---------- */
.met-comandos {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .9rem;
  padding: .25rem 0;
}
.met-lateral {
  height: 4.2rem;
  padding: .5rem .4rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 18px -10px #000, inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .08s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.met-lateral:active { transform: scale(.95); }
.met-lateral-titulo { font-family: var(--font-display); font-size: .82rem; font-weight: 700; letter-spacing: .02em; }
.met-lateral-nota { font-size: .66rem; color: var(--fog); font-weight: 500; }
.met-tap:active { border-color: var(--latao); box-shadow: 0 0 22px -6px rgba(212, 162, 76, .7); }
.met-contagem[aria-pressed="true"] {
  border-color: var(--latao);
  background: linear-gradient(180deg, rgba(212, 162, 76, .22), rgba(138, 100, 37, .12));
  box-shadow: 0 0 22px -8px rgba(212, 162, 76, .6);
}
.met-contagem[aria-pressed="true"] .met-lateral-titulo { color: var(--latao-claro); }

.met-play {
  position: relative;
  width: 5.6rem;
  height: 5.6rem;
  padding: 0;
  border-radius: 50%;
  border: 0;
  color: var(--paper);
  background: radial-gradient(circle at 32% 26%, #ff5262, var(--ember) 52%, #6d0c19);
  box-shadow:
    0 0 0 6px rgba(196, 23, 42, .14),
    0 0 0 1px rgba(255, 90, 104, .35) inset,
    0 16px 38px -10px rgba(255, 36, 56, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, box-shadow .2s ease;
}
.met-play:active { transform: scale(.93); }
.met-play svg { width: 2.2rem; height: 2.2rem; position: relative; z-index: 1; }
.met-play .met-icone-play { margin-left: .2rem; }
.met-play .met-icone-parar { display: none; }
.met-play[aria-pressed="true"] .met-icone-play { display: none; }
.met-play[aria-pressed="true"] .met-icone-parar { display: block; }
.met-play-anel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 90, 104, .8);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Cartões ---------- */
.met-cartao {
  background: linear-gradient(180deg, rgba(33, 26, 20, .82), rgba(21, 17, 13, .9));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  gap: .8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.met-rotulo {
  margin: 0;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fog);
}
.met-nota { margin: 0; font-size: .8rem; color: var(--fog); line-height: 1.4; }
.met-cartao-acao { grid-template-columns: 1fr auto; align-items: center; }
.met-cartao-acao .met-nota { margin-top: .35rem; }

.met-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.met-chip {
  min-height: 2.5rem;
  padding: .45rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--paper-dim);
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease, transform .08s ease;
}
.met-chip:active { transform: scale(.95); }
.met-chip[aria-checked="true"] {
  color: #fff;
  border-color: var(--ember);
  background: linear-gradient(180deg, rgba(196, 23, 42, .32), rgba(92, 13, 23, .4));
  box-shadow: 0 0 18px -6px rgba(255, 36, 56, .7);
}
.met-chip-compasso { font-family: var(--font-mono); font-weight: 700; min-width: 3.4rem; justify-content: center; }
.met-chip small { color: var(--fog); font-weight: 500; font-size: .74rem; }
.met-chip-remover {
  margin-left: .2rem;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  color: var(--fog);
  font-size: .8rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.met-volume { display: grid; gap: .1rem; }

.met-botao-secundario {
  min-height: 2.6rem;
  padding: .5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--latao-escuro);
  background: linear-gradient(180deg, rgba(212, 162, 76, .2), rgba(138, 100, 37, .1));
  color: var(--latao-claro);
  font-weight: 700;
  font-size: .88rem;
  touch-action: manipulation;
}
.met-botao-secundario:active { transform: scale(.95); }

/* ---------- Seções recolhíveis ---------- */
.met-detalhe { padding: 0; gap: 0; }
.met-detalhe > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  -webkit-tap-highlight-color: transparent;
}
.met-detalhe > summary::-webkit-details-marker { display: none; }
.met-detalhe > summary::after {
  content: '';
  width: .55rem;
  height: .55rem;
  border-right: 2px solid var(--fog);
  border-bottom: 2px solid var(--fog);
  transform: rotate(45deg);
  transition: transform .2s ease;
  flex-shrink: 0;
  margin-left: .2rem;
}
.met-detalhe[open] > summary::after { transform: rotate(-135deg); }
.met-resumo { margin-left: auto; font-size: .8rem; color: var(--latao-claro); font-weight: 600; text-align: right; }
.met-detalhe-corpo { padding: 0 1rem 1rem; display: grid; gap: .9rem; }

.met-campos { display: grid; gap: .6rem; }
.met-campos label {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
  color: var(--paper-dim);
}
.met-campos input[type="number"],
.met-form-preset input[type="text"] {
  width: 4.6rem;
  min-height: 2.6rem;
  padding: .4rem .6rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--paper);
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.met-campos input:focus,
.met-form-preset input:focus { border-color: var(--ember); box-shadow: var(--shadow-ember); outline: none; }

.met-form-preset { display: flex; gap: .5rem; }
.met-form-preset input[type="text"] { flex: 1; width: auto; text-align: left; font-family: var(--font-body); font-weight: 500; font-size: .9rem; }

/* Interruptores */
.met-opcoes { gap: .2rem; }
.met-interruptor {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 2.9rem;
  font-size: .92rem;
  color: var(--paper-dim);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.met-interruptor input { position: absolute; opacity: 0; pointer-events: none; }
.met-trilho {
  position: relative;
  flex-shrink: 0;
  width: 2.9rem;
  height: 1.7rem;
  border-radius: 999px;
  background: var(--void);
  border: 1px solid var(--line);
  transition: background .2s ease, border-color .2s ease;
}
.met-trilho::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.7rem - 6px);
  height: calc(1.7rem - 6px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cfc6b8, #7c746b);
  transition: transform .2s cubic-bezier(.3, 1.3, .5, 1), background .2s ease;
}
.met-interruptor input:checked + .met-trilho { background: rgba(196, 23, 42, .35); border-color: var(--ember); }
.met-interruptor input:checked + .met-trilho::after { transform: translateX(1.2rem); background: radial-gradient(circle at 35% 30%, var(--latao-claro), var(--latao) 60%, var(--latao-escuro)); }
.met-interruptor input:focus-visible + .met-trilho { outline: 2px solid var(--ember-bright); outline-offset: 2px; }

/* Diálogo de músicas */
.met-dialogo-busca { padding: .6rem .6rem 0; }
.met-dialogo-busca input { width: 100%; }
#met-lista-musicas .candidato-artista b { color: var(--latao-claro); font-family: var(--font-mono); }
.met-vazio { padding: 1.2rem; text-align: center; color: var(--fog); font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  .met-barra, .met-passo, .met-lateral, .met-play, .met-chip { transition: none; }
}

@media (max-width: 340px) {
  .met-bpm-linha { grid-template-columns: 3rem 1fr 3rem; }
  .met-passo { width: 3rem; height: 3rem; }
  .met-play { width: 4.8rem; height: 4.8rem; }
}

.met-dialogo-chips { padding: 0 .6rem; }
