:root {
  color-scheme: dark;
  --bg: #08070d;
  --bg-soft: #11101a;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.13);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f8f7ff;
  --muted: #b8b4c7;
  --primary: #ff1f57;
  --primary-2: #ff8a00;
  --accent: #7c3cff;
  --success: #29e6a7;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 31, 87, 0.26), transparent 34rem),
    radial-gradient(circle at 85% 15%, rgba(124, 60, 255, 0.22), transparent 28rem),
    linear-gradient(180deg, #14101d 0%, var(--bg) 38%, #050409 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 7, 13, 0.82);
  backdrop-filter: blur(18px);
}

.brand,
.main-nav,
.hero-actions,
.hero-stats,
.section-heading,
.score-board,
.mini-stats {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 28px rgba(255, 31, 87, 0.28);
  font-size: 0.8rem;
  letter-spacing: 0;
}

.brand-logo {
  width: clamp(10rem, 19vw, 15rem);
  height: 4.2rem;
  object-fit: contain;
  object-position: left center;
}

.main-nav {
  gap: 1.35rem;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.main-nav a:hover,
.section-heading a:hover {
  color: var(--text);
}

.ghost-button,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ghost-button {
  padding: 0.75rem 1.05rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.25rem;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 16px 40px rgba(255, 31, 87, 0.28);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.small {
  padding: 0.7rem 1rem;
}

.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.connect-button:hover,
.challenge-button:hover {
  transform: translateY(-2px);
}

main {
  width: min(1180px, calc(100% - clamp(0.75rem, 4vw, 2rem)));
  margin: 0 auto;
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(310px, 0.82fr);
  gap: 2rem;
  align-items: stretch;
  padding: clamp(3rem, 8vw, 7rem) 0 3rem;
}

.hero-copy {
  display: grid;
  align-content: center;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--success);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 1.15rem;
  font-size: clamp(2.6rem, 7vw, 5.9rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: -0.055em;
}

.hero-text,
.panel-copy {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-actions {
  gap: 0.8rem;
  flex-wrap: wrap;
  margin: 1.1rem 0 1.8rem;
}

.hero-stats,
.mini-stats {
  gap: 0.8rem;
  flex-wrap: wrap;
  color: var(--muted);
}

.login-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: 520px;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.9rem;
}

.login-card strong {
  display: block;
}

.login-card p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.hero-stats span,
.mini-stats span,
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.6rem 0.85rem;
}

.hero-stats strong,
.mini-stats strong {
  color: var(--text);
}

.featured-card,
.panel,
.battle-card,
.singer-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--card-strong), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.featured-card {
  position: relative;
  overflow: hidden;
  min-height: 470px;
  padding: 2rem;
  border-radius: 2rem;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.82)),
    radial-gradient(circle at 50% 22%, rgba(255, 138, 0, 0.38), transparent 15rem),
    linear-gradient(135deg, rgba(255, 31, 87, 0.45), rgba(124, 60, 255, 0.34));
}

.featured-card::after {
  content: "";
  position: absolute;
  inset: auto -15% -18% 18%;
  height: 58%;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent);
  filter: blur(8px);
}

.featured-card h2,
.featured-card p,
.score-board,
.live-badge {
  position: relative;
  z-index: 1;
}

.featured-card h2 {
  margin-top: 13rem;
}

.live-badge {
  display: inline-flex;
  border-radius: 999px;
  background: var(--primary);
  padding: 0.42rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-board {
  gap: 0.8rem;
  margin-top: 1.3rem;
}

.score-board div {
  flex: 1;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.34);
  padding: 1rem;
}

.score-board span,
.battle-meta,
.singer-style {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.score-board strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.7rem;
}

.content-section,
.grid-layout {
  padding: 2rem 0;
}

