/* Luís Cantor — mobile-first. Formatado 100% para telefone. */
:root {
  --bg: #111418;
  --surface: #1b1f26;
  --surface-2: #232833;
  --text: #e8eaed;
  --muted: #9aa3af;
  --accent: #ffb703;      /* cor do acorde */
  --border: #2b313c;
}
[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #16191d;
  --muted: #5b6270;
  --accent: #b25e00;
  --border: #dde1e7;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  /* área segura de aparelhos com notch */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---- Menu de cima ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; }
.menu { display: flex; gap: 4px; margin-left: auto; }
.topbar button {
  background: none; border: 0; color: var(--text);
  font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.menu button:active, .menu button.active { background: var(--surface-2); }
.theme-toggle { font-size: 18px; }

/* ---- Conteúdo ---- */
main { padding: 14px; max-width: 720px; margin: 0 auto; }
h1 { font-size: 20px; margin: 4px 0 14px; }

/* Lista de músicas */
.song-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.song-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; cursor: pointer;
}
.song-card .t { font-weight: 600; }
.song-card .a { color: var(--muted); font-size: 13px; margin-top: 2px; }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; }

/* ---- Tela da CIFRA (parada, pra acompanhar) ---- */
.chord-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.chord-head .tom { color: var(--muted); font-size: 13px; }
.cifra {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  /* monospace: alinha acorde sobre a letra (igual Cifra Club) */
  font-family: "SF Mono", ui-monospace, "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 15px; line-height: 1.7;
  white-space: pre;               /* preserva o alinhamento exato */
  overflow-x: auto;               /* rola no eixo X em telas estreitas */
  -webkit-overflow-scrolling: touch;
}
.cifra .chord { color: var(--accent); font-weight: 700; }

/* ---- Escanear ---- */
.uploader {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: 12px; padding: 22px; text-align: center;
}
.uploader input[type=file] { display: none; }
.btn {
  display: inline-block; background: var(--accent); color: #111;
  border: 0; border-radius: 10px; padding: 12px 18px; font: inherit; font-weight: 600;
  cursor: pointer; margin-top: 8px;
}
.btn.secondary { background: var(--surface-2); color: var(--text); }
.preview { margin-top: 14px; max-width: 100%; border-radius: 10px; }
.note { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* Tela de perguntas (salvar) */
.formsalvar { margin-top: 6px; }
.fl { display: block; margin: 12px 0; font-size: 13px; color: var(--muted); }
.fl input, .fl textarea {
  display: block; width: 100%; margin-top: 5px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; font: inherit;
}
.fl textarea.cifra-edit {
  font-family: "SF Mono", ui-monospace, "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 14px; line-height: 1.6; white-space: pre; overflow-wrap: normal;
}
.uploader .btn { margin-top: 12px; }
#scanOut .btn { margin: 12px 8px 0 0; }

/* badges / botões */
.badge {
  font-size: 11px; font-weight: 700; vertical-align: middle;
  background: var(--surface-2); color: var(--accent);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; margin-left: 4px;
}
.btn.danger { background: #b23b3b; color: #fff; }
.chord-head { flex-wrap: wrap; gap: 8px; }
.chord-head .btn { margin: 0; }
h2.sec { font-size: 15px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; }
h2.sec small { font-weight: 400; }

/* Seções da tela Adicionar (buscar / escanear) */
.add-sec {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; margin-top: 14px;
}
.add-sec h2.sec { margin-top: 0; }

/* Repertório do show */
.rep-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rep-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.rep-item .num {
  width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center;
  background: var(--surface-2); border-radius: 50%; font-size: 12px; font-weight: 700; color: var(--accent);
}
.rep-item .ti { flex: 1; min-width: 0; }
.rep-item .ord { display: flex; gap: 4px; }
.rep-item .ord button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; width: 34px; height: 34px; font-size: 14px; cursor: pointer;
}
.rep-item .ord button:disabled { opacity: .35; }
.rep-item .ord .rm { color: #d66; }
.song-card.add { border-style: dashed; }
#iniciar { width: 100%; font-size: 17px; padding: 14px; }
#iniciar:disabled { opacity: .4; }

/* ---- Modo palco (apresentação) ---- */
body.stage-on .topbar { display: none; }
body.stage-on main { max-width: none; padding: 0; }
.stage { min-height: 100dvh; display: flex; flex-direction: column; padding: 10px 12px 0; }
.stage-top { display: flex; align-items: center; gap: 10px; }
.stage-pos { color: var(--muted); font-size: 13px; margin-left: auto; }
.stage-title { font-size: 22px; font-weight: 700; margin: 10px 0 8px; }
.stage-title .tom { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 8px; }
.stage-cifra { flex: 1; font-size: 17px; margin: 0; border-radius: 12px 12px 0 0; }
.stage-foot { position: sticky; bottom: 0; background: var(--bg); }
.stage-auto { display: flex; align-items: center; gap: 12px; padding: 10px 0 2px; }
.stage-auto #auto { min-width: 108px; }
.stage-auto #auto.on { border-color: var(--accent); color: var(--accent); }
.stage-auto input[type=range] { flex: 1; accent-color: var(--accent); height: 26px; }
.stage-auto .vel-label {
  min-width: 1.6em; text-align: center; color: var(--muted);
  font-variant-numeric: tabular-nums; font-size: 15px;
}
.stage-nav { display: flex; gap: 10px; padding: 10px 0 12px; }
.stage-nav .btn { flex: 1; padding: 16px; font-size: 16px; }
.stage-nav .btn:disabled { opacity: .35; }

/* ---- Login (OTP) ---- */
.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg); overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px;
}
.login-card {
  width: 100%; max-width: 380px; text-align: center;
}
.login-card h1 { font-size: 24px; margin: 6px 0 4px; }
.login-logo { font-size: 46px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 4px 0 18px; }
.login-card .song-list { text-align: left; }
.login-card .song-card { cursor: pointer; }
.login-card .btn { margin: 14px 8px 0 0; }

/* hidden vence qualquer display (senão overlay/topbar com display:flex ignoram [hidden]) */
[hidden] { display: none !important; }
