@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&display=swap");

:root {
  --ink: #2b1d12;
  --muted: #7a6553;
  --soft: #a89684;
  --line: #e6d8c6;
  --surface: #fffaf3;
  --subtle: #f6ece0;
  --accent: #8a5a2b;
  --accent-hover: #6f4620;
  --ground: #f4ece1;
  --display: "Bricolage Grotesque", Inter, -apple-system, sans-serif;

  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--ground); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.page-shell { min-height: 100vh; }
.site-header, main, footer { width: min(640px, calc(100% - 40px)); margin-inline: auto; }

/* ---------- header ---------- */
.site-header { height: 58px; display: flex; align-items: center; justify-content: center; }
.logo {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 600; letter-spacing: -0.035em;
}
.logo-mark { width: 20px; height: 20px; display: block; object-fit: contain; }

/* ---------- hero ---------- */
.hero { max-width: 640px; margin: 42px auto 28px; text-align: center; }
.status-pill {
  width: fit-content; margin: 0 auto 14px; padding: 7px 11px;
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--accent); border-radius: 999px;
  background: rgba(138, 90, 43, 0.07);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  color: var(--accent); font-size: 11px;
}
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.hero h1 {
  margin: 0; font-size: clamp(38px, 5vw, 48px); line-height: 1.06;
  letter-spacing: -0.06em; font-weight: 600; text-wrap: balance;
}
.hero h1 em { color: var(--accent); font-style: normal; }
.hero > p {
  max-width: 560px; margin: 18px auto 0;
  color: var(--muted); font-size: 18px; line-height: 1.5; letter-spacing: -0.02em;
}

.notice {
  max-width: 640px; margin: 0 auto 14px; padding: 11px 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--accent); border-radius: 12px;
  background: rgba(138, 90, 43, 0.07); color: #525252; font-size: 12px;
}
.notice button { border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }

