@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #8B5CF6;
  --primary-light: #A78BFA;
  --primary-dark: #7C3AED;
  --accent: #F59E0B;
  --success: #10B981;
  --bg-dark: #0F0F1A;
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #F8FAFC;
  --text-secondary: rgba(248, 250, 252, 0.6);
  --text-muted: rgba(248, 250, 252, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --spotify-green: #1DB954;
  --youtube-red: #FF0000;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Prompt', 'Inter', -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* === CARD PAGE === */
.card-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Blurred background from cover */
.bg-blur {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-size: cover;
  background-position: center;
  filter: blur(80px) brightness(0.3) saturate(1.5);
  z-index: 0;
  transition: background-image 1s ease;
}

.bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, transparent 0%, var(--bg-dark) 70%);
  z-index: 1;
}

/* Floating particles */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary-light);
  border-radius: 50%;
  opacity: 0;
  animation: float-up 6s infinite;
}

@keyframes float-up {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  20% { opacity: 0.6; }
  80% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-20vh) scale(1); }
}

/* Card content */
.card-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

/* Rotating album cover */
.cover-container {
  margin: 0 auto 32px;
  width: 220px;
  height: 220px;
  position: relative;
}

.cover-ring {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 236px;
  height: 236px;
  border-radius: 50%;
  border: 2px solid rgba(139, 92, 246, 0.3);
  animation: ring-pulse 3s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 1; }
}

.cover-image {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  animation: spin 20s linear infinite;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.3), 0 0 100px rgba(139, 92, 246, 0.1);
}

.cover-image.paused {
  animation-play-state: paused;
}

.cover-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background: var(--bg-dark);
  border-radius: 50%;
  border: 2px solid rgba(139, 92, 246, 0.4);
  z-index: 2;
}

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

.cover-placeholder {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
  animation: spin 20s linear infinite;
}

/* Song info */
.song-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.3;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.song-artist {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-weight: 400;
}

/* Message bubble */
.message-bubble {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 32px;
  text-align: left;
  position: relative;
}

.message-bubble::before {
  content: '💌';
  position: absolute;
  top: -12px;
  left: 16px;
  font-size: 20px;
}

.message-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  font-style: italic;
}

/* Play buttons */
.play-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-family: inherit;
}

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

.btn-spotify {
  background: var(--spotify-green);
  color: white;
  box-shadow: 0 8px 30px rgba(29, 185, 84, 0.3);
}

.btn-spotify:hover {
  box-shadow: 0 12px 40px rgba(29, 185, 84, 0.5);
  transform: translateY(-2px);
}

.btn-youtube {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-youtube:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.btn-icon {
  width: 22px;
  height: 22px;
}

/* Tap count */
.tap-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Footer */
.card-footer {
  position: relative;
  z-index: 2;
  margin-top: 12px;
}

.btn-change {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  transition: color 0.2s;
}

.btn-change:hover {
  color: var(--text-secondary);
}

.brand {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* === SETUP PAGE === */
.setup-page {
  min-height: 100vh;
  padding: 24px;
  padding-top: env(safe-area-inset-top, 24px);
  background: var(--bg-dark);
}

.setup-header {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 20px;
}

.setup-logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.setup-title {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.setup-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Search panel */
.panel {
  display: none;
}

.panel.active {
  display: block;
}

.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-muted);
}

/* Search results */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.search-results::-webkit-scrollbar {
  width: 4px;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.result-item:hover, .result-item.selected {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
}

.result-cover {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-artist {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-check {
  color: var(--primary);
  font-size: 20px;
  flex-shrink: 0;
  display: none;
}

.result-item.selected .result-check {
  display: block;
}

/* Paste panel */
.paste-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 80px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.paste-input:focus {
  border-color: var(--primary);
}

.paste-input::placeholder {
  color: var(--text-muted);
}

.paste-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

.paste-result {
  margin-top: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.paste-result.show {
  display: flex;
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.parsed-song-info {
  flex: 1;
}

.parsed-platform {
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}

.parsed-track {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.parsed-check {
  font-size: 24px;
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
  margin-left: 12px;
}

/* Step guide */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Supported platforms footer */
.setup-supported {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
  letter-spacing: 0.5px;
}

/* Message input */
.message-section {
  margin-top: 24px;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.message-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 60px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.message-input:focus {
  border-color: var(--primary);
}

.message-input::placeholder {
  color: var(--text-muted);
}

/* Save button */
.btn-save {
  width: 100%;
  margin-top: 32px;
  padding: 16px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.3);
}

.btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.5);
}

.btn-save:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

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

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--success);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  transition: transform 0.3s ease;
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.3);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Loading page */
.loading-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
}

.loading-page .spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* Error page */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--bg-dark);
}

.error-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.error-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

/* === COUNTDOWN AUTO-REDIRECT === */
.countdown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.countdown-ring-wrap {
  position: relative;
  width: 60px;
  height: 60px;
}

.countdown-svg {
  width: 60px;
  height: 60px;
  transform: rotate(-90deg);
}

.countdown-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.countdown-circle {
  fill: none;
  stroke: var(--primary-light);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 0;
  animation: countdown-ring 3s linear forwards;
}

@keyframes countdown-ring {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 163.36; }
}

.countdown-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-light);
}

.countdown-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-cancel-redirect {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 24px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-cancel-redirect:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
}

/* === RESPONSIVE === */

/* NetEase Cloud Music button */
.btn-netease {
  background: #E60026;
  color: white;
  box-shadow: 0 8px 30px rgba(230, 0, 38, 0.3);
}

.btn-netease:hover {
  box-shadow: 0 12px 40px rgba(230, 0, 38, 0.5);
  transform: translateY(-2px);
}

/* QQ Music button */
.btn-qqmusic {
  background: #31C27C;
  color: white;
  box-shadow: 0 8px 30px rgba(49, 194, 124, 0.3);
}

.btn-qqmusic:hover {
  box-shadow: 0 12px 40px rgba(49, 194, 124, 0.5);
  transform: translateY(-2px);
}

.btn-icon-text {
  font-size: 20px;
  font-weight: 700;
}

/* Manual input form */
.manual-field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.manual-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.manual-input:focus {
  border-color: var(--primary);
}

.manual-input::placeholder {
  color: var(--text-muted);
}

/* Platform selector */
.platform-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.platform-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.platform-btn:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
}

.platform-btn.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Paste example text */
.paste-example {
  color: var(--text-muted);
  font-style: italic;
}
@media (max-width: 380px) {
  .cover-image, .cover-placeholder {
    width: 180px;
    height: 180px;
  }
  .cover-container {
    width: 180px;
    height: 180px;
  }
  .cover-ring {
    width: 196px;
    height: 196px;
  }
  .song-name {
    font-size: 20px;
  }
}
