/* Video Downloader Web - Mobile-First Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-primary: #0a0a0c;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a24;
  --bg-hover: #22222e;
  
  --accent: #ff6b6b;
  --accent-light: #ff8a8a;
  --accent-glow: rgba(255, 107, 107, 0.25);
  --accent-secondary: #ffa07a;
  
  --text-primary: #f4f4f5;
  --text-secondary: #a0a0a8;
  --text-muted: #6b6b73;
  
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  
  --success: #4ade80;
  --error: #ef4444;
  
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background:
    radial-gradient(ellipse at top, rgba(255, 107, 107, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(255, 160, 122, 0.05) 0%, transparent 55%),
    var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  line-height: 1.5;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.btn-history {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-history:hover,
.btn-history:active {
  color: var(--accent);
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-history svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-history span {
  display: inline;
}

.logo svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}

.header-text h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Donations Section */
.donations-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 20px;
  border-top: 2px solid var(--border);
}

.donations-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.donations-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 4px;
}

.crypto-addresses {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crypto-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: nowrap;
}

.crypto-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.crypto-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.crypto-icon svg {
  width: 100%;
  height: 100%;
}

.crypto-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 11rem;
  min-width: 11rem;
  flex-shrink: 0;
}

.crypto-address {
  flex: 1;
  min-width: 0;
  display: block;
  font-size: 12px;
  color: var(--accent);
  font-family: ui-monospace, monospace;
  word-break: break-all;
  background: transparent;
  padding: 4px 0;
}

.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  -webkit-appearance: none;
}

.btn-copy:hover,
.btn-copy:active {
  color: var(--accent);
  background: var(--bg-secondary);
  border-color: var(--accent);
}

.btn-copy svg {
  width: 14px;
  height: 14px;
}

/* Input Section */
.input-section {
  margin-bottom: 20px;
}

.input-wrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input {
  flex: 1;
  min-width: 150px;
}

.input-wrapper .btn-fetch {
  width: 100%;
}

