/* Base reset (the artifact skeleton used to provide this) */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 14px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: one-screen app — top bar, scrolling sheet, optional setlist bar at the bottom. Stage-first: big type, chords lit like keyboard LEDs. */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --line: #e2dfd7;
  --fg: #1b1a1f;
  --muted: #6d6a73;
  --chord: #b4530a;
  --note: #6b4fc8;
  --section: #0e7c72;
  --section-bg: #dcf1ee;
  --cue: #a3266a;
  --accent: #b4530a;
  --accent-fg: #ffffff;
  --c-vermelho: #c62828; --c-laranja: #d35400; --c-verde: #2e7d32; --c-azul: #1565c0; --c-rosa: #c2185b; --c-marca: #fff176;
  --font-ui: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-brand: "Lexend", "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", Menlo, "SF Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114; --surface: #1b1b20; --line: #2c2c33; --fg: #ece8e1; --muted: #9a96a0;
    --chord: #f2b544; --note: #b9a4f0; --section: #5fc4b8; --section-bg: #17322f; --cue: #f08cc0;
    --accent: #f2b544; --accent-fg: #17140c; color-scheme: dark;
    --c-vermelho: #ff6b6b; --c-laranja: #ffa04d; --c-verde: #6fdc8c; --c-azul: #6cb8ff; --c-rosa: #ff8fc8; --c-marca: #9a7d00;
  }
}
:root[data-theme="dark"] {
  --bg: #111114; --surface: #1b1b20; --line: #2c2c33; --fg: #ece8e1; --muted: #9a96a0;
  --chord: #f2b544; --note: #b9a4f0; --section: #5fc4b8; --section-bg: #17322f; --cue: #f08cc0;
  --accent: #f2b544; --accent-fg: #17140c; color-scheme: dark;
  --c-vermelho: #ff6b6b; --c-laranja: #ffa04d; --c-verde: #6fdc8c; --c-azul: #6cb8ff; --c-rosa: #ff8fc8; --c-marca: #9a7d00;
}
/* Modo palco: força o escuro, mesmo com o aparelho no claro */
:root.stage {
  --bg: #050506; --surface: #121215; --line: #24242a; --fg: #f4f1ea; --muted: #8f8b95;
  --chord: #ffc24d; --note: #c4b2ff; --section: #6fd6c9; --section-bg: #12302c; --cue: #ff9fd0;
  --accent: #ffc24d; --accent-fg: #17140c; color-scheme: dark;
  --c-vermelho: #ff6b6b; --c-laranja: #ffa04d; --c-verde: #6fdc8c; --c-azul: #6cb8ff; --c-rosa: #ff8fc8; --c-marca: #9a7d00;
}

