:root {
  --bg-primary: #0a0c10;
  --bg-card: #12161f;
  --bg-card-hover: #181e2b;
  --border-color: #1e2638;
  --accent-cyan: #22d3ee;
  --accent-cyan-glow: rgba(34, 211, 238, 0.25);
  --accent-active: #06b6d4;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --danger-red: #ef4444;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   DESKTOP HEADER & GLOBAL NAVIGATION
   ========================================================================== */
header {
  background-color: #0d1117;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.logo {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  order: 1;
}

.logo span {
  color: var(--accent-cyan);
}

.center-dock {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #151b26;
  padding: 6px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  order: 2;
}

.header-right {
  display: flex;
  align-items: center;
  order: 3;
}

nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  color: #ffffff;
  background: #1e2638;
}

.nav-btn.active {
  background: var(--accent-cyan);
  color: #080a0f;
  font-weight: 700;
}

/* ==========================================================================
   DESKTOP TRANSPORT CONTROLS
   ========================================================================== */
.toggle-btn {
  background: #20293a;
  border: 1px solid #2e3b52;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn.active {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.transport-dock {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.ctrl-btn {
  background: #1d2433;
  color: var(--text-main);
  border: 1px solid #2d3748;
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ctrl-btn:hover {
  background: #2a3449;
  border-color: var(--accent-cyan);
}

.main-play-btn {
  background: var(--accent-cyan);
  color: #080a0f;
  border: none;
  font-size: 0.95rem;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 900;
}

.main-play-btn:hover {
  background: #67e8f9;
}

.scrubber-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-display {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 32px;
}

#progress-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 5px;
  border-radius: 3px;
  background: #2d3748;
  outline: none;
  cursor: pointer;
}

#progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 4px;
}

#volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 60px;
  height: 5px;
  border-radius: 3px;
  background: #2d3748;
  outline: none;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
}

#volume-label {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-muted);
  width: 34px;
}

/* ==========================================================================
   DESKTOP MATCHUP ARENA (420PX CARDS, RESTORED ORIGINAL PROPORTIONS)
   ========================================================================== */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
}

.view-section {
  display: none;
  width: 100%;
  max-width: 1050px;
}

.view-section.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cards-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.track-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 14px;
  width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.track-card:hover {
  background: var(--bg-card-hover);
  border-color: #2e3b52;
}

.track-card.is-playing {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 25px var(--accent-cyan-glow);
}

.art-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #080a0f;
  border-radius: 12px;
  overflow: hidden;
}

.art-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-state-indicator {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(13, 17, 23, 0.85);
  border: 1px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.indicator-icon {
  color: var(--accent-cyan);
  font-size: 1.1rem;
}

.track-card.is-playing .play-state-indicator {
  background: var(--accent-cyan);
}

.track-card.is-playing .indicator-icon {
  color: #080a0f;
}

.track-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.track-info p {
  color: var(--accent-cyan);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.meta-badges {
  display: flex;
  gap: 6px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.rank-badge {
  background: #1e2638;
  color: var(--text-muted);
}

.elo-badge {
  background: #164e63;
  color: var(--accent-cyan);
}

.error-badge {
  display: none;
  background: var(--danger-red);
  color: #ffffff;
}

.error-badge.active {
  display: inline-block;
}

.play-cue {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.play-cue kbd {
  background: #1e2638;
  border: 1px solid #2d3748;
  padding: 1px 5px;
  border-radius: 4px;
  color: #ffffff;
}

.vote-btn {
  background: var(--accent-cyan);
  color: #080a0f;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  width: 100%;
}

.vote-btn:hover {
  background: #67e8f9;
  transform: translateY(-1px);
}

.versus-divider {
  font-size: 1.2rem;
  font-weight: 900;
  color: #3b4252;
  letter-spacing: 1px;
}

.controls-bar {
  margin-top: 14px;
}

.skip-btn {
  background: #161b26;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 22px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.skip-btn:hover {
  color: #ffffff;
  border-color: #3b4252;
}

/* ==========================================================================
   TABLES & FAQ
   ========================================================================== */
.section-header {
  width: 100%;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

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

.search-box input {
  background: #151b26;
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  width: 250px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent-cyan);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: var(--bg-card);
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #1a2233;
  font-size: 0.9rem;
}

.data-table th {
  background: #0d1117;
  color: var(--text-muted);
  font-weight: 600;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--accent-cyan);
}

.faq-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.faq-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 18px;
  border-radius: 12px;
}

.faq-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.faq-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.floating-faq {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #151b26;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 99;
}

.floating-faq:hover {
  color: #ffffff;
  border-color: var(--accent-cyan);
}

#headless-player-wrapper {
  position: absolute;
  top: -9999px;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   MOBILE BREAKPOINT (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  header {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
    justify-content: space-between;
  }

  .logo {
    order: 1;
    font-size: 1.2rem;
  }

  .header-right {
    order: 2;
  }

  .nav-btn {
    padding: 6px 9px;
    font-size: 0.78rem;
    border-radius: 6px;
  }

  .center-dock {
    order: 3;
    width: 100%;
    justify-content: space-between;
    padding: 5px 10px;
    gap: 6px;
    border-radius: 12px;
  }

  .toggle-btn {
    font-size: 0.72rem;
    padding: 4px 8px;
  }

  .ctrl-btn {
    padding: 4px 6px;
    font-size: 0.72rem;
  }

  #btn-start, #btn-fwd-60 {
    display: none;
  }

  .scrubber-bar {
    gap: 4px;
  }

  #progress-slider {
    width: 50px;
  }

  .time-display {
    font-size: 0.7rem;
    min-width: 26px;
  }

  .volume-container {
    display: none;
  }

  main {
    padding: 8px 6px 60px 6px;
    justify-content: flex-start;
  }

  .cards-container {
    flex-direction: row;
    gap: 6px;
    width: 100%;
    align-items: stretch;
  }

  .track-card {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 8px;
    border-radius: 12px;
    gap: 6px;
  }

  .art-wrapper {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
  }

  .play-state-indicator {
    width: 32px;
    height: 32px;
    bottom: 6px;
    right: 6px;
  }

  .indicator-icon {
    font-size: 0.85rem;
  }

  .track-info h2 {
    font-size: 0.85rem;
    margin-bottom: 2px;
    line-height: 1.2;
  }

  .track-info p {
    font-size: 0.74rem;
  }

  .meta-row {
    margin-top: 4px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .meta-badges {
    gap: 4px;
  }

  .badge {
    font-size: 0.64rem;
    padding: 2px 5px;
  }

  .play-cue {
    display: none;
  }

  .vote-btn {
    padding: 9px 4px;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: 8px;
    line-height: 1.2;
  }

  .versus-divider {
    font-size: 0.75rem;
    color: #4b5563;
    align-self: center;
  }

  .controls-bar {
    margin-top: 10px;
    width: 100%;
    text-align: center;
  }

  .skip-btn {
    padding: 6px 18px;
    font-size: 0.78rem;
    margin-top: 0;
  }

  .catalog-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  .floating-faq {
    bottom: 10px;
    right: 10px;
    padding: 5px 12px;
    font-size: 0.72rem;
  }
}