:root {
  --site-font: Arial, sans-serif;
  --site-bg: #ECE7F5;
  --site-surface: #F9F8FC;
  --site-surface-white: #FFFFFF;
  --site-surface-soft: #F3ECF8;
  --site-border: #DED5E6;
  --site-border-strong: #C9B9D9;
  --site-plum: #6D4770;
  --site-plum-muted: #8A6B8E;
  --site-plum-soft: #9C82A1;
  --site-orchid: #DC7EE3;
  --site-orchid-hover: #CA64D2;
  --site-orchid-deep: #B54FBE;
  --site-orchid-soft: rgba(220, 126, 227, 0.16);
  --site-orchid-glow: rgba(220, 126, 227, 0.34);
  --site-heart: #E84A96;

  --bg-deep: var(--site-bg);
  --bg-surface: var(--site-surface);
  --bg-card: var(--site-surface-white);
  --bg-card-hover: var(--site-surface-soft);
  --border-subtle: var(--site-border);
  --border-strong: var(--site-border-strong);
  --accent-pink: var(--site-orchid);
  --accent-pink-hover: var(--site-orchid-hover);
  --accent-pink-deep: var(--site-orchid-deep);
  --accent-magenta: var(--site-orchid);
  --accent-purple: var(--site-plum);
  --accent-soft: var(--site-orchid-soft);
  --accent-glow: var(--site-orchid-glow);
  --text-primary: var(--site-plum);
  --text-secondary: var(--site-plum-muted);
  --text-muted: var(--site-plum-soft);
  --heart-color: var(--site-heart);
}

.hidden {
  display: none !important;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: rgba(220, 126, 227, 0.16);
  color: var(--site-orchid-deep);
  user-select: none;
  cursor: default;
}

.role-badge svg {
  width: 12px;
  height: 12px;
  display: block;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  font-family: var(--site-font);
}

button,
input,
select,
textarea,
optgroup {
  font-family: inherit;
}

.page-shell {
  max-width: 1040px;
  margin: 0 auto;
}

.site-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  transition: opacity 0.22s ease, visibility 0s linear 0s;
}

body.fs-player-open .site-topbar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 37px;
}

.site-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 37px;
}

.user-name-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 230px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgba(109, 71, 112, 0.08);
  user-select: none;
}

.user-name-badge > svg {
  flex-shrink: 0;
  color: var(--accent-pink-deep);
}

.user-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgba(109, 71, 112, 0.08);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.site-nav-btn:hover {
  background: var(--bg-card);
  border-color: var(--accent-pink);
  color: var(--accent-pink-deep);
}

.site-nav-btn:active {
  transform: scale(0.97);
}

.site-nav-btn.is-active {
  background: linear-gradient(135deg, var(--site-orchid) 0%, var(--site-orchid-deep) 100%);
  color: #ffffff;
  border-color: var(--site-orchid-deep);
  box-shadow: 0 4px 14px var(--site-orchid-glow);
}

.site-nav-btn.is-active:hover {
  background: linear-gradient(135deg, var(--site-orchid-hover) 0%, var(--site-orchid-deep) 100%);
  border-color: var(--site-orchid-deep);
  color: #ffffff;
}

@media (max-width: 480px) {
  .site-nav-btn {
    padding: 7px 12px;
    font-size: 12.5px;
    gap: 6px;
  }

  .user-name-badge {
    max-width: 180px;
    padding: 5px 11px;
    font-size: 12px;
    gap: 5px;
  }
}

/* Loading Skeleton Primitives */
.loading-skeleton-shell {
  display: block;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(109, 71, 112, 0.09) 25%,
    rgba(220, 126, 227, 0.16) 50%,
    rgba(109, 71, 112, 0.09) 75%
  );
  background-size: 220% 100%;
  animation: skeletonShimmer 1.55s ease-in-out infinite;
}

.skeleton-shimmer-hero {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.16) 25%,
    rgba(255, 255, 255, 0.34) 50%,
    rgba(255, 255, 255, 0.16) 75%
  );
  background-size: 220% 100%;
  animation: skeletonShimmer 1.55s ease-in-out infinite;
}

.skeleton-line {
  display: block;
  height: 14px;
  border-radius: 7px;
}

.skeleton-circle {
  display: block;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-pill {
  display: inline-block;
  border-radius: 999px;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-shimmer,
  .skeleton-shimmer-hero {
    animation: none;
  }
}

/* Shared App Shell Layout & Components */
* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--site-bg);
  color: var(--site-plum);
  font-family: var(--site-font);
  padding: 16px 16px 32px;
}

