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

:root {
  --bg: #0a0a0a;
  --surface: #161616;
  --surface-hover: #1e1e1e;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --danger: #f4212e;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}

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

header {
  text-align: center;
  margin-bottom: 32px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

.lang-select {
  position: absolute;
  right: 0;
  padding: 6px 24px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.lang-select:focus {
  border-color: var(--accent);
}

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

.subtitle {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

/* ── Form ── */

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

#url-input {
  flex: 1;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#url-input:focus {
  border-color: var(--accent);
}

#url-input::placeholder {
  color: var(--text-muted);
}

#submit-btn {
  padding: 14px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#submit-btn:hover {
  background: var(--accent-hover);
}

#submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-loader {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Error ── */

.error {
  background: rgba(244, 33, 46, 0.1);
  border: 1px solid rgba(244, 33, 46, 0.3);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-top: 16px;
  font-size: 0.9rem;
}

/* ── Tweet Info ── */

#tweet-info {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tweet-author {
  font-weight: 600;
  color: var(--accent);
}

.tweet-text {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Media Grid ── */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.media-card:hover {
  border-color: var(--accent);
}

.media-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.media-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.media-card-footer {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.media-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.media-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quality-select {
  padding: 7px 8px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
}

.quality-select:focus {
  border-color: var(--accent);
}

.download-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
  white-space: nowrap;
}

.download-btn:hover {
  background: var(--accent-hover);
}

/* ── Download All ── */

.download-all {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.download-all:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Accessibility ── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.input-help {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── SEO Sections ── */

.seo-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.seo-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

/* Steps */

.steps {
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  padding-left: 56px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.steps li strong {
  display: block;
  margin-bottom: 4px;
}

.steps li p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Features Grid */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.feature-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

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

/* FAQ */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-list details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-list summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.faq-list details[open] summary::after {
  content: "-";
}

.faq-list details p {
  padding: 0 16px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Footer */

footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-note {
  margin-top: 6px;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* ── Responsive ── */

@media (max-width: 480px) {
  .input-group {
    flex-direction: column;
  }

  #submit-btn {
    width: 100%;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }
}
