:root {
  --bg: #0f1217;
  --bg-soft: #181c23;
  --text: #edf2f7;
  --muted: #9ba6b2;
  --accent: #25c2a0;
  --accent-2: #1ca37f;
  --brass: #b08d57;
  --danger: #ff6b6b;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 194, 160, 0.2), transparent 45%),
    radial-gradient(circle at bottom right, rgba(28, 163, 127, 0.18), transparent 50%),
    var(--bg);
  background-size: 150% 150%, 160% 160%, auto;
  background-position: 0% 0%, 100% 100%, 0% 0%;
  animation: background-flow 26s ease-in-out infinite alternate;
  min-height: 100vh;
}

@keyframes background-flow {
  0% {
    background-position: 0% 0%, 100% 100%, 0% 0%;
  }
  100% {
    background-position: 18% 12%, 82% 88%, 0% 0%;
  }
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.player-header {
  align-items: flex-end;
}

.player-header .row {
  align-items: flex-end;
  margin-left: auto;
  justify-content: flex-end;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.brand-logo {
  display: block;
  width: min(700px, 72vw);
  height: auto;
}

.brand-link {
  text-decoration: none;
  color: inherit;
}

.brand p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.3fr 1fr;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.22),
    0 2px 8px rgba(0, 0, 0, 0.16);
}

#uploadPanel.is-drop-hover {
  border-color: rgba(37, 194, 160, 0.9);
  box-shadow:
    0 0 0 1px rgba(37, 194, 160, 0.5) inset,
    0 14px 34px rgba(0, 0, 0, 0.24),
    0 2px 10px rgba(0, 0, 0, 0.18);
}

.search {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.85rem;
}

.track-list {
  max-height: 68vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.track-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.track-list-wrap {
  position: relative;
  min-height: 0;
}

.track-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: border-color 120ms ease, transform 120ms ease;
}

.track-item:hover {
  border-color: rgba(37, 194, 160, 0.6);
}

.track-item.active {
  border-color: var(--accent);
  background: rgba(37, 194, 160, 0.14);
}

