@import url("https://fonts.googleapis.com/css2?family=Audiowide&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --bg: #050508;
  --bg-soft: #0c0c13;
  --panel: #131320;
  --card: #1a1a2b;
  --line: #2d2d42;
  --text: #f8f8ff;
  --muted: #b3b3c3;
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --danger: #ef4444;
  --success: #10b981;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  position: relative;
  overflow-x: hidden;
  padding-bottom: 122px;
  background:
    radial-gradient(70vw 50vh at 100% 0%, rgba(139, 92, 246, 0.26), transparent 65%),
    radial-gradient(65vw 45vh at 0% 10%, rgba(124, 58, 237, 0.2), transparent 70%),
    var(--bg);
  background-size: 130% 130%, 140% 140%, 100% 100%;
  animation: ambientShift 16s ease-in-out infinite alternate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 42vw;
  height: 42vw;
  min-width: 280px;
  min-height: 280px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(36px);
  opacity: 0.45;
}

body::before {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.45), transparent 68%);
  top: -12vw;
  left: -10vw;
  animation: floatingGlowA 14s ease-in-out infinite;
}

body::after {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(124, 58, 237, 0.28), transparent 70%);
  right: -12vw;
  bottom: -16vw;
  animation: floatingGlowB 18s ease-in-out infinite;
}

.container {
  width: min(1180px, 95vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(5, 5, 8, 0.7);
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
}

.topbar-inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0.75rem;
}

.brand-wrap h1 {
  margin: 0;
  text-transform: lowercase;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  letter-spacing: 0.08em;
  position: relative;
  display: inline-block;
  font-family: "Audiowide", "Space Grotesk", sans-serif;
  background: linear-gradient(90deg, #ffffff 12%, #d6c6ff 47%, #9d6fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 0 10px rgba(171, 132, 255, 0.45),
    0 0 28px rgba(139, 92, 246, 0.35);
  animation: brandGlow 2.8s ease-in-out infinite;
}

.brand-wrap h1::after {
  content: "beatoon";
  position: absolute;
  inset: 0;
  color: rgba(171, 132, 255, 0.3);
  filter: blur(10px);
  z-index: -1;
  pointer-events: none;
}

.brand-wrap p {
  margin: 0.24rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.online-pill {
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  color: #e9dcff;
  background: rgba(139, 92, 246, 0.14);
}

.tab-btn,
button {
  font: inherit;
}

.tab-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  padding: 0.52rem 0.8rem;
  cursor: pointer;
}

a.tab-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-btn.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.2);
}

.global-status {
  margin: 0;
  min-height: 1.5rem;
  padding-bottom: 0.45rem;
  color: var(--muted);
}

.global-status.error {
  color: var(--danger);
}

.global-status.success {
  color: var(--success);
}

main {
  padding: 1rem 0 2rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.window {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: var(--panel);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
}

.window-profile {
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.08), transparent 35%),
    var(--panel);
}

.window-publish {
  background:
    linear-gradient(180deg, rgba(124, 58, 237, 0.1), transparent 35%),
    var(--panel);
}

.window-feed {
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.06), transparent 35%),
    var(--panel);
}

.window-settings {
  background:
    linear-gradient(180deg, rgba(109, 40, 217, 0.08), transparent 35%),
    var(--panel);
}

h2,
h3,
h4 {
  margin: 0 0 0.7rem;
}

h4 {
  margin-top: 0.8rem;
}

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

.user-link {
  color: var(--text);
  text-decoration: none;
}

.user-link:hover {
  color: #d9ccff;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.profile-header {
  border: 1px solid var(--line);
  border-radius: 16px;
  height: 240px;
  background: linear-gradient(135deg, #17172a, #311f53);
  position: relative;
  overflow: hidden;
}

.profile-avatar {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #ffffff;
  left: 1.2rem;
  bottom: 1.2rem;
  background: #0f0f18;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.profile-main {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: start;
}

.profile-main-hero {
  margin-top: -0.4rem;
  padding: 0 0.25rem;
  align-items: end;
}

.profile-identity {
  min-height: 84px;
  padding-left: 172px;
}

.profile-main h2 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.4rem, 3.1vw, 2.05rem);
}

.profile-hero-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.profile-toolbar {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.profile-tab.active,
.public-profile-tab.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.22);
}

.profile-panels {
  margin-top: 0.9rem;
}

.profile-panel {
  display: none;
}

.profile-panel.active {
  display: block;
}

.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.stat-box {
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-box strong {
  font-size: 1.1rem;
}

.sub-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.8rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 0.8rem;
}

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

input,
textarea,
select {
  width: 100%;
  margin-top: 0.28rem;
  background: #11111a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.56rem 0.64rem;
  font: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.24);
}

button {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

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

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

.feed-search {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.search-results {
  margin-top: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.5rem;
  display: grid;
  gap: 0.42rem;
}

.search-result-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.45rem 0.55rem;
}

.search-result-item span {
  display: block;
}

.search-result-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.feed-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.feed-filter.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.2);
}

