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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  background: #f9fafb;
}

header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 1.5rem;
}

header nav span { margin-left: auto; }

h1, h2, h3 { margin-bottom: 0.5rem; }
main { padding: 1rem 0; }
section { margin-bottom: 2rem; }
p { margin-bottom: 0.5rem; }

/* Landing */
.landing {
  text-align: center;
  padding-top: 6rem;
}
.landing h1 { font-size: 3rem; margin-bottom: 0.5rem; }
.landing p { font-size: 1.2rem; color: #555; margin-bottom: 2rem; }
.auth-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn, button {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 1rem;
}
.btn:hover, button:hover { background: #1d4ed8; }

.btn-link {
  background: none;
  color: #2563eb;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { background: none; color: #1d4ed8; }

.btn-sm {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
.btn-sm:hover { background: #1d4ed8; }
.btn-sm.btn-danger { background: #dc2626; }
.btn-sm.btn-danger:hover { background: #b91c1c; }

/* Import form */
.import-section { margin-bottom: 1.5rem; }

.import-form {
  display: flex;
  gap: 0.5rem;
}

.import-form input[type="url"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.import-form input[type="url"]:focus { border-color: #2563eb; }

.import-form button {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  white-space: nowrap;
}

/* Subscribe buttons */
.subscribe-section { margin-bottom: 1.5rem; }
.subscribe-section h3 { font-size: 0.9rem; color: #6b7280; margin-bottom: 0.5rem; font-weight: 500; }
.subscribe-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.subscribe-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.subscribe-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.subscribe-btn svg { flex-shrink: 0; color: #6b7280; }
.subscribe-btn:hover svg { color: #374151; }

/* Audio Player */
.player {
  display: none;
  padding: 0.75rem 1rem;
  background: #f0f4ff;
  border-top: 1px solid #e0e7ff;
}
.player.player-open { display: block; }

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.player-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  cursor: pointer;
  color: #374151;
}
.player-btn:hover { background: #e5e7eb; }
.player-btn-play { width: 44px; height: 44px; background: #2563eb; border-color: #2563eb; color: #fff; }
.player-btn-play:hover { background: #1d4ed8; border-color: #1d4ed8; }

.player-progress-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.player-time { font-size: 0.75rem; color: #6b7280; min-width: 3.2rem; font-variant-numeric: tabular-nums; }
.player-current { text-align: right; }

.player-seek {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #d1d5db;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #2563eb;
  border-radius: 50%;
  cursor: pointer;
}
.player-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #2563eb;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.player-speed-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.player-speed-row label { font-size: 0.75rem; color: #6b7280; }
.speed-buttons { display: flex; gap: 0.25rem; }
.speed-btn {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  color: #374151;
}
.speed-btn:hover { background: #e5e7eb; }
.speed-btn.speed-active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Article card grid */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.article-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}
.article-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.card-body {
  padding: 1rem;
  flex: 1;
}

.card-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1a1a1a;
  text-decoration: none;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-title:hover { color: #2563eb; }

.card-site {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.card-excerpt {
  font-size: 0.85rem;
  color: #4b5563;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}

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

/* Status badges */
.status { padding: 0.2rem 0.5rem; border-radius: 3px; font-size: 0.8rem; font-weight: 500; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-extracting, .status-converting { background: #dbeafe; color: #1e40af; }
.status-extracted { background: #e0e7ff; color: #3730a3; }
.status-ready { background: #d1fae5; color: #065f46; }
.status-failed { background: #fee2e2; color: #991b1b; }

/* Settings */
code.copyable {
  display: block;
  background: #f3f4f6;
  padding: 0.75rem;
  border-radius: 4px;
  word-break: break-all;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Utilities */
.error { color: #991b1b; background: #fee2e2; padding: 0.5rem 0.75rem; border-radius: 6px; margin-top: 0.5rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
}
.empty-state p { margin: 0; font-size: 1.1rem; }

/* Admin */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e5e7eb; }
.admin-table th { font-weight: 600; background: #f9fafb; position: sticky; top: 0; }
.admin-table tbody tr:hover { background: #f3f4f6; }
.cell-title { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title a { color: #1a1a1a; text-decoration: none; }
.cell-title a:hover { color: #2563eb; }
.cell-error { max-width: 300px; }
.cell-error code { font-size: 0.75rem; color: #991b1b; word-break: break-all; display: block; max-height: 3rem; overflow: auto; }
.cell-time { white-space: nowrap; color: #6b7280; font-size: 0.8rem; }
.cell-id code { font-size: 0.7rem; color: #6b7280; }
.job-type { padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.8rem; font-weight: 500; }
.job-type-extract { background: #ede9fe; color: #5b21b6; }
.job-type-tts { background: #fce7f3; color: #9d174d; }
.status-running { background: #dbeafe; color: #1e40af; }
.status-completed { background: #d1fae5; color: #065f46; }
