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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #0a0a0f;
  color: #edf2ff;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}

/* Subtle background pattern */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle at 1px 1px, rgba(168, 85, 247, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  position: relative;
  z-index: 2;
}

/* Header/Brand */
.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 1rem;
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo h1 span {
  background: linear-gradient(135deg, #a855f7, #ec489a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo p {
  font-size: 0.8rem;
  color: #8b8ca6;
  margin-top: 0.25rem;
}

.badge span {
  background: rgba(168, 85, 247, 0.15);
  padding: 0.4rem 1rem;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #c084fc;
  backdrop-filter: blur(4px);
}

.badge i {
  margin-right: 0.4rem;
  font-size: 0.75rem;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.gradient-text {
  background: linear-gradient(135deg, #a855f7, #ec489a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  font-size: 1.1rem;
  color: #9ca3af;
  max-width: 600px;
  margin: 0 auto;
}

/* Input Card */
.card {
  background: rgba(18, 18, 24, 0.8);
  backdrop-filter: blur(12px);
  border-radius: 28px;
  padding: 1.5rem;
  margin-bottom: 3rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.input-card {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Shake Animation */
.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.input-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.input-icon {
  background: rgba(168, 85, 247, 0.15);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  font-size: 1.8rem;
  color: #a855f7;
}

#tiktokUrl {
  flex: 1;
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.2rem;
  font-size: 1rem;
  border-radius: 20px;
  color: #fff;
  font-family: 'Inter', monospace;
  transition: all 0.2s;
}

#tiktokUrl:focus {
  outline: none;
  border-color: #a855f7;
  background: #14141a;
}

.btn-primary {
  background: linear-gradient(135deg, #a855f7, #ec489a);
  border: none;
  padding: 0.9rem 2rem;
  border-radius: 40px;
  font-weight: 600;
  font-size: 1rem;
  color: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.4);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Examples */
.examples {
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.8rem;
  color: #8b8ca6;
}

.example-link {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 30px;
  font-size: 0.75rem;
  color: #c084fc;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.example-link:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.loading-spinner {
  text-align: center;
  background: rgba(24, 24, 32, 0.95);
  padding: 2rem 2.5rem;
  border-radius: 32px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  min-width: 280px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(168, 85, 247, 0.2);
  border-top-color: #a855f7;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

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

.loading-spinner p {
  margin-top: 0.5rem;
  color: #cbd5e1;
}

.api-attempt {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: #8b8ca6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.attempt-dot {
  width: 6px;
  height: 6px;
  background: #a855f7;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: rgba(30, 30, 38, 0.95);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transform: translateX(120%);
  animation: slideIn 0.3s ease forwards;
  pointer-events: auto;
  cursor: pointer;
}

.toast.success {
  border-left-color: #10b981;
}
.toast.success i {
  color: #10b981;
}

.toast.error {
  border-left-color: #ef4444;
}
.toast.error i {
  color: #ef4444;
}

.toast.warning {
  border-left-color: #f59e0b;
}
.toast.warning i {
  color: #f59e0b;
}

.toast.info {
  border-left-color: #3b82f6;
}
.toast.info i {
  color: #3b82f6;
}

.toast i {
  font-size: 1.2rem;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.toast-message {
  font-size: 0.75rem;
  color: #9ca3af;
}

@keyframes slideIn {
  0% {
    transform: translateX(120%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(120%);
    opacity: 0;
  }
}

.toast.exit {
  animation: slideOut 0.3s ease forwards;
}

/* Result Area */
.result-area {
  margin: 2rem 0;
  animation: slideUp 0.3s ease;
}

.video-card {
  background: rgba(18, 18, 24, 0.9);
  backdrop-filter: blur(8px);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: transform 0.2s;
}

.video-preview {
  position: relative;
  background: #000;
  max-height: 500px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.video-preview video {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
}

.video-info {
  padding: 1.5rem;
}

.video-info h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.author {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.8rem 0;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.stats {
  display: flex;
  gap: 1.5rem;
  margin: 1rem 0;
  padding: 0.8rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

.stats i {
  color: #a855f7;
  width: 18px;
}

.download-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn-download {
  background: linear-gradient(135deg, #a855f7, #ec489a);
  border: none;
  padding: 0.75rem 1.8rem;
  border-radius: 40px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: inherit;
  text-decoration: none;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1.4rem;
  border-radius: 40px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(168, 85, 247, 0.5);
}

/* Features Grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.8rem;
  margin: 4rem 0;
}

.feature-card {
  background: rgba(18, 18, 24, 0.6);
  backdrop-filter: blur(8px);
  padding: 1.5rem;
  border-radius: 24px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}

.feature-card i {
  font-size: 2rem;
  background: linear-gradient(135deg, #a855f7, #ec489a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.feature-card p {
  font-size: 0.85rem;
  color: #9ca3af;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: #6b7280;
}

.disclaimer {
  font-size: 0.7rem;
  margin-top: 0.5rem;
  color: #4b5563;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem 1rem 3rem;
  }
  
  .hero h2 {
    font-size: 1.8rem;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .input-icon {
    display: none;
  }
  
  #tiktokUrl {
    width: 100%;
  }
  
  .btn-primary {
    width: 100%;
    justify-content: center;
  }
  
  .brand {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .features {
    gap: 1rem;
  }
  
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .toast {
    min-width: auto;
    width: calc(100% - 20px);
    max-width: none;
  }
}

/* Enhanced Loading Overlay */
.loading-spinner {
  text-align: center;
  background: rgba(24, 24, 32, 0.95);
  padding: 2rem 2.5rem;
  border-radius: 32px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  min-width: 320px;
  backdrop-filter: blur(16px);
  animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(168, 85, 247, 0.2);
  border-top-color: #a855f7;
  border-right-color: #ec489a;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

.loading-spinner p {
  margin-top: 1rem;
  color: #e2e8f0;
  font-size: 1rem;
  font-weight: 500;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Loading message animation */
#loadingMessage {
  animation: gentlePulse 1.5s ease-in-out infinite;
}

@keyframes gentlePulse {
  0%, 100% { opacity: 0.7; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

/* Button Loader */
.btn-loader {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
}

.btn-primary.loading .btn-text {
  opacity: 0.8;
}

.btn-primary.loading {
  cursor: wait;
}

/* Accordion Styles */
.accordion-section {
  margin: 3rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.accordion-item {
  background: rgba(18, 18, 24, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
}

.accordion-item:hover {
  border-color: rgba(168, 85, 247, 0.3);
}

.accordion-header {
  padding: 1.2rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.2s ease;
}

.accordion-header:hover {
  background: rgba(168, 85, 247, 0.05);
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1rem;
  color: #e2e8f0;
}

.accordion-title i {
  font-size: 1.2rem;
  color: #a855f7;
}

.accordion-icon {
  font-size: 0.9rem;
  color: #8b8ca6;
  transition: transform 0.3s ease;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active .accordion-content {
  max-height: 800px;
}

.accordion-inner {
  padding: 0 1.5rem 1.5rem 1.5rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.accordion-inner p {
  margin-bottom: 1rem;
}

.accordion-inner ol, 
.accordion-inner ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.accordion-inner li {
  margin: 0.6rem 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.accordion-inner li i {
  width: 20px;
  color: #a855f7;
  font-size: 0.9rem;
}

/* Tip, Warning, Success Boxes */
.tip-box,
.warning-box,
.success-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.85rem;
}

.tip-box {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid #3b82f6;
}

.tip-box i {
  color: #3b82f6;
  font-size: 1rem;
}

.warning-box {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid #f59e0b;
}

.warning-box i {
  color: #f59e0b;
  font-size: 1rem;
}

.success-box {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid #10b981;
}

.success-box i {
  color: #10b981;
  font-size: 1rem;
}

/* Link Formats */
.link-formats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 1rem 0;
}

.format-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.format-badge code {
  font-family: monospace;
  font-size: 0.75rem;
  color: #c084fc;
  word-break: break-all;
  flex: 1;
}

.format-label {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  background: rgba(168, 85, 247, 0.2);
  border-radius: 20px;
  color: #a855f7;
  white-space: nowrap;
}

.note {
  font-size: 0.8rem;
  color: #8b8ca6;
  margin-top: 0.5rem;
}

/* Responsive Accordion */
@media (max-width: 768px) {
  .accordion-header {
    padding: 1rem;
  }
  
  .accordion-title {
    font-size: 0.9rem;
  }
  
  .accordion-inner {
    padding: 0 1rem 1rem 1rem;
  }
  
  .format-badge {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .format-label {
    align-self: flex-start;
  }
}