.selection-list,
.playlist-list,
.tracks-list,
.simple-list,
.chat-list {
  display: grid;
  gap: 0.55rem;
}

.selection-item,
.simple-item,
.playlist-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.58rem;
  background: rgba(255, 255, 255, 0.02);
}

.selection-item p,
.simple-item p,
.playlist-item p {
  margin: 0.18rem 0 0;
}

.album-cover-preview {
  display: block;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  margin-top: 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #0f0f18;
}

.upload-form,
.mini-form,
.message-form {
  display: grid;
  gap: 0.55rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.album-track-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.album-track-option input {
  width: auto;
  margin: 0;
}

.audio-player {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.audio-player .ghost {
  min-width: 118px;
}

.audio-player .muted {
  margin: 0;
  font-size: 0.8rem;
}

.track-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.7rem;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 0.7rem;
}

.search-hit {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3), 0 12px 30px rgba(0, 0, 0, 0.35);
}

.track-cover {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f0f18;
}

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

.track-main h4 {
  margin: 0;
}

.track-meta {
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.84rem;
  display: grid;
  gap: 0.12rem;
}

.track-desc {
  margin: 0.46rem 0;
  white-space: pre-wrap;
}

.tag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin-bottom: 0.4rem;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.78rem;
}

.track-actions,
.comment-actions {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.action-btn.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.22);
}

.playlist-adder {
  margin-top: 0.48rem;
  display: flex;
  gap: 0.4rem;
}

.comments-wrap {
  margin-top: 0.55rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}

.comment-node {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.44rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  margin-top: 0.4rem;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.comment-author-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 999px;
  padding: 0.05rem 0.36rem;
  color: #ffd4d4;
  font-size: 0.75rem;
}

.comment-author-badge img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-text {
  margin: 0.3rem 0;
  white-space: pre-wrap;
}

.replies {
  margin-left: 0.65rem;
  border-left: 1px dashed var(--line);
  padding-left: 0.45rem;
}

.reply-form,
.comment-form,
.edit-form {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.4rem;
}

.chat-list {
  max-height: 260px;
  overflow: auto;
  padding-right: 0.2rem;
}

.chat-message {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.chat-message.mine {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.16);
}

.chat-message p {
  margin: 0.2rem 0 0;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

.equalizer-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.eq-band {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  margin: 0;
}

.eq-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.eq-band span {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
}

.eq-band small {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.73rem;
}

.eq-band strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.eq-band input {
  margin: 0.35rem 0 0;
}

.global-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  padding: 0.65rem 0 calc(0.65rem + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(5, 5, 8, 0.32), rgba(5, 5, 8, 0.92)),
    rgba(5, 5, 8, 0.92);
  border-top: 1px solid rgba(139, 92, 246, 0.35);
  backdrop-filter: blur(10px);
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.global-player.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.global-player-inner {
  width: min(1180px, 95vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: 0.65rem;
}

.player-track-info strong {
  display: block;
  font-size: 0.95rem;
}

.player-track-info span {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.8rem;
}

.player-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.player-controls button {
  min-width: 44px;
  padding: 0.45rem 0.5rem;
}

.player-controls button.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.24);
}

.player-volume {
  display: grid;
  justify-items: end;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.player-volume input {
  margin: 0;
  width: min(220px, 48vw);
}

.player-playing[data-playing="1"] {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.16);
}

.global-player audio {
  display: none;
}

@keyframes ambientShift {
  0% {
    background-position: 0% 0%, 100% 100%, center;
  }
  100% {
    background-position: 100% 20%, 0% 80%, center;
  }
}

@keyframes floatingGlowA {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(12vw, 5vh) scale(1.08);
  }
  100% {
    transform: translate(3vw, 10vh) scale(0.95);
  }
}

@keyframes floatingGlowB {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-10vw, -8vh) scale(1.12);
  }
  100% {
    transform: translate(-4vw, -3vh) scale(0.96);
  }
}

@keyframes brandGlow {
  0%,
  100% {
    text-shadow:
      0 0 10px rgba(171, 132, 255, 0.45),
      0 0 28px rgba(139, 92, 246, 0.35);
  }
  50% {
    text-shadow:
      0 0 16px rgba(188, 154, 255, 0.6),
      0 0 38px rgba(139, 92, 246, 0.52);
  }
}

@media (max-width: 900px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs-nav {
    justify-content: flex-start;
  }

  .topbar-right {
    align-items: flex-start;
  }

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

  .profile-identity {
    min-height: 0;
    padding-left: 0;
    padding-top: 148px;
  }

  .profile-avatar {
    width: 128px;
    height: 128px;
  }

  .profile-main-hero {
    margin-top: -0.2rem;
  }

  .profile-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-hero-actions {
    justify-content: flex-start;
  }

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

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

  .track-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .playlist-adder {
    flex-direction: column;
  }

  .global-player-inner {
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 0.52rem;
  }

  .player-controls {
    justify-content: flex-start;
  }

  .player-volume {
    justify-items: start;
  }

  .player-volume input {
    width: 100%;
  }

  .equalizer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
