:root {
  color-scheme: light dark;
  --page: #f7f8f3;
  --surface: #ffffff;
  --ink: #171914;
  --muted: #686c62;
  --line: #d9dcd2;
  --line-strong: #b9beb0;
  --accent: #b7ed32;
  --accent-hover: #a5da23;
  --accent-ink: #162000;
  --danger: #b42318;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  line-height: 1.5;
}
button, input { font: inherit; letter-spacing: 0; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #506b0d; outline-offset: 2px; }

.shell { width: min(960px, calc(100% - 40px)); margin-inline: auto; }
.site-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.brand, .header-actions, .network-control, .leaderboard-heading, .site-footer {
  display: flex;
  align-items: center;
}
.brand { gap: 9px; font-size: 18px; font-weight: 800; }
.brand-tld { color: var(--muted); font-weight: 700; }
.brand-logo {
  width: 32px;
  height: 32px;
  display: block;
  flex: 0 0 auto;
}
.header-actions { gap: 16px; color: var(--muted); font-size: 13px; font-weight: 700; }

.language-button, .network-button, .input-with-button button, .bid-button, .pending-payment-button, .amount-stepper > button, .row-bid-button, .dialog-close, .copy-address-button, .verify-button {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-weight: 750;
}
.language-button { min-height: 34px; padding: 0 10px; }

.hero { padding: 14px 0 10px; text-align: center; }
.hero h1 { max-width: 900px; margin: 0 auto; font-size: 32px; line-height: 1.15; }
.hero h1 strong { color: #577708; }
.hero p { margin: 4px auto 0; color: var(--muted); font-size: 14px; }
.visitor-stat {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: Consolas, monospace;
  font-size: 11px !important;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgb(23 25 20 / 5%);
}
.visitor-live-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #6a9300;
  box-shadow: 0 0 0 0 rgb(106 147 0 / 35%);
  animation: live-pulse 2.2s ease-out infinite;
}
@keyframes live-pulse {
  0%, 45% { box-shadow: 0 0 0 0 rgb(106 147 0 / 35%); }
  75%, 100% { box-shadow: 0 0 0 6px rgb(106 147 0 / 0%); }
}

.bid-panel { min-height: 376px; padding: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.network-control {
  width: fit-content;
  gap: 4px;
  margin-bottom: 4px;
  padding: 3px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.network-button { min-height: 30px; padding: 0 11px; border-color: transparent; background: transparent; color: var(--muted); font-size: 12px; }
.network-button.active { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.bid-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.field { min-width: 0; display: grid; gap: 6px; }
.field label, .payment-dialog > label { font-size: 12px; font-weight: 750; }
.input-with-button, .amount-input {
  min-height: 42px;
  display: flex;
  align-items: center;
  background: var(--page);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.input-with-button:focus-within, .amount-input:focus-within { border-color: #506b0d; box-shadow: 0 0 0 2px rgb(80 107 13 / 18%); }
.input-with-button input, .amount-input input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.input-with-button input { padding: 0 11px; font-family: Consolas, monospace; font-size: 11px; }
.input-with-button button { min-width: 58px; min-height: 34px; margin-right: 4px; padding: 0 12px; background: var(--ink); border-color: var(--ink); color: var(--page); font-size: 12px; white-space: nowrap; }
.amount-input { padding: 0 11px; gap: 7px; }
.amount-input input { font-family: Consolas, monospace; font-size: 16px; font-weight: 800; }
.amount-input span { color: var(--muted); font-size: 11px; font-weight: 750; }
.bid-button { min-height: 40px; display: flex; align-items: center; justify-content: center; background: var(--accent); border-color: var(--accent-hover); color: var(--accent-ink); white-space: nowrap; }
.bid-button:hover, .row-bid-button:hover, .verify-button:hover { background: var(--accent-hover); }
.bid-button:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.pending-payment-button { min-height: 38px; background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.pending-payment-button:hover { border-color: #506b0d; color: #506b0d; }
.bid-context { min-height: 22px; display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.bid-context strong { color: var(--ink); }
.bid-context .context-spacer { flex: 1; }
.metadata-pending { color: var(--danger); font-weight: 750; }
.destination-field { margin-top: 4px; }
.destination-field input { width: 100%; min-height: 38px; padding: 0 11px; background: var(--page); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); }
.destination-field input:focus { border-color: #506b0d; outline: 0; box-shadow: 0 0 0 2px rgb(80 107 13 / 18%); }
.field-error { margin: 0; color: var(--danger); font-size: 11px; }
.bid-offer { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); text-align: center; }
.offer-summary { margin: 0; color: var(--ink); font-size: 20px; font-weight: 800; }
.amount-stepper { width: min(360px, 100%); min-height: 44px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; margin: 6px auto 0; overflow: hidden; background: var(--page); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.amount-stepper > button { border: 0; border-radius: 0; background: var(--surface); color: var(--muted); font-size: 20px; }
.amount-stepper > button:first-child { border-right: 1px solid var(--line); }
.amount-stepper > button:last-child { border-left: 1px solid var(--line); }
.amount-stepper .amount-input { min-height: 42px; padding: 0 12px; border: 0; border-radius: 0; }
.amount-stepper:focus-within { border-color: #506b0d; box-shadow: 0 0 0 2px rgb(80 107 13 / 18%); }
.amount-stepper .amount-input:focus-within { box-shadow: none; }
.amount-stepper .amount-input input { text-align: center; }
.rank-hint { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.bid-offer .bid-button { width: min(520px, 100%); margin: 4px auto 0; }

.mini-logo, .project-logo {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--page);
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}
.mini-logo { width: 24px; height: 24px; }
.project-logo { width: 72px; height: 72px; }
.mini-logo img, .project-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.leaderboard { padding: 14px 0 16px; }
.leaderboard-heading { justify-content: space-between; gap: 20px; margin-bottom: 6px; }
.leaderboard-title { display: flex; align-items: baseline; gap: 10px; }
.leaderboard h2 { margin: 0; font-size: 26px; }
.leaderboard-title span { color: var(--muted); font-family: Consolas, monospace; font-size: 12px; font-weight: 800; }
.ranking-table { background: transparent; }
.table-header, .ranking-row { display: grid; grid-template-columns: 58px minmax(220px, 1fr) 132px 70px; align-items: center; gap: 18px; }
.table-header { display: none; }
.ranking-row { min-height: 108px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ranking-row:last-child { border-bottom: 0; }
.rank { font-family: Consolas, monospace; font-size: 16px; font-weight: 900; }
.podium-row { min-height: 108px; margin-bottom: 10px; padding: 14px 18px; border: 2px solid var(--podium); border-radius: var(--radius); background: color-mix(in srgb, var(--podium) 11%, var(--surface)); box-shadow: 0 8px 20px color-mix(in srgb, var(--podium) 10%, transparent); }
.podium-row:last-child { margin-bottom: 0; }
.podium-1 { min-height: 108px; --podium: #b97900; }
.podium-2 { --podium: #64707d; }
.podium-3 { --podium: #a35432; }
.podium-rank { width: 54px; min-height: 46px; display: grid; place-items: center; border-radius: 4px; background: var(--podium); color: #ffffff; font-size: 17px; }
.podium-row .project-logo { width: 72px; height: 72px; border: 2px solid var(--podium); background: var(--surface); }
.podium-1 .project-logo { width: 72px; height: 72px; }
.podium-row .project-copy strong { font-size: 22px; line-height: 1.2; }
.podium-1 .project-copy strong { font-size: 22px; }
.podium-row .paid-total { color: var(--podium); font-size: 20px; }
.project-cell { min-width: 0; display: flex; align-items: center; gap: 16px; }
.project-copy { min-width: 0; display: grid; gap: 6px; }
.project-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; line-height: 1.2; }
.project-copy > span { color: var(--muted); font-size: 12px; }
.project-meta { min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.project-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-time { flex: 0 0 auto; color: var(--podium); font-weight: 750; }
.project-clicks { flex: 0 0 auto; color: var(--ink); font-weight: 700; }
.project-link:hover .project-copy strong { text-decoration: underline; text-underline-offset: 3px; }
.paid-total { font-family: Consolas, monospace; font-size: 20px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.row-bid-button { min-height: 40px; padding: 0 12px; font-size: 12px; }
.empty-state { min-height: 120px; display: grid; place-content: center; gap: 3px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 17px; }
.empty-state span { font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.pagination button { min-height: 34px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 750; }
.pagination button:disabled { color: var(--muted); cursor: not-allowed; }
.pagination span { color: var(--muted); font-family: Consolas, monospace; font-size: 12px; }
.rules-line { margin: 0 0 72px; color: var(--muted); font-size: 12px; text-align: center; }
.site-footer { min-height: 80px; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.site-footer span:first-child { color: var(--ink); font-weight: 800; }
.footer-meta { display: flex; align-items: center; justify-content: flex-end; gap: 18px; text-align: right; }
.footer-meta a { color: var(--ink); font-weight: 750; }
.footer-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }
.developer-credit a { color: #577708; }

.rules-main { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 88px; }
.rules-intro { margin-bottom: 44px; }
.rules-intro h1 { margin: 0; font-size: clamp(42px, 7vw, 68px); line-height: 1; }
.rules-intro p { max-width: 680px; margin: 18px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.rules-content { display: grid; gap: 36px; }
.rules-section { padding-top: 28px; border-top: 1px solid var(--line); }
.rules-section h2 { margin: 0 0 14px; font-size: 22px; }
.rules-section ul { display: grid; gap: 10px; margin: 0; padding-left: 20px; color: var(--muted); }
.rules-section li { padding-left: 3px; }
.rules-section strong { color: var(--ink); }

.payment-dialog { width: min(440px, calc(100% - 28px)); max-height: calc(100dvh - 28px); overflow-y: auto; padding: 24px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); }
.payment-dialog::backdrop { background: rgb(15 17 12 / 55%); }
.payment-dialog h2 { margin: 0 34px 6px 0; font-size: 24px; }
.payment-dialog > p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; font-size: 20px; }
.invoice-details { display: grid; gap: 10px; margin: 0 0 18px; }
.invoice-details div { display: flex; justify-content: space-between; gap: 16px; }
.invoice-details dt { color: var(--muted); font-size: 12px; }
.invoice-details dd { margin: 0; font-family: Consolas, monospace; font-weight: 800; }
.invoice-details .asset-address { max-width: 250px; overflow-wrap: anywhere; font-size: 10px; text-align: right; }
.invoice-details .recipient-value { max-width: 275px; display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.recipient-value code { min-width: 0; overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: 10px; text-align: right; }
.copy-address-button { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; padding: 0; background: var(--page); color: var(--ink); font-size: 17px; line-height: 1; }
.copy-address-button:hover { border-color: #506b0d; color: #506b0d; }
.invoice-verification-note { margin: 8px 0 10px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.payment-dialog > input { width: 100%; min-height: 44px; margin: 6px 0 10px; padding: 0 10px; background: var(--page); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); font-family: Consolas, monospace; }
.payment-status { min-height: 34px; margin: 0 0 10px; padding: 8px 10px; background: var(--page); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: 11px; line-height: 1.45; }
.payment-status[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); color: var(--danger); }
.payment-actions { display: grid; gap: 8px; }
.verify-button { width: 100%; min-height: 44px; background: var(--accent); border-color: var(--accent-hover); color: var(--accent-ink); }
.verify-button:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: wait; }
.discard-invoice-button { min-height: 30px; padding: 2px 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.discard-invoice-button:hover { color: var(--danger); text-decoration: underline; text-underline-offset: 3px; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: min(360px, calc(100vw - 36px)); padding: 12px 14px; background: var(--ink); border-radius: var(--radius); color: var(--page); font-size: 12px; font-weight: 700; }
.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; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 600px); }
  .site-header { min-height: 52px; }
  .header-actions > a { display: none; }
  .hero { padding: 22px 0 16px; }
  .hero h1 { font-size: 32px; }
  .bid-panel { min-height: 0; }
  .bid-fields { grid-template-columns: 1fr; }
  .bid-context { flex-wrap: wrap; }
  .bid-context .context-spacer { display: none; }
  .table-header { display: none; }
  .ranking-row { min-height: 108px; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
  .podium-row { min-height: 108px; padding: 12px; }
  .podium-1 { min-height: 108px; }
  .podium-rank { width: 48px; min-height: 42px; grid-row: 1 / span 2; }
  .project-logo, .podium-row .project-logo, .podium-1 .project-logo { width: 56px; height: 56px; }
  .project-cell { gap: 10px; }
  .project-copy strong, .podium-row .project-copy strong, .podium-1 .project-copy strong { font-size: 17px; }
  .project-meta { flex-wrap: wrap; row-gap: 2px; }
  .paid-total { grid-column: 2; font-size: 12px; text-align: left; }
  .row-bid-button { grid-column: 3; grid-row: 1 / span 2; }
  .rules-line { margin-bottom: 50px; text-align: left; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding: 20px 0; }
  .footer-meta { align-items: flex-start; flex-direction: column; gap: 8px; text-align: left; }
  .rules-main { width: min(100% - 28px, 600px); padding-top: 48px; }
}

@media (max-width: 430px) {
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 14px; }
  .bid-panel { padding: 12px; }
  .network-control { width: 100%; }
  .network-button { flex: 1; }
  .bid-fields { grid-template-columns: 1fr; }
  .token-field, .bid-button { grid-column: 1; }
  .leaderboard { padding-top: 32px; }
  .podium-row { padding-inline: 10px; }
  .project-logo, .podium-row .project-logo, .podium-1 .project-logo { width: 50px; height: 50px; }
  .project-copy strong, .podium-row .project-copy strong, .podium-1 .project-copy strong { font-size: 15px; }
  .podium-row .paid-total { font-size: 13px; }
}

@media (prefers-color-scheme: dark) {
  :root { --page: #151712; --surface: #1e211a; --ink: #eef1e7; --muted: #adb2a4; --line: #373c31; --line-strong: #555c4b; --danger: #ff8b82; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .visitor-live-dot { animation: none; }
}
