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

:root {
  --bg: #faf8f3;
  --bg-alt: #f5f2ea;
  --text: #1a1a1a;
  --text-muted: #6a6a6a;
  --accent: #c8302a;
  --border: #e5dfd2;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "Courier New", monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  line-height: 1.6;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-weight: bold;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.nav {
  display: flex;
  gap: 1.2rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  align-items: center;
}

.live {
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: bold;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.auth-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 0.5rem 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.auth-btn:hover { opacity: 0.85; }

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: normal;
  font-style: italic;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.warning {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* Deploy box */
.deploy-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem 2rem;
  margin-bottom: 3rem;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.deploy-box h3 {
  font-size: 1.4rem;
  font-weight: normal;
  margin-bottom: 1.5rem;
  color: var(--text);
  letter-spacing: 0.01em;
}

.deploy-code {
  background: #1a1a1a;
  color: #f0f0f0;
  padding: 1.2rem 1.4rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.8rem;
  text-align: left;
}

.deploy-code code {
  flex: 1;
  word-break: break-word;
  line-height: 1.6;
  background: none;
  padding: 0;
  color: #f0f0f0;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #f0f0f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.deploy-steps {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0;
  margin: 0 0 1.8rem 0;
  counter-reset: step;
}

.deploy-steps li {
  counter-increment: step;
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  position: relative;
  padding-top: 2.5rem;
  line-height: 1.4;
}

.deploy-steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: bold;
  font-size: 0.9rem;
}

.deploy-links {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.deploy-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.deploy-links a:hover { color: var(--accent); }

.deploy-links .sep {
  margin: 0 0.7rem;
  opacity: 0.4;
}

/* Search bar */
.search-bar {
  margin-bottom: 1.5rem;
}

.search-bar input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  font-family: var(--serif);
  font-size: 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}

.search-bar input:focus {
  border-color: var(--text);
  background: #fff;
}

/* Filters (primary sort tabs) */
.filters {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  flex-wrap: wrap;
}

.filter {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0;
  letter-spacing: 0.1em;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.filter:hover { color: var(--text); }
.filter.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* Time range bar (secondary) */
.time-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  margin-bottom: 2rem;
  font-family: var(--mono);
  flex-wrap: wrap;
}

.range-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-right: 0.5rem;
  font-weight: bold;
}

.range-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.35rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.range-btn:hover {
  color: var(--text);
}

.range-btn.active {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
  font-weight: bold;
}

/* Shuffle bar (only visible in RANDOM mode) */
.shuffle-bar {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.shuffle-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 0.9rem 2rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.shuffle-btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 48, 42, 0.25);
}

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

.shuffle-icon {
  font-size: 1.2rem;
  display: inline-block;
  transition: transform 0.5s ease;
}

.shuffle-btn.spinning .shuffle-icon {
  transform: rotate(360deg);
}

.shuffle-hint {
  font-size: 0.75rem;
  opacity: 0.7;
  letter-spacing: 0.05em;
  font-weight: normal;
}

@media (max-width: 700px) {
  .shuffle-btn {
    padding: 0.8rem 1.2rem;
    font-size: 0.8rem;
  }
  .shuffle-hint { display: none; }
}

/* Sites list — Google-style search results */
.sites-grid {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  max-width: 760px;
  margin: 0 auto;
}

.result-item {
  position: relative;
  padding: 0.2rem 0;
}

.result-source {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.result-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: bold;
  flex-shrink: 0;
}

.result-source-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.result-bot-name {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  font-weight: bold;
  letter-spacing: 0.02em;
}

.result-url {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  color: #1a3a8c;
  text-decoration: none;
  margin-bottom: 0.3rem;
  line-height: 1.35;
  font-weight: normal;
}

.result-title:hover {
  text-decoration: underline;
  color: #c8302a;
}

.result-title:visited {
  color: #5a2a8c;
}

.result-description {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0.4rem;
  max-width: 100%;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.result-meta .dot-sep {
  opacity: 0.5;
}

.trend-badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  background: var(--accent);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  letter-spacing: 0.05em;
  font-weight: bold;
}

/* Quality tier badges */
.tier-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  letter-spacing: 0.04em;
  font-weight: bold;
  border: 1px solid transparent;
}

.tier-draft {
  background: #fff3e0;
  color: #b45309;
  border-color: #fbbf24;
}

.tier-basic {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
}

.tier-polished {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.tier-premium {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
  font-weight: bold;
}

.fav-btn {
  position: absolute;
  top: 0.2rem;
  right: 0;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--border);
  transition: all 0.2s;
  padding: 0;
  z-index: 5;
}

.fav-btn:hover { transform: scale(1.2); }
.fav-btn.active { color: var(--accent); }

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* Mobile */
@media (max-width: 700px) {
  .topbar { padding: 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .nav { gap: 0.8rem; font-size: 0.75rem; }
  main { padding: 2rem 1rem; }
  .hero h1 { font-size: 2rem; }
  .subtitle { font-size: 1rem; }
  .sites-grid { gap: 1.5rem; }
  .filters { gap: 1rem; }
  .time-range { padding: 0.5rem; }
  .range-btn { padding: 0.3rem 0.6rem; font-size: 0.7rem; }
  .deploy-box { padding: 1.5rem 1rem; }
  .deploy-code {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .deploy-steps {
    flex-direction: column;
    gap: 1rem;
  }
  .deploy-steps li {
    padding-top: 0;
    padding-left: 3rem;
    text-align: left;
  }
  .deploy-steps li::before {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
  }
}