/* toque: sem zoom de toque duplo (quem bate rápido nas notas dava zoom sem querer); o de pinça no iPhone fica no game.js */
* { touch-action: manipulation; }

:root {
  /* trocadas pelo tema de cada música */
  --accent: #4d7dff;
  --accent-2: #b06bff;
  --accent-rgb: 77, 125, 255;

  --bg: #060814;
  --panel: rgba(12, 16, 36, 0.86);
  --panel-2: rgba(255, 255, 255, 0.035);
  --line: rgba(140, 160, 255, 0.12);
  --text: #e8ebff;
  --muted: rgba(200, 208, 240, 0.62);
  --green: #6ee7a0;
  --cyan: #56d4f5;
  --orange: #ffb45c;
  --red: #ff4d6d;
  color-scheme: dark;
  font-family: Inter, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
body {
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(var(--accent-rgb), 0.10), transparent 70%),
    var(--bg);
  transition: background 0.8s;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* barras de rolagem finas, na cor do tema (Chrome/Edge/Safari pelo ::-webkit-scrollbar; Firefox só aceita cor e espessura) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), 0.3); border: 3px solid transparent; border-radius: 99px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--accent-rgb), 0.6); }
::-webkit-scrollbar-thumb:active { background-color: rgba(var(--accent-rgb), 0.8); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: rgba(var(--accent-rgb), 0.4) transparent; }
}
.accent { color: var(--accent) !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.08);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  font-family: inherit;
  color: var(--text);
}
.hint kbd, .keys-note kbd { height: 22px; min-width: 22px; font-size: 11px; padding: 0 6px; }

/* uma área só: a tela de jogar (o menu, com as outras telas, fica por cima) */
.app { height: 100vh; height: 100dvh; }
.main { height: 100%; }

.btn:focus-visible, .tabs button:focus-visible, .song-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chips.left { justify-content: flex-start; margin: 0; }
.chip.source { border-color: var(--line); background: rgba(255, 255, 255, 0.06); }
.chip.source.yt { border-color: rgba(230, 30, 40, 0.8); background: rgba(230, 30, 40, 0.18); }

/* volume e vídeo */
.sound-card { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px; }
.np-switch {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
}
.np-switch[hidden] { display: none; }
.np-switch svg { width: 18px; height: 18px; justify-self: center; }
.np-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.np-switch i {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.15s;
}
.np-switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.np-switch input:checked + i { background: var(--accent); }
.np-switch input:checked + i::after { transform: translateX(14px); }
.np-switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.np-volume {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}
.np-volume button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.np-volume button:hover { background: rgba(255, 255, 255, 0.06); }
.np-volume button:focus-visible, .np-volume input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.np-volume svg { width: 18px; height: 18px; }
.np-volume input { width: 100%; accent-color: var(--accent); margin: 0; }
.np-volume output { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }

.main { position: relative; min-width: 0; min-height: 0; }
.view { display: none; height: 100%; }
.view.active { display: block; }
.view.page { overflow-y: auto; padding: 12px 8px 24px; }

.stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 48px rgba(var(--accent-rgb), 0.14);
  background: #05060f;
  transition: border-color 0.8s, box-shadow 0.8s;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
