/* Vaporwave is the app's single, always-on theme. */
:root {
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --button-height: 2.5rem;
  --bg-deep: #130b2f;
  --bg-mid: #24104a;
  --surface: rgba(26, 16, 54, 0.76);
  --surface-strong: rgba(20, 10, 45, 0.9);
  --surface-border: rgba(255, 92, 209, 0.38);
  --text-main: #ffe9ff;
  --text-muted: #c9c4ff;
  --neon-pink: #ff4fd8;
  --neon-cyan: #3ff6ff;
  --neon-purple: #9e5dff;
  --danger: #ff628f;
}

html {
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 79, 216, 0.28), transparent 30%),
    radial-gradient(circle at 78% 6%, rgba(63, 246, 255, 0.26), transparent 32%),
    linear-gradient(160deg, var(--bg-deep) 0%, #1b0f42 45%, var(--bg-mid) 100%);
  color: var(--text-main);
}

body {
  font-family: "Trebuchet MS", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 2rem 1.25rem 2.5rem;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 79, 216, 0.28), transparent 30%),
    radial-gradient(circle at 78% 6%, rgba(63, 246, 255, 0.26), transparent 32%),
    linear-gradient(160deg, var(--bg-deep) 0%, #1b0f42 45%, var(--bg-mid) 100%);
  color: var(--text-main);
  line-height: 1.45;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.08) 0,
    rgba(255, 255, 255, 0.08) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.35;
}

body::after {
  content: "";
  position: fixed;
  width: 28rem;
  height: 28rem;
  top: -12rem;
  right: -8rem;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 174, 58, 0.75) 0%, rgba(255, 79, 216, 0.68) 54%, rgba(255, 79, 216, 0) 100%);
  filter: blur(1px);
}

main {
  max-width: 960px;
  margin: 0 auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.top-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.top-actions button {
  width: 100%;
  margin: 0;
}

.hamburger-btn {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1;
  min-width: 3rem;
  padding: 0.45rem 0.75rem;
}

.header-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 0, 24, 0.64);
  z-index: 850;
}

.header-menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(300px, 82vw);
  height: 100vh;
  padding: 5rem 1rem 1.25rem;
  background: var(--surface-strong);
  border-left: 1px solid var(--surface-border);
  box-shadow: -4px 0 28px rgba(8, 4, 28, 0.6);
  transform: translateX(102%);
  transition: transform 0.2s ease-in-out;
  z-index: 900;
}

.header-menu-panel.is-open {
  transform: translateX(0);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 1.1rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 0 0 1px rgba(63, 246, 255, 0.08), 0 12px 30px rgba(4, 0, 20, 0.35);
  backdrop-filter: blur(8px);
}

.ranking-workspace {
  display: flex;
  flex-direction: column;
}

.filter-summary-panel {
  cursor: pointer;
}

.filter-summary-panel h2 {
  margin-top: 0;
}

.filter-summary-panel .helper-text {
  margin-bottom: 0;
}

.filter-summary-panel:focus-visible {
  outline: 3px solid var(--neon-cyan);
  outline-offset: 2px;
}

.onboarding-panel {
  position: sticky;
  top: 0.5rem;
  z-index: 5;
  box-shadow: 0 8px 22px rgba(17, 42, 84, 0.08);
}