body.has-mini-player {
  padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px));
}

html[data-active-view="home"] #view-artist,
html[data-active-view="home"] #view-playlist,
html[data-active-view="artist"] #view-home,
html[data-active-view="artist"] #view-playlist,
html[data-active-view="playlist"] #view-home,
html[data-active-view="playlist"] #view-artist {
  display: none !important;
}

#auth-error {
  background-color: #fdf0f5;
  color: #9c2754;
  border: 1px solid #f0b8ce;
  padding: 15px;
  border-radius: 12px;
  max-width: 450px;
  font-weight: bold;
}

#auth-loading {
  color: var(--site-plum-muted);
  font-style: italic;
}

.player-spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(109, 71, 112, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: inherit;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.spinner-ring {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  box-shadow: 0 0 10px rgba(109, 71, 112, 0.35);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ctrl-btn {
  border: 1.5px solid var(--site-border-strong);
  background: var(--site-surface);
  color: var(--site-plum);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(109, 71, 112, 0.08);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ctrl-btn:hover {
  background: var(--site-surface-white);
  border-color: var(--site-orchid);
  color: var(--site-orchid-deep);
}

.ctrl-btn.active {
  background: var(--site-orchid);
  color: #ffffff;
  border-color: var(--site-orchid);
  box-shadow: 0 4px 14px var(--site-orchid-glow);
}

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

.ctrl-btn-primary,
.ctrl-btn-admin {
  background: var(--site-orchid);
  color: #ffffff;
  border-color: var(--site-orchid);
  box-shadow: 0 4px 14px var(--site-orchid-glow);
}

.ctrl-btn-primary:hover,
.ctrl-btn-admin:hover {
  background: var(--site-orchid-hover);
  border-color: var(--site-orchid-hover);
  color: #ffffff;
}

.main-toast {
  position: fixed;
  bottom: 102px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10050;
  background: var(--site-plum);
  color: #ffffff;
  border: 1px solid rgba(220, 126, 227, 0.45);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: bold;
  box-shadow: 0 10px 26px rgba(109, 71, 112, 0.3);
}

/* Admin Song Row 3-Dots Menu & Delete Confirmation Modal */
.row-end-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

.row-more-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.row-more-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--site-plum-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.popular-row:hover .row-more-btn,
.popular-row:focus-within .row-more-btn,
.playlist-row:hover .row-more-btn,
.playlist-row:focus-within .row-more-btn,
.row-more-wrap.is-open .row-more-btn {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .row-more-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

.row-more-btn:hover,
.row-more-wrap.is-open .row-more-btn {
  background: var(--site-orchid-soft);
  border-color: rgba(220, 126, 227, 0.35);
  color: var(--site-plum);
}

.row-context-menu {
  position: fixed;
  min-width: 148px;
  padding: 5px;
  border-radius: 11px;
  background: var(--site-surface-white);
  border: 1px solid var(--site-border);
  box-shadow: 0 12px 28px rgba(109, 71, 112, 0.22);
  z-index: 10500;
}

.row-context-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--site-plum);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.row-context-menu-item.is-danger {
  color: #b42352;
}

.row-context-menu-item.is-danger:hover {
  background: #fdf0f5;
  color: #8f183f;
}

.delete-song-modal-card {
  width: min(430px, 100%);
}

.delete-song-confirm-text {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--site-plum);
}

.delete-song-confirm-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--site-plum-muted);
  line-height: 1.45;
}

.admin-danger-btn {
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  background: #c6285a;
  color: #ffffff;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(198, 40, 90, 0.28);
  transition: background 0.15s ease;
}

.admin-danger-btn:hover:not(:disabled) {
  background: #a91d4a;
}

.admin-danger-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#liked-playlist-created-modal {
  z-index: 12000;
}

.liked-created-modal-card {
  max-width: 440px;
  text-align: center;
  padding: 28px 26px 24px;
}

.liked-created-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #ffffff;
  background: linear-gradient(135deg, #d9468f, #8b5cf6);
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.32);
}

.liked-created-title {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 800;
  color: #362552;
  line-height: 1.35;
}

.liked-created-desc {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #5b4b75;
}

.liked-created-actions {
  justify-content: center;
  gap: 10px;
}

.liked-created-actions .admin-sec-btn,
.liked-created-actions .admin-primary-btn {
  min-width: 124px;
}