.section-heading {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading.compact {
  align-items: flex-start;
}

.section-heading a,
.pill {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.stage-row,
.battle-grid,
.singer-grid,
.song-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stage-card {
  min-height: 230px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  padding: 1.2rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
}

.stage-card span,
.stage-card strong {
  position: relative;
  z-index: 1;
  display: block;
}

.stage-card span {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 900;
}

.stage-card strong {
  margin-top: 7.5rem;
  font-size: 1.25rem;
  line-height: 1.1;
}

.pop {
  background: radial-gradient(circle at 80% 20%, rgba(255, 31, 87, 0.72), transparent 9rem), #191122;
}

.sertanejo {
  background: radial-gradient(circle at 80% 20%, rgba(255, 138, 0, 0.72), transparent 9rem), #191122;
}

.rock {
  background: radial-gradient(circle at 80% 20%, rgba(124, 60, 255, 0.72), transparent 9rem), #191122;
}

.gospel {
  background: radial-gradient(circle at 80% 20%, rgba(41, 230, 167, 0.55), transparent 9rem), #191122;
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1rem;
}

.panel {
  border-radius: 1.6rem;
  padding: 1.3rem;
}

.ranking-list {
  display: grid;
  gap: 0.72rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.ranking-item,
.battle-header,
.singer-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.ranking-item {
  justify-content: space-between;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.85rem;
}

.rank-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.rank-number,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  font-weight: 900;
}

.rank-number {
  width: 2.2rem;
  height: 2.2rem;
  background: rgba(255, 255, 255, 0.1);
}

.avatar {
  width: 2.85rem;
  height: 2.85rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.rank-name,
.singer-name {
  display: block;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-genre {
  color: var(--muted);
  font-size: 0.84rem;
}

.rank-score {
  color: var(--success);
  font-size: 1.25rem;
  font-weight: 900;
}

.meter {
  height: 0.95rem;
  overflow: hidden;
  margin: 1.2rem 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--success));
}

.battle-card,
.singer-card,
.song-card {
  border-radius: 1.35rem;
  padding: 1rem;
}

.song-card {
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 31, 87, 0.28), transparent 8rem),
    linear-gradient(145deg, var(--card-strong), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
}

.song-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.9rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
}

.song-card h3 {
  margin: 0.8rem 0 0.35rem;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.song-card p {
  color: var(--muted);
  margin-bottom: 1rem;
}

.song-card small {
  display: block;
  margin: -0.5rem 0 1rem;
  color: var(--muted);
}

.favorite-list.compact-list {
  display: grid;
  gap: 0.5rem;
}

.compact-song-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 0.9rem;
  padding: 0.65rem 0.75rem;
  min-height: 56px;
}

.compact-song-cover {
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.compact-song-main {
  min-width: 0;
}

.compact-song-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.compact-song-main span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-song-actions {
  display: flex;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.compact-song-actions .small {
  padding: 0.42rem 0.62rem;
  font-size: 0.76rem;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.7rem;
}

.profile-stat-card {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.28);
  padding: 0.85rem 0.9rem;
}

.profile-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.profile-stat-card strong {
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.top-songs-wrap {
  margin-top: 1rem;
}

.top-songs-wrap h3 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.top-songs-list {
  display: grid;
  gap: 0.55rem;
}

.top-song-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.65rem 0.75rem;
}

.top-song-item strong,
.top-song-item span {
  display: block;
}

.top-song-item strong {
  font-size: 0.94rem;
}

.top-song-item div span {
  color: var(--muted);
  font-size: 0.8rem;
}

.top-song-metrics {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
  white-space: nowrap;
}

.song-genre {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(41, 230, 167, 0.12);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 0.42rem 0.7rem;
  text-transform: uppercase;
}

.lyrics-panel {
  margin-top: 1rem;
}

.lyrics-box {
  overflow-x: auto;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font: inherit;
  line-height: 1.8;
  padding: 1rem;
  white-space: pre-wrap;
}

.lyrics-panel audio {
  width: 100%;
}

.youtube-player {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.28);
}

.youtube-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-analysis-wrap {
  margin-top: 0.9rem;
}

.pitch-overlay {
  width: 100%;
  height: 140px;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}

.pitch-monitor {
  margin-top: 0.8rem;
}

.pitch-monitor-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.pitch-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 7, 13, 0.78);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  padding: 0.45rem 0.7rem;
}

.user-badge {
  color: var(--success);
}

.song-badge {
  color: #ff9a3d;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.song-upload-form {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.song-upload-form label,
.youtube-search-box label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.song-upload-form input,
.song-upload-form textarea,
.youtube-search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  padding: 0.85rem;
}

.song-upload-form input[type="file"] {
  cursor: pointer;
}

.song-upload-form textarea {
  resize: vertical;
}

.full-field,
.song-upload-form button {
  grid-column: 1 / -1;
}

