:root {
  --bg: #FBFDFE;
  --bg-subtle: #F2F8FB;
  --ink: #10171C;
  --muted: #6B7B85;
  --muted-light: #94A3B8;
  --accent: #1B7FA8;
  --accent-hover: #146485;
  --accent-light: #EAF4F8;
  --accent-badge: #E1F0F6;
  --accent-border: #CFE6F0;
  --water: #7FC4DF;
  --border: #E4EBEE;
  --border-light: #F0F5F7;
  --live-green: #22C55E;
  --card-bg: #FFFFFF;
  --card-border: #DDEBF0;
  --card-shadow: 0 4px 20px rgba(16, 23, 28, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --radius-card: 20px;
  --radius-pill: 999px;
  --max-width: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Dark mode */
body.dark {
  --bg: #0B1014;
  --bg-subtle: #10171D;
  --ink: #E6EEF2;
  --muted: #8AA0AD;
  --muted-light: #5A6F7D;
  --accent: #38BDF8;
  --accent-hover: #0EA5E9;
  --accent-light: #0D2230;
  --accent-badge: #0F2A36;
  --accent-border: #1B4A5E;
  --water: #1B4A5E;
  --border: #1C2A33;
  --border-light: #152028;
  --card-bg: #121C24;
  --card-border: #1C2A33;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Water Level animation at bottom */
.water-level {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(127, 196, 223, 0.12) 0%, rgba(127, 196, 223, 0.25) 100%);
  height: 0;
  pointer-events: none;
  z-index: -1;
  transition: height 900ms cubic-bezier(.2, .8, .2, 1);
  border-top: 1px solid rgba(27, 127, 168, 0.1);
}
.water-wave {
  position: absolute; top: -18px; left: 0; right: 0; height: 36px;
  background: radial-gradient(ellipse 60% 100% at 50% 100%, rgba(127, 196, 223, 0.18) 0%, transparent 70%);
  opacity: .7;
}

/* Header */
.topbar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #FFF;
  font-size: 16px;
  font-weight: 800;
}

.toggle {
  display: flex;
  background: #EEF4F7;
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
body.dark .toggle { background: #172433; }
.toggle button {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.toggle button.active {
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
body.dark .toggle button.active {
  background: #233544;
  color: #FFF;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  transition: color 0.15s;
}
.nav a:hover {
  color: var(--ink);
  text-decoration: none;
}
.nav a.active {
  color: var(--accent);
  font-weight: 600;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #FFFFFF;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  margin-left: 4px;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover {
  color: var(--ink);
  border-color: var(--muted-light);
}
body.dark .icon-btn {
  background: #121C24;
  border-color: #1C2A33;
}

/* Online / Stats pill */
.live-wrap {
  max-width: var(--max-width);
  margin: 32px auto 0;
  text-align: center;
  padding: 0 20px;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
body.dark .live-pill {
  background: #121C24;
  border-color: #1C2A33;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Hero Section */
.hero {
  max-width: var(--max-width);
  margin: 20px auto 0;
  padding: 0 20px;
  text-align: center;
}
.headline {
  font-size: 54px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.stepper button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--accent-badge);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  transition: transform 0.1s, background 0.15s;
}
.stepper button:hover {
  background: var(--accent-border);
}
.stepper button:active {
  transform: scale(0.94);
}
.stepper .val {
  font-size: 54px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.04em;
  line-height: 1;
}

.subline {
  max-width: 640px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}
.subline strong {
  color: var(--ink);
  font-weight: 600;
}

/* Hero Input Row */
.hero-form {
  max-width: 740px;
  margin: 24px auto 0;
}
.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.pill-input {
  flex: 1.5;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
body.dark .pill-input {
  background: #121C24;
  border-color: #1C2A33;
}
.pill-input input {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 14.5px;
  background: transparent;
  color: var(--ink);
}
.pill-input input::placeholder {
  color: var(--muted-light);
}
.pill-input svg {
  color: var(--muted-light);
  flex-shrink: 0;
}

.select-wrap {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.pill-select {
  width: 100%;
  appearance: none;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 12px 36px 12px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.dark .pill-select {
  background: #121C24;
  border-color: #1C2A33;
  color: var(--ink);
}
.select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: 12px;
}

.btn-outbid {
  background: var(--accent);
  color: #FFFFFF;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(27, 127, 168, 0.25);
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}
.btn-outbid:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(27, 127, 168, 0.35);
}
.btn-outbid:active {
  transform: none;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}

/* Category Chips Row */
.cat-row-container {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding: 0 20px;
  position: relative;
}
.cat-row {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.cat-row::-webkit-scrollbar { display: none; }

.cat-chip {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cat-chip:hover {
  background: var(--accent-light);
  color: var(--ink);
}
body.dark .cat-chip:hover {
  background: #172433;
}
.cat-chip.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(27, 127, 168, 0.3);
}
.cat-chip.active svg {
  stroke: #FFFFFF;
}

.cat-more-btn {
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
body.dark .cat-more-btn {
  background: #121C24;
  border-color: #1C2A33;
  color: #FFF;
}

#catDropdown {
  display: none;
  position: absolute;
  top: 48px;
  left: 20px;
  right: 20px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.12);
  padding: 16px;
  z-index: 40;
}
body.dark #catDropdown {
  background: #121C24;
  border-color: #1C2A33;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

/* Leaderboard Cards */
.board {
  max-width: var(--max-width);
  margin: 16px auto 0;
  padding: 0 20px;
}

.card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(27, 127, 168, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.rank-badge {
  background: var(--accent);
  color: #FFFFFF;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 4px;
}

.logo-wrap {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--ink);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 20px;
  border: 1px solid var(--border);
}
.logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.card-top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  text-decoration: none;
}
.card-title:hover {
  text-decoration: underline;
}

.card-bid {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.card-blurb {
  color: #4B5563;
  font-size: 14px;
  line-height: 1.45;
  margin-top: 4px;
}
body.dark .card-blurb {
  color: #9CA3AF;
}

.card-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.meta-domain {
  color: var(--muted);
}
.meta-category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.clicks-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.click-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.see-details {
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
}
.see-details:hover {
  text-decoration: underline;
  color: var(--ink);
}

.show-more {
  display: block;
  margin: 20px auto 0;
  border: 1px solid var(--border);
  background: #FFFFFF;
  border-radius: var(--radius-pill);
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}
body.dark .show-more {
  background: #121C24;
  border-color: #1C2A33;
  color: var(--ink);
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  background: #FFFFFF;
}
body.dark .empty { background: #121C24; }
.loading { color: var(--muted); font-size: 14px; text-align: center; padding: 20px; }
.error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 12px 14px; font-size: 13px; text-align: center; margin: 12px 0; }
body.dark .error { background: #2a1212; border-color: #5a1a1a; color: #fca5a5; }

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 23, 28, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay.open {
  display: flex;
}

.modal {
  background: #FFFFFF;
  border-radius: 24px;
  max-width: 520px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
body.dark .modal {
  background: #121C24;
  color: var(--ink);
}

@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.96) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.modal-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin: 10px 0 16px;
}
body.dark .modal-summary-pill {
  background: #0F2A36;
}

.logo-drop-box {
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  background: #FAFBFC;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
body.dark .logo-drop-box {
  background: #172433;
  border-color: #233544;
}
.logo-drop-box:hover {
  border-color: var(--accent);
  background: #FFFFFF;
}

.price-breakdown-box {
  background: #F8FBFC;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 16px;
}
body.dark .price-breakdown-box {
  background: #172433;
  border-color: #233544;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 3px 0;
  color: var(--muted);
}
.breakdown-row.highlight {
  font-weight: 700;
  color: var(--ink);
}

/* Footer */
footer {
  max-width: var(--max-width);
  margin: 60px auto 0;
  padding: 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--ink); }

/* Responsive adjustments */
@media(max-width: 720px) {
  .headline { font-size: 38px; }
  .stepper .val { font-size: 38px; }
  .input-row { flex-direction: column; }
  .pill-input, .select-wrap, .btn-outbid { width: 100%; }
  .card { flex-wrap: wrap; padding: 16px; }
  .card-top-row { flex-direction: column; gap: 4px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
}
