:root {
  --bg: #141612;
  --surface: #1c1f19;
  --surface-2: #252922;
  --ink: #ecefe6;
  --muted: #a7b09a;
  --line: #343a30;
  --amber: #d4a017;
  --amber-soft: #e0b84a;
  --olive: #8a9a5b;
  --danger: #c45c3e;
  --font-display: "Chakra Petch", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --max: 68rem;
  --prose: 52ch;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(212, 160, 23, 0.12), transparent 55%),
    radial-gradient(700px 400px at 0% 20%, rgba(138, 154, 91, 0.1), transparent 50%),
    linear-gradient(180deg, #10120f 0%, var(--bg) 40%, #10120f 100%);
  line-height: 1.5;
}

a {
  color: var(--amber-soft);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--amber);
  color: #111;
  padding: 0.5rem 0.8rem;
  z-index: 20;
}

.skip-link:focus {
  top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(20, 22, 18, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-donate {
  background: transparent;
  color: var(--amber-soft);
  border: 1px solid rgba(212, 160, 23, 0.55);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-donate:hover,
.btn-donate:focus-visible {
  background: var(--amber);
  color: #111;
  border-color: var(--amber);
}

.linkish {
  appearance: none;
  background: none;
  border: 0;
  color: var(--amber-soft);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.linkish:hover,
.linkish:focus-visible {
  color: var(--amber);
}

.donate-dialog {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  padding: 0;
  max-width: min(42rem, calc(100vw - 2rem));
  width: 100%;
}

.donate-dialog::backdrop {
  background: rgba(8, 10, 7, 0.72);
}

.donate-panel {
  margin: 0;
  padding: 1.15rem 1.25rem 1.35rem;
}

.donate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.donate-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.donate-close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.15rem 0.55rem;
}

.donate-close:hover,
.donate-close:focus-visible {
  border-color: var(--amber);
  color: var(--amber-soft);
}

.donate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.donate-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  background: var(--surface);
  padding: 1rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.donate-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.btn-donate-action {
  justify-self: start;
  text-decoration: none;
  text-align: center;
}

.donate-email {
  word-break: break-all;
}

.donate-qr {
  width: 11rem;
  height: 11rem;
  object-fit: contain;
  background: var(--ink);
  border: 1px solid var(--line);
  padding: 0.35rem;
}

.btc-address {
  display: block;
  font-size: 0.78rem;
  line-height: 1.4;
  word-break: break-all;
  color: var(--amber-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.55rem 0.65rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.api-pill {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.api-pill.is-live {
  color: var(--olive);
  border-color: rgba(138, 154, 91, 0.5);
}

.api-pill.is-fallback {
  color: var(--amber);
  border-color: rgba(212, 160, 23, 0.45);
}

.api-pill.is-error {
  color: var(--danger);
}

main {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  margin-bottom: 1.75rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.lede {
  margin: 0;
  max-width: var(--prose);
  color: var(--muted);
  font-size: 1.05rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

.tab:hover,
.tab:focus-visible {
  color: var(--ink);
}

.tab.is-active {
  color: var(--bg);
  background: var(--amber);
}

.panel[hidden] {
  display: none;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

/* Wider than hero text — spans past the copy column */
.search-banner {
  margin: 1.15rem 0 1.35rem;
  width: min(100vw - 1.25rem, calc(var(--max) + 10rem));
  max-width: none;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  background: var(--surface);
  overflow: hidden;
  line-height: 0;
}

.search-banner img {
  display: block;
  width: 100%;
  height: clamp(11rem, 28vw, 22rem);
  object-fit: cover;
  object-position: center 40%;
}

.search-form input,
.toolbar select,
.toolbar input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0.85rem 0.95rem;
  font: inherit;
  border-radius: 0;
}

.search-form input:focus,
.toolbar select:focus,
.toolbar input[type="number"]:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.btn {
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 700;
  padding: 0.85rem 1.15rem;
  cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
  background: var(--amber);
  color: #111;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.toolbar label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 12rem;
}

.results {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.75rem;
}

.result-card,
.map-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  padding: 0.95rem 1rem;
}

.result-card h3,
.map-card h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.extract {
  margin: 0.45rem 0 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.result-card a,
.map-card a,
.data-table a {
  color: var(--amber-soft);
  text-decoration: none;
}

.result-card a:hover,
.map-card a:hover,
.data-table a:hover {
  text-decoration: underline;
}

.empty,
.loading {
  color: var(--muted);
  padding: 1rem 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}

.data-table tbody tr:hover {
  background: rgba(212, 160, 23, 0.06);
}

.pen-high {
  color: var(--olive);
  font-weight: 700;
}

.tips-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--olive);
  background: var(--surface);
  padding: 1rem 1.15rem 1.1rem;
  margin: 0 0 1.1rem;
  max-width: min(70ch, 100%);
}

.tips-card h2 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tips-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  display: grid;
  gap: 0.45rem;
}

.tips-list strong {
  color: var(--ink);
  font-weight: 600;
}

.why-cell {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
}

/* Newbies table: wider layout so Why never collides with price */
#panel-newbies .table-wrap {
  width: 100%;
}

#newbie-table {
  min-width: 58rem;
  table-layout: fixed;
}

#newbie-table th:nth-child(1),
#newbie-table td:nth-child(1) {
  width: 22%;
  white-space: normal;
}

#newbie-table th:nth-child(2),
#newbie-table td:nth-child(2) {
  width: 11%;
}

#newbie-table th:nth-child(3),
#newbie-table td:nth-child(3) {
  width: 28%;
  white-space: normal;
}