.youtube-search-box {
  display: grid;
  align-content: start;
  gap: 0.8rem;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.youtube-results {
  display: grid;
  gap: 0.65rem;
  max-height: 360px;
  overflow: auto;
}

#songChooserPanel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

/* Barra de busca / filtros do repertório (#escolher-musica) */
#buscar-repertorio {
  scroll-margin-top: 5.75rem;
}

.song-chooser-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  padding: 1.05rem 1.15rem 1.15rem;
  border-radius: 1.35rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.1) 0%, transparent 42%),
    linear-gradient(180deg, rgba(8, 7, 13, 0.2), rgba(0, 0, 0, 0.35));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 40px rgba(0, 0, 0, 0.22);
}

.song-chooser-field {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin: 0;
  min-width: 0;
}

.song-chooser-field-label {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.song-chooser-input-shell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 1rem 0.72rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.38);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.song-chooser-input-shell:focus-within {
  border-color: rgba(255, 31, 87, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 31, 87, 0.2);
}

.song-chooser-search-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  opacity: 0.72;
  background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.song-chooser-search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  outline: none;
}

.song-chooser-search-input::placeholder {
  color: rgba(184, 180, 199, 0.72);
  font-weight: 500;
}

.song-chooser-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.song-chooser-toolbar-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.song-chooser-toolbar-actions--solo {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 0;
}

.song-chooser-select-shell {
  position: relative;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.32);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.song-chooser-select-shell:focus-within {
  border-color: rgba(124, 60, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 60, 255, 0.16);
}

.song-chooser-select-shell::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.28rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
  opacity: 0.85;
}

.song-chooser-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.68rem 2.35rem 0.68rem 0.95rem;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.song-chooser-clear-btn {
  border-radius: 1rem;
  align-self: stretch;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .song-chooser-toolbar {
    flex-direction: row;
    align-items: flex-end;
    gap: 1.15rem;
    padding: 1rem 1.25rem 1.15rem;
  }

  .song-chooser-search-block {
    flex: 1 1 auto;
    min-width: 0;
  }

  .song-chooser-toolbar-actions {
    flex: 1 1 42%;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.7rem;
    min-width: 0;
  }

  .song-chooser-toolbar-actions--solo {
    flex: 0 0 auto;
    min-width: 0;
  }

  .song-chooser-clear-btn {
    flex: 0 0 auto;
    align-self: end;
  }
}

#favoritesGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  min-width: 0;
  width: 100%;
}

#songsByStyleGrid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

#songsByStyleGrid .style-block.panel {
  padding: 1rem 1.05rem;
}

.style-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.7rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.style-block-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.style-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.style-song-list {
  display: grid;
  gap: 0.5rem;
}

.style-song-row.compact-song-card {
  align-items: center;
}

.style-song-cover-placeholder {
  width: 64px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 0.55rem;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.youtube-result {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.65rem;
}

.youtube-result img {
  width: 88px;
  height: 50px;
  border-radius: 0.7rem;
  object-fit: cover;
}

.youtube-result strong,
.youtube-result span {
  display: block;
}

.youtube-result strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.youtube-result span,
.compact-copy {
  color: var(--muted);
  font-size: 0.85rem;
}

.battle-card {
  display: grid;
  gap: 1rem;
}

.battle-header,
.singer-header {
  justify-content: space-between;
}

.battle-title,
.singer-card p {
  margin: 0;
}

.battle-title {
  font-size: 1.05rem;
  font-weight: 900;
}

.battle-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.8rem;
  align-items: center;
  text-align: center;
}

.battle-score strong {
  font-size: 1.6rem;
}

.versus {
  color: var(--muted);
  font-weight: 900;
}

.challenge-button,
.connect-button {
  width: 100%;
  border: 0;
  border-radius: 0.9rem;
  cursor: pointer;
  padding: 0.8rem 1rem;
  color: white;
  font-weight: 900;
}

.challenge-button {
  background: linear-gradient(135deg, var(--accent), var(--primary));
}

.connect-button {
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.12);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.recorder-panel,
.score-panel {
  min-height: 100%;
}

.recorder-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.2rem 0;
}

.danger-button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff204d, #a50034);
  box-shadow: 0 16px 40px rgba(255, 31, 87, 0.28);
  color: white;
  cursor: pointer;
  font-weight: 900;
  padding: 0.9rem 1.25rem;
}

.recording-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