@media (min-width: 400px) {
  .input-wrapper .btn-fetch {
    width: auto;
  }
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-paste {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  -webkit-appearance: none;
}

.btn-paste:hover,
.btn-paste:active {
  color: var(--accent);
  background: var(--bg-hover);
}

.textarea-wrapper {
  position: relative;
  margin-bottom: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.textarea-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea-wrapper .btn-paste {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  width: 40px;
  height: 40px;
}

.input-section textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 12px 12px 52px;
  padding-top: 8px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  resize: vertical;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.input-section textarea:focus {
  outline: none;
}

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

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.input-options {
  display: flex;
  align-items: center;
}

.input-buttons {
  display: flex;
  gap: 8px;
}

.btn-secondary {
  padding: 12px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
}

.btn-secondary:hover,
.btn-secondary:active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.input-wrapper input {
  background: transparent;
  border: none;
  outline: none;
  padding: 14px;
  font-size: 17px;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}

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

.btn-fetch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.btn-fetch:hover {
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-fetch:active {
  transform: scale(0.98);
}

.btn-fetch:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-text.hidden {
  display: none;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-left: 4px;
  position: relative;
}

.more-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.more-link:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

.supported-sites {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.supported-sites.hidden {
  display: none;
}

.supported-sites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.supported-sites h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.btn-hide-sites {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
  flex-shrink: 0;
}

.btn-hide-sites:hover,
.btn-hide-sites:active {
  color: var(--accent);
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-hide-sites svg {
  width: 14px;
  height: 14px;
}

.supported-sites ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.supported-sites li {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 4px 0;
}

/* Bulk Progress */
.bulk-progress {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.bulk-progress.hidden {
  display: none;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
}

#bulkStatus {
  color: var(--text-secondary);
}

#bulkCounter {
  color: var(--accent);
  font-weight: 600;
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.bulk-results {
  max-height: 200px;
  overflow-y: auto;
}

.bulk-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.bulk-result-item:last-child {
  border-bottom: none;
}

.bulk-result-item.success {
  color: var(--success);
}

.bulk-result-item.error {
  color: var(--error);
}

.bulk-result-item.pending {
  color: var(--text-muted);
}

.bulk-result-item .result-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Error Message */
.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--error);
  font-size: 15px;
}

.error-message.hidden {
  display: none;
}

/* History Modal */
.btn-clear-history {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
}

.btn-clear-history:hover,
.btn-clear-history:active {
  background: var(--bg-hover);
  color: var(--error);
  border-color: var(--error);
}

.btn-clear-history svg {
  width: 16px;
  height: 16px;
}

.history-list {
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 2px;
}

.history-note-wrapper {
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 40px 12px 12px;
  margin-bottom: 16px;
}

.history-note-wrapper.hidden {
  display: none;
}

.history-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.btn-hide-note {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
  flex-shrink: 0;
}

.btn-hide-note:hover,
.btn-hide-note:active {
  color: var(--accent);
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-hide-note svg {
  width: 12px;
  height: 12px;
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: background 0.15s;
}

.history-item:last-child {
  margin-bottom: 0;
}

.history-item:hover {
  background: var(--bg-hover);
}

.history-thumb {
  width: 80px;
  height: 60px;
  min-width: 80px;
  background: var(--bg-secondary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.history-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-icon svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.history-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.history-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.history-filename {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.history-url {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, monospace;
}

.history-time {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Album Section */
.album-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.album-section.hidden {
  display: none;
}

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

.album-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.album-info {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.album-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 120px;
}

.album-meta .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.album-meta h2 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-meta span:not(.label) {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Toggle */
.toggle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.toggle-option input {
  display: none;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle-option input:checked + .toggle-switch {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-option input:checked + .toggle-switch::after {
  left: 18px;
  background: white;
}

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

@media (min-width: 600px) {
  .toggle-switch {
    width: 40px;
    height: 22px;
  }
  
  .toggle-switch::after {
    width: 16px;
    height: 16px;
  }
  
  .toggle-option input:checked + .toggle-switch::after {
    left: 20px;
  }
  
  .toggle-label {
    font-size: 13px;
  }
}

@media (min-width: 1200px) {
  .toggle-switch {
    width: 44px;
    height: 24px;
  }
  
  .toggle-switch::after {
    width: 18px;
    height: 18px;
  }
  
  .toggle-option input:checked + .toggle-switch::after {
    left: 22px;
  }
  
  .toggle-label {
    font-size: 14px;
  }
}

/* Tabs */
.media-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab span {
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 13px;
}

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

/* Media List */
.media-list {
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.media-list.hidden {
  display: none;
}

.media-list::-webkit-scrollbar {
  width: 4px;
}

.media-list::-webkit-scrollbar-track {
  background: transparent;
}

.media-list::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 2px;
}

.media-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}

.media-item:active,
.media-item.selected {
  background: var(--bg-hover);
}

.media-item.selected {
  background: rgba(255, 107, 107, 0.1);
  border-left: 3px solid var(--accent);
  padding-left: 11px;
}

.media-item:last-child {
  border-bottom: none;
}

/* Checkbox */
.checkbox-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.checkbox-wrapper input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-hover);
  border-radius: 4px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.checkbox-wrapper input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-wrapper input:checked + .checkbox-custom::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.media-thumb {
  width: 48px;
  height: 36px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.media-thumb:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.media-thumb svg {
  color: var(--accent);
  opacity: 0.5;
  width: 16px;
  height: 16px;
}

.media-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.media-title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quality-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.source-badge {
  font-size: 9px;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  margin-left: 4px;
}

.media-url {
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-size {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  -webkit-appearance: none;
}

.btn-download:active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-download.downloading {
  pointer-events: none;
}

.btn-download.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* Download All */
.download-all-section {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-download-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
}

.btn-download-selected:active {
  background: var(--accent);
  color: white;
}

.btn-download-selected.hidden {
  display: none;
}

.btn-download-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.btn-download-all:active {
  transform: scale(0.98);
}

.btn-download-all:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Footer */
.footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.footer-separator {
  color: var(--text-muted);
  font-size: 12px;
}

.footer-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
  transition: color 0.15s;
  -webkit-appearance: none;
}

.footer-link:hover,
.footer-link:active {
  color: var(--accent);
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-modal.hidden {
  display: none;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  z-index: 2001;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-close {
  position: absolute;
  top: -60px;
  right: 0;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 2002;
  -webkit-appearance: none;
}

.lightbox-close:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.1);
}

.lightbox-media {
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-media video {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: var(--bg-primary);
}

@media (max-width: 600px) {
  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }
  
  .lightbox-content {
    padding: 10px;
  }
  
  .lightbox-media img,
  .lightbox-media video {
    max-height: 85vh;
  }
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideUp 0.3s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
}

.modal-close:hover,
.modal-close:active {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.modal-body {
  padding: 20px;
}

.modal-body h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 20px;
  margin-bottom: 8px;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-body .last-updated {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 24px;
  margin-bottom: 0;
  font-style: italic;
}

.modal-body ul {
  margin: 12px 0;
  padding-left: 24px;
  color: var(--text-secondary);
}

.modal-body li {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.hidden {
  display: none;
}

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

/* Desktop styles */
@media (min-width: 600px) {
  .container {
    padding: 40px 24px;
  }
  
  .header {
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 28px;
  }
  
  .logo svg {
    width: 56px;
    height: 56px;
  }
  
  .header-text h1 {
    font-size: 28px;
  }
  
  .tagline {
    font-size: 15px;
  }
  
  .donations-section {
    padding: 20px;
    margin-top: 24px;
  }
  
  .donations-text {
    font-size: 15px;
  }
  
  .crypto-item {
    padding: 12px 14px;
  }
  
  .crypto-icon {
    width: 32px;
    height: 32px;
  }
  
  .crypto-icon img {
    width: 28px;
    height: 28px;
  }
  
  .crypto-label {
    font-size: 14px;
    width: 11rem;
    min-width: 11rem;
  }
  
  .crypto-address {
    font-size: 13px;
  }
  
  .btn-copy {
    width: 36px;
    height: 36px;
  }
  
  .btn-copy svg {
    width: 16px;
    height: 16px;
  }
  
  .input-section {
    margin-bottom: 32px;
  }
  
  .btn-history {
    padding: 12px 16px;
    font-size: 15px;
  }
  
  .btn-history span {
    display: inline;
  }
  
  .btn-history svg {
    width: 18px;
    height: 18px;
  }
  
  .history-list {
    max-height: 65vh;
  }
  
  .history-item {
    padding: 12px;
  }
  
  .history-thumb {
    width: 70px;
    height: 52px;
    min-width: 70px;
  }
  
  .history-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .history-title {
    font-size: 14px;
  }
  
  .history-filename {
    font-size: 12px;
  }
  
  .history-meta {
    font-size: 13px;
  }
  
  .input-wrapper {
    flex-direction: row;
    padding: 8px;
  }
  
  .btn-paste {
    width: 48px;
    height: 48px;
  }
  
  .input-wrapper input {
    padding: 16px 20px;
    font-size: 16px;
  }
  
  .btn-fetch {
    width: auto;
    min-width: 140px;
    padding: 16px 32px;
    font-size: 17px;
  }
  
  .album-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px;
  }
  
  .album-meta h2 {
    font-size: 18px;
    max-width: 400px;
  }
  
  .album-meta span:not(.label) {
    font-size: 15px;
  }
  
  .tab {
    padding: 16px 24px;
    font-size: 15px;
  }
  
  .tab span {
    font-size: 13px;
    padding: 3px 8px;
  }
  
  .media-list {
    max-height: 500px;
  }
  
  .media-item {
    padding: 16px 24px;
    gap: 16px;
  }
  
  .media-item:hover {
    background: var(--bg-hover);
  }
  
  .checkbox-custom {
    width: 22px;
    height: 22px;
  }
  
  .media-thumb {
    width: 80px;
    height: 60px;
    border-radius: 8px;
  }
  
  .media-title {
    font-size: 15px;
    margin-bottom: 4px;
  }
  
  .media-url {
    font-size: 13px;
  }
  
  .btn-download {
    width: 44px;
    height: 44px;
  }
  
  .btn-download:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
  }
  
  .download-all-section {
    padding: 20px 24px;
    gap: 12px;
  }
  
  .btn-download-all {
    padding: 18px;
    font-size: 16px;
  }
  
  .btn-download-selected {
    padding: 14px;
    font-size: 15px;
  }
  
  .btn-download-all:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
  }
  
  .btn-download-selected:hover {
    background: var(--accent);
    color: white;
  }
}

/* Large desktop styles */
@media (min-width: 1200px) {
  .container {
    max-width: 1100px;
    padding: 60px 40px;
  }
  
  .header {
    gap: 24px;
    margin-bottom: 50px;
    padding-bottom: 32px;
  }
  
  .logo svg {
    width: 64px;
    height: 64px;
  }
  
  .header-text h1 {
    font-size: 32px;
  }
  
  .tagline {
    font-size: 16px;
  }
  
  .donations-section {
    padding: 24px;
    margin-top: 28px;
  }
  
  .donations-text {
    font-size: 16px;
  }
  
  .crypto-item {
    padding: 14px 16px;
  }
  
  .crypto-icon {
    width: 36px;
    height: 36px;
  }
  
  .crypto-icon img {
    width: 32px;
    height: 32px;
  }
  
  .crypto-label {
    font-size: 15px;
    width: 11.5rem;
    min-width: 11.5rem;
  }
  
  .crypto-address {
    font-size: 14px;
  }
  
  .btn-copy {
    width: 40px;
    height: 40px;
  }
  
  .btn-copy svg {
    width: 18px;
    height: 18px;
  }
  
  .input-wrapper {
    padding: 10px;
  }
  
  .btn-paste {
    width: 52px;
    height: 52px;
  }
  
  .btn-paste svg {
    width: 22px;
    height: 22px;
  }
  
  .input-wrapper input {
    padding: 18px 24px;
    font-size: 17px;
  }
  
  .btn-fetch {
    min-width: 160px;
    padding: 18px 40px;
    font-size: 18px;
  }
  
  .album-header {
    padding: 28px;
  }
  
  .album-meta h2 {
    font-size: 20px;
  }
  
  .tab {
    padding: 18px 28px;
    font-size: 16px;
  }
  
  .media-list {
    max-height: 550px;
  }
  
  .media-item {
    padding: 18px 28px;
  }
  
  .media-thumb {
    width: 100px;
    height: 75px;
  }
  
  .media-title {
    font-size: 16px;
  }
  
  .btn-download {
    width: 48px;
    height: 48px;
  }
  
  .download-all-section {
    padding: 24px 28px;
  }
  
  .btn-download-all {
    padding: 20px;
    font-size: 17px;
  }
  
  .btn-download-selected {
    padding: 16px;
    font-size: 16px;
  }
  
  .btn-history {
    padding: 14px 20px;
    font-size: 16px;
  }
  
  .btn-history svg {
    width: 20px;
    height: 20px;
  }
  
  .history-list {
    max-height: 70vh;
  }
  
  .history-item {
    padding: 14px;
  }
  
  .history-thumb {
    width: 90px;
    height: 68px;
    min-width: 90px;
  }
  
  .history-icon svg {
    width: 24px;
    height: 24px;
  }
  
  .history-title {
    font-size: 16px;
  }
  
  .history-filename {
    font-size: 13px;
  }
  
  .history-meta {
    font-size: 14px;
  }
  
  .modal-content {
    max-width: 700px;
  }
  
  .modal-header {
    padding: 24px;
  }
  
  .modal-body {
    padding: 24px;
  }
  
  .modal-body h3 {
    font-size: 17px;
  }
  
  .modal-body p {
    font-size: 15px;
  }
}

/* Mobile-specific: prevent header overflow, readable quality badge, uncrammed donations */
@media (max-width: 500px) {
  .header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-text {
    flex: 1;
    min-width: 0;
  }

  .header-text h1 {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tagline {
    font-size: 12px;
  }

  /* Paste button: align with first line of text on mobile (wrapper + textarea padding) */
  .textarea-wrapper .btn-paste {
    top: 16px;
  }

  /* Download History: own row on mobile so it never falls off the screen */
  .btn-history {
    padding: 10px 14px;
    order: 3;
    width: 100%;
    margin-left: 0;
    margin-top: 6px;
    justify-content: center;
  }

  .btn-history span {
    display: inline;
  }

  /* Very narrow: icon-only to save space */
  @media (max-width: 360px) {
    .btn-history span {
      display: none;
    }
    .btn-history {
      width: auto;
      margin-left: auto;
      margin-top: 0;
      order: unset;
    }
  }

  /* Quality badge (720p / 1080p) more visible on mobile */
  .quality-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
  }

  .media-title {
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .media-title .quality-badge {
    flex-shrink: 0;
  }

  /* Donations: compact cards, no empty space on mobile */
  .donations-section {
    padding: 14px 12px;
    margin-top: 16px;
  }

  .donations-text {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
  }

  .crypto-addresses {
    gap: 8px;
  }

  .crypto-item {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 6px 10px;
    align-items: flex-start;
    min-height: 0;
  }

  .crypto-item .crypto-icon {
    order: 0;
    width: 24px;
    height: 24px;
  }

  .crypto-item .crypto-icon img {
    width: 20px;
    height: 20px;
  }

  .crypto-item .crypto-label {
    order: 1;
    width: auto;
    min-width: 0;
    flex: 1;
    font-size: 13px;
  }

  .crypto-item .crypto-address {
    order: 3;
    width: 100%;
    font-size: 11px;
    line-height: 1.45;
    padding: 2px 0 0;
    word-break: break-all;
    margin: 0;
  }

  .crypto-item .btn-copy {
    order: 2;
    margin-left: auto;
    width: 28px;
    height: 28px;
  }

  .crypto-item .btn-copy svg {
    width: 12px;
    height: 12px;
  }
}
