@font-face {
  font-family: "Berkeley Mono";
  src: url("https://static.corespeed.io/fonts/berkeley-mono.woff2")
    format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

body {
  font-family: "Berkeley Mono", monospace;
  background: #f8f9fa;
  color: #1a1a1a;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

header {
  text-align: center;
  padding: 60px 0 40px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1a1a1a;
}

.total-count {
  font-size: 1rem;
  font-weight: 500;
  color: #666;
  background: #f5f5f5;
  padding: 4px 12px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 8px;
}

.subtitle {
  color: #666;
  font-size: 1rem;
  font-weight: 400;
  margin-top: 8px;
}

.slogan {
  color: #333;
  font-size: 1.1rem;
  margin-top: 16px;
  font-weight: 400;
}

.slogan strong {
  color: #000;
  font-weight: 600;
}

.powered-by {
  display: inline-block;
  margin-top: 16px;
}

.powered-by img {
  height: 20px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.powered-by:hover img {
  opacity: 1;
}

.chat-box {
  max-width: 600px;
  margin: 0 auto 40px;
  background: #fff;
  border: 1px solid #000;
  border-radius: 8px;
  overflow: hidden;
}

.chat-header {
  background: #000;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  display: none;
}

.chat-title {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
}

.chat-subtitle {
  display: none;
}

.chat-status {
  margin-left: auto;
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
}

.chat-messages {
  max-height: 0;
  overflow-y: auto;
  padding: 0 16px;
  background: #fff;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.chat-messages.has-messages {
  max-height: 400px;
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.chat-message {
  margin-bottom: 12px;
  line-height: 1.5;
}

.chat-message:last-child {
  margin-bottom: 0;
}

.chat-message.user {
  text-align: right;
}

.chat-message.user .bubble {
  background: #000;
  color: #fff;
  display: inline-block;
  padding: 8px 14px;
  border-radius: 12px 12px 2px 12px;
  max-width: 80%;
  text-align: left;
  font-size: 0.9rem;
}

.chat-message.assistant {
  display: block;
}

.chat-message.assistant .avatar {
  display: none;
}

.chat-message.assistant .bubble {
  background: #f5f5f5;
  display: inline-block;
  padding: 8px 14px;
  border-radius: 2px 12px 12px 12px;
  max-width: 80%;
  font-size: 0.9rem;
  border: 1px solid #e0e0e0;
}

.chat-message .bubble a {
  color: #0066cc;
  text-decoration: none;
}

.chat-message .bubble a:hover {
  text-decoration: underline;
}

.streaming-cursor {
  display: inline-block;
  animation: blink 0.7s infinite;
  color: #666;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

.chat-input-wrapper {
  display: flex;
  padding: 12px;
  gap: 8px;
  background: #fff;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.chat-input:focus {
  border-color: #000;
}

.chat-input::placeholder {
  color: #999;
}

.chat-send {
  background: #000;
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send:hover {
  background: #333;
}

.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 40px;
}

.tab {
  padding: 10px 20px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #666;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab img {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.tab:hover {
  border-color: #ccc;
  color: #333;
}

.tab.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.content {
  min-height: 400px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #999;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid #e0e0e0;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.posts {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
}

@media (min-width: 768px) {
  .posts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .posts {
    grid-template-columns: repeat(3, 1fr);
  }
}

.post {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease forwards;
  opacity: 0;
}

.post:hover {
  border-color: #ddd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.source-tag {
  background: #f5f5f5;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #666;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.source-tag img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.post-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 12px;
}

.post-title a {
  color: #1a1a1a;
  text-decoration: none;
  transition: color 0.2s;
}

.post-title a:hover {
  color: #666;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: #999;
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-summary {
  margin-top: 12px;
  color: #666;
  font-size: 0.85rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.hn-link {
  color: #1a1a1a;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 16px;
  background: #f5f5f5;
  border-radius: 6px;
  transition: all 0.2s;
  display: inline-block;
}

.hn-link:hover {
  background: #1a1a1a;
  color: #fff;
}

.error {
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 24px;
  border-radius: 12px;
  color: #666;
  text-align: center;
}

.empty {
  text-align: center;
  padding: 80px 20px;
  color: #999;
}

footer {
  text-align: center;
  padding: 60px 0 40px;
  color: #999;
  font-size: 0.85rem;
}
footer a {
  color: #7289da;
  text-decoration: none;
  margin-left: 12px;
}
footer a:hover {
  text-decoration: underline;
}

/* User Bar */
.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #666;
  transition: all 0.2s;
}

.social-link:hover {
  background: #f0f0f0;
  color: #333;
}

.social-link[href*="discord"]:hover {
  color: #5865f2;
  background: rgba(88, 101, 242, 0.1);
}

.social-link[href*="x.com"]:hover,
.social-link[href*="twitter"]:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.05);
}

.social-link[href*="linkedin"]:hover {
  color: #0a66c2;
  background: rgba(10, 102, 194, 0.1);
}

.corespeed-link {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.corespeed-link:hover {
  background: rgba(0, 0, 0, 0.05);
}

.corespeed-link img {
  opacity: 0.7;
  transition: opacity 0.2s;
}

.corespeed-link:hover img {
  opacity: 1;
}

.social-divider {
  width: 1px;
  height: 16px;
  background: #ddd;
  margin: 0 4px;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  padding: 6px 12px;
  border-radius: 24px;
  transition: background 0.2s;
}

.user-info:hover {
  background: #f5f5f5;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.user-name-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.user-display-name {
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
}

.user-plan {
  font-size: 0.7rem;
  color: #888;
}

.user-plan.premium {
  color: #d97706;
  font-weight: 500;
}

.dropdown-arrow {
  color: #999;
  font-size: 0.7rem;
  margin-left: 4px;
}

.account-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 280px;
  z-index: 1000;
  overflow: hidden;
}

.account-dropdown.show {
  display: block;
}

.account-dropdown-header {
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa, #fff);
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-dropdown-header .user-avatar {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

.account-dropdown-header .user-details {
  flex: 1;
}

.account-dropdown-header .user-details .name {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
  margin-bottom: 2px;
}

.account-dropdown-header .user-details .email {
  font-size: 0.8rem;
  color: #666;
}

.account-dropdown-body {
  padding: 8px;
}

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #333;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.account-dropdown-item:hover {
  background: #f5f5f5;
}

.account-dropdown-item .item-icon {
  width: 20px;
  text-align: center;
  color: #666;
}

.account-dropdown-item.plan-item {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  margin-bottom: 4px;
}

.account-dropdown-item.plan-item .item-icon {
  color: #d97706;
}

.account-dropdown-item.plan-item .plan-name {
  color: #b45309;
  font-weight: 600;
}

.account-dropdown-item.free-item {
  background: #f9fafb;
  margin-bottom: 4px;
}

.account-dropdown-divider {
  height: 1px;
  background: #eee;
  margin: 8px 0;
}

.account-dropdown-item.logout-item {
  color: #666;
}

.account-dropdown-item.logout-item:hover {
  background: #fef2f2;
  color: #dc2626;
}

.account-dropdown-item.logout-item:hover .item-icon {
  color: #dc2626;
}

.account-dropdown-item.summary-item {
  justify-content: space-between;
}

.account-dropdown-item.summary-item .summary-label {
  flex: 1;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  transition: 0.2s;
  border-radius: 999px;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background-color: #fff;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
  background-color: #10b981;
}

.switch input:checked + .slider:before {
  transform: translateX(18px);
}

.user-bar button {
  padding: 8px 16px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-login {
  background: #000;
  color: #fff;
  border: none;
}

.btn-login:hover {
  background: #333;
}

.btn-subscribe {
  background: #10b981;
  color: #fff;
  border: none;
}

.btn-subscribe:hover {
  background: #059669;
}

.btn-manage,
.btn-logout {
  display: none;
}

.premium-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Pricing Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
}

.pricing-plans {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-copy {
  color: #4b5563;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: #000;
}

.btn-secondary {
  background: #fff;
  color: #111827;
  border-color: #e5e7eb;
}

.btn-secondary:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.plan-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.plan-card:hover {
  border-color: #000;
}

.plan-card.popular {
  border-color: #10b981;
  background: #f0fdf4;
}

.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.plan-name {
  font-weight: 600;
}

.plan-badge {
  background: #10b981;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
}

.plan-price {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.plan-price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: #666;
}

.plan-savings {
  font-size: 0.8rem;
  color: #10b981;
}

/* Podcast Button */
.post-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.podcast-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.podcast-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.podcast-btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.podcast-btn.disabled {
  background: #e5e7eb;
  color: #9ca3af;
}

.podcast-btn.premium-required {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.podcast-btn.success {
  background: #10b981;
}

.podcast-btn.error {
  background: #ef4444;
}

.podcast-icon {
  font-size: 1rem;
}

.premium-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Notification Toast */
.notification-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1f2937;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.notification-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* My Podcasts Page */
.podcasts-page {
  max-width: 800px;
  margin: 0 auto;
}

.podcasts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.podcasts-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.podcast-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.podcast-card:hover {
  border-color: #ddd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.podcast-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.podcast-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1a1a1a;
  flex: 1;
}

.podcast-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.podcast-status.pending,
.podcast-status.generating_script,
.podcast-status.generating_audio {
  background: #fef3c7;
  color: #92400e;
}

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

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

.podcast-meta {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 16px;
}

.podcast-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.podcast-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.podcast-play-btn:hover {
  background: #333;
}

.podcast-play-btn:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.podcast-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  color: #ef4444;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.podcast-delete-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.podcast-audio-player {
  width: 100%;
  margin-top: 12px;
}

/* Plyr audio player customization */
.podcast-card .plyr {
  margin-top: 12px;
}

.podcast-card .plyr--audio .plyr__controls {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 8px 12px;
}

.podcast-card .plyr--audio .plyr__control {
  color: #333;
}

.podcast-card .plyr--audio .plyr__control:hover {
  background: #e9ecef;
}

.podcast-card .plyr__progress input[type=range] {
  color: #10b981;
}

.podcast-card .plyr--full-ui input[type=range] {
  color: #10b981;
}

.empty-podcasts {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
}

.empty-podcasts-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.back-link:hover {
  color: #1a1a1a;
}
