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

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #262626;
  --bg-hover: #2d2d2d;
  --text-primary: #e6e6e6;
  --text-secondary: #a3a3a3;
  --text-tertiary: #737373;
  --border: #333333;
  --accent: #8B5CF6;
  --accent-hover: #7C3AED;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Mobile header - hidden on desktop */
.mobile-header {
  display: none;
}

/* Sidebar close button - hidden on desktop */
.sidebar-close {
  display: none;
}

.sidebar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* Sidebar overlay - hidden on desktop */
.sidebar-overlay {
  display: none;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 16px; /* Prevents iOS zoom */
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
}

.agents-list {
  overflow-y: auto;
  flex: 1;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
}

.category {
  margin-bottom: 8px;
}

.category-header {
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}

.agent-card {
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.agent-card:hover {
  background: var(--bg-hover);
}

.agent-card.active {
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
}

.agent-card-emoji {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.agent-card-content {
  flex: 1;
  min-width: 0;
}

.agent-card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.agent-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

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

.agent-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.agent-emoji {
  font-size: 36px;
  line-height: 1;
}

#agentName {
  font-size: 24px;
  font-weight: 600;
}

.copy-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: translateY(0);
}

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  -webkit-overflow-scrolling: touch;
}

.welcome {
  max-width: 600px;
  margin: 60px auto;
  text-align: center;
}

.welcome h1 {
  font-size: 32px;
  margin-bottom: 16px;
}

.welcome p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.agent-count {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 24px;
}

/* Markdown styles */
.markdown-content {
  max-width: 800px;
}

.markdown-content h1 {
  font-size: 32px;
  margin: 32px 0 16px;
  font-weight: 600;
}

.markdown-content h2 {
  font-size: 24px;
  margin: 28px 0 12px;
  font-weight: 600;
}

.markdown-content h3 {
  font-size: 20px;
  margin: 24px 0 12px;
  font-weight: 600;
}

.markdown-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.markdown-content ul,
.markdown-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.markdown-content li {
  margin-bottom: 8px;
}

.markdown-content code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Monaco', 'Courier New', monospace;
}

.markdown-content pre {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.markdown-content pre code {
  padding: 0;
  background: none;
}

.markdown-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.markdown-content a {
  color: var(--accent);
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.markdown-content th,
.markdown-content td {
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border);
}

.markdown-content th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  /* Mobile top bar */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 200;
  }

  .mobile-logo {
    height: 28px;
  }

  /* Hamburger button */
  .hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 201;
  }

  .hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s;
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 299;
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* Sidebar - off-screen by default on mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
  }

  /* Content adjustments */
  .content-header {
    padding: 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .agent-title {
    gap: 10px;
  }

  .agent-emoji {
    font-size: 28px;
  }

  #agentName {
    font-size: 18px;
  }

  .content-body {
    padding: 16px;
  }

  .welcome {
    margin: 30px auto;
  }

  .welcome h1 {
    font-size: 24px;
  }

  .copy-btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .markdown-content h1 { font-size: 24px; }
  .markdown-content h2 { font-size: 20px; }
  .markdown-content h3 { font-size: 17px; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

.hidden {
  display: none;
}

/* Collection tabs */
.collection-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 4px;
}

.collection-tabs .tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.collection-tabs .tab:hover {
  color: var(--text-primary);
}

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

/* Email gate modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.modal-box h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.modal-box p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-box .field {
  margin-bottom: 12px;
}

.modal-box input {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 15px;
}

.modal-box input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-btn {
  width: 100%;
  padding: 14px;
  background: #F59E0B;
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.modal-btn:hover {
  background: #D97706;
}

.modal-cancel {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 13px;
  cursor: pointer;
  margin-top: 16px;
  padding: 8px;
}

.modal-cancel:hover {
  color: var(--text-secondary);
}

/* Deploy buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.deploy-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.deploy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
  white-space: nowrap;
}

.deploy-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.deploy-btn:active {
  transform: translateY(0);
}

.deploy-chatgpt {
  background: #10a37f;
}

.deploy-claude {
  background: #d97706;
}

.deploy-gemini {
  background: #4285f4;
}

.deploy-grok {
  background: #1d1d1f;
  border: 1px solid #444;
}

/* Tags */
.agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Responsive deploy buttons */
@media (max-width: 768px) {
  .header-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }
  
  .deploy-buttons {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .deploy-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Deploy toast notification */
.deploy-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  max-width: 90vw;
  line-height: 1.5;
}
.deploy-toast.show {
  transform: translateX(-50%) translateY(0);
}
.deploy-toast .toast-icon {
  font-size: 20px;
  margin-right: 8px;
}
.deploy-toast .toast-hint {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 4px;
}

/* Community: Ratings, Votes, Comments */
.community-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #374151;
}

.community-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Star Rating */
.star-rating {
  display: flex;
  align-items: center;
  gap: 4px;
}
.star-rating .star {
  font-size: 24px;
  cursor: pointer;
  color: #4B5563;
  transition: color 0.15s, transform 0.15s;
  user-select: none;
}
.star-rating .star:hover,
.star-rating .star.active {
  color: #F59E0B;
  transform: scale(1.15);
}
.star-rating .star.hovered {
  color: #FBBF24;
}
.rating-text {
  font-size: 13px;
  color: #9CA3AF;
  margin-left: 8px;
}

/* Votes */
.vote-section {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vote-btn {
  background: none;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
  color: #9CA3AF;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.vote-btn:hover {
  border-color: #6B7280;
  color: white;
}
.vote-btn.voted-up {
  border-color: #10B981;
  color: #10B981;
  background: rgba(16, 185, 129, 0.1);
}
.vote-btn.voted-down {
  border-color: #EF4444;
  color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
}
.vote-score {
  font-size: 14px;
  font-weight: 600;
  color: #D1D5DB;
  min-width: 30px;
  text-align: center;
}

/* Comments */
.comments-section {
  margin-top: 20px;
}
.comments-header {
  font-size: 15px;
  font-weight: 600;
  color: #D1D5DB;
  margin-bottom: 12px;
}
.comment-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.comment-form input,
.comment-form textarea {
  background: #1F2937;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 10px 14px;
  color: #F3F4F6;
  font-size: 14px;
  font-family: inherit;
}
.comment-form input {
  width: 160px;
}
.comment-form textarea {
  flex: 1;
  min-width: 200px;
  min-height: 40px;
  max-height: 120px;
  resize: vertical;
}
.comment-form button {
  background: #F59E0B;
  color: #111827;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.comment-form button:hover {
  background: #D97706;
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comment-item {
  background: #1F2937;
  border-radius: 8px;
  padding: 12px 16px;
}
.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.comment-name {
  font-weight: 600;
  font-size: 13px;
  color: #F59E0B;
}
.comment-date {
  font-size: 12px;
  color: #6B7280;
}
.comment-text {
  font-size: 14px;
  color: #D1D5DB;
  line-height: 1.5;
  white-space: pre-wrap;
}