.track-title {
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.track-title-main {
  min-width: 0;
}

.track-private-lock {
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.track-private-lock svg {
  width: 0.82rem;
  height: 0.82rem;
  display: block;
}

.track-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

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

.track-cover {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  flex: 0 0 auto;
}

.track-cover-fallback {
  background-image: linear-gradient(140deg, #1f6756, #113453 55%, #2a4b2a);
}

.track-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.track-share,
.track-download {
  min-height: 42px;
  padding: 0.65rem 0.95rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.track-download {
  min-height: auto;
  min-width: 0;
  padding: 0.2rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--brass);
}

.track-download:hover {
  background: rgba(176, 141, 87, 0.12);
}

.track-download svg {
  width: 0.82rem;
  height: 0.82rem;
  display: block;
}

.track-meta {
  color: var(--muted);
  margin-top: 0.2rem;
  font-size: 0.92rem;
}

.track-artist,
.track-uploaded {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.track-text {
  display: grid;
  gap: 0.2rem;
}

.player-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.player-idle {
  display: none;
  position: absolute;
  inset: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(120% 92% at 10% 52%, rgba(37, 194, 160, 0.12), rgba(28, 163, 127, 0.05) 44%, rgba(13, 22, 30, 0.34) 100%),
    linear-gradient(120deg, rgba(37, 194, 160, 0.08), rgba(13, 30, 40, 0.38) 56%, rgba(28, 163, 127, 0.06));
}

.player-idle::before,
.player-idle::after {
  content: "";
  position: absolute;
  inset: -8% -8%;
  pointer-events: none;
}

.player-card.is-idle .player-idle {
  display: block;
}

.player-card.is-idle .now-cover,
.player-card.is-idle .wave-player-box {
  visibility: hidden;
}

.player-idle::before {
  /* Wavy line field (subtle, same palette as page background). */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 700' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%2325c2a0' stroke-opacity='0.12' stroke-width='1.2'%3E%3Cpath d='M20 0 C120 120 120 260 20 380 C-70 500 -60 620 20 700'/%3E%3Cpath d='M70 0 C170 120 170 260 70 380 C-20 500 -10 620 70 700'/%3E%3Cpath d='M120 0 C220 120 220 260 120 380 C30 500 40 620 120 700'/%3E%3Cpath d='M170 0 C270 120 270 260 170 380 C80 500 90 620 170 700'/%3E%3Cpath d='M220 0 C320 120 320 260 220 380 C130 500 140 620 220 700'/%3E%3Cpath d='M270 0 C370 120 370 260 270 380 C180 500 190 620 270 700'/%3E%3Cpath d='M320 0 C420 120 420 260 320 380 C230 500 240 620 320 700'/%3E%3Cpath d='M370 0 C470 120 470 260 370 380 C280 500 290 620 370 700'/%3E%3Cpath d='M420 0 C520 120 520 260 420 380 C330 500 340 620 420 700'/%3E%3Cpath d='M470 0 C570 120 570 260 470 380 C380 500 390 620 470 700'/%3E%3Cpath d='M520 0 C620 120 620 260 520 380 C430 500 440 620 520 700'/%3E%3Cpath d='M570 0 C670 120 670 260 570 380 C480 500 490 620 570 700'/%3E%3Cpath d='M620 0 C720 120 720 260 620 380 C530 500 540 620 620 700'/%3E%3Cpath d='M670 0 C770 120 770 260 670 380 C580 500 590 620 670 700'/%3E%3Cpath d='M720 0 C820 120 820 260 720 380 C630 500 640 620 720 700'/%3E%3Cpath d='M770 0 C870 120 870 260 770 380 C680 500 690 620 770 700'/%3E%3Cpath d='M820 0 C920 120 920 260 820 380 C730 500 740 620 820 700'/%3E%3Cpath d='M870 0 C970 120 970 260 870 380 C780 500 790 620 870 700'/%3E%3Cpath d='M920 0 C1020 120 1020 260 920 380 C830 500 840 620 920 700'/%3E%3Cpath d='M970 0 C1070 120 1070 260 970 380 C880 500 890 620 970 700'/%3E%3Cpath d='M1020 0 C1120 120 1120 260 1020 380 C930 500 940 620 1020 700'/%3E%3Cpath d='M1070 0 C1170 120 1170 260 1070 380 C980 500 990 620 1070 700'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 140% 110%;
  background-repeat: no-repeat;
  background-position: -8% 50%;
  opacity: 0.2;
  transform: scale(1.02);
  animation: idle-swirl-a 28s ease-in-out infinite alternate;
}

.player-idle::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 700' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%231ca37f' stroke-opacity='0.10' stroke-width='1'%3E%3Cpath d='M45 0 C145 110 145 270 45 390 C-45 520 -35 620 45 700'/%3E%3Cpath d='M95 0 C195 110 195 270 95 390 C5 520 15 620 95 700'/%3E%3Cpath d='M145 0 C245 110 245 270 145 390 C55 520 65 620 145 700'/%3E%3Cpath d='M195 0 C295 110 295 270 195 390 C105 520 115 620 195 700'/%3E%3Cpath d='M245 0 C345 110 345 270 245 390 C155 520 165 620 245 700'/%3E%3Cpath d='M295 0 C395 110 395 270 295 390 C205 520 215 620 295 700'/%3E%3Cpath d='M345 0 C445 110 445 270 345 390 C255 520 265 620 345 700'/%3E%3Cpath d='M395 0 C495 110 495 270 395 390 C305 520 315 620 395 700'/%3E%3Cpath d='M445 0 C545 110 545 270 445 390 C355 520 365 620 445 700'/%3E%3Cpath d='M495 0 C595 110 595 270 495 390 C405 520 415 620 495 700'/%3E%3Cpath d='M545 0 C645 110 645 270 545 390 C455 520 465 620 545 700'/%3E%3Cpath d='M595 0 C695 110 695 270 595 390 C505 520 515 620 595 700'/%3E%3Cpath d='M645 0 C745 110 745 270 645 390 C555 520 565 620 645 700'/%3E%3Cpath d='M695 0 C795 110 795 270 695 390 C605 520 615 620 695 700'/%3E%3Cpath d='M745 0 C845 110 845 270 745 390 C655 520 665 620 745 700'/%3E%3Cpath d='M795 0 C895 110 895 270 795 390 C705 520 715 620 795 700'/%3E%3Cpath d='M845 0 C945 110 945 270 845 390 C755 520 765 620 845 700'/%3E%3Cpath d='M895 0 C995 110 995 270 895 390 C805 520 815 620 895 700'/%3E%3Cpath d='M945 0 C1045 110 1045 270 945 390 C855 520 865 620 945 700'/%3E%3Cpath d='M995 0 C1095 110 1095 270 995 390 C905 520 915 620 995 700'/%3E%3Cpath d='M1045 0 C1145 110 1145 270 1045 390 C955 520 965 620 1045 700'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 150% 115%;
  background-repeat: no-repeat;
  background-position: 6% 50%;
  opacity: 0.14;
  filter: blur(0.4px);
  transform: scale(1.03);
  animation: idle-swirl-b 34s ease-in-out infinite alternate-reverse;
}

@keyframes idle-swirl-a {
  0% {
    background-position: -12% 48%;
    transform: scale(1.02);
  }
  100% {
    background-position: 2% 52%;
    transform: scale(1.05);
  }
}

@keyframes idle-swirl-b {
  0% {
    background-position: 10% 51%;
    transform: scale(1.01);
  }
  100% {
    background-position: -5% 49%;
    transform: scale(1.04);
  }
}

.now-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.now-cover-fallback {
  background-image: linear-gradient(145deg, #1f6756, #113453 58%, #2a4b2a);
}

.now-title {
  margin: 0;
  font-size: 1.55rem;
  padding-left: 0.25rem;
}

.now-artist {
  margin: 0.1rem 0 0.25rem;
  color: var(--muted);
  font-size: 1.03rem;
  padding-left: 0.25rem;
}

.wave-player-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(120deg, rgba(53, 171, 149, 0.18), rgba(22, 56, 72, 0.18) 48%, rgba(112, 216, 188, 0.16));
  padding: 0.7rem;
  display: grid;
  gap: 0.6rem;
}

.wave-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.wave-controls-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.35rem;
}

.icon-btn {
  width: 46px;
  min-width: 46px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.wave-times {
  color: var(--muted);
  font-size: 0.92rem;
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  white-space: nowrap;
  margin-left: auto;
}

.waveform {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 112px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(83, 205, 178, 0.06), rgba(0, 0, 0, 0));
}

.waveform > * {
  border-radius: 8px;
}

.waveform-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  backdrop-filter: blur(1px);
  background: linear-gradient(90deg, rgba(8, 16, 21, 0.68), rgba(19, 43, 52, 0.6));
  pointer-events: none;
}

.waveform-loading-spinner {
  width: 0.92rem;
  height: 0.92rem;
  border-radius: 999px;
  border: 2px solid rgba(133, 232, 210, 0.32);
  border-top-color: rgba(133, 232, 210, 0.95);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

a {
  color: var(--accent);
}

button,
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  color: #05241b;
  transition: background 120ms ease;
  text-decoration: none;
  display: inline-block;
}

button:hover,
.btn:hover {
  background: var(--accent-2);
}

.secondary {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

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

.error {
  color: var(--brass);
  margin: 0;
}

.player-page-error {
  color: var(--brass);
  text-align: center;
  margin: 1rem 0 0;
}

.site-footer {
  margin-top: 1.2rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: rgba(20, 52, 47, 0.95);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.form {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.93rem;
  color: var(--muted);
}

.label-head {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.audio-hint {
  white-space: nowrap;
}

input,
textarea {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 0.7rem 0.8rem;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.form-actions {
  margin-top: 0.45rem;
  justify-content: space-between;
  align-items: center;
}

.upload-panel-logo {
  width: min(190px, 38%);
  height: auto;
  opacity: 0.9;
  margin-right: 0.45rem;
}

.auth-only-panel {
  min-height: 180px;
  display: grid;
  place-items: center;
}

.auth-only-content {
  display: grid;
  gap: 0.7rem;
  width: min(360px, 100%);
}

.google-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #ebf0f7);
  color: #1b2532;
  padding: 0.8rem 1rem;
  font-weight: 700;
}

.google-login-btn:hover {
  background: linear-gradient(180deg, #ffffff, #dee7f3);
}

.google-login-icon {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #fff;
  color: #2a6df6;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.admin-header-actions {
  justify-content: flex-end;
}

.admin-header-actions .btn,
.admin-header-actions button {
  width: 140px;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.upload-progress-wrap {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.upload-progress {
  width: 100%;
  height: 0.75rem;
  accent-color: var(--accent);
}

.file-picker-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

@media (max-width: 900px) {
  .player-header .row {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    margin-left: auto;
  }

  .brand-logo {
    width: min(520px, 62vw);
    margin-right: 0.75rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .grid > .player-card {
    order: 1;
  }

  .grid > .panel:first-child {
    order: 2;
  }

  .track-list {
    max-height: 42vh;
  }

  .wave-controls-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  .wave-times {
    margin-left: 0;
  }
}