.onboarding-progress {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.onboarding-actions button {
  margin-top: 0;
  margin-right: 0;
}

.onboarding-helper {
  margin: 0.5rem 0 0;
}

label {
  display: block;
  margin-bottom: 0.5rem;
}

input, select {
  width: 100%;
  max-width: 360px;
  padding: 0.55rem 0.65rem;
  margin-top: 0.25rem;
  border: 1px solid rgba(63, 246, 255, 0.36);
  border-radius: 10px;
  background: rgba(17, 10, 44, 0.78);
  color: var(--text-main);
}

input[type="checkbox"] {
  width: auto;
  max-width: none;
  margin-top: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  line-height: 1.5;
}

th, td {
  border: 1px solid rgba(158, 93, 255, 0.34);
  padding: 0.65rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: rgba(63, 246, 255, 0.14);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 640px;
}

.table-state {
  text-align: center;
  color: var(--text-muted);
  background: rgba(17, 10, 44, 0.82);
  font-style: italic;
}

.table-state-empty {
  color: var(--text-muted);
  background: rgba(17, 10, 44, 0.75);
}

.table-state-error {
  color: #ffd0de;
  background: rgba(126, 30, 68, 0.42);
}

th button {
  margin: 0;
  padding: 0.3rem 0.4rem;
}

code {
  white-space: pre-wrap;
  word-break: break-word;
}

button {
  --btn-height: var(--button-height);
  --btn-padding-x: 1rem;
  --btn-gap: var(--space-2);
  min-height: var(--btn-height);
  padding: 0.55rem var(--btn-padding-x);
  margin-top: var(--btn-gap);
  margin-right: var(--btn-gap);
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.08s ease;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a[href]:focus-visible {
  outline: 3px solid var(--neon-cyan);
  outline-offset: 2px;
}


button,
.btn-primary {
  border-color: var(--neon-cyan);
  background: linear-gradient(135deg, #2b1a6e 0%, #9837d0 52%, #ff4fd8 100%);
  color: #fff8ff;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.48);
}

button:hover,
.btn-primary:hover {
  background: linear-gradient(135deg, #361f86 0%, #a344da 50%, #ff6be1 100%);
  border-color: #8ffbff;
}

.btn-secondary {
  border-color: rgba(63, 246, 255, 0.55);
  background: rgba(20, 41, 98, 0.62);
  color: #c7f8ff;
}

.btn-secondary:hover {
  background: rgba(25, 52, 124, 0.7);
  border-color: rgba(143, 251, 255, 0.72);
}

.btn-ghost {
  border-color: rgba(158, 93, 255, 0.7);
  background: rgba(33, 18, 77, 0.6);
  color: #ecd7ff;
}

.btn-ghost:hover {
  background: rgba(44, 22, 98, 0.72);
  border-color: rgba(255, 79, 216, 0.72);
  color: #fff0ff;
}

.btn-danger {
  border-color: #ff87ac;
  background: linear-gradient(135deg, #7a2048 0%, #cf3f7a 100%);
  color: #fff7fb;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #8a2554 0%, #e44d8b 100%);
  border-color: #ffb0c9;
}

.btn-icon {
  --btn-height: 2rem;
  --btn-padding-x: 0.55rem;
  --btn-gap: 0;
  min-width: 2rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
}

.btn-secondary:active,
.btn-ghost:active,
.btn-danger:active,
.btn-primary:active,
button:active {
  filter: brightness(0.97);
}

#pair-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.pair-wide-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: var(--space-2);
}

.pair-wide-actions button {
  margin-left: 0;
  margin-right: 0;
}

.song-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(158, 93, 255, 0.42);
  border-radius: 14px;
  padding: 0.8rem;
  background: rgba(21, 12, 50, 0.78);
}

.song-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

.song-card-actions > button:not(.btn-icon) {
  width: 100%;
  margin: 0;
}

.song-card-secondary-actions {
  display: flex;
  width: 100%;
  gap: 0.45rem;
}

.song-card-secondary-actions button {
  flex: 1;
  margin: 0;
}

.album-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(63, 246, 255, 0.34);
  background: rgba(14, 7, 36, 0.9);
  margin-bottom: 0;
}

.album-media-shell {
  position: relative;
  display: block;
  margin-bottom: 0.75rem;
}

.album-art-trigger {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  line-height: 0;
  cursor: pointer;
}

.song-inspect-btn,
.song-vote-btn {
  --btn-height: 2rem;
  --btn-padding-x: 0;
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(14, 7, 36, 0.76), 0 8px 22px rgba(4, 0, 20, 0.42);
}

.song-inspect-btn {
  bottom: 0.65rem;
}

.song-vote-btn {
  bottom: 0.65rem;
}

.song-card-left .song-vote-btn {
  right: 0.65rem;
}

.song-card-left .song-inspect-btn {
  left: 0.65rem;
}

.song-card-right .song-vote-btn {
  left: 0.65rem;
}

.song-card-right .song-inspect-btn {
  right: 0.65rem;
}

.album-art-trigger:hover .album-art,
.album-art-trigger:focus-visible .album-art {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(63, 246, 255, 0.34);
}

.album-art-trigger.is-hidden {
  display: none;
}

.album-embed-slot,
.album-embed-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
}

.album-embed-slot {
  display: none;
}

.album-embed-slot.is-active {
  display: block;
}

.album-embed-frame {
  border: 1px solid rgba(63, 246, 255, 0.34);
  background: #000;
}

.album-embed-message {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.youtube-modal-player-slot {
  width: 100%;
  max-width: 680px;
  margin: 0 auto 0.75rem;
}

.youtube-modal-player-slot .album-embed-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.song-title {
  margin: 0 0 0.45rem;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #fff3ff;
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.25);
}

.song-meta {
  margin: 0.2rem 0;
  color: var(--text-muted);
}

.warning {
  color: #ffe7c4;
  background: rgba(121, 58, 7, 0.34);
  border: 1px solid rgba(255, 190, 122, 0.5);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
}

.warning-dismissible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.warning-dismissible p {
  margin: 0;
}

.warning-dismiss-btn {
  flex-shrink: 0;
  padding: 0.25rem 0.5rem;
  border-color: rgba(255, 190, 122, 0.72);
}

.helper-text {
  margin: 0.1rem 0 0.55rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.status-info,
.status-success,
.status-error {
  margin: 0.55rem 0 0;
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  border: 1px solid transparent;
  font-weight: 600;
}

.status-info {
  color: #d6f6ff;
  background: rgba(20, 41, 98, 0.58);
  border-color: rgba(63, 246, 255, 0.42);
}

.status-success {
  color: #c5ffd3;
  background: rgba(18, 94, 76, 0.46);
  border-color: rgba(136, 255, 198, 0.48);
}

.status-error {
  color: #ffd9e8;
  background: rgba(120, 24, 74, 0.44);
  border-color: rgba(255, 130, 186, 0.48);
}

.status-hidden {
  display: none;
}

.import-status {
  font-size: 1rem;
  box-shadow: 0 1px 8px rgba(15, 23, 38, 0.08);
}

.filter-summary {
  margin: 0;
  color: var(--text-muted);
}

.inline-forms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.grid-3, .grid-4 {
  display: grid;
  gap: var(--space-3);
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 2, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal {
  background: var(--surface-strong);
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  width: min(900px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.1rem;
  position: relative;
}

.user-modal-nav {
  position: sticky;
  top: -1.1rem;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.9rem 0 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid rgba(158, 93, 255, 0.45);
  border-bottom: 1px solid rgba(158, 93, 255, 0.45);
  background: var(--surface-strong);
}

.user-modal-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.15rem 0.75rem;
  border: 1px solid rgba(158, 93, 255, 0.7);
  border-radius: 999px;
  background: rgba(33, 18, 77, 0.65);
  color: #ecd7ff;
  text-decoration: none;
  font-weight: 600;
}

.user-modal-nav a:hover {
  background: rgba(44, 22, 98, 0.76);
  border-color: rgba(255, 79, 216, 0.72);
}

.user-modal-section {
  margin: 0;
  padding: 0.2rem 0 0.95rem;
  border-bottom: 1px solid rgba(158, 93, 255, 0.35);
}

.user-modal-section:last-of-type {
  border-bottom: 0;
  padding-bottom: 0.3rem;
}

.user-modal-section details {
  display: block;
}

.user-modal-section summary {
  margin: 0;
  padding: 0.5rem 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.user-modal-section-body {
  margin-top: 0.4rem;
}

.user-modal-section-body h3 {
  margin: 1rem 0 0.6rem;
}

.profile-avatar-hero {
  margin-top: 0.35rem;
}

.profile-avatar-image {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(63, 246, 255, 0.7);
  background: rgba(17, 10, 44, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 79, 216, 0.24);
}

.profile-avatar-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: end;
  margin-bottom: 0.6rem;
}

.profile-avatar-form label {
  margin-bottom: 0;
  flex: 1;
  min-width: 220px;
}

.section-task-hint {
  margin: 0 0 0.7rem;
  color: var(--text-muted);
}

.modal .table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(17, 10, 44, 0.96);
}

.filter-modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-modal-actions {
  justify-content: flex-end;
}

.modal-close {
  position: absolute;
  right: 0.5rem;
  top: 0.25rem;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.song-details-grid {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.9rem;
}

.song-details-key {
  font-weight: 700;
  color: var(--text-muted);
}

.song-details-value {
  overflow-wrap: anywhere;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  body {
    padding: 1rem 0.75rem 1.5rem;
  }

  .onboarding-panel {
    top: 0.35rem;
    padding: 0.9rem;
  }

  .onboarding-actions {
    flex-direction: column;
  }

  .onboarding-actions button {
    width: 100%;
  }

  .filter-modal-actions {
    justify-content: stretch;
  }

  .filter-modal-actions button {
    flex: 1;
    margin-right: 0;
  }

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

  .song-card-actions {
    gap: 0.4rem;
  }

  .hide-sm {
    display: none;
  }

  .user-modal-nav {
    top: -0.9rem;
  }
}

@media (min-width: 1000px) {
  .ranking-workspace {
    display: flex;
    flex-direction: column;
  }
}
