:root {
  --bg: #0f1216;
  --bg-soft: #171c22;
  --bg-glow: #1c232b;
  --card: #1c232b;
  --card-strong: #202a34;
  --text: #f2f5f8;
  --muted: #a7b0bd;
  --accent: #ff7a18;
  --accent-2: #ffb347;
  --danger: #ff4d4f;
  --line: #2c3642;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Spline Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #24303c 0%, var(--bg) 45%) no-repeat fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px clamp(20px, 6vw, 64px) 56px;
  gap: 28px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(120deg, rgba(255, 122, 24, 0.18), rgba(255, 179, 71, 0.04));
  border: 1px solid rgba(255, 122, 24, 0.2);
  padding: 20px 28px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.95rem;
}

.header-right {
  display: flex;
  gap: 16px;
}

.ghost-link {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

.ghost-link:hover {
  border-color: rgba(255, 122, 24, 0.5);
  color: var(--accent-2);
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  align-items: stretch;
}

.hero-left h1 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 3.6vw, 3rem);
  margin-bottom: 8px;
}

.hero-left p {
  color: var(--muted);
  margin-bottom: 18px;
  max-width: 520px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
}

.pill-state {
  border-color: rgba(255, 122, 24, 0.45);
  color: var(--accent-2);
}

.pill-ok {
  border-color: rgba(80, 200, 120, 0.5);
  color: #7ff0a8;
}

.pill-warn {
  border-color: rgba(255, 77, 79, 0.5);
  color: #ffd2d2;
}

.status-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-title {
  font-weight: 600;
  font-size: 1rem;
}

audio {
  width: 100%;
  border-radius: 12px;
  background: var(--bg-soft);
}

.status-meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hls-link {
  color: var(--accent-2);
  margin-left: 4px;
  word-break: break-all;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-panel {
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-title {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
}

.panel-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-footer {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.panel-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.viral-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  padding: 26px;
  border-radius: 24px;
  background: radial-gradient(circle at top right, rgba(255, 122, 24, 0.25), rgba(15, 18, 22, 0.85)),
    linear-gradient(135deg, rgba(36, 44, 58, 0.95), rgba(15, 18, 22, 0.9));
  border: 1px solid rgba(255, 122, 24, 0.25);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.viral-hero::after {
  content: "";
  position: absolute;
  inset: -40% 50% auto -40%;
  height: 320px;
  background: radial-gradient(circle, rgba(255, 179, 71, 0.22), rgba(0, 0, 0, 0));
  pointer-events: none;
  filter: blur(0px);
}

.viral-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.viral-hero-left h1 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  margin: 14px 0 10px;
}

.viral-hero-left p {
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 18px;
}

.viral-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.viral-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-card {
  background: rgba(15, 18, 22, 0.7);
  border: 1px solid rgba(255, 122, 24, 0.2);
  border-radius: 16px;
  padding: 12px 14px;
  text-align: left;
}

.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.share-card {
  background: linear-gradient(160deg, rgba(255, 122, 24, 0.18), rgba(15, 18, 22, 0.85));
  border: 1px solid rgba(255, 122, 24, 0.35);
  border-radius: 22px;
  padding: 22px;
  display: grid;
  gap: 12px;
  position: relative;
  min-height: 320px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.share-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 77, 79, 0.2);
  border: 1px solid rgba(255, 77, 79, 0.6);
  color: #ffd2d2;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
}

.share-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.share-sub {
  color: var(--muted);
  font-size: 0.95rem;
}

.share-wave {
  height: 70px;
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(255, 122, 24, 0.3), rgba(255, 179, 71, 0.05));
  position: relative;
  overflow: hidden;
}

.share-wave::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 122, 24, 0.5), rgba(0, 0, 0, 0));
  animation: waveGlow 4s ease-in-out infinite;
}

.share-meta {
  display: grid;
  gap: 4px;
}

.share-line {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--muted);
}

.share-link {
  word-break: break-all;
  font-weight: 600;
  color: var(--accent-2);
}

.share-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.viral-panel {
  margin-top: 24px;
  border: 1px solid rgba(255, 122, 24, 0.2);
}