.recording-dot.active {
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(255, 31, 87, 0.75);
  animation: pulse 1.2s infinite;
}

.status-message {
  color: var(--muted);
  line-height: 1.6;
}

.playback-card {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 1rem;
}

.playback-card h3,
.singer-card h3 {
  margin: 0 0 0.75rem;
}

.playback-card audio {
  width: 100%;
}

.score-panel h2 {
  margin: 0.8rem 0 0;
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: 0.9;
}

.singer-card p {
  color: var(--muted);
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  max-width: 340px;
  transform: translateY(1rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(13, 12, 20, 0.92);
  box-shadow: var(--shadow);
  opacity: 0;
  padding: 1rem;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 0.75rem rgba(255, 31, 87, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 31, 87, 0);
  }
}

@media (max-width: 980px) {
  .hero,
  .grid-layout,
  .upload-panel {
    grid-template-columns: 1fr;
  }

  .stage-row,
  .battle-grid,
  .singer-grid,
  .song-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: center;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.85rem clamp(0.65rem, 3vw, 1.1rem);
  }

  .brand {
    justify-content: center;
    width: 100%;
  }

  .brand-logo {
    object-position: center center;
    width: clamp(9.5rem, 58vw, 14rem);
    height: auto;
    max-height: 3.35rem;
  }

  .main-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    gap: 0.42rem 0.5rem;
    row-gap: 0.38rem;
    padding: 0 0.1rem 0.1rem;
    overflow-x: visible;
  }

  .main-nav a {
    flex: 0 1 auto;
    padding: 0.4rem 0.62rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    font-size: clamp(0.72rem, 3.1vw, 0.86rem);
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
  }

  .main-nav a:active {
    background: rgba(255, 255, 255, 0.12);
  }

  .topbar > .ghost-button {
    width: 100%;
    max-width: min(22rem, 100%);
    justify-content: center;
    padding: 0.62rem 1rem;
    font-size: clamp(0.78rem, 3.4vw, 0.9rem);
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  .hero {
    padding-top: 2.2rem;
  }

  .featured-card {
    min-height: 390px;
  }

  .section-heading,
  .battle-header,
  .singer-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stage-row,
  .battle-grid,
  .singer-grid,
  .song-grid {
    grid-template-columns: 1fr;
  }

  .profile-stats-grid {
    grid-template-columns: 1fr;
  }

  .top-song-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-song-metrics {
    text-align: left;
    white-space: normal;
  }

  .song-upload-form {
    grid-template-columns: 1fr;
  }

  .search-row,
  .youtube-result {
    grid-template-columns: 1fr;
  }

  .song-chooser-toolbar {
    padding: 0.95rem 1rem 1.05rem;
  }

  .song-chooser-toolbar-actions {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .song-chooser-toolbar-actions--solo {
    justify-content: stretch;
  }

  /* Evita zoom automático no iOS ao focar campos */
  #songChooserPanel .song-chooser-search-input {
    font-size: 16px;
  }

  #songChooserPanel .song-chooser-clear-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  #escolher-musica .panel {
    padding: 1rem 0.85rem;
    border-radius: 1.25rem;
    max-width: 100%;
    overflow-x: hidden;
  }

  #escolher-musica .section-heading {
    width: 100%;
  }

  #escolher-musica .section-heading .secondary-button {
    width: 100%;
    max-width: 100%;
    justify-content: center;
  }

  #escolher-musica #favoritesGrid .panel h2 {
    font-size: clamp(1.05rem, 5vw, 1.35rem);
    line-height: 1.25;
    word-break: break-word;
  }

  .compact-song-card {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.65rem;
  }

  .compact-song-main {
    flex: 1 1 calc(100% - 4.5rem);
    min-width: 0;
  }

  .compact-song-main strong {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
  }

  .compact-song-main span {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
  }

  .compact-song-actions {
    flex: 1 1 100%;
    width: 100%;
    justify-content: stretch;
    flex-wrap: nowrap;
  }

  .compact-song-actions .small {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 0.5rem 0.45rem;
  }

  .style-block-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .style-count {
    white-space: normal;
  }

  .youtube-result img {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 380px) {
  .compact-song-cover,
  .style-song-cover-placeholder {
    width: 52px;
    height: 34px;
  }

  .compact-song-main {
    flex: 1 1 calc(100% - 3.75rem);
  }
}
