/* ==========================================================================
   TikTok Downloader - Modern & Clean Frontend Stylesheet
   Supports Light & Dark Modes, Responsive Layout, Prefers-Reduced-Motion
   ========================================================================== */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Kantumruy Pro", "Khmer OS Battambang";
  --bg-color: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #0f172a;
  --border-glow: rgba(254, 44, 85, 0.25);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --primary-text: #ffffff;
  
  --accent: #fe2c55; /* TikTok Brand Magenta */
  --accent-cyan: #25f4ee; /* TikTok Brand Cyan */
  --accent-hover: #e02449;
  --accent-gradient: linear-gradient(135deg, #fe2c55 0%, #ff5277 50%, #25f4ee 100%);
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 35px -8px rgba(15, 23, 42, 0.12), 0 10px 15px -4px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 35px rgba(254, 44, 85, 0.2);
  
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg-color: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-subtle: #19233c;
  --bg-elevated: #1a243b;
  --border-color: #23304c;
  --border-focus: #38bdf8;
  --border-glow: rgba(254, 44, 85, 0.35);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-text: #0b0f19;
  
  --accent: #fe2c55;
  --accent-cyan: #25f4ee;
  --accent-hover: #ff476e;
  
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger-bg: rgba(239, 68, 68, 0.12);
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 6px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px -5px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 25px 50px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 45px rgba(254, 44, 85, 0.28);
}

/* ==========================================================================
   Global Reset & Ambient Background
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 50% -10%, rgba(254, 44, 85, 0.10) 0%, rgba(37, 244, 238, 0.05) 30%, transparent 65%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="dark"] body {
  background-image: 
    radial-gradient(circle at 50% -10%, rgba(254, 44, 85, 0.16) 0%, rgba(37, 244, 238, 0.07) 35%, transparent 70%);
}

.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

iconify-icon {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

/* ==========================================================================
   Sticky Navbar
   ========================================================================== */

.navbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.9rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: var(--transition);
}

[data-theme="dark"] .navbar {
  background: rgba(19, 27, 46, 0.85);
  border-bottom-color: var(--border-color);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #25f4ee;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .brand-icon-box {
  background: linear-gradient(135deg, #fe2c55 0%, #25f4ee 100%);
  color: #0b0f19;
  box-shadow: 0 4px 16px rgba(254, 44, 85, 0.35);
}

.brand-badge {
  font-size: 0.65rem;
  background: var(--accent);
  color: #fff;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(254, 44, 85, 0.35);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* License Status Pill */
.license-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: var(--transition);
}

.license-pill:hover {
  border-color: var(--text-dim);
  color: var(--text-main);
  transform: translateY(-1px);
}

.license-pill.active {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.license-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-dot 2s infinite;
}

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

.lang-select {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.lang-select:hover, .lang-select:focus {
  border-color: var(--text-dim);
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border-color: var(--text-dim);
  transform: translateY(-1px);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero {
  padding: 3.5rem 0 2rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-full);
  background: rgba(254, 44, 85, 0.08);
  border: 1px solid rgba(254, 44, 85, 0.2);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
  backdrop-filter: blur(8px);
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 0.85rem;
  background: linear-gradient(135deg, var(--text-main) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero-title {
  background: linear-gradient(135deg, #ffffff 40%, #ff5277 85%, #25f4ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 620px;
  margin: 0 auto 2.25rem;
  line-height: 1.5;
}

/* ==========================================================================
   Downloader Floating Box (Core UX)
   ========================================================================== */

.downloader-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  position: relative;
  transition: var(--transition);
}

.downloader-box:focus-within {
  border-color: rgba(254, 44, 85, 0.45);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 680px) {
  .input-group {
    flex-direction: row;
  }
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-icon-lead {
  position: absolute;
  left: 1.1rem;
  color: var(--text-dim);
  pointer-events: none;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
}

.url-input {
  width: 100%;
  padding: 1.1rem 5.8rem 1.1rem 3.1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.url-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .url-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.input-actions {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear.visible {
  display: flex;
}

.btn-clear:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.btn-paste {
  background: rgba(254, 44, 85, 0.08);
  border: 1px solid rgba(254, 44, 85, 0.2);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.btn-paste:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-fetch {
  background: var(--primary);
  color: var(--primary-text);
  border: none;
  font-weight: 700;
  padding: 1.1rem 2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .btn-fetch {
  background: linear-gradient(135deg, #fe2c55 0%, #ff476e 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(254, 44, 85, 0.4);
}

.btn-fetch:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(254, 44, 85, 0.35);
}

.btn-fetch:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Sample Quick Link */
.sample-url-wrapper {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.sample-link {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: var(--transition);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Legal Notice */
.legal-notice {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
}

.legal-notice-icon {
  color: var(--accent);
  flex-shrink: 0;
  font-size: 1.15rem;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: fadeIn 0.3s ease;
  text-align: left;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
}

/* ==========================================================================
   Interactive Skeleton Loader
   ========================================================================== */

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.skeleton-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .skeleton-layout {
    flex-direction: row;
  }
}

.skeleton-thumb {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 9/16;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-card-subtle) 25%, var(--border-color) 50%, var(--bg-card-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin: 0 auto;
}

.skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
}

.skeleton-line {
  height: 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-card-subtle) 25%, var(--border-color) 50%, var(--bg-card-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* ==========================================================================
   Video Result Card
   ========================================================================== */

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2.5rem;
  display: none;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card.active {
  display: block;
}

.result-layout {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

@media (min-width: 640px) {
  .result-layout {
    flex-direction: row;
    align-items: flex-start;
  }
}

.result-thumb-wrapper {
  position: relative;
  width: 100%;
  max-width: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.result-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 9/16;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.result-thumb-wrapper:hover .result-thumb {
  transform: scale(1.04);
}

.duration-badge {
  position: absolute;
  bottom: 0.65rem;
  right: 0.65rem;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.result-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 2rem;
  opacity: 0.85;
  pointer-events: none;
}

.result-details {
  flex: 1;
  text-align: left;
}

.result-creator-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.creator-avatar-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--accent);
}

.creator-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}

.result-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  line-height: 1.4;
  word-break: break-word;
}

.download-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

@media (min-width: 480px) {
  .download-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.btn-download {
  flex: 1;
  min-width: 180px;
  padding: 1rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-download-mp4 {
  background: linear-gradient(135deg, #fe2c55 0%, #ff476e 100%);
  color: #ffffff;
  border: none;
}

.btn-download-mp4:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(254, 44, 85, 0.4);
}

.btn-download-mp3 {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-download-mp3:hover {
  background: var(--border-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.btn-copy-link {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy-link:hover {
  color: var(--text-main);
  border-color: var(--text-dim);
}

/* ==========================================================================
   3-Step "How It Works" Section
   ========================================================================== */

.section-showcase {
  margin: 3.5rem 0 2rem;
  text-align: center;
}

.section-header {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: left;
  position: relative;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.step-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(254, 44, 85, 0.3);
}

.step-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(254, 44, 85, 0.08);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
}

.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ==========================================================================
   4-Feature Highlight Grid
   ========================================================================== */

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-align: left;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--text-dim);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.feature-content h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.feature-content p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-dim);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.modal-input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  outline: none;
  transition: var(--transition);
}

.modal-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border-color: var(--text-dim);
}

/* ==========================================================================
   Spinners & Animations
   ========================================================================== */

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

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

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

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

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 2.5rem 0 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--text-main);
}

.footer-disclaimer {
  font-size: 0.775rem;
  color: var(--text-dim);
  max-width: 680px;
  margin: 0.75rem auto 0;
  line-height: 1.5;
}
