/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #1a1a2e;
  background: #f8f9fa;
  min-height: 100vh;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img, svg {
  vertical-align: middle;
}

/* ── Container ────────────────────────────────────────────────── */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ───────────────────────────────────────────────────── */
.header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.logo:hover {
  color: #2563eb;
}

.nav {
  display: flex;
  gap: 20px;
}

.nav a {
  font-size: 0.9rem;
  color: #6b7280;
  text-decoration: none;
}

.nav a:hover {
  color: #2563eb;
}

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 28px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Download Form ────────────────────────────────────────────── */
.download-form {
  max-width: 640px;
  margin: 0 auto;
}

.input-group {
  display: flex;
  gap: 8px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-group:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.url-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 14px;
  font-size: 1rem;
  color: #1a1a2e;
  background: transparent;
  min-width: 0;
}

.url-input::placeholder {
  color: #9ca3af;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

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

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:disabled {
  background: #93c5fd;
  cursor: not-allowed;
  transform: none;
}

.btn-download {
  background: #059669;
  color: #fff;
  text-decoration: none;
}

.btn-download:hover {
  background: #047857;
  text-decoration: none;
}

/* ── Status Area ──────────────────────────────────────────────── */
.status-area {
  max-width: 640px;
  margin: 20px auto 0;
}

.hidden {
  display: none !important;
}

.status-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b7280;
  font-size: 0.95rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.result-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.result-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-icon {
  flex-shrink: 0;
}

.success-icon { color: #059669; }
.error-icon { color: #dc2626; }

.result-title {
  font-weight: 600;
  color: #1a1a2e;
  font-size: 0.95rem;
}

.result-meta {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 2px;
}

.error-area {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dc2626;
  font-size: 0.95rem;
}

/* ── Platforms Section ────────────────────────────────────────── */
.platforms-section {
  padding: 32px 0 24px;
}

.platforms-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 16px;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.platform-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #374151;
  transition: border-color 0.15s;
}

.platform-item:hover {
  border-color: #2563eb;
}

.platform-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Ad Slot ──────────────────────────────────────────────────── */
.ad-slot {
  margin: 24px 0;
  padding: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  text-align: center;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label {
  font-size: 0.7rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.ad-placeholder {
  color: #d1d5db;
  font-size: 0.85rem;
}

/* ── How It Works ─────────────────────────────────────────────── */
.how-section {
  padding: 24px 0;
}

.how-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.steps {
  list-style: decimal;
  padding-left: 20px;
  color: #6b7280;
  font-size: 0.9rem;
}

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

.steps li strong {
  color: #374151;
}

/* ── History ──────────────────────────────────────────────────── */
.history-section {
  padding: 24px 0 48px;
}

.history-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.history-empty {
  color: #9ca3af;
  font-size: 0.9rem;
  padding: 16px 0;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.history-table td {
  padding: 10px 12px;
  font-size: 0.9rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.history-table tr:hover td {
  background: #f9fafb;
}

.history-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.history-status.completed {
  background: #d1fae5;
  color: #065f46;
}

.history-status.failed {
  background: #fee2e2;
  color: #991b1b;
}

.history-status.downloading,
.history-status.pending {
  background: #dbeafe;
  color: #1e40af;
}

.history-link {
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 500;
}

.history-url {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
  color: #6b7280;
  font-size: 0.85rem;
}

.history-file {
  color: #059669;
  font-size: 0.85rem;
}

.history-size {
  color: #6b7280;
  font-size: 0.85rem;
}

/* ── Footer ───────────────────────────────────────────────────── */
.footer {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #6b7280;
}

.footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: #6b7280;
}

.footer-nav a:hover {
  color: #2563eb;
}

/* ── Static Pages ─────────────────────────────────────────────── */
.page-section {
  padding: 48px 0;
}

.page-section h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.page-section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

.page-section p {
  margin-bottom: 12px;
  color: #374151;
}

.page-section ul, .page-section ol {
  padding-left: 20px;
  margin-bottom: 12px;
  color: #374151;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero h1 {
    font-size: 1.35rem;
  }

  .input-group {
    flex-direction: column;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 10px;
  }

  .input-group:focus-within {
    box-shadow: none;
  }

  .url-input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 14px;
    background: #fff;
  }

  .url-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 14px;
  }

  .result-area {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-download {
    width: 100%;
    justify-content: center;
  }

  .platform-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-table {
    font-size: 0.85rem;
  }

  .history-table td {
    padding: 8px 6px;
  }

  .history-url {
    max-width: 120px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 32px 0 24px;
  }

  .platform-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav {
    gap: 12px;
  }
}

/* ── Utility ──────────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