/* ---------- bid panel ---------- */
.bid-panel {
  max-width: 640px; margin: 0 auto 24px; padding: 22px;
  border: 1px solid var(--line); border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02), 0 10px 32px rgba(0, 0, 0, 0.04);
}
.url-control {
  min-height: 47px; padding: 0 13px; display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--soft);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.url-control:focus-within { border-color: #bdbdbd; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.035); }
.url-control.invalid { border-color: #aaa; }
.url-control input {
  width: 100%; min-width: 0; border: 0; outline: 0;
  background: transparent; color: var(--ink); font-size: 13px;
}
.url-control input::placeholder { color: var(--soft); }
.spinner { flex: 0 0 auto; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form-error { margin: 7px 3px 0; color: #525252; font-size: 11px; }

.selected-app {
  margin-top: 10px; padding: 9px;
  display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--subtle); color: var(--muted);
}
.selected-app img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; }
.selected-app > div:nth-child(2) { min-width: 0; }
.selected-app strong { color: var(--ink); font-size: 11px; }
.selected-app p {
  margin: 4px 0 0; overflow: hidden; color: var(--muted);
  font-size: 10px; line-height: 1.45; white-space: nowrap; text-overflow: ellipsis;
}
.selected-rank { padding-left: 18px; border-left: 1px solid var(--line); text-align: right; }
.selected-rank span { display: block; color: var(--muted); font-size: 9px; }
.selected-rank strong { font-size: 20px; letter-spacing: -0.04em; }

.amount-section { margin-top: 12px; }
.stacked-price-control {
  width: 250px; max-width: 100%; height: 58px; margin-inline: auto;
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.stacked-price-control > button {
  height: 100%; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.stacked-price-control > button:first-child { border-right: 1px solid var(--line); }
.stacked-price-control > button:last-child { border-left: 1px solid var(--line); }
.stacked-price-control > button:hover { background: var(--subtle); }
.stacked-price-control > label { height: 100%; display: flex; align-items: center; justify-content: center; }
.stacked-price-control > label span {
  margin-right: 2px; font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -0.05em;
}
.stacked-price-control input {
  width: 72px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -0.05em; text-align: center;
  -webkit-appearance: textfield; -moz-appearance: textfield; appearance: textfield;
}
.stacked-price-control input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; }

.rank-explainer {
  margin: 15px 8px 0; color: var(--muted); font-size: 14px;
  line-height: 1.5; text-align: center; letter-spacing: -0.015em;
}
.suggestions { margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; }
.suggestions > span { color: var(--soft); font-size: 9px; }
.suggestions button {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 10px; cursor: pointer;
}
.suggestions button:hover { border-color: #c7c7c7; color: var(--ink); }

.submit-button {
  width: 100%; min-height: 52px; margin-top: 14px; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--accent); border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 600;
  cursor: pointer; box-shadow: 0 2px 6px rgba(138, 90, 43, 0.2);
}
.submit-button:hover:not(:disabled) { background: var(--accent-hover); }
.submit-button:disabled { opacity: 0.28; cursor: not-allowed; }
.checkout-note { margin: 9px 0 0; color: var(--soft); text-align: center; font-size: 9px; }
.top-up-note {
  margin: 12px 0 0; padding: 9px 11px; border-radius: 10px;
  background: var(--subtle); color: var(--muted); font-size: 10px;
}

/* ---------- leaderboard ---------- */
.leaderboard { max-width: 640px; margin: 0 auto 90px; }
.section-heading { margin-bottom: 25px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.section-heading span {
  display: block; margin-bottom: 7px; color: var(--muted);
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.section-heading h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.045em; }
.section-heading > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: right; }

.ranking-panel { display: flex; flex-direction: column; gap: 10px; }
.app-row {
  min-height: 88px; padding: 14px 18px;
  display: grid; grid-template-columns: 38px 52px 1fr 86px; gap: 13px; align-items: center;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02), 0 7px 22px rgba(0, 0, 0, 0.02);
  transition: background-color 0.16s, border-color 0.16s, transform 0.16s;
}
.app-row.first {
  border-color: rgba(138, 90, 43, 0.28); background: #f7e9d6;
  box-shadow: 0 1px 2px rgba(138, 90, 43, 0.04), 0 10px 28px rgba(138, 90, 43, 0.08);
}
.app-row.first .position { color: var(--accent); }
.app-row:hover { border-color: var(--accent); background: #f7f7f7; transform: translateY(-1px); }
.app-row.just-added { animation: flash 1.2s ease-out; }
@keyframes flash {
  from { background: #f0dcc0; }
  to { background: var(--surface); }
}
.position { color: #525252; font-size: 14px; font-weight: 600; letter-spacing: -0.03em; }
.app-icon { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); background: var(--subtle); }
.app-copy { min-width: 0; }
.app-copy > div { display: flex; align-items: center; gap: 8px; }
.app-copy h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.015em; }
.app-copy small { color: var(--soft); font-size: 9px; white-space: nowrap; }
.app-copy p {
  max-width: 600px; margin: 5px 0 0; display: -webkit-box; overflow: hidden;
  color: var(--muted); font-size: 12px; line-height: 1.45;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.row-actions { display: flex; align-items: center; justify-content: flex-end; }
.row-actions strong { font-size: 17px; font-weight: 600; letter-spacing: -0.035em; }
.empty-row {
  min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); font-size: 11px;
}
.empty-row strong { color: var(--ink); font-size: 14px; }

/* ---------- how it works ---------- */
.how-it-works { margin-bottom: 120px; }
.section-heading.compact { margin-bottom: 20px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.steps article {
  min-height: 150px; padding: 20px;
  border: 1px solid var(--line); border-radius: 17px; background: var(--surface);
}
.steps article > span { display: block; margin-bottom: 28px; color: var(--soft); font-size: 9px; }
.steps h3 { margin: 0 0 7px; font-size: 13px; font-weight: 600; }
.steps p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

/* ---------- footer ---------- */
footer {
  min-height: 90px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line);
}
footer p { margin: 0; color: var(--muted); font-size: 10px; }
.footer-meta { display: flex; align-items: center; gap: 7px; color: var(--soft); font-size: 10px; }
.footer-link {
  color: var(--muted); text-decoration: underline; text-decoration-color: var(--line);
  text-underline-offset: 3px; transition: color 0.18s ease, text-decoration-color 0.18s ease;
}
.footer-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- rules page ---------- */
.rules-main { padding: 62px 0 100px; }
.rules-intro { max-width: 600px; }
.rules-intro h1 { margin: 0 0 16px; font-size: 42px; font-weight: 600; line-height: 1.1; letter-spacing: -0.05em; }
.rules-intro p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.rules-sections { margin-top: 46px; border-top: 1px solid var(--line); }
.rules-sections section { padding: 28px 0; border-bottom: 1px solid var(--line); }
.rules-sections h2 { margin: 0 0 11px; font-size: 18px; font-weight: 600; letter-spacing: -0.025em; }
.rules-sections p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }

/* ---------- responsive ---------- */
@media (max-width: 700px) {
  .site-header, main, footer { width: min(100% - 24px, 960px); }
  .site-header { height: 66px; }
  .logo { font-size: 15px; }

  /* Phones get bigger type throughout — the desktop sizes are editorial-small and turn
     into squinting on a 375px screen. */
  .hero { margin: 40px auto 30px; }
  .hero h1 { font-size: clamp(30px, 8.6vw, 40px); }
  .hero > p { font-size: 17px; }
  .status-pill { font-size: 12px; padding: 8px 13px; }

  .bid-panel { margin-bottom: 18px; padding: 16px 14px; border-radius: 18px; }
  /* 16px keeps iOS Safari from zooming the whole page when the field is focused. */
  .url-control { min-height: 52px; }
  .url-control input { font-size: 16px; }
  .stacked-price-control { width: 100%; max-width: 280px; height: 64px; }
  .stacked-price-control > label span, .stacked-price-control input { font-size: 34px; }
  .rank-explainer { font-size: 15px; margin-top: 16px; }
  .suggestions { gap: 6px; }
  .suggestions button { font-size: 12px; padding: 8px 12px; }
  .suggestions > span { font-size: 10px; width: 100%; text-align: center; }
  .submit-button { min-height: 56px; font-size: 17px; }
  .checkout-note { font-size: 10px; }
  .top-up-note { font-size: 11px; }
  .selected-app strong { font-size: 13px; }
  .selected-app p { font-size: 11px; }

  .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .section-heading h2 { font-size: 26px; }
  .section-heading span { font-size: 11px; }
  .section-heading > p { text-align: left; font-size: 11px; }
  .leaderboard { margin-bottom: 70px; }

  .app-row { grid-template-columns: 30px 54px 1fr; gap: 11px; padding: 16px 13px; }
  .app-icon { width: 54px; height: 54px; border-radius: 13px; }
  .position { font-size: 15px; }
  .app-copy h3 { font-size: 15px; }
  .app-copy p { font-size: 13px; -webkit-line-clamp: 2; }
  .app-copy .row-meta { font-size: 11px; margin-top: 7px; }
  .row-actions { grid-column: 2 / 4; align-items: center; justify-content: flex-end; }
  .row-actions strong { font-size: 19px; }
  .app-row.first .row-actions strong { font-size: 21px; }
  .top-badge { font-size: 9px; padding: 3px 7px; }

  .steps { grid-template-columns: 1fr; }
  .steps article { min-height: 0; padding: 18px; }
  .steps h3 { font-size: 15px; }
  .steps p { font-size: 12px; }
  .steps article > span { margin-bottom: 14px; font-size: 10px; }

  footer { flex-wrap: wrap; gap: 14px; padding: 25px 0; }
  footer p, .footer-meta { font-size: 11px; }
  .footer-meta { width: 100%; flex-wrap: wrap; order: 2; }

  .rules-main { padding: 38px 0 70px; }
  .rules-intro h1 { font-size: 34px; }
  .rules-intro p { font-size: 17px; }
  .rules-sections { margin-top: 38px; }
  .rules-sections h2 { font-size: 19px; }
  .rules-sections p { font-size: 15px; }
}
}

/* ---------- comedic layer ---------- */

.hero h1, .section-heading h2, .rules-intro h1, .empty-row strong {
  font-family: var(--display);
  font-weight: 800;
}
.hero h1 { letter-spacing: -0.045em; }
.submit-button { font-family: var(--display); font-weight: 800; letter-spacing: -0.01em; }

.bid-panel { background: var(--surface); }
.url-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 90, 43, 0.12);
}
.suggestions button:hover { border-color: var(--accent); }