.viral-form {
  display: grid;
  gap: 16px;
}

.playlist-panel {
  display: grid;
  gap: 16px;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
}

.upload-row .btn.primary {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  justify-self: end;
}

.upload-row input[type="file"] {
  color: var(--muted);
}

.file-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15, 18, 22, 0.6);
  cursor: pointer;
  overflow: hidden;
}

.file-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  transition: border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.file-name {
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-picker:hover .file-btn {
  border-color: rgba(255, 122, 24, 0.5);
  color: var(--accent-2);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.sort-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 0;
}

.sort-btn:hover {
  color: var(--accent-2);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.6);
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.modal-title {
  font-weight: 700;
  font-size: 1.1rem;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.preview-audio {
  display: none;
}

.row-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.play-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: all 0.2s ease;
}

.play-dot-on {
  background: #7ff0a8;
  box-shadow: 0 0 12px rgba(127, 240, 168, 0.6);
}

.library-panel {
  display: grid;
  gap: 16px;
}

.library-upload {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.library-grid {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 18px;
}

.library-title {
  font-weight: 600;
  margin-bottom: 10px;
}

.library-folders {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  min-height: 280px;
}

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

.folder-row {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  position: relative;
  padding-right: 32px;
}

.folder-row.active {
  color: var(--accent-2);
  background: rgba(255, 122, 24, 0.12);
}

.folder-add {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.folder-add:hover {
  border-color: rgba(255, 122, 24, 0.5);
  color: var(--accent-2);
}

.folder-del {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 77, 79, 0.45);
  background: rgba(255, 77, 79, 0.08);
  color: #ffd2d2;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.folder-del:hover {
  border-color: rgba(255, 77, 79, 0.8);
  color: #ffb2b2;
}

.folder-create {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px 8px 8px 18px;
}

.folder-ok {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.library-folders details {
  margin-bottom: 6px;
}

.library-folders details details {
  margin-left: 16px;
}

.folder-group > summary {
  padding-left: 8px;
}

@media (max-width: 900px) {
  .library-upload {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .upload-row {
    grid-template-columns: 1fr;
  }
}

@keyframes waveGlow {
  0% {
    transform: translateX(-20%);
    opacity: 0.4;
  }
  50% {
    transform: translateX(20%);
    opacity: 0.8;
  }
  100% {
    transform: translateX(-20%);
    opacity: 0.4;
  }
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  font-weight: 600;
}

.btn:hover:enabled {
  transform: translateY(-1px);
  border-color: rgba(255, 122, 24, 0.5);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: none;
  color: #1a120b;
}

.btn.danger {
  background: rgba(255, 77, 79, 0.12);
  border-color: rgba(255, 77, 79, 0.6);
  color: #ffd2d2;
}

.btn.ghost {
  background: transparent;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.2);
}

.error {
  color: #ffd2d2;
  background: rgba(255, 77, 79, 0.16);
  border: 1px solid rgba(255, 77, 79, 0.5);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.table-panel {
  padding-bottom: 8px;
}

.table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr 1fr auto;
  gap: 16px;
  padding: 12px 16px;
  background: var(--card-strong);
  border-radius: 14px;
  align-items: center;
}

.playlist-panel .table-row {
  grid-template-columns: 0.7fr 2fr 2fr 1fr auto;
}

.table-row.active {
  border: 1px solid rgba(255, 122, 24, 0.5);
  background: rgba(255, 122, 24, 0.08);
}

.table-row.drag-over {
  border: 1px dashed rgba(255, 179, 71, 0.6);
  background: rgba(255, 179, 71, 0.08);
}

.table-head {
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.cell-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.strong {
  font-weight: 600;
}

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

.empty {
  color: var(--muted);
  padding: 14px 6px;
}

.count-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.85rem;
}

.progress-box {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: 14px;
  border: 1px solid var(--line);
}

.map-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: 14px;
  border: 1px solid var(--line);
}

.listener-map {
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 8px;
}

.euro-map {
  width: 100%;
  height: 100%;
}

.euro-map path {
  vector-effect: non-scaling-stroke;
}

.progress-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.progress-line {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .row-actions {
    justify-content: flex-start;
  }
}
