:root {
  --bg-primary: #07090e;
  --bg-secondary: #0d121d;
  --card-bg: rgba(14, 20, 32, 0.75);
  --card-border: rgba(30, 42, 66, 0.7);
  --neon-cyan: #00f2fe;
  --neon-blue: #4facfe;
  --neon-green: #10b981;
  --neon-red: #ef4444;
  --neon-yellow: #f59e0b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --glow-cyan: 0 0 25px rgba(0, 242, 254, 0.25);
  --glow-green: 0 0 25px rgba(16, 185, 129, 0.35);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Background Grids & Ambient Glow */
.background-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--neon-cyan), transparent);
  top: -150px;
  left: -150px;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--neon-blue), transparent);
  bottom: -200px;
  right: -200px;
}

/* Main Container */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

/* App Header */
.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: rgba(13, 18, 29, 0.6);
  border: 1px solid var(--card-border);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.ascii-logo {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.15;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
  white-space: pre;
}

.logo-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.logo-tag span {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.main-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 40%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.platform-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
}

/* Glassmorphism Card Base */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 2rem;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
  border-color: rgba(0, 242, 254, 0.25);
}

/* Input Card */
.input-card {
  position: relative;
}

.input-group {
  display: flex;
  align-items: center;
  background: rgba(7, 9, 14, 0.85);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.5rem 0.4rem 1rem;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.input-group:focus-within {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.input-icon {
  font-size: 1.1rem;
  opacity: 0.7;
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
}

.input-group input::placeholder {
  color: var(--text-dim);
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
  text-align: center;
}

.hint-text strong {
  color: var(--neon-cyan);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: #040810;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-hero {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.9rem 1.8rem;
  border-radius: var(--radius-md);
  box-shadow: var(--glow-green);
  width: 100%;
}

.btn-hero:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
}

.btn-download {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: #040810;
  font-size: 0.95rem;
  font-weight: 700;
  width: 100%;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-download:hover {
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

.btn-small {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.35);
}

.btn-link {
  background: none;
  border: none;
  color: var(--neon-cyan);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Spinner */
.spinner, .btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Toast */
.toast {
  background: rgba(14, 20, 32, 0.95);
  border: 1px solid var(--neon-cyan);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--glow-cyan);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Single Video Result */
.video-preview {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}

.thumbnail-wrapper {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: #000;
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-meta {
  display: flex;
  flex-direction: column;
}

.video-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.author-text {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.label-title {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.format-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.radio-label {
  cursor: pointer;
}

.radio-label input {
  display: none;
}

.radio-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.radio-card .quality {
  font-weight: 600;
  font-size: 0.88rem;
}

.radio-card .ext {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.radio-label input:checked + .radio-card {
  border-color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.08);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

/* Playlist Styling */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-accent {
  background: rgba(16, 185, 129, 0.15);
  color: var(--neon-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  margin-bottom: 0.5rem;
}

.playlist-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.playlist-stats {
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* 1-Click Box */
.one-click-box {
  background: rgba(7, 9, 14, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.one-click-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.dropdown {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.dropdown:focus {
  border-color: var(--neon-green);
}

/* Queue HUD */
.queue-hud {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

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

.hud-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
  animation: pulse 1.5s infinite;
}

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

.wakelock-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(16, 185, 129, 0.12);
  color: var(--neon-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 8px;
  border-radius: 20px;
}

.progress-bar-container {
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-green));
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
  transition: width 0.3s ease;
}

.hud-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.hud-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Playlist Items List */
.playlist-items-section {
  margin-top: 1.5rem;
}

.items-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.items-toolbar h3 {
  font-size: 1rem;
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.divider {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Scrollbar */
.items-list::-webkit-scrollbar {
  width: 6px;
}
.items-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.item-row {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  gap: 0.8rem;
  transition: background 0.2s;
}

.item-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.item-row.active {
  border-color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.05);
}

.item-row.completed {
  border-color: var(--neon-green);
  opacity: 0.85;
}

.item-index {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  min-width: 24px;
}

.item-thumb {
  width: 64px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  background: #000;
}

.item-details {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-duration {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.item-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.item-action-btn:hover {
  background: var(--neon-cyan);
  color: #040810;
  font-weight: 700;
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 3rem;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem 1rem 3rem;
  }
  
  .ascii-logo {
    font-size: 0.52rem;
  }

  .main-title {
    font-size: 1.6rem;
  }

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

  .input-group input {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .input-group button {
    width: 100%;
  }

  .video-preview {
    grid-template-columns: 1fr;
  }

  .format-options {
    grid-template-columns: 1fr;
  }

  .one-click-controls {
    flex-direction: column;
  }

  .hud-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}
