:root {
  --bg: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f0f5;
  --text-muted: #8888a0;
  --accent: #7c6cf0;
  --accent-light: #a594ff;
  --accent-glow: rgba(124, 108, 240, 0.35);
  --cyan: #4ecdc4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --player-h: 80px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 600px; height: 600px;
  background: var(--accent-glow);
  top: -200px; right: -100px;
  opacity: 0.5;
}
.bg-glow-2 {
  width: 500px; height: 500px;
  background: rgba(78, 205, 196, 0.15);
  bottom: 100px; left: -150px;
}

/* Header */
.header {
  position: relative;
  z-index: 1;
  padding: 48px 24px 32px;
  text-align: center;
}
.header-inner { max-width: 800px; margin: 0 auto; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.logo-text {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff 30%, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tagline {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 300;
}

/* Main */
.main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px calc(var(--player-h) + 60px);
}

.view { display: none; }
.view.active { display: block; }

.section-head {
  margin-bottom: 28px;
}
.section-head h2 {
  font-size: 1.35rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.muted { color: var(--text-muted); font-size: 0.875rem; }

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(8px);
}
.cat-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(124, 108, 240, 0.3);
  box-shadow: var(--shadow), 0 0 24px var(--accent-glow);
}
.cat-card-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
}
.cat-card-name {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 6px;
}
.cat-card-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* List toolbar */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.875rem;
  transition: color 0.2s, border-color 0.2s;
}
.btn-back:hover { color: var(--text); border-color: var(--accent); }
.list-title {
  font-size: 1.25rem;
  font-weight: 500;
  flex: 1;
}

/* Search */
.search-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}
.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.search-select {
  flex: 0 0 180px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
}
.search-select:focus { border-color: var(--accent); }
.search-input-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px 12px 42px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }
.btn-search {
  background: linear-gradient(135deg, var(--accent), #6355d4);
  border: none;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-search:hover { opacity: 0.9; transform: scale(1.02); }
.btn-search:active { transform: scale(0.98); }
.search-hint {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* List status */
.list-status {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  min-height: 1.4em;
}
.list-status.loading { color: var(--accent-light); }

/* Ringtone list */
.ringtone-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ring-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: background 0.2s, border-color 0.2s;
}
.ring-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 108, 240, 0.2);
}
.ring-item.playing {
  border-color: var(--accent);
  background: rgba(124, 108, 240, 0.08);
}

.btn-play {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), #6355d4);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.2s;
}
.btn-play:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.ring-item.playing .btn-play {
  background: linear-gradient(135deg, var(--cyan), #3ab8b0);
}

.ring-body { flex: 1; min-width: 0; }
.ring-name {
  font-size: 0.9rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ring-size {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-dl {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.78rem;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-dl:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  padding-bottom: 20px;
}
.page-btn {
  min-width: 38px; height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
}
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 12px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }

/* Player bar */
.player-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--player-h);
  background: rgba(12, 12, 18, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  transform: translateY(0);
  transition: transform 0.3s;
}
.player-bar.hidden {
  transform: translateY(100%);
  pointer-events: none;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.player-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
  flex-shrink: 0;
}
.player-visualizer span {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  height: 8px;
  transition: height 0.15s;
}
.player-bar.playing .player-visualizer span:nth-child(1) { animation: bar 0.8s ease infinite alternate; }
.player-bar.playing .player-visualizer span:nth-child(2) { animation: bar 0.6s ease 0.1s infinite alternate; }
.player-bar.playing .player-visualizer span:nth-child(3) { animation: bar 0.7s ease 0.2s infinite alternate; }
.player-bar.playing .player-visualizer span:nth-child(4) { animation: bar 0.5s ease 0.15s infinite alternate; }
@keyframes bar {
  from { height: 6px; }
  to { height: 24px; }
}

.player-meta { min-width: 0; }
.player-title {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-category {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.btn-player {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), #6355d4);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-download {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.btn-download:hover { border-color: var(--cyan); color: var(--cyan); }

.hidden { display: none !important; }

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 20px 32px;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.8;
}
.footer-beian a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-beian a:hover {
  color: var(--text);
}

/* Responsive */
@media (max-width: 600px) {
  .header { padding: 32px 16px 24px; }
  .logo-text { font-size: 1.5rem; }
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cat-card { padding: 18px 12px; }
  .search-select { flex: 1 1 100%; }
  .search-row { flex-direction: column; }
  .btn-search { width: 100%; }
  .player-bar { padding: 0 16px; }
  .btn-download { display: none; }
  .ring-name { font-size: 0.85rem; }
}