html, body { height: 100%; }
body { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 16px;
  -webkit-text-size-adjust: 100%; overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { height: 100%; display: grid; grid-template-rows: auto auto 1fr auto; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; gap: 10px; padding-block: 10px; border-bottom: 1px solid var(--line); background: var(--surface); min-width: 0; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.01em; margin: 0; white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 0.32em; font-family: var(--font-brand); letter-spacing: -0.01em; }
.brand .mark { height: 0.95em; width: auto; fill: var(--accent); flex: none; }
.spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px;
  padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; font-size: 15px; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.danger { color: #c0392b; }
.btn svg { width: 20px; height: 20px; flex: none; }
.group { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.group .btn { border: 0; border-radius: 0; background: transparent; min-width: 44px; padding: 0 10px; }
.group .btn.on { background: var(--accent); color: var(--accent-fg); }
.group .val { min-width: 44px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.label-sm { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }

/* ---------- library ---------- */
.searchwrap { padding-block: 12px 8px; background: var(--bg); display: grid; gap: 10px; }
.search { width: 100%; min-height: 52px; font-size: 19px; padding: 0 16px 0 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 15px center; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-weight: 600; }
.tagchip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.recent { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.recent::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; }

.scroller { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; position: relative; }
.libgrid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; }
.list { list-style: none; margin: 0; padding: 0 0 40px; min-width: 0; }
.letter { position: sticky; top: 0; background: var(--bg); font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: 18px; padding: 10px 4px 4px; z-index: 1; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 62px; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.row:active { background: var(--surface); }
.row .t { font-family: var(--font-display); font-weight: 600; font-size: 23px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row .a { color: var(--muted); font-size: 14px; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .hit { color: var(--muted); font-size: 13px; font-family: var(--font-mono); display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .hit mark { background: var(--section-bg); color: var(--fg); border-radius: 3px; }
.key { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--chord); border: 1.5px solid currentColor; border-radius: 8px; padding: 3px 8px; min-width: 42px; text-align: center; }
.key.empty { color: var(--line); }
.az { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; padding: 6px 0 40px; }
.az button { border: 0; background: transparent; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--muted); min-height: 24px; width: 28px; padding: 0; }
.az button:active { color: var(--accent); }
.empty-state { padding: 48px 8px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty-state strong { color: var(--fg); font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.banner { padding-block: 8px; font-size: 14px; background: var(--section-bg); color: var(--fg); }

/* setlists */
.setcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 14px 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.setcard .t { font-family: var(--font-display); font-weight: 600; font-size: 24px; display: block; }
.setcard .a { color: var(--muted); font-size: 14px; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.setrow .n { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.setrow .t { font-family: var(--font-display); font-weight: 600; font-size: 21px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setrow .ops { display: flex; gap: 2px; }
.setrow .ops .btn { min-width: 40px; padding: 0 8px; }
.namefield { width: 100%; font-family: var(--font-display); font-weight: 700; font-size: 30px; border: 0; border-bottom: 2px solid var(--line); background: transparent; padding: 6px 0; }
.namefield:focus { border-color: var(--accent); outline: none; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; margin: 24px 0 6px; }
.pad { padding-block: 16px 60px; max-width: 820px; margin: 0 auto; width: 100%; box-sizing: border-box; }

/* ---------- song sheet ---------- */
.songhead { min-width: 0; display: grid; }
.songhead h1 { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.05; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.songhead span { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 8px; background: var(--surface); border-bottom: 1px solid var(--line); align-items: center; }
.tools .keyshow { font-family: var(--font-mono); font-weight: 700; color: var(--chord); }
.sheet { font-family: var(--font-mono); font-size: var(--fs, 18px); line-height: 1.35; padding-block: 18px 45vh; }
.sheet .blk { break-inside: avoid; margin-bottom: 0.9em; }
.sheet.cols { column-count: 2; column-gap: 40px; column-rule: 1px solid var(--line); padding-bottom: 40px; }
.ln { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.35em; }
.ln.pair { white-space: normal; line-height: 1.25; margin-bottom: 0.35em; }
.seg { display: inline-flex; flex-direction: column; vertical-align: bottom; white-space: pre; }
.seg .c { padding-right: 0.6ch; line-height: 1.2; }
.seg .l { white-space: pre; }
.w { white-space: nowrap; display: inline-block; vertical-align: bottom; }
.ln.chords, .ln .ch { color: var(--chord); font-weight: 700; }
.ln.notes { color: var(--note); font-weight: 700; }
.sec { display: inline-block; font-family: var(--font-ui); font-weight: 700; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.07em; color: var(--section); background: var(--section-bg); border-radius: 6px; padding: 1px 8px; margin-right: 0.5ch; }
.cue { color: var(--cue); font-weight: 700; }
.sheetwrap { overflow-x: auto; }

.setbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding-block: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.setbar .mid { text-align: center; min-width: 0; }
.setbar .mid .pos { font-variant-numeric: tabular-nums; font-weight: 700; }
.setbar .mid .nx { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.setbar .btn { min-width: 120px; font-size: 17px; }

/* editor */
.edgrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr); gap: 10px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field input, .field textarea { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; min-height: 44px; width: 100%; box-sizing: border-box; }
.field textarea { font-family: var(--font-mono); font-size: 15px; line-height: 1.4; min-height: 55vh; white-space: pre; overflow-x: auto; resize: vertical; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

.sheet .ch { cursor: pointer; border-radius: 4px; }
.sheet .ch:active { background: var(--section-bg); }
.keysheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -12px 40px rgba(0,0,0,0.25); padding-top: 14px; padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; justify-items: center; }
.keysheet .hd { display: flex; align-items: baseline; gap: 12px; width: 100%; max-width: 560px; }
.keysheet .nm { font-family: var(--font-mono); font-weight: 700; font-size: 30px; color: var(--chord); }
.keysheet .nn { color: var(--muted); font-size: 15px; }
.keysheet > svg { width: 100%; max-width: 560px; height: auto; }
.wk { fill: #fbfaf7; stroke: #3a3840; stroke-width: 1; }
.bk { fill: #1e1d22; stroke: #1e1d22; }
.wk.hit, .bk.hit { fill: var(--chord); }
.wk.bass, .bk.bass { fill: var(--section); }
.keylbl { font: 700 11px var(--font-ui); fill: #1e1d22; text-anchor: middle; }
.pastebox { border: 2px dashed var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 6px; background: var(--surface); }
.pastebox strong { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.k-vermelho, .k-vermelho * { color: var(--c-vermelho) !important; font-weight: 700; }
.k-laranja, .k-laranja * { color: var(--c-laranja) !important; font-weight: 700; }
.k-verde, .k-verde * { color: var(--c-verde) !important; font-weight: 700; }
.k-azul, .k-azul * { color: var(--c-azul) !important; font-weight: 700; }
.k-rosa, .k-rosa * { color: var(--c-rosa) !important; font-weight: 700; }
.k-marca { background: var(--c-marca); border-radius: 3px; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.swatch svg { width: 18px; height: 18px; }
.swatch i { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.stopfab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 12; display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,0.35); }
.stopfab .btn { min-height: 56px; min-width: 56px; font-size: 22px; }
.stopfab .stopbtn { font-size: 19px; padding: 0 22px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 20; }
.speedval { min-width: 28px; }

@media (max-width: 640px) {
  .brand { font-size: 22px; }
  .sheet.cols { column-count: 1; }
  .edgrid { grid-template-columns: 1fr; }
  .setbar .btn { min-width: 0; }
  .songhead h1 { font-size: 22px; }
}
@media (max-width: 480px) {
  .bar { gap: 6px; }
  .bar .brand { font-size: 20px; }
  .bar .btn.ghost > span { display: none; } /* Palco and Conta show only their icons on phones */
  .bar .btn.ghost { min-width: 40px; padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }

/* account & cloud */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.good { background: #2fa36b; }
.dot.busy { background: var(--accent); }
.dot.bad { background: #d64545; }
.dot.off { background: var(--line); border: 1px solid var(--muted); }
.linkbtn { border: 0; background: none; padding: 0 2px; color: var(--accent); font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 32px; }
.loginrow { display: flex; flex-wrap: wrap; gap: 8px; }
.loginrow input { flex: 1 1 220px; min-height: 48px; font-size: 18px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.acct { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.acct .dot { margin-top: 6px; }
.acct > div { display: grid; gap: 2px; min-width: 0; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hint.err { color: #d64545; }

/* login / sign-up */
.authwrap { grid-row: 1 / -1; display: grid; place-items: start center; padding-block: 8vh 40px; }
.authcard { width: 100%; max-width: 420px; display: grid; gap: 14px; }
.authcard .brand { font-size: 40px; }
.authh { font-family: var(--font-display); font-weight: 700; font-size: 24px; margin: 4px 0 0; }
.authform { display: grid; gap: 12px; }
.authform input { min-height: 50px; font-size: 18px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); width: 100%; box-sizing: border-box; }
.pwrow { display: flex; align-items: center; gap: 8px; }
.pwrow input { flex: 1; }
.btn.big { min-height: 54px; font-size: 18px; }
.hint.okmsg { color: var(--section); font-weight: 600; }
.authcard .tabs .tab { flex: 1; }

/* install instructions: the line for this device stands out */
.install { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.install li.here { color: var(--fg); }
.install li.here::marker { color: var(--accent); }

/* PalcoPad: leitura e repertórios */
.tools.reading-focus > :not(.group:last-child) { display:none; }
.setrow .t { white-space:normal; overflow:visible; overflow-wrap:anywhere; }
.setrow .hint { display:block; font-size:13px; }
.setbar .mid .nx { white-space:normal; overflow:visible; overflow-wrap:anywhere; }
#pickList [aria-pressed="true"] { background:var(--surface); outline:2px solid var(--accent); outline-offset:-2px; }
.toast { display:flex; align-items:center; gap:12px; }
@media(max-width:520px) { .setrow { grid-template-columns:26px minmax(0,1fr); } .setrow .ops { grid-column:2; justify-content:flex-end; } }

/* author's signature, small and quiet at the end of the main screens */
.signature { margin: 8px 0 0; padding: 20px 0 28px; text-align: center; font-family: var(--font-brand); font-size: 11px; letter-spacing: 0.12em; color: var(--muted); opacity: 0.55; }
.signature.pinned { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 4px 0 max(6px, env(safe-area-inset-bottom, 0px)); font-size: 10px; pointer-events: none; z-index: 2; }

/* lifetime purchase */
.banner.trial { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.price { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); }
.price .v { font-family: var(--font-brand); font-size: 34px; color: var(--accent); line-height: 1.1; }

/* Native controls follow the explicitly selected light palette. */
:root { color-scheme: light; }
:root[data-theme="dark"], :root.stage { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* connected band */
.livetag { display: inline-block; font-family: var(--font-ui); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: #fff; background: #d64545; border-radius: 6px; padding: 2px 8px; vertical-align: middle; }
.livedot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d64545; margin-left: 4px; vertical-align: middle; animation: livepulse 1.4s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .livedot { animation: none; } }
.setbar.livebar { border-top: 2px solid #d64545; }
.setbar.livebar .livetag { justify-self: start; }
.followbox { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.invite { display: grid; gap: 8px; padding: 14px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--surface); }
.invite .code { font-family: var(--font-mono); font-size: 30px; font-weight: 700; letter-spacing: 0.18em; color: var(--accent); }