#newbie-table th:nth-child(4),
#newbie-table td:nth-child(4) {
  width: 14%;
  white-space: nowrap;
}

#newbie-table th:nth-child(5),
#newbie-table td:nth-child(5) {
  width: 25%;
  white-space: normal;
}

#newbie-table .value-cell {
  padding-left: 0.9rem;
}

.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.85rem;
}

.traders-toolbar {
  align-items: end;
}

.traders-toolbar label:has(input[type="number"]) {
  min-width: 8.5rem;
}

.category-row,
.price-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 0.85rem;
}

.preset-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 0.15rem;
}

.chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
}

.chip-sm {
  font-size: 0.8rem;
  padding: 0.28rem 0.65rem;
}

.chip:hover:not(:disabled),
.chip:focus-visible {
  border-color: var(--amber);
  color: var(--amber-soft);
  outline: none;
}

.chip.is-active {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1a14;
}

.chip:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.cat-pill {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.toolbar-actions {
  display: grid;
  gap: 0.35rem;
  align-content: end;
}

.panel-note {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: var(--prose);
}

.value-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--amber-soft);
}

.slots-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Slots / ₽/slot only when browsing Barter */
#traders-table .barter-only {
  display: none;
}

#traders-table.show-barter-slots .barter-only {
  display: table-cell;
}

.th-sort {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  padding: 0;
  text-align: left;
  text-transform: inherit;
}

.th-sort:hover,
.th-sort:focus-visible {
  color: var(--amber-soft);
  outline: none;
}

.posts-feed {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.post-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--olive);
  padding: 0.95rem 1rem;
}

.post-item h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.post-meta {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-item p {
  margin: 0;
  color: var(--ink);
  max-width: var(--prose);
}

.posts-submit {
  margin-top: 0.5rem;
}

.posts-submit h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}

.guest-post-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
  max-width: 36rem;
}

.guest-post-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.guest-post-form input,
.guest-post-form textarea,
.guest-post-form select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  padding: 0.85rem 0.95rem;
  font: inherit;
  border-radius: 0;
}

.guest-post-form input:focus,
.guest-post-form textarea:focus,
.guest-post-form select:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.guest-post-form .btn {
  justify-self: start;
}

.thanks-page {
  max-width: 36rem;
  margin: 0 auto;
  padding: clamp(3rem, 10vw, 6rem) 1.25rem;
}

.thanks-page h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin: 0.5rem 0 1rem;
}

.thanks-page .lede {
  color: var(--muted);
  max-width: var(--prose);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem clamp(1rem, 4vw, 2rem) 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (min-width: 1100px) {
  :root {
    --max: 76rem;
    --prose: 58ch;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 3.4vw, 3.5rem);
  }
}

@media (max-width: 640px) {
  :root {
    --max: 100%;
    --prose: 40ch;
  }

  main {
    width: min(100% - 1.25rem, var(--max));
    padding: 1.25rem 0 3rem;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .search-banner {
    width: min(100vw - 1rem, 100%);
  }

  .site-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .tabs {
    gap: 0.4rem;
  }

  .tab {
    padding: 0.5rem 0.7rem;
    font-size: 0.92rem;
  }

  .guest-post-form {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