/* segurar o dedo na tela (nota longa) não pode abrir menu, lupa, seleção de texto nem o destaque do toque (iPad/iPhone) */
.stage, .stage *, body.playing { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.hud-pause {
  pointer-events: auto;
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 6px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.hud-pause i { width: 7px; height: 26px; border-radius: 2px; background: #fff; box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9); }
.hud-combo { position: absolute; top: 66px; left: 22px; display: flex; flex-direction: column; }
.hud-combo span, .hud-score span { font-size: 16px; font-weight: 500; letter-spacing: 0.04em; }
.hud-combo strong { font-size: 42px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hud-combo strong.bump { animation: bump 0.18s ease-out; }
@keyframes bump { from { transform: scale(1.18); } to { transform: scale(1); } }
.hud-score { position: absolute; top: 22px; right: 22px; display: flex; flex-direction: column; align-items: flex-end; }
.hud-score strong { font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.hud-progress {
  position: absolute;
  top: 30px;
  left: 50%;
  width: min(36%, 240px);
  height: 3px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
}
.hud-progress i { display: block; width: 0; height: 100%; border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* Telas por cima do palco */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(4, 6, 18, 0.35), rgba(4, 6, 18, 0.15) 70%);
  z-index: 3;
  overflow-y: auto;
}
.ov-card {
  width: min(360px, 100%);
  padding: 24px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 14px;
  background: rgba(10, 13, 32, 0.9);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(var(--accent-rgb), 0.12);
  text-align: center;
}
.ov-card h2 { margin: 0 0 16px; font-size: 22px; font-weight: 600; }
.overlay > * { margin: auto; }
.start-card { padding: 20px 24px 22px; }
.start-cover {
  width: 148px;
  height: 148px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(var(--accent-rgb), 0.35);
  margin-bottom: 14px;
}
.start-card h2 { margin: 0; }
.start-card .muted { margin: 4px 0 12px; }
.chips { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.hint { margin: 12px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 99px;
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}
.chip[hidden] { display: none; }
.chip.ghost { border-color: var(--line); background: transparent; color: var(--muted); }

.btn {
  font: 600 15px inherit;
  font-family: inherit;
  color: var(--text);
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, opacity 0.15s, filter 0.15s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.primary {
  border: 0;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 24px rgba(var(--accent-rgb), 0.35);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.panel h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }

.start-card h2, .song-tile strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.link { color: var(--accent); font-size: 13px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.keys-note { margin: 14px 0 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tip {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.tip div { display: flex; flex-direction: column; gap: 3px; }
.tip strong { font-size: 14px; font-weight: 600; }
.tip span { font-size: 12px; color: var(--muted); line-height: 1.45; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.tabs button {
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 500 13px inherit;
  font-family: inherit;
  cursor: pointer;
}
.tabs button.active { background: rgba(var(--accent-rgb), 0.18); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rank-list li {
  display: grid;
  grid-template-columns: 24px 32px minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.rank-list li.me { background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.32), rgba(var(--accent-rgb), 0.16)); }
.rank-list .pos { text-align: center; font-weight: 600; }
.rank-list .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.rank-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .pts { font-variant-numeric: tabular-nums; color: var(--text); }
.rank-list .grade { text-align: right; font-weight: 600; color: var(--accent); }
.rank-list .gap { justify-content: center; color: var(--muted); padding: 0; display: flex; }

.page-head h1 { margin: 6px 0 4px; font-size: 28px; font-weight: 600; }
.page-head p { margin: 0 0 20px; }

/* Músicas: título à esquerda, busca e dificuldade à direita */
.songs-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.songs-head p { margin-bottom: 0; }

.section-title { margin: 28px 0 14px; font-size: 16px; font-weight: 600; }

.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
/* o card é o .tile-wrap; dentro, o botão que escolhe a música e (YouTube/arquivo) o "Remover" */
.tile-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.tile-wrap:hover { transform: translateY(-2px); border-color: var(--t-accent, var(--accent)); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.tile-wrap.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 30px rgba(var(--accent-rgb), 0.2); }
.song-tile {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.song-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* capa: origem no canto de cima, melhor nota embaixo à esquerda; "⋯" no canto de cima à direita */
.tile-cover { position: relative; display: block; margin-bottom: 8px; }
.song-tile .tile-cover img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #111; }
/* cards verticais (músicas e playlists): imagem levemente escurecida, volta ao normal com o mouse ou o foco */
.song-tile .tile-cover img { filter: brightness(0.7); transition: filter 0.2s; }
.tile-wrap:hover .tile-cover img, .song-tile:focus-visible .tile-cover img { filter: none; }
.song-tile .tile-tags { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; align-items: center; }
.song-tile .src-badge { padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 11px; font-weight: 600; line-height: 1.6; }
/* nota: fundo escuro, letra na cor da nota */
/* coroa no card: 1º ouro, 2º prata, 3º bronze */
.song-tile .crown { display: grid; place-items: center; width: 26px; height: 24px; border-radius: 6px; background: rgba(4, 6, 16, 0.82); }
.song-tile .crown svg { width: 17px; height: 17px; }
.crown.c1 { color: #ffd166; } .crown.c1 svg { filter: drop-shadow(0 0 5px rgba(255, 209, 102, 0.6)); }
.crown.c2 { color: #d6dde8; } .crown.c2 svg { filter: drop-shadow(0 0 4px rgba(214, 221, 232, 0.45)); }
.crown.c3 { color: #e09a5f; } .crown.c3 svg { filter: drop-shadow(0 0 4px rgba(224, 154, 95, 0.45)); }
.song-tile .best { min-width: 28px; padding: 1px 8px; border-radius: 6px; background: rgba(4, 6, 16, 0.82); font-weight: 800; font-size: 14px; line-height: 1.45; text-align: center; color: #fff; }
.song-tile .best.grade-s { color: #ffd166; text-shadow: 0 0 8px rgba(255, 209, 102, 0.55); }
.song-tile .best.grade-a { color: var(--green); }
.song-tile .best.grade-b { color: var(--cyan); }
.song-tile .best.grade-c { color: var(--orange); }
.song-tile .best.grade-d { color: var(--red); }
.tile-more {
  position: absolute; top: 14px; right: 14px; z-index: 1;
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(6, 8, 20, 0.66); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background 0.15s;
}
.tile-more svg { width: 18px; height: 18px; }
.tile-more:hover, .tile-more[aria-expanded="true"] { background: rgba(var(--accent-rgb), 0.55); }
.tile-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* menu do "⋯" (dialog aberto sem ser modal, posicionado pelo jogo) */
.tile-menu {
  position: fixed; inset: auto; margin: 0; z-index: 60;
  min-width: 180px; padding: 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.35); border-radius: 12px;
  background: #0e1330; color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
.tile-menu[open] { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font: 500 14px inherit; font-family: inherit; text-align: left; cursor: pointer; white-space: nowrap;
}
.menu-item svg { width: 18px; height: 18px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: rgba(var(--accent-rgb), 0.16); outline: none; }
.menu-item:hover svg, .menu-item:focus-visible svg { color: var(--text); }
.menu-item.danger, .menu-item.danger svg { color: var(--red); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: rgba(255, 77, 109, 0.12); }

/* janela de compartilhar */
.dialog .share-song { margin: -4px 0 10px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row { display: flex; gap: 8px; margin-top: 16px; }
.share-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--text);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.share-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.share-copy { display: grid; place-items: center; padding: 0 12px; }
.share-copy svg { width: 20px; height: 20px; }
.dialog .share-msg { margin-top: 8px; font-size: 13px; color: var(--green); }
.dialog .share-msg.bad { color: var(--red); }
.share-msg:empty { display: none; }
.song-tile strong { font-size: 15px; font-weight: 600; }
.song-tile span { font-size: 13px; color: var(--muted); }
/* título e artista numa linha só: o que não couber termina em reticências */
.song-tile > strong, .song-tile > strong + span { display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* quem trouxe a música: foto pequena e nome (ou as barrinhas do EchoBeat, para a estação e as amostras) */
.song-tile .tile-by { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 8px; font-size: 12px; color: var(--muted); }
.song-tile .tile-by > span:last-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.avatar.tiny { width: 18px; height: 18px; border-width: 1px; }
.avatar.tiny svg { width: 11px; height: 11px; }
.avatar.station { display: flex; align-items: center; justify-content: center; gap: 1.5px; }
.avatar.station i { display: block; width: 2px; border-radius: 1px; background: #fff; height: 5px; }
.avatar.station i:nth-child(2) { height: 9px; }
.start-by { margin-top: 4px; font-size: 13px; color: var(--muted); }
/* música do desafio de hoje escolhida fora da tela do desafio: a partida vale como tentativa */
.start-daily { margin: 10px auto 12px; max-width: 340px; padding: 7px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; color: #ffd59a; background: rgba(255, 179, 92, 0.12); border: 1px solid rgba(255, 179, 92, 0.3); }
.song-tile .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--t-accent); box-shadow: 0 0 8px var(--t-accent); }

.field { display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 6px 12px; align-items: center; margin-top: 16px; }
.field:first-child { margin-top: 0; }
.field label { grid-column: 1 / -1; font-size: 14px; }
/* Reiniciar a história (Configurações): botão e explicação um embaixo do outro, não na grade dos controles deslizantes */
.field.story-reset { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.field.story-reset .hint { margin: 0; }
.field output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field.inline { grid-template-columns: minmax(0, 1fr) auto; }
.field.inline label { grid-column: auto; }
.toggle { display: flex; gap: 10px; align-items: center; margin-top: 18px; font-size: 14px; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 18px; height: 18px; }
#view-config .panel { max-width: 560px; }

select {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
select option { background: #11142a; }

.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ach {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.ach .medal {
  grid-row: span 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.15);
  color: var(--muted);
}
.ach.done .medal { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.4); }
.ach strong { font-size: 14px; font-weight: 600; }
.ach span { font-size: 12px; color: var(--muted); }
.ach .meter { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.ach .meter i { display: block; height: 100%; background: var(--accent); }

.results { width: min(380px, 100%); }
.results > p { margin: 0; }
.rank {
  font-size: 96px;
  font-weight: 700;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 20px rgba(var(--accent-rgb), 0.5));
}
.badge {
  display: inline-block;
  margin: 0 4px 8px !important;
  padding: 3px 12px;
  border-radius: 99px;
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.res-score { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; text-align: left; }
.res-grid div { background: rgba(255, 255, 255, 0.04); border-radius: 8px; padding: 8px 12px; }
.res-grid dt { font-size: 12px; color: var(--muted); }
.res-grid dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.c-perfect { color: var(--green) !important; }
.c-great { color: var(--cyan) !important; }
.c-good { color: var(--orange) !important; }
.c-miss { color: var(--red) !important; }

.spinner {
  width: 36px;
  height: 36px;
  margin: 4px auto 12px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* contagem 3, 2, 1 ao sair da pausa */
.countdown {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none;
  font-size: clamp(96px, 18vw, 180px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  background: rgba(4, 6, 14, 0.35);
  color: #fff; text-shadow: 0 0 32px rgba(var(--accent-rgb), 0.9), 0 4px 24px rgba(0, 0, 0, 0.6);
}
.countdown[hidden] { display: none; }
.countdown.tick { animation: count-tick 1s ease-out both; }
@keyframes count-tick {
  0% { opacity: 0; transform: scale(1.6); }
  18% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(0.9); }
}

/* o clipe atrás das colunas, cobrindo o palco (corta as laterais do 16:9). O player fica do tamanho de um vídeo
   480p e é ampliado (fitStageVideo no game.js), para o YouTube não subir a qualidade e parar para carregar */
.stage-video { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: #000; }
/* o navegador barrou o som sem toque (tablet, celular): o vídeo vem para a frente das notas e recebe o toque (game.js) */
.stage.video-tap-on .stage-video { z-index: 40; pointer-events: auto; opacity: 1 !important; filter: none !important; }
.video-tap { position: absolute; left: 50%; bottom: 12%; translate: -50% 0; z-index: 41; pointer-events: none; max-width: calc(100% - 32px); }
.video-tap span { display: block; padding: 12px 22px; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.15rem; text-align: center;
  transform: skewX(-10deg); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5); animation: video-tap-pulse 1.2s ease-in-out infinite; }
@keyframes video-tap-pulse { 50% { scale: 1.05; } }
.stage-video iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 854px;
  height: 480px;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  border: 0;
}

/* player da fila: fora da tela */
.yt-proc { position: fixed; left: -10000px; top: 0; width: 320px; height: 180px; }

.level-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; margin: -4px 0 16px; border: 1px solid var(--line); border-radius: 10px; }
.level-pick button {
  padding: 8px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 500 13px inherit;
  font-family: inherit;
  cursor: pointer;
}
.level-pick button:hover { color: var(--text); }
.level-pick button.active { background: rgba(var(--accent-rgb), 0.25); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.level-pick button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* pela largura do próprio card (a coluna do meio estreita com o painel da direita aberto) */
@container (max-width: 640px) { .songs-tools-row { grid-template-columns: minmax(0, 1fr); } }

/* celular: o botão embaixo do link, na largura toda */
@container (max-width: 420px) { .songs-tools-row .yt-add { flex-wrap: wrap; } .songs-tools-row .yt-add input { flex-basis: 100%; } .songs-tools-row .yt-add .btn { flex: 1; } }

.yt-warning { margin: 0 0 14px; padding: 10px 12px; border: 1px solid rgba(255, 180, 92, 0.5); border-radius: 10px; background: rgba(255, 180, 92, 0.1); color: #ffd7a8; font-size: 13px; line-height: 1.5; }
.yt-message { margin: 10px 0 0; font-size: 13px; color: var(--orange); min-height: 0; }
.yt-message:empty { display: none; }
.row-buttons.left { justify-content: flex-start; margin-top: 12px; }
.row-buttons.left:has(> [hidden]:only-child) { display: none; }

.yt-queue { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.yt-queue:empty { display: none; }
.yt-item { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.yt-item img { width: 72px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #111; }
.yt-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.yt-info strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-status { font-size: 12px; color: var(--muted); }
.yt-item.erro .yt-status { color: var(--red); }
.yt-item.pronta .yt-status { color: var(--green); }
.yt-item.processando .yt-status { color: var(--text); }
.yt-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.yt-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }
.yt-actions { display: flex; gap: 6px; }
.btn.small { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* configurar teclas */
.keys-config { margin-top: 16px; }
.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 10px; margin-top: 14px; } /* 5 colunas + o Fever */
.key-config { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; background: var(--panel-2); border-top: 3px solid var(--lane); }
.key-config-name { font-size: 12px; color: var(--muted); text-align: center; }
.key-slot {
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text);
  font: 600 14px inherit;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.key-slot.empty { border-style: dashed; border-color: var(--line); background: transparent; color: var(--muted); font-weight: 400; }
.key-slot.listening { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.25); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25); }
.key-slot:hover { border-color: var(--accent); }
.key-slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* janela de confirmação */
.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  border-radius: 14px;
  background: #0c1024;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.dialog::backdrop { background: rgba(3, 4, 14, 0.65); backdrop-filter: blur(2px); }
.dialog h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; }
.dialog p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.dialog .row-buttons { justify-content: flex-end; }

/* janela de editar música */
#edit-form { text-align: left; }
.edit-field { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.edit-field input { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; color: var(--text); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.edit-field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dialog .edit-orig { margin-top: 12px; font-size: 12px; overflow-wrap: anywhere; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.dialog .edit-error { margin-top: 8px; color: var(--red); font-size: 13px; }
.dialog .edit-error[hidden] { display: none; }
#edit-form .row-buttons { margin-top: 18px; }

.yt-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.yt-inline[hidden] { display: none; }

.source-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.source-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.source-tab svg { width: 28px; height: 28px; color: var(--accent); margin-bottom: 6px; }
.source-tab strong { font-size: 18px; font-weight: 600; }
.source-tab span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.source-tab:hover { border-color: var(--accent); transform: translateY(-2px); }
.source-tab.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.06));
  box-shadow: 0 0 0 1px var(--accent), 0 10px 30px rgba(var(--accent-rgb), 0.15);
}
.source-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* com uma aba aberta, os botões ficam mais baixos */
.source-tabs.compact .source-tab { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; }
.source-tabs.compact .source-tab svg { width: 22px; height: 22px; margin: 0; }
.source-tabs.compact .source-tab strong { font-size: 16px; }
.source-tabs.compact .source-tab span { display: none; }

.empty-state { max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state h2 { margin: 6px 0 0; font-size: 22px; font-weight: 600; }
.overlay .empty-state h2 { margin-bottom: 12px; } /* sem texto embaixo: o respiro até o botão fica no título */
.empty-state p { margin: 0 0 8px; line-height: 1.5; }
.empty-state .btn.big { width: auto; padding: 14px 32px; }
.empty-art {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px dashed rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}
.empty-art svg { width: 34px; height: 34px; }
.overlay .empty-state {
  padding: 30px 28px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 16px;
  background: rgba(10, 13, 32, 0.88);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.empty-state.inline { margin: 24px auto 0; padding: 32px 16px; border: 1px dashed var(--line); border-radius: 14px; max-width: none; }
.empty-state.inline[hidden] { display: none; }

.pf-tabs button[hidden] { display: none !important; } /* playlists fora de vista */

.ach-date { font-size: 11px; color: var(--muted); }
.ach-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin-top: 4px; }
.ach-progress small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ach.done strong { color: var(--text); }

.res-ach { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.res-ach[hidden] { display: none; }
.res-ach li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 0 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 10px;
  background: rgba(255, 209, 102, 0.08);
}
.res-ach svg { grid-row: span 2; width: 22px; height: 22px; color: #ffd166; }
.res-ach strong { font-size: 13px; }
.res-ach span { font-size: 12px; color: var(--muted); }

/* avisos de conquista: canto inferior direito, sobem da borda como os da Steam */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(340px, calc(100vw - 32px));
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: linear-gradient(180deg, #202a40, #141a2a);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.4);
  animation: toast-up 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 0.4s, transform 0.4s;
}
.toast.out { opacity: 0; transform: translateY(16px); }
.toast { pointer-events: auto; cursor: pointer; }
.toast.info svg { background: linear-gradient(145deg, rgba(var(--accent-rgb), 0.9), rgba(var(--accent-rgb), 0.55)); color: #fff; }
.toast.info div span { color: rgba(var(--accent-rgb), 1); filter: brightness(1.4); }

/* navegando pelo controle: foco bem visível */
.pad-nav :focus { outline: 3px solid var(--accent) !important; outline-offset: 3px; }
.pad-status { margin: 0 0 8px; font-size: 14px; }
.key-slot.fret { display: grid; place-items: center; min-height: 38px; font-size: 13px; cursor: default; }
#controle-cfg { margin-top: 16px; }
#controle-cfg .field.inline { margin-top: 14px; }
.toast svg {
  flex-shrink: 0; width: 56px; height: 56px; padding: 13px; box-sizing: border-box; border-radius: 4px;
  background: linear-gradient(145deg, #ffe08a, #e0a52c); color: #3a2604;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
@keyframes toast-up { from { opacity: 0; transform: translateY(28px); } }
.toast div { display: flex; flex-direction: column; gap: 1px; }
.toast span { font-size: 11px; color: #ffd166; letter-spacing: 0.04em; text-transform: uppercase; }
.toast strong { font-size: 15px; }
.toast small { font-size: 12px; color: var(--muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* Início: melhores pontuações */
/* 1, 2 ou 4 colunas (divisores de 8): as linhas sempre fecham */
#view-inicio { container-type: inline-size; }

@container (min-width: 1100px) { .best-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (max-width: 540px) { .best-grid { grid-template-columns: minmax(0, 1fr); } }

@container (min-width: 1100px) { #home-songs, #home-top { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container (max-width: 540px) { #home-songs, #home-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.small-text { font-size: 12px; margin: 0; line-height: 1.5; }

/* abas de origem no celular: as três lado a lado, ícone em cima e nome embaixo */
@media (max-width: 700px) {
  .source-tabs { gap: 8px; }
  .source-tabs.compact .source-tab { flex-direction: column; gap: 6px; padding: 12px 6px; text-align: center; }
  .source-tabs.compact .source-tab strong { font-size: 13px; line-height: 1.2; }
}

.avatar {
  position: relative; flex: none; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.35), rgba(176, 107, 255, 0.3));
  border: 1px solid rgba(var(--accent-rgb), 0.45); color: rgba(255, 255, 255, 0.85);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar img[hidden] { display: none; }
.avatar svg { width: 58%; height: 58%; }
.avatar img:not([hidden]) + svg { display: none; }
.avatar.big { width: 112px; height: 112px; border-width: 2px; }
.avatar.busy::after { content: ''; position: absolute; inset: 0; background: rgba(6, 8, 20, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23fff' stroke-width='2.5' stroke-dasharray='40 20'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='0.9s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center / 34px no-repeat; }

.profile-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; max-width: 760px; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 220px; text-align: center; }
.profile-photo .row-buttons { justify-content: center; }
.profile-photo .hint { margin-top: 8px; }
.profile-name .edit-field { margin-top: 0; }
.profile-msg { margin: 10px 0 0; font-size: 13px; color: var(--green); }
.profile-msg.bad { color: var(--red); }
.profile-msg:empty { display: none; }
#view-perfil > .panel + .panel { margin-top: 16px; max-width: 760px; }
.profile-note { margin-top: 0; }
.btn.danger { color: var(--red); border-color: rgba(255, 77, 109, 0.35); }
.btn.danger:hover:not(:disabled) { background: rgba(255, 77, 109, 0.1); }

.legal-links { margin: 22px 0 8px; font-size: 13px; color: var(--muted); }
.legal-links a, .login-legal a { color: var(--muted); text-underline-offset: 3px; }
.legal-links a:hover, .login-legal a:hover { color: var(--text); }

/* janela de entrar */
.login-buttons { margin-top: 18px; }
.login-btn { display: flex; align-items: center; justify-content: center; gap: 12px; text-decoration: none; }
.login-btn[hidden] { display: none; }
.login-btn b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-size: 14px; font-weight: 700; }
.login-btn.google { background: #fff; color: #1f1f1f; border-color: #fff; }
.login-btn.google:hover { background: #eef1f6 !important; }
.login-btn.google b { color: #4285f4; }
.login-btn.discord { background: #5865f2; color: #fff; border-color: #5865f2; }
.login-btn.discord:hover { background: #4752c4 !important; }
.login-btn.discord b { background: rgba(255, 255, 255, 0.18); }
.login-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dialog .login-legal { margin-top: 16px; font-size: 12px; }

#report-form { text-align: left; }
.report-reasons { display: grid; gap: 4px; margin: 14px 0 0; }
.report-reason { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.report-reason:hover { background: rgba(255, 255, 255, 0.04); }
.report-reason:has(input:checked) { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); }
.report-reason input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.report-reason:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.edit-field textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; color: var(--text); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; resize: vertical; }
.edit-field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dialog .report-note { margin-top: 10px; font-size: 12px; }
.dialog .report-note a { color: var(--accent); filter: brightness(1.3); }
#report-form .row-buttons { margin-top: 16px; }

.btn.gold {
  border: 0; color: #2a1a00; font-weight: 700;
  background: linear-gradient(90deg, #ffd76a, #f0a93a);
  box-shadow: 0 6px 24px rgba(240, 169, 58, 0.35);
}
.btn.gold:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(90deg, #ffd76a, #f0a93a); }
.btn.gold svg { fill: currentColor; }
.btn.gold[hidden] { display: none; }

.daily-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #ffcf6e; }

@container (max-width: 720px) { .daily-home { grid-template-columns: minmax(0, 1fr); } }

/* ranking */
.daily-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.daily-row { display: grid; grid-template-columns: 30px 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 8px; font-size: 14px; }
.daily-row.me { background: rgba(255, 207, 110, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 207, 110, 0.35); }
.daily-pos { font-weight: 700; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.daily-row:nth-child(1) .daily-pos { color: #ffd166; }
.daily-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily-res { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.daily-res .grade { color: var(--accent); }
.daily-res .grade.s { color: #ffd166; } .daily-res .grade.d { color: var(--red); }
.daily-gap { text-align: center; color: var(--muted); font-size: 12px; line-height: 1; }
.avatar.small { width: 28px; height: 28px; border-width: 1px; }
.daily-rank.big .daily-row { padding: 8px 10px; font-size: 15px; }
.daily-rank.big .avatar.small { width: 32px; height: 32px; }
.daily-rank.big .daily-row { grid-template-columns: 34px 32px minmax(0, 1fr) auto; }

/* tela do desafio */
.daily-card { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 16px;
  border-color: rgba(255, 207, 110, 0.35); background: linear-gradient(135deg, rgba(255, 207, 110, 0.08), var(--panel) 55%); }
.daily-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: #111; }
.daily-info h2 { margin: 4px 0 2px; font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.daily-info p { margin: 0; }
.daily-ends { margin-top: 6px !important; font-size: 13px; color: #ffcf6e; }
.daily-action { grid-column: 1 / -1; }
.daily-state { margin: 0; line-height: 1.5; }
.daily-state:empty { display: none; }
#daily-bar { margin-top: 10px; height: 6px; }
#daily-bar[hidden] { display: none; }
.daily-action .row-buttons { margin-top: 12px; }
.daily-action .btn.big { width: auto; padding: 13px 28px; }
#daily-play[hidden], #daily-login[hidden] { display: none; }
#daily-tries:empty { display: none; }
#daily-status-msg:empty { display: none; }
@container (max-width: 640px) { .daily-card { grid-template-columns: minmax(0, 1fr); } }
/* desafio: o card do dia e o ranking lado a lado; embaixo, os 6 anteriores */
.daily-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.daily-top .daily-card { margin-bottom: 0; }
@container (min-width: 641px) { .daily-top .daily-card { grid-template-columns: 150px minmax(0, 1fr); gap: 16px; } }
.daily-rank-panel .panel-head { align-items: center; }
#daily-past-sec { margin-top: 26px; }
#daily-past-sec[hidden] { display: none; }
.daily-past { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } /* 6 cartões: 3 + 3 */
@container (max-width: 640px) { .daily-past { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.daily-past-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; min-width: 0; }
.daily-past-song { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.daily-past-song img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.daily-past-info { display: grid; gap: 2px; min-width: 0; }
.daily-past-info strong, .daily-past-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily-past-info span { font-size: 12px; color: var(--muted); }
.daily-past-song:hover strong { text-decoration: underline; }
.daily-past-me { margin: 0; font-size: 13px; color: var(--muted); }
.daily-past-me:empty { display: none; }
.daily-past-card .board-scope.wide { margin: 0; }
.daily-past-card .daily-row { grid-template-columns: 26px 24px minmax(0, 1fr) auto; gap: 8px; padding: 4px 6px; font-size: 13px; }
.daily-past-card .avatar.small { width: 24px; height: 24px; }
.daily-past-card .small-text { margin: 0; }
.daily-past-card .small-text[hidden], #daily-rank-empty[hidden] { display: none; }
@container (max-width: 1000px) { .daily-past { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 700px) { .daily-top { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 560px) { .daily-past { grid-template-columns: minmax(0, 1fr); } }
#view-desafio { container-type: inline-size; }

/* durante uma tentativa do desafio: Normal fixo, sem reiniciar (seria uma chance a mais) */
body.daily-run #start-levels, body.daily-run #btn-restart, body.daily-run #btn-replay { display: none !important; }
body.daily-run #start-level { display: inline-flex !important; }
.res-daily { color: #ffcf6e !important; }
.res-daily[hidden] { display: none; }

/* aviso de estatísticas de uso (Google Analytics só depois do "Aceitar") */
.consent {
  position: fixed; left: 50%; bottom: 20px; z-index: 70; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); padding: 16px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.45); border-radius: 14px;
  background: #0d1128; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: consent-in 0.3s ease-out;
}
@keyframes consent-in { from { opacity: 0; transform: translate(-50%, 16px); } }
.consent[hidden] { display: none; }
.consent strong { font-size: 15px; font-weight: 600; }
.consent p { margin: 6px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.consent a, .toggle a { color: var(--accent); filter: brightness(1.3); text-underline-offset: 3px; }
.consent-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.consent-buttons .btn { padding: 9px 18px; font-size: 14px; }

.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (max-width: 1060px) {
  .keys-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (max-width: 700px) {
  .profile-card { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .profile-photo { width: auto; }
  .consent-buttons .btn { flex: 1; }
  /* balões no alto, para não cobrir os botões do resultado nem o menu */
  .toasts { top: 62px; bottom: auto; left: 10px; right: 10px; }
  .toast { width: 100%; padding: 8px 12px 8px 8px; }
  .toast svg { width: 42px; height: 42px; padding: 10px; }
  @keyframes toast-up { from { opacity: 0; transform: translateY(-18px); } }
  /* resultado compacto */
  .ov-card { padding: 18px 16px; }
  .rank { font-size: 68px; }
  .res-score { font-size: 26px; }
  .res-grid { gap: 6px; margin-top: 12px; }
  .res-grid div { padding: 6px 10px; }
  .res-grid dd { font-size: 16px; }
  .res-ach { margin-top: 10px; gap: 4px; }
  /* músicas: 2 por linha */
  .song-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .song-tile { padding: 8px 8px 10px; }
  .song-tile strong { font-size: 14px; }
  .song-tile span { font-size: 12px; }
  .hud-combo strong { font-size: 34px; }
  .hud-score strong { font-size: 20px; }
  .hud-progress { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .hud-combo strong.bump { animation: none; }
  .countdown.tick { animation: none; }
  .toast { animation: none; }
  .toast.out { transform: none; }
  .btn, .song-tile { transition: none; }
}

.btn.with-icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.with-icon svg { width: 18px; height: 18px; }
.btn.with-icon.small svg { width: 15px; height: 15px; }
.btn.preparing { opacity: 0.55; cursor: progress; } /* Jogar enquanto o vídeo pré-carrega */
/* "Preparando…": um círculo girando antes do texto */
.btn.preparing::before {
  content: ''; display: inline-block; width: 0.9em; height: 0.9em; margin-right: 0.5em; vertical-align: -0.12em;
  border: 0.15em solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btn-spin 0.8s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn.with-icon.icon-only { padding-left: 14px; padding-right: 14px; } /* Compartilhar no resultado: cabe ao lado de Jogar de novo e Outra música */
.btn.with-icon[hidden] { display: none; }
.btn.with-icon.primary svg { fill: currentColor; }
.btn.with-icon:not(.primary) svg { fill: none; }

#view-playlists, #view-compartilhada { container-type: inline-size; }

/* editor */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 6px 4px 0;
  border: 0; background: none; color: var(--muted); font: 500 14px inherit; font-family: inherit; cursor: pointer;
}
.back-link svg { width: 18px; height: 18px; }
.back-link:hover { color: var(--text); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

@container (max-width: 860px) { .pl-columns { grid-template-columns: minmax(0, 1fr); } }

/* resultado e início de música no meio de uma playlist */
.res-pl { margin: 14px 0 0 !important; font-size: 13px; color: var(--muted); }

/* telas estreitas: a linha vira dois andares (nome em cima, as duas notas embaixo) */
@container (max-width: 720px) {
  .sh-cols { display: none; }
  .sh-row { grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr) 40px; grid-template-areas: "img info info play" "img them you play"; gap: 6px 12px; }
  .sh-row > .pl-num { display: none; }
  .sh-row > img { grid-area: img; width: 72px; align-self: start; }
  .sh-row > .pl-item-info { grid-area: info; }
  .sh-row > .sh-score:nth-child(4) { grid-area: them; }
  .sh-row > .sh-score:nth-child(5) { grid-area: you; }
  .sh-row > .sh-play { grid-area: play; width: 40px; height: 40px; }
  .sh-score { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
  .sh-score-who { display: block; flex-basis: 100%; font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sh-score strong { font-size: 15px; }
  .sh-score span { white-space: normal; }
  .sh-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .sh-head .avatar.big { width: 72px; height: 72px; }
  .sh-head h1 { font-size: 24px; }
  .pl-item { grid-template-columns: 28px 56px minmax(0, 1fr) 32px auto; gap: 8px; }
  .pl-items.unsaved .pl-item { grid-template-columns: 28px 56px minmax(0, 1fr) auto; }
  .pl-item > .pl-num, .pl-item > .pl-dur { display: none; }
  .pl-item img, .pl-pick-row img { width: 56px; }
  .pl-pick-row .pl-dur { display: none; }
  .pl-pick-row { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; }
}

/* conquista oculta, depois de conquistada */
.ach.done.secret .medal { border-color: #ffcf6e; color: #ffcf6e; background: rgba(255, 196, 80, 0.08); box-shadow: 0 0 16px rgba(255, 196, 80, 0.35); }
.ach-secret { grid-column: 2; justify-self: start; display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px; border: 1px dashed rgba(255, 196, 80, 0.55); color: #ffcf6e; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ranking da música: linha na tela da música, card no painel, janela e linha no resultado */
.start-board { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 0 0 12px; padding: 8px 12px; border-radius: 10px;
  background: rgba(255, 209, 102, 0.08); border: 1px solid rgba(255, 209, 102, 0.25); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.start-board[hidden] { display: none; }
.start-board:hover, .start-board:focus-visible { background: rgba(255, 209, 102, 0.14); }
.start-board svg { flex: none; width: 16px; height: 16px; color: #ffd166; }
.start-board svg.chev { width: 14px; height: 14px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 2; }
.start-board span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.board-dialog { width: min(460px, calc(100vw - 32px)); }
.board-dialog .level-pick { margin: 4px 0 12px; }
.board-dialog .level-pick[hidden] { display: none; }
.board-dialog .daily-rank { min-height: 40px; }
.board-dialog .small-text { margin: 10px 0 0; }
.res-board[hidden] { display: none; }

/* perfil público (/echobeat/u/<código>) */
.pf-msg:empty { display: none; }
.pf-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; }
.avatar.huge { width: 112px; height: 112px; border-width: 2px; }
.avatar.huge svg { width: 52px; height: 52px; }
.pf-info h1 { margin: 0; font-size: 28px; overflow-wrap: anywhere; }
.pf-bio { margin: 8px 0 0; max-width: 62ch; white-space: pre-line; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; color: var(--text); opacity: 0.9; }
.pf-bio[hidden] { display: none; }
.pf-counts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; }
.pf-count { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.pf-count b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-count:not(.static):hover span, .pf-count:not(.static):focus-visible span { text-decoration: underline; }
.pf-count.static, .pf-count:disabled { cursor: default; color: var(--muted); }
.pf-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-self: start; }
.pf-actions [hidden] { display: none; }
/* abas do perfil (Melhores pontuações, Últimas partidas, Playlists, Músicas na Biblioteca) */
.board-scope.wide.pf-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 22px 0 16px; }
.board-scope.wide.pf-tabs button { padding: 9px 10px; font-size: 14px; }
.pf-tab[hidden] { display: none; }
.pf-more { margin-top: 12px; }
.pf-more[hidden] { display: none; }
.pf-best-row.recent { grid-template-columns: 64px minmax(0, 1fr) auto; padding-left: 8px; }
@media (max-width: 700px) { .board-scope.wide.pf-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; margin-top: 16px; } }
#pf-pl-sec[hidden] { display: none; }
.pf-mine { margin: -6px 0 12px; }
.pf-best { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pf-best-row { display: grid; grid-template-columns: 24px 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 8px 14px 8px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pf-best-row:hover, .pf-best-row:focus-visible { border-color: var(--accent); }
.pf-best-n { color: var(--muted); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.pf-best-row img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.pf-best-info { display: grid; gap: 2px; min-width: 0; }
.pf-best-info strong, .pf-best-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-best-info span { font-size: 13px; color: var(--muted); }
.pf-best-res { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; justify-items: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-best-res small { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.pf-best-res .grade { color: var(--accent); }
.pf-best-res .grade.s { color: #ffd166; } .pf-best-res .grade.d { color: var(--red); }

@media (max-width: 700px) {
  .pf-head { grid-template-columns: auto minmax(0, 1fr); gap: 16px; }
  .avatar.huge { width: 76px; height: 76px; }
  .pf-info h1 { font-size: 22px; }
  .pf-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .pf-best-row { grid-template-columns: 20px 52px minmax(0, 1fr) auto; gap: 10px; }
  .pf-best-row img { width: 52px; height: 40px; }
  .pf-best-row.recent { grid-template-columns: 52px minmax(0, 1fr) auto; }
}

/* nome que leva ao perfil (rankings, desafio, "Trazida por") */
.link-name { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.link-name:hover, .link-name:focus-visible, .tile-by-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.tile-by-name { cursor: pointer; }
.start-by .link-name { color: var(--text); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 2px; }

.board-scope { display: inline-flex; flex: none; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.board-scope button { padding: 4px 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.board-scope button.active { background: rgba(var(--accent-rgb), 0.25); color: var(--text); }
.board-scope.wide { display: flex; margin: 4px 0 10px; }
.board-scope.wide button { flex: 1; padding: 6px 10px; font-size: 13px; }

/* seguidores / seguindo (o seu perfil) */
.follows-dialog { width: min(420px, calc(100vw - 32px)); }
.follows-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 50vh; overflow: auto; }
.follow-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.follow-who { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.follow-who span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow-who:hover span:last-child { text-decoration: underline; }
.follows-dialog .small-text:empty { display: none; }

/* editar perfil: bio e o que aparece no perfil público */
.bio-count { float: right; font-variant-numeric: tabular-nums; }
.profile-sub { margin: 20px 0 0; font-size: 14px; font-weight: 600; }
#profile-form .profile-sub + .toggle, #profile-form .toggle + .toggle { margin-top: 10px; }
/* perfil privado: as escolhas do perfil público ficam apagadas */
#profile-form .toggle.off { opacity: 0.45; cursor: default; }
.pf-private-note { margin: 14px 0; }
.pf-counts[hidden], .board-scope.pf-tabs[hidden] { display: none; }
#profile-bio { resize: vertical; }
.profile-name .hint + .edit-field { margin-top: 16px; }

