:root {
  --bg: #0f1115;
  --card-bg: #1a1d24;
  --accent: #6c5ce7;
  --text: #f1f1f3;
  --text-muted: #9a9ea8;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.2rem;
  background: var(--bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-titles {
  text-align: center;
}

.app-title {
  font-size: 1.2rem;
  margin: 0;
}

#feed-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

.icon-button {
  position: absolute;
  left: 1.2rem;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.icon-button:hover {
  background: rgba(255,255,255,0.08);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

/* Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0,0,0,0.5);
}

.drawer-backdrop.hidden {
  display: none;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  width: 280px;
  max-width: 84vw;
  background: var(--card-bg);
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.drawer.hidden {
  transform: translateX(-100%);
  visibility: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.feed-list {
  overflow-y: auto;
  padding: 0.6rem;
}

.feed-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
}

.feed-item:hover {
  background: rgba(255,255,255,0.06);
}

.feed-item.active {
  background: var(--accent);
  color: #fff;
}

.feed-item-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.feed-item.active .feed-item-count {
  color: rgba(255,255,255,0.8);
}

/* Track list */
.container {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

#list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.track {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.track-title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.track-heart {
  position: relative;
  top: -2px;
  flex: none;
  width: 13px;
  height: 13px;
  color: #e0245e;
  pointer-events: none;
}

.track-heart svg {
  width: 100%;
  height: 100%;
}

.track-heart.hidden {
  display: none;
}

.track:hover {
  transform: translateY(-2px);
}

.track-play,
.track-main {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.track-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.track-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.track-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.track-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-play {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.track:hover .track-play {
  filter: brightness(1.1);
}

.track-duration {
  flex: none;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}

/* Player modal */
.player-modal.hidden {
  display: none;
}

.player-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.player-modal-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 480px;
  margin: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem 1.6rem 1.6rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
}

.player-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem;
}

.player-modal-close:hover {
  color: var(--text);
}

.player-modal-heart {
  position: absolute;
  top: 0.75rem;
  left: 0.8rem;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-modal-heart svg {
  width: 20px;
  height: 20px;
}

.player-modal-heart:hover {
  color: var(--text);
}

.player-modal-heart.active {
  color: #e0245e;
}

.player-modal-heart:disabled {
  opacity: 0.5;
  cursor: default;
}

.player-modal-title {
  flex: none;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.player-modal-subtitle {
  flex: none;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.3rem 0 0 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.player-modal-subtitle.hidden {
  display: none;
}

/* Info view (description + full text) vs player view -- only one shown at a time */
.info-view,
.player-view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.player-modal.mode-info .info-view {
  display: flex;
}

.player-modal.mode-player .player-view {
  display: flex;
}

.info-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 0.6rem;
  padding-right: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.info-scroll::-webkit-scrollbar {
  width: 6px;
}

.info-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.info-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
}

.info-description {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1rem;
  text-align: center;
}

.info-fulltext {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-line;
  margin: 0;
  text-align: center;
}

.info-description.hidden,
.info-fulltext.hidden {
  display: none;
}

.info-play-button {
  flex: none;
  align-self: center;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
}

.info-play-button svg {
  width: 18px;
  height: 18px;
}

.info-play-button:hover {
  filter: brightness(1.1);
}

.player-captions {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-y: auto;
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.4rem;
}

.player-captions-text {
  color: var(--text);
  transition: color 0.2s ease, opacity 0.2s ease;
}

.player-captions-text.faded {
  color: var(--text-muted);
  opacity: 0.7;
}

.player-controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.player-toggle {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.player-toggle svg {
  width: 22px;
  height: 22px;
}

.player-toggle:hover {
  filter: brightness(1.1);
}

.player-time {
  flex: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 2.6em;
  text-align: center;
}

.player-seek-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.player-seek {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

/* Same size as .player-seek-thumb below and left fully transparent -- it
   still owns dragging/hit-testing, but .player-seek-thumb is what's drawn,
   so the visible circle and the repeat number are one element and can
   never visually drift apart from each other. */
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.player-seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.player-seek-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* Horizontal position is set via the transform's translateX in app.js,
     not `left` -- `left` is a layout property, so animating it re-hints/
     re-antialiases the number glyph on every frame; a transform just
     moves an already-rasterized layer, so the digit stays crisp. */
  will-change: transform;
}

.player-repeat-badge {
  font-size: 0.5rem;
  font-weight: 400;
  line-height: 1;
  color: #fff;
}

.player-repeat-badge.hidden {
  display: none;
}

.player-download {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
}

.player-download:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.player-download svg {
  width: 20px;
  height: 20px;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .container { padding: 1.2rem 0.8rem 1.6rem; }
  .app-title { font-size: 1.05rem; }
  .track { padding: 0.6rem 1rem; }
  .player-modal-content { height: 420px; padding: 1.6rem 1.2rem 1.2rem; }
}