/* The top spot gets to look slightly pleased with itself. */
.app-row.first { transform: rotate(-0.45deg); }
.app-row.first:hover { transform: rotate(-0.45deg) translateY(-1px); }
.app-row.first .position::after { content: " 💩"; }

.logo::after { content: "💩"; font-size: 13px; }

/* ---------- the explosion ---------- */

.poop-storm {
  position: fixed; inset: 0; z-index: 60;
  pointer-events: none; overflow: hidden;
}
.poop-storm span {
  position: absolute; top: 50%; left: 50%;
  font-size: var(--size, 28px); line-height: 1;
  will-change: transform, opacity;
  animation: poop-fly var(--dur, 1600ms) cubic-bezier(0.15, 0.6, 0.4, 1) forwards;
}
@keyframes poop-fly {
  0%   { transform: translate(-50%, -50%) rotate(0deg) scale(0.3); opacity: 0; }
  12%  { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--spin)) scale(1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-row.first, .app-row.first:hover { transform: none; }
  .poop-storm span { animation-duration: 1ms; }
}

/* The status pill becomes a live counter once DataFast is answering. */
.status-pill { text-decoration: none; transition: border-color 0.18s, color 0.18s; }
.status-pill:hover { border-color: var(--accent-hover); }
.status-pill.is-live i { background: #2f8f4e; animation: live-blip 2.4s ease-in-out infinite; }
@keyframes live-blip { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .status-pill.is-live i { animation: none; } }

/* Row meta: when the last bid landed, and how many people actually clicked through. */
.app-copy .row-meta {
  display: block; margin-top: 6px;
  color: var(--soft); font-size: 10px; letter-spacing: 0.01em;
}

/* The pill switches from a joke to a real visitor count once DataFast is answering. */
.status-pill strong { font-weight: 700; }
.status-pill.is-live i { background: #2f8f4e; animation: live-blip 2.4s ease-in-out infinite; }
@keyframes live-blip { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .status-pill.is-live i { animation: none; } }

/* ---------- the top spot, being smug about it ---------- */

.top-badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid rgba(138, 90, 43, 0.35); border-radius: 999px;
  background: rgba(138, 90, 43, 0.09);
  color: var(--accent); font-size: 9px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  animation: badge-bob 3.2s ease-in-out infinite;
}
@keyframes badge-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-2px) rotate(1.5deg); }
}

/* The winner's money gets to be the loudest thing in the row. */
.app-row.first .row-actions strong { color: var(--accent); font-size: 19px; }
.app-row.first .app-icon { box-shadow: 0 2px 10px rgba(138, 90, 43, 0.3); }

.poop-storm span { left: 50%; top: 50%; }

@media (prefers-reduced-motion: reduce) {
  .top-badge { animation: none; }
}
