:root {
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --btn-secondary-bg: #eff6ff;
  --media-bg: #0f172a;
  --shadow-color: rgba(0, 0, 0, 0.05);
}

body.dark-theme {
  --bg-color: #0b1120;
  --card-bg: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --btn-secondary-bg: #334155;
  --media-bg: #0b1120;
  --shadow-color: rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

.app-container {
  width: 100%;
  max-width: 420px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #2563eb;
}

.add-container {
  position: relative;
}

.add-btn {
  background-color: #2563eb;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.add-menu {
  position: absolute;
  top: 115%;
  right: 0;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 10px 25px var(--shadow-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  min-width: 180px;
}

.add-menu button {
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}

.add-menu button:active {
  background-color: var(--btn-secondary-bg);
}

.player-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  padding: 16px;
  border-radius: 24px;
  box-shadow: 0 10px 30px var(--shadow-color);
  border: 1px solid var(--border-color);
}

/* Card Principal interativo para capas e visualizador */
.media-card {
  position: relative;
  width: 100%;
  height: 250px;
  background: var(--media-bg);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.album-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visualizer-canvas {
  width: 100%;
  height: 100%;
}

.export-lyrics-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(37, 99, 235, 0.95);
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  z-index: 20;
  transition: transform 0.2s ease, background 0.2s;
}

.export-lyrics-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.expand-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
  cursor: pointer;
  z-index: 10;
}

.hidden {
  display: none !important;
}

.track-info, .fs-track-info {
  width: 100%;
  text-align: center;
}

.marquee-container {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 2px 0;
  mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 6%, black 94%, transparent);
}

.track-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  display: inline-block;
  will-change: transform;
}

.fs-title {
  font-size: 1.25rem;
}

.track-title.scrolling {
  animation: marquee-bounce 10s ease-in-out infinite alternate;
}

@keyframes marquee-bounce {
  0%, 15% {
    transform: translateX(0);
  }
  85%, 100% {
    transform: translateX(var(--scroll-dist, 0px));
  }
}

.track-info p, .fs-track-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.progress-container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.progress-container input[type="range"] {
  flex: 1;
  accent-color: #2563eb;
  height: 6px;
  border-radius: 3px;
  cursor: pointer;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.ctrl-btn {
  background: var(--btn-secondary-bg);
  border: none;
  color: #2563eb;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sub-btn {
  width: 38px;
  height: 38px;
  font-size: 0.95rem;
  opacity: 0.55;
  filter: grayscale(80%);
}

.sub-btn.active {
  opacity: 1;
  filter: grayscale(0%);
  background-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.play-main {
  background: #2563eb;
  color: #ffffff;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.4rem;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.playlist-section {
  flex: 1;
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.playlist-header h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-count {
  color: #2563eb;
  font-weight: 700;
}

.clear-btn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.playlist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.playlist li {
  background: var(--card-bg);
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
}

.playlist li .item-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-right: 10px;
}

.playlist li .item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist li .item-artist {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.playlist li .remove-track {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  padding: 4px 8px;
  cursor: pointer;
}

.playlist li.active {
  border-left: 4px solid #2563eb;
  background: var(--btn-secondary-bg);
  color: #2563eb;
  font-weight: 600;
}

/* Modal Tela Cheia */
.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-color);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
}

.close-fs-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--btn-secondary-bg);
  border: none;
  color: #2563eb;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
}

.fs-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
  padding-top: 30px;
}

.fs-media-container {
  width: 100%;
  max-width: 240px;
  height: 240px;
  background: var(--media-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 35px var(--shadow-color);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fs-album-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fs-visualizer-canvas {
  width: 100%;
  height: 100%;
}

.fs-lyrics-box {
  width: 100%;
  max-height: 140px;
  overflow-y: auto;
  background: var(--btn-secondary-bg);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--border-color);
  box-sizing: border-box;
  margin: 8px 0;
}

.fs-lyrics-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  text-align: center;
  font-weight: 500;
}

.fs-progress {
  width: 100%;
}

.fs-controls {
  gap: 16px;
  margin-bottom: 10px;
}

.theme-toggle-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 6px 16px var(--shadow-color);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: transform 0.2s;
}

.theme-toggle-fab:active {
  transform: scale(0.92);
}
