:root {
  --bg: #0a0e1a;
  --bg-lighter: #111828;
  --panel: #1a2332;
  --accent: #5cf1d9;
  --accent-2: #8f74ff;
  --accent-glow: rgba(92, 241, 217, 0.15);
  --text: #e7ecf7;
  --text-muted: #8b92a8;
  --border: #1f2937;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 10px;
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  font-size: 16px;
}

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

body {
  background: radial-gradient(circle at 25% 15%, #1a2640, #0a0e1a 50%),
              radial-gradient(circle at 75% 85%, #141f35, transparent 50%),
              #0a0e1a;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== AUTH PAGE ===== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-container {
  max-width: 480px;
  width: 100%;
}

.auth-hero {
  text-align: center;
  margin-bottom: 32px;
}

.logo-area {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.orb-small {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), var(--accent-2));
  filter: blur(20px);
  opacity: 0.6;
  margin: 0 auto 16px;
  animation: float 4s ease-in-out infinite;
}

.auth-hero h1 {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.auth-lede {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

.auth-card {
  padding: 32px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg-lighter);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.tab {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--panel);
  color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form.hidden {
  display: none;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
}

.pill-mini {
  display: inline-block;
  padding: 6px 12px;
  margin: 4px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(92, 241, 217, 0.08);
  color: var(--accent);
  border: 1px solid rgba(92, 241, 217, 0.2);
}

/* ===== NAVBAR ===== */
.navbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-user {
  color: var(--text-muted);
  font-size: 14px;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--accent);
}

/* ===== MAIN PAGE ===== */
.main-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  align-items: start;
}

.settings-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px;
}

.settings-page h1 {
  font-size: 36px;
  margin-bottom: 32px;
}

.settings-section {
  margin-bottom: 24px;
}

/* ===== CARDS ===== */
.card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 20px;
  margin-bottom: 16px;
  font-weight: 600;
}

/* ===== FORMS ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group {
  display: grid;
  gap: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

label {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

input,
select {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  padding: 12px 14px;
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: all 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== BUTTONS ===== */
button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0e1a;
  box-shadow: 0 8px 24px rgba(92, 241, 217, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(92, 241, 217, 0.35);
}

.btn-secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-lighter);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
}

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

/* ===== PROVIDER SELECTOR ===== */
.provider-selector {
  margin-bottom: 20px;
}

.provider-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.provider-btn {
  background: var(--panel);
  border: 2px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.provider-btn:hover {
  border-color: var(--accent);
}

.provider-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

.provider-icon {
  font-size: 24px;
}

/* ===== PLAYBACK INFO ===== */
.refresh-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auto-refresh-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

.manual-section {
  margin: 20px 0;
}

.manual-section summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  padding: 12px;
  background: var(--bg-lighter);
  border-radius: var(--radius-sm);
  user-select: none;
}

.manual-section summary:hover {
  color: var(--accent);
}

.manual-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.now-playing-info {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-lighter);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.track-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.track-artist {
  font-size: 15px;
  color: var(--text-muted);
}

.track-details {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.track-bpm {
  font-weight: 600;
  color: var(--accent);
}

.placeholder-text,
.error-text {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.error-text {
  color: #ff6b6b;
}

/* ===== ANIMATION ===== */
.animation-section {
  min-height: 500px;
}

.animation-container {
  margin-top: 16px;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  min-height: 400px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, rgba(92, 241, 217, 0.05), transparent 50%),
              radial-gradient(circle at 70% 70%, rgba(143, 116, 255, 0.08), transparent 50%);
  position: relative;
  overflow: hidden;
}

.placeholder-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
}

.pulse-loader {
  width: 60px;
  height: 60px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.animation-container video {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.animation-meta {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

/* ===== MANNEQUIN FALLBACK ===== */
.mannequin {
  position: relative;
  width: 180px;
  height: 240px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.3));
}

.mannequin .head {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffcba4, #f0b27a);
  position: absolute;
  top: 24px;
}

.mannequin .torso {
  width: 32px;
  height: 80px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--accent), #2fb8a8);
  position: absolute;
  top: 58px;
}

.mannequin .limb {
  width: 16px;
  height: 75px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent-2), #5b5fdd);
  position: absolute;
  transform-origin: top center;
  animation: swing var(--anim-speed, 1.4s) ease-in-out infinite alternate;
}

.mannequin .arm {
  top: 66px;
}

.mannequin .leg {
  top: 132px;
  height: 84px;
}

.mannequin .left {
  left: -28px;
}

.mannequin .right {
  right: -28px;
}

.mannequin .left.arm {
  animation-delay: 0.05s;
}
.mannequin .right.arm {
  animation-delay: 0.15s;
}
.mannequin .left.leg {
  animation-delay: 0.25s;
}
.mannequin .right.leg {
  animation-delay: 0.35s;
}

.mannequin[data-bucket='slow'] {
  --anim-speed: 2.4s;
}
.mannequin[data-bucket='groove'] {
  --anim-speed: 1.6s;
}
.mannequin[data-bucket='fast'] {
  --anim-speed: 1.2s;
}
.mannequin[data-bucket='hyper'] {
  --anim-speed: 0.9s;
}

@keyframes swing {
  0% {
    transform: rotate(-20deg);
  }
  100% {
    transform: rotate(20deg);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.05);
  }
}

/* ===== SETTINGS ===== */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.character-card {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.character-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.character-card.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.character-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  color: #0a0e1a;
}

.character-name {
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
}

.character-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #0a0e1a;
  display: grid;
  place-items: center;
  font-weight: 700;
}

/* ===== OAUTH BUTTONS ===== */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--panel);
  border: 2px solid var(--border);
  text-align: left;
  font-size: 16px;
  transition: all 0.2s;
}

.oauth-btn:not(:disabled):hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

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

.oauth-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--accent-glow);
  border-radius: 12px;
}

.oauth-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.oauth-text strong {
  color: var(--text);
}

.oauth-status {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.oauth-arrow {
  font-size: 20px;
  color: var(--text-muted);
}

/* ===== STATUS ===== */
.status {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
}

.status.success {
  background: rgba(92, 241, 217, 0.1);
  color: var(--accent);
  border: 1px solid rgba(92, 241, 217, 0.3);
}

.status.error {
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
}

/* ===== UTILITIES ===== */
.muted {
  color: var(--text-muted);
}

.tiny {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

.hidden {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1000px) {
  .main-page {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 12px 16px;
  }

  .nav-content {
    flex-direction: column;
    gap: 12px;
  }

  .main-page,
  .settings-page {
    padding: 16px;
  }

  .provider-buttons {
    grid-template-columns: 1fr;
  }

  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
