:root {
  --bg-primary: #0a0a0f;
  --bg-card: rgba(20, 20, 30, 0.7);
  --bg-card-hover: rgba(30, 30, 45, 0.9);
  --bg-card-active: rgba(50, 20, 80, 0.5);
  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-subtle: rgba(139, 92, 246, 0.15);
  --border-active: rgba(139, 92, 246, 0.6);
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(rgba(15, 15, 19, 0.85), rgba(15, 15, 19, 0.85)), url('../img/background.png');
  background-size: cover;
  background-attachment: scroll;
  background-position: center;
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow: hidden;
}

/* Header */
header {
  width: 100%;
  background: rgba(26, 26, 36, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 1.6rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 8px;
}

/* Now Playing Bar */
.now-playing-bar {
  width: 100%;
  background: rgba(30, 30, 46, 0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.ctrl-btn:hover {
  color: var(--accent);
  background: rgba(139, 92, 246, 0.15);
}

.ctrl-btn:active {
  transform: scale(0.95);
}

.ctrl-btn.play-btn {
  background: rgba(139, 92, 246, 0.2);
  color: var(--accent);
}

.ctrl-btn.play-btn:hover {
  background: var(--accent);
  color: white;
}

.ctrl-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.station-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-name.idle {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}

/* Wave Animation */
.wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.wave span {
  display: block;
  width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite;
}

.wave span:nth-child(1) { height: 6px;  animation-delay: 0s; }
.wave span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.wave span:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.wave span:nth-child(4) { height: 18px; animation-delay: 0.3s; }
.wave span:nth-child(5) { height: 5px;  animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.35); }
}

.wave.hidden {
  display: none;
}

/* Volume */
.volume-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border-subtle);
}

.volume-group label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.volume-icon {
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.volume-icon:hover {
  color: var(--accent);
}

input[type="range"] {
  width: 90px;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(60, 60, 80, 0.5);
  border-radius: 3px;
  cursor: pointer;
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--accent-glow);
}

/* Main Content */
main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  padding: 0 24px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.grid-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 24px 24px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.grid-container::-webkit-scrollbar {
  display: none;
}

.grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Card */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  animation: fadeInLeft 0.4s ease backwards;
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.25s;
}

.card:hover,
.card:focus-visible {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
  transform: translateX(4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  outline: none;
}

.card:focus-visible {
  box-shadow: 0 0 0 2px var(--accent), 0 6px 20px rgba(0, 0, 0, 0.3);
}

.card:hover::before,
.card:focus-visible::before {
  opacity: 1;
}

.card.active {
  border-color: var(--accent);
  background: var(--bg-card-active);
  box-shadow: 0 0 15px var(--accent-glow);
}

.card.active::before {
  opacity: 1;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-light) 100%);
}

.card .flag {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card .name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .meta {
  display: flex;
  gap: 6px;
}

.card .meta span {
  font-size: 0.65rem;
  color: var(--text-secondary);
  background: rgba(60, 60, 80, 0.4);
  border-radius: 4px;
  padding: 2px 6px;
  font-weight: 500;
}

.card .meta span.genre {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(167, 139, 250, 0.2) 100%);
  color: var(--accent-light);
}

.play-indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.card:hover .play-indicator {
  background: rgba(139, 92, 246, 0.25);
}

.card.active .play-indicator {
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
}

/* Footer */
footer {
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-align: center;
  flex-shrink: 0;
  margin-top: auto;
}

@media (max-width: 768px) {
  footer {
    padding: 10px 16px;
  }
}

/* Audio (hidden) */
audio {
  display: none;
}

/* Emoji sizing */
img.emoji {
  height: 1.4rem;
  width: auto;
  vertical-align: middle;
}

/* =====================
   MOBILE / CARRO
   ===================== */
@media (max-width: 768px) {
  body {
    background-color: #0f0f13;
    min-height: 100dvh;
  }

  header {
    padding: 12px 16px;
  }

  .logo {
    font-size: 1.2rem;
    gap: 8px;
  }

  .logo-icon {
    font-size: 1.4rem;
  }

  .subtitle {
    display: none;
  }

  .now-playing-bar {
    padding: 10px 12px;
    gap: 10px;
    flex-wrap: nowrap;
    min-height: 52px;
  }

  .controls {
    gap: 2px;
  }

  .ctrl-btn {
    padding: 5px;
  }

  .ctrl-btn svg {
    width: 16px;
    height: 16px;
  }

  .ctrl-btn.play-btn svg {
    width: 18px;
    height: 18px;
  }

  .station-name {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
  }

  .station-name.idle {
    font-size: 0.9rem;
  }

  .volume-group {
    display: none;
  }

  main {
    padding: 0 12px;
  }

  .grid-container {
    padding: 12px 0 80px;
  }

  .grid {
    gap: 10px;
  }

  .card {
    padding: 14px 16px;
    gap: 14px;
  }

  .card .flag {
    font-size: 2.4rem;
  }

  .card .name {
    font-size: 1rem;
  }

  .card .meta span {
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  .play-indicator {
    width: 54px;
    height: 54px;
    font-size: 1.4rem;
  }

  .card:hover {
    transform: translateX(4px);
  }

  .card.active .play-indicator {
    animation: pulse 2s ease-in-out infinite;
  }

  footer {
    display: none;
  }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 20px 5px var(--accent-glow); }
}

/* Tela muito pequena */
@media (max-width: 360px) {
  .card .meta .country,
  .card .meta .bitrate {
    display: none;
  }
}
