/* =========================================================================
   Novo projeto — a "tela 02" da reforma (docs/reforma-ui.md).

   Formato, ritmo e fundo, com o CTA fixo carregando o resumo da escolha. É
   uma tela de PASSAGEM: sem nav, sem marca, com uma saída para trás no topo.
   ========================================================================= */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--txt2);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 88px; /* o rodapé fixo não pode cobrir a última seção */
}

/* ----------------------------------------------------------------- topo -- */

.head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  max-width: 720px; margin: 0 auto;
}
.head b { font-size: 17px; font-weight: 800; color: var(--txt); }
.head__back {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--raised); color: var(--txt3);
}
.head__back svg { width: 17px; height: 17px; fill: currentColor; }
.head__back:hover { background: #23232C; color: var(--txt); }

.sheet { max-width: 720px; margin: 0 auto; padding: 0 20px 30px; display: flex; flex-direction: column; gap: 24px; }

.field { display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 13px; font-weight: 700; color: var(--txt); }
.label--row { display: flex; align-items: baseline; gap: 8px; }
.label i { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 800; color: var(--accent-soft); }
.note { margin: 0; font-size: 12px; color: var(--txt5); }

/* ----------------------------------------------------------------- nome -- */

.named {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--divider); border-radius: 12px;
  padding: 0 14px;
}
.named:focus-within { border-color: var(--accent); }
.named input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--txt); font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 13px 0;
}
.named i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--txt5); }

/* ------------------------------------------------------------- formatos -- */

.formats { display: flex; gap: 9px; }
.formats button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px 11px; cursor: pointer;
  border: 1px solid var(--divider); border-radius: 14px;
  background: var(--card); color: var(--txt3); font-family: inherit;
}
.formats button:hover { border-color: var(--border); }
.formats button.is-on { background: var(--accent-chip); border-color: var(--accent-chip-border); color: var(--accent-soft); }
/* A miniatura do formato é a PROPORÇÃO de verdade, não um ícone: é assim que
   se escolhe entre 4:3 e 3:4 sem ler o rótulo. */
.formats i {
  display: block; border-radius: 4px;
  background: var(--txt5); border: 0;
}
.formats button.is-on i { background: var(--accent-soft); }
.formats b { font-size: 12px; font-weight: 700; }
.formats small { font-size: 9.5px; color: var(--txt5); font-family: ui-monospace, Menlo, monospace; }
.formats button.is-on small { color: var(--accent-soft); opacity: .8; }

/* ------------------------------------------------------------------ fps -- */

/* O grupo inteiro num cartão, como no app: prévia, controle e atalhos são uma
   escolha só. */
.rhythm {
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--divider); border-radius: 18px;
  background: var(--card); padding: 16px;
}

.preview {
  position: relative; overflow: hidden;
  height: 92px; border-radius: 12px; background: var(--bar);
}
/* SEM transição, de propósito: uma transição interpolaria entre os quadros e
   apagaria justamente o que a prévia existe para mostrar — o engasgo de 6 fps
   viraria um deslizar suave, e os cinco ritmos ficariam idênticos. */
.preview__ball {
  position: absolute; width: 22px; height: 22px;
  border-radius: 50%; background: var(--ice);
}
.preview__ground {
  position: absolute; left: 0; right: 0; bottom: 20px;
  height: 1px; background: rgba(255, 255, 255, .12);
}
.preview__tag {
  position: absolute; top: 9px; right: 9px;
  background: rgba(0, 0, 0, .5); color: var(--ice);
  border-radius: 6px; padding: 3px 8px;
  font-size: 10px; font-weight: 700;
}

.rhythm input[type='range'] { accent-color: var(--accent); width: 100%; }

.fps { display: flex; gap: 9px; }
.fps button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 11px 4px; cursor: pointer;
  border: 1px solid var(--divider); border-radius: 12px;
  background: var(--card); color: var(--txt2); font-family: inherit;
}
.fps button:hover { border-color: var(--border); }
.fps button.is-on { background: var(--accent-chip); border-color: var(--accent-chip-border); color: var(--accent-soft); }
.fps b { font-size: 15px; font-weight: 800; }
.fps small { font-size: 9.5px; color: var(--txt5); }
.fps button.is-on small { color: var(--accent-soft); opacity: .8; }

/* ---------------------------------------------------------------- fundo -- */

.swatches { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; }
.swatches button {
  aspect-ratio: 1; border-radius: 10px; cursor: pointer; padding: 0;
  border: 1.5px solid rgba(255, 255, 255, .14);
}
.swatches button.is-on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent-chip-border); }

.custom {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  border: 1px solid var(--divider); border-radius: 14px;
  background: var(--card); padding: 12px 14px;
}
.custom:hover { border-color: var(--border); }
.custom input {
  width: 34px; height: 34px; flex: none; padding: 0; cursor: pointer;
  border: 0; border-radius: 10px; background: none;
}
.custom span { display: flex; flex-direction: column; gap: 2px; }
.custom b { font-size: 13px; font-weight: 700; color: var(--txt); }
.custom small { font-size: 11px; color: var(--txt5); }

/* -------------------------------------------------------------- rodapé -- */

/* A barra atravessa a tela, mas o conteúdo dela para na mesma coluna do
   formulário: resumo à esquerda, CTA à direita, ambos alinhados com o que
   está acima. */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 20px;
  background: rgba(20, 20, 20, .92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--divider);
  display: flex; align-items: center; gap: 16px;
  justify-content: center;
}
.bar__summary {
  display: flex; flex-direction: column; gap: 1px;
  flex: 1 1 auto; max-width: 520px; min-width: 0;
}
.bar__summary b { font-size: 13px; font-weight: 700; color: var(--txt); }
.bar__summary small { font-size: 11px; color: var(--txt3); }
.bar__go {
  flex: none;
  padding: 12px 26px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--brand-gradient); color: var(--on-accent);
  font-family: inherit; font-size: 14px; font-weight: 800;
}
.bar__go:hover { filter: brightness(1.06); }
.bar__go:disabled { opacity: .45; cursor: default; filter: none; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 16px; font-size: 12.5px; color: var(--txt2);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .55); z-index: 20;
}
.toast[hidden] { display: none; }

@media (max-width: 620px) {
  .formats, .fps { flex-wrap: wrap; }
  .formats button, .fps button { flex: 1 1 28%; }
  .swatches { grid-template-columns: repeat(6, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
