/* ================= Tema do Karaokão =================
 * Uma cor de destaque (vem dos ajustes da festa), superfícies escuras levemente quentes,
 * dourado só para notas/medalhas. Tipografia: Outfit (títulos) + Figtree (texto).
 */
:root {
  --acc: #ff4f7b;
  --acc-ink: #fff;
  --acc-soft: color-mix(in srgb, var(--acc) 16%, transparent);
  --gold: #ffc857;
  --ok: #34d399;
  --danger: #f43f5e;

  --bg: #0f0c14;
  --surface: #19151f;
  --surface-2: #231e2b;
  --surface-3: #2e2838;
  --line: rgba(255, 255, 255, .08);
  --fg: #f6f3f8;
  --muted: #a8a1b3;
  --faint: #6f6879;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --sombra: 0 12px 32px -12px rgba(8, 4, 16, .7);
  --t: 180ms cubic-bezier(.2, .8, .2, 1);

  --f-titulo: "Outfit", "Segoe UI", system-ui, sans-serif;
  --f-texto: "Figtree", "Segoe UI", system-ui, sans-serif;

  --z-barra: 10;
  --z-folha: 30;
  --z-toast: 40;
  --z-tela: 50;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* toque sem atraso de 300 ms (sem zoom de duplo toque nos controles) */
button, a, input, select, label, [role="button"] { touch-action: manipulation; }
/* nomes e títulos enormes não estouram o layout */
h1, h2, h3, b { overflow-wrap: anywhere; }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.45 var(--f-texto);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--f-titulo); letter-spacing: -.015em; line-height: 1.15; text-wrap: balance; }
p { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--acc) 70%, white); outline-offset: 2px; border-radius: 6px; }

/* textura sutil de palco (ruído) para não ficar chapado */
.textura::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-md);
  background: var(--acc); color: var(--acc-ink); font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform var(--t), filter var(--t), background var(--t); text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.sec { background: var(--surface-3); color: var(--fg); }
.btn.fantasma { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.perigo { background: color-mix(in srgb, var(--danger) 18%, transparent); color: #ff8fa3; }
.btn.grande { min-height: 54px; font-size: 17px; border-radius: var(--r-lg); width: 100%; }
.btn.pequeno { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.link { color: var(--acc); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

.redondo {
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); flex: none; transition: transform var(--t), background var(--t);
}
.redondo:hover { background: color-mix(in srgb, var(--surface-3) 70%, white 10%); }
.redondo:active { transform: scale(.92); }
.redondo.pri { background: var(--acc); color: var(--acc-ink); }
.redondo.ok { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.redondo svg, .btn svg { width: 20px; height: 20px; flex: none; }

/* ---------- campos ---------- */
.campo { display: block; }
.campo > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.entrada {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1.5px solid transparent; outline: none; transition: border-color var(--t), background var(--t);
}
.entrada:focus { border-color: var(--acc); background: var(--surface); }
.entrada::placeholder { color: var(--faint); }
select.entrada { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a8a1b3' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }

.chave { position: relative; width: 46px; height: 28px; flex: none; }
.chave input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chave i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background var(--t); pointer-events: none; }
.chave i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform var(--t); }
.chave input:checked + i { background: var(--acc); }
.chave input:checked + i::after { transform: translateX(18px); }
.chave input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--acc) 70%, white); outline-offset: 2px; }

/* ---------- selos ---------- */
.selo { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; line-height: 1;
  padding: 3px 6px; border-radius: 5px; background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); vertical-align: 1px; }
.selo.ruim { background: color-mix(in srgb, var(--danger) 16%, transparent); color: #ff8fa3; }
.selo.voce { background: var(--acc); color: var(--acc-ink); }
.selo.neutro { background: var(--surface-3); color: var(--muted); }

/* ---------- carregando ---------- */
.esqueleto { background: linear-gradient(90deg, var(--surface-2) 0, var(--surface-3) 40%, var(--surface-2) 80%); background-size: 300% 100%;
  animation: brilho 1.3s ease-in-out infinite; border-radius: var(--r-sm); }
@keyframes brilho { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- aviso flutuante ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px);
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: min(92vw, 520px);
  background: #fbf8fc; color: #19121f; padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--sombra);
  font-weight: 600; font-size: 14px; z-index: var(--z-toast); opacity: 0; pointer-events: none; transition: opacity var(--t), transform var(--t);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.erro { background: #ffe4e8; color: #7a0019; }
#toast button { color: var(--acc); font-weight: 800; padding: 4px 2px; white-space: nowrap; filter: brightness(.85); }

/* ---------- microinterações ---------- */
/* onda de luz no clique (adicionada pelo K.onda em common.js) */
.onda { position: absolute; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(255,255,255,.45), rgba(255,255,255,0) 70%); animation: onda .6s ease-out forwards; }
@keyframes onda { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.btn, .redondo { position: relative; overflow: hidden; }
/* brilho que atravessa o botão principal */
.btn:not(.sec):not(.fantasma):not(.perigo)::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); transform: skewX(-18deg); }
.btn:not(.sec):not(.fantasma):not(.perigo):hover::after, .btn:not(.sec):not(.fantasma):not(.perigo):focus-visible::after { animation: brilhoBtn .8s ease; }
@keyframes brilhoBtn { to { left: 130%; } }
.btn:not(.sec):not(.fantasma):not(.perigo):hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--acc) 60%, transparent), 0 6px 24px -6px var(--acc); }
/* equalizador animado (tocando agora) */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; vertical-align: -2px; }
.eq i { display: block; width: 3px; border-radius: 2px; background: var(--acc); animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; } .eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
.eq.parado i { animation-play-state: paused; height: 30%; }
/* entrada em cascata de listas */
.cascata > * { animation: cascata .35s cubic-bezier(.2,.8,.2,1) both; }
.cascata > *:nth-child(2) { animation-delay: .03s; } .cascata > *:nth-child(3) { animation-delay: .06s; } .cascata > *:nth-child(4) { animation-delay: .09s; }
.cascata > *:nth-child(5) { animation-delay: .12s; } .cascata > *:nth-child(6) { animation-delay: .15s; } .cascata > *:nth-child(n+7) { animation-delay: .18s; }
@keyframes cascata { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
