:root {
  --bg: #f6f5fb;
  --bg-elevated: #ffffff;
  --text: #14151f;
  --text-muted: #6b6f84;
  --border: #e4e3f0;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #6d4fef 0%, #17b8cc 100%);
  --accent-text: #ffffff;
  --gold: #b5790a;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 14px;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b10;
    --bg-elevated: #14151e;
    --text: #f4f5fa;
    --text-muted: #8b8fa3;
    --border: #23242f;
    --accent: #8b7cff;
    --accent-2: #37e0f5;
    --accent-grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
    --gold: #ffc65c;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0b10;
  --bg-elevated: #14151e;
  --text: #f4f5fa;
  --text-muted: #8b8fa3;
  --border: #23242f;
  --accent: #8b7cff;
  --accent-2: #37e0f5;
  --accent-grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --gold: #ffc65c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; }

h1, h2 { font-family: var(--font-display); }

.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
  padding: 22px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand svg { flex-shrink: 0; }

.brand-name { color: var(--text); }
.brand-tld { color: var(--text-muted); font-weight: 600; }

.main-nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link.active,
.nav-link:hover {
  color: var(--text);
}

#theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.ticker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  margin: 0 auto 24px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ticker strong { color: var(--text); font-weight: 600; }

.ticker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5);
  animation: ticker-pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes ticker-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.hero {
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(20, 21, 31, 0.04);
}

.hero-claim {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}

.hero-claim h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.bid-amount-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.bid-amount-inline button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
  flex-shrink: 0;
}

.bid-amount-inline button:hover { border-color: var(--accent); }

.bid-amount-currency {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

#bid-amount-display {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  background: none;
  border: none;
  border-bottom: 2px dashed transparent;
  width: 5.5ch;
  padding: 0 2px;
  text-align: left;
}

#bid-amount-display:hover,
#bid-amount-display:focus {
  border-bottom-color: var(--border);
  outline: none;
}

.hero-hints {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 620px;
  margin: 18px auto 0;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.category-pill {
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.category-pill:hover { border-color: var(--accent); color: var(--text); }

.category-pill.active {
  background: var(--accent-grad);
  border-color: transparent;
  color: var(--accent-text);
  font-weight: 700;
}

#bid-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 560px;
  margin: 20px auto 0;
}

#bid-form input[type="text"] {
  flex: 1 1 200px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

#bid-form input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#bid-form select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  max-width: 180px;
}

#bid-form button {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent-grad);
  color: var(--accent-text);
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

#bid-form button:hover { opacity: 0.9; }

.payment-step {
  max-width: 420px;
  margin: 20px auto 0;
  text-align: left;
}

#payment-element {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.payment-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.payment-actions #payment-back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
}

.payment-actions #payment-submit {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent-grad);
  color: var(--accent-text);
  font-weight: 700;
  cursor: pointer;
}

.payment-actions #payment-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.bid-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bid-status.error { color: var(--danger); }
.bid-status.success { color: var(--success); }

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.panel h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 12px;
}

.trending-list, .activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trending-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trending-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.trending-list li.extra, .activity-list li.extra {
  display: none;
}

.trending-list.expanded li.extra {
  display: flex;
}

.activity-list.expanded li.extra {
  display: inline-flex;
}

.trending-list a, .activity-list a {
  text-decoration: none;
  font-weight: 600;
}

.trending-list a:hover, .activity-list a:hover { color: var(--accent); }

.trending-list span, .activity-list span {
  color: var(--text-muted);
}

/* Latest activity: horizontal wrapping chips, unlike trending's list. */
.activity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.activity-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.activity-list .fav { width: 16px; height: 16px; }

.activity-list time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.show-more-btn {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

.show-more-btn:hover { text-decoration: underline; }

.contribution-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contribution-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.contribution-list time {
  color: var(--text-muted);
}

.empty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

.leaderboard-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.refresh-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.refresh-btn:hover { color: var(--text); border-color: var(--accent); }

.listing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.listing-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s ease;
}

.listing-row.rank-top3 {
  border-color: var(--rank-color, var(--gold));
  border-width: 1.5px;
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    linear-gradient(180deg, color-mix(in srgb, var(--rank-color, var(--gold)) 8%, var(--bg-elevated)), var(--bg-elevated) 60%);
}
.listing-row.rank-1 { --rank-color: #d4a017; }
.listing-row.rank-2 { --rank-color: #9aa3b2; }
.listing-row.rank-3 { --rank-color: #c17a44; }

.rank {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 34px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  flex-shrink: 0;
}

.rank-top3 .rank {
  background: var(--rank-color, var(--gold));
  color: #1a1200;
}

.fav {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: cover;
}

.fav-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-grad);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
}

.content-page h1 .fav, .content-page h1 .fav-letter {
  width: 32px;
  height: 32px;
  vertical-align: middle;
  margin-right: 8px;
}

.listing-body { flex: 1; min-width: 0; }

.listing-title {
  font-weight: 700;
  text-decoration: none;
  margin-right: 10px;
}

.listing-title:hover { color: var(--accent); }

.listing-amount {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
}

.listing-desc {
  margin: 4px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.listing-meta {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.listing-meta a {
  color: var(--text-muted);
  text-decoration: underline;
}

.category-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.claim-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.claim-btn:hover { border-color: var(--accent); color: var(--accent); }

.divider-item { list-style: none; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-pill {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.pagination a, .pagination .page-ellipsis {
  text-decoration: none;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.pagination a:hover { background: var(--bg-elevated); color: var(--text); }
.pagination a.current {
  background: var(--accent-grad);
  color: var(--accent-text);
}
.pagination .disabled { color: var(--border); }

.pagination-count {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 8px;
}

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  gap: 16px;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.content-page {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.content-page h1 { margin-top: 0; font-weight: 600; display: flex; align-items: center; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .stat-cards { grid-template-columns: 1fr; }
}

/* Admin */
.admin-login, .admin-dashboard {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  margin: 0;
  padding: 40px 16px;
}

.admin-dashboard h1 { font-family: var(--font-display); }

.login-card {
  max-width: 320px;
  margin: 80px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.login-card h1 { font-family: var(--font-display); font-size: 1.2rem; }

.login-card input, .login-card button {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.login-card button {
  background: var(--accent-grad);
  color: var(--accent-text);
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.admin-table {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  border-collapse: collapse;
}

.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-size: 0.85rem;
}

.status { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; }
.status-visible { background: #e6f4ea; color: #2e7d32; }
.status-hidden { background: #fdecea; color: var(--danger); }

.admin-table button {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 0.75rem;
}

@media (max-width: 600px) {
  .panel-grid { grid-template-columns: 1fr; }
  .listing-row { flex-wrap: wrap; }
  .claim-btn { width: 100%; }
}
