@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #faf8f3;
  --panel: #f2eee6;
  --field: #fffdf9;
  --ink: #2a251c;
  --muted: #726b60;
  --ph: #9a9388;
  --line: #ddd6c8;
  --accent: #8f4d1f;
  --go: #2a5f66;
  --card: #ffffff;
  --match-fill: #D0EDA9;
  --match-line: #b4d47e;
  --good: #3c6a3a;
  --warn: #a05538;
  --new: #3a6d78;
  --hover: #e8e2d6;
  --photo: #e6dfd2;
  --shadow: rgba(62, 52, 38, 0.08);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
header.top {
  display: flex; justify-content: space-between; gap: 16px;
  align-items: flex-start; margin-bottom: 4px; flex-wrap: wrap;
}
header h1 { font-size: 1.55rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.ver { margin: 0 0 8px; color: var(--muted); font-size: 0.78rem; }
.lede { color: var(--muted); margin: 0 0 16px; line-height: 1.45; max-width: 46rem; }
.filter-legend {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.fld {
  display: inline-flex; align-items: center; gap: 0.28em;
}
button.info {
  all: unset;
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px;
  color: var(--muted); cursor: help; flex: 0 0 auto;
}
button.info svg { display: block; width: 13px; height: 13px; }
button.info:hover, button.info[aria-expanded="true"] {
  color: var(--accent);
}
.tip-pop {
  position: fixed; z-index: 90;
  max-width: min(22rem, calc(100vw - 24px));
  padding: 10px 12px;
  background: var(--field); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 24px var(--shadow);
  font-size: 0.82rem; line-height: 1.45;
}
.prefs {
  display: flex; align-items: flex-end; gap: 10px;
  flex-wrap: wrap; justify-content: flex-end;
}
.lang {
  display: flex; flex-direction: column; gap: 4px;
  color: var(--muted); font-size: 0.78rem; flex-shrink: 0;
}
.lang select {
  background: var(--field); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit;
  min-width: 8.5rem; max-width: min(220px, 46vw);
}
.price-orig {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}
.price-fx-hint {
  margin: 4px 0 0;
  min-height: 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--muted);
}
.price-fx-hint[hidden] {
  display: none;
}
.search-form {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 0 18px;
}
.search {
  display: flex; flex-direction: column; gap: 6px;
  margin: 0; padding: 8px 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
}
.search-place {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}
.search-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 8px;
  align-items: end;
}
.range-field {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  color: var(--muted); font-size: 0.72rem;
}
.range-pair { display: flex; gap: 6px; min-width: 0; }
.range-pair input { flex: 1 1 0; min-width: 0; width: 100%; }
.search label {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  color: var(--muted); font-size: 0.72rem;
}
.search input, .search select {
  background: #faf8f3; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 8px; min-width: 0; width: 100%;
  height: 30px; box-sizing: border-box; font: inherit; font-size: 0.88rem;
}
.search input::placeholder {
  color: var(--ph); opacity: 1;
}
.search input::-moz-placeholder { color: var(--ph); opacity: 1; }
.search select.is-empty { color: var(--ph); }
.search select option { color: var(--ink); }
.search-place input, .search-place select { height: 34px; }
.city-wrap { position: relative; }
.city-wrap input { width: 100%; min-width: 0; }
@media (max-width: 860px) {
  .search-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.city-suggest {
  position: fixed; z-index: 80;
  margin: 0; padding: 6px 0; list-style: none;
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 24px var(--shadow);
  max-height: 16.5rem; overflow: auto;
}
.city-suggest li {
  padding: 8px 12px; cursor: pointer; color: var(--ink); font-size: 0.92rem;
}
.city-suggest li:hover, .city-suggest li.active {
  background: var(--hover); color: var(--accent);
}
button {
  background: var(--accent); color: var(--field); border: 0; border-radius: 8px;
  padding: 10px 16px; font-weight: 650; cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: wait; }
.search-go {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; min-width: 0;
  padding: 16px 16px;
  min-height: 52px;
  background: var(--go);
  color: #fff;
}
.search-go:hover { background: #234e54; }
.search-go .spinner {
  display: none;
  width: 0.95em; height: 0.95em;
  border: 2px solid var(--field);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex: 0 0 auto;
}
.search-go.is-searching .spinner { display: inline-block; }
.search-go.is-searching { cursor: wait; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; margin: 0 0 16px;
}
.meta { color: var(--muted); font-size: 0.92rem; }
.status { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; min-height: 1.2em; }
.status.warn { color: var(--muted); }
.err { color: var(--warn); font-size: 0.9rem; margin: 0 0 8px; }

.filters {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.chip {
  border: 1px solid var(--line); color: var(--muted); background: var(--field);
  border-radius: 999px; padding: 6px 12px; font-size: 0.85rem; cursor: pointer;
}
.chip.active { border-color: var(--accent); color: var(--ink); background: var(--panel); }

.pager {
  display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; justify-content: center;
  margin: 8px 0 12px;
  padding: 0;
  background: none;
  border: 0;
}
.pager-bar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 32px;
  gap: 12px;
}
.pager-nav {
  display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; justify-content: center;
  flex: 0 1 auto;
}
.pager-bar .pager-sort,
.pager-bar .pager-size {
  position: static;
  transform: none;
  flex: 0 0 auto;
}
.pager[hidden] { display: none !important; }
@media (max-width: 860px) {
  .pager-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    row-gap: 8px;
  }
  .pager-bar .pager-sort,
  .pager-bar .pager-size {
    position: static;
    transform: none;
  }
  .pager-bar .pager-sort { grid-column: 1; }
  .pager-bar .pager-size { grid-column: 2; justify-self: end; }
  .pager-nav { grid-column: 1 / -1; }
}
.pager-sort {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; color: var(--muted); font-size: 0.8rem;
}
.pager button:not(.info),
.pager-sort select,
.pager-jump input,
.pager-size select {
  height: 32px; box-sizing: border-box;
  margin: 0; padding: 0 10px;
  font-family: inherit; font-size: 0.8rem; font-weight: 400;
  line-height: 30px;
  border-radius: 8px;
}
.pager button:not(.info):hover,
.pager button:not(.info):focus,
.pager-sort select:hover,
.pager-sort select:focus,
.pager-jump input:hover,
.pager-jump input:focus,
.pager-size select:hover,
.pager-size select:focus {
  font-weight: 400;
}
.pager-sort select {
  width: 7.4rem; max-width: 7.4rem; padding: 0 8px;
  background: var(--field); color: var(--ink);
  border: 1px solid var(--line);
}
.pager-extra {
  width: 100%;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  margin: 0 0 12px;
}
.pager button:not(.info) {
  background: var(--field); color: var(--accent);
  border: 1px solid var(--accent);
}
.pager button:not(.info):disabled {
  opacity: 0.35; cursor: default;
}
.pager-info { color: var(--muted); font-size: 0.8rem; line-height: 32px; }
.pager-jump, .pager-size {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 0.8rem; line-height: 32px;
  padding: 0; border: 0; background: none;
  height: 32px; font-weight: 400;
}
.pager-jump input {
  width: 3.4rem; padding: 0 6px;
  background: var(--field); color: var(--ink);
  border: 1px solid var(--line);
  text-align: center;
}
.pager-size select {
  width: 3.8rem; max-width: 3.8rem; padding: 0 4px;
  background: var(--field); color: var(--ink);
  border: 1px solid var(--line);
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 24px; }
.pager-bottom { margin-top: 4px; margin-bottom: 28px; }
.card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column; min-height: 100%;
  cursor: pointer;
  box-shadow: none;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card-hit {
  position: absolute; inset: 0; z-index: 1;
}
.card.exact {
  background: var(--match-fill);
  border-color: var(--match-line);
}
.card:hover, .card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px var(--shadow);
}
.card.exact:hover, .card.exact:focus-within {
  background: var(--match-fill);
  border-color: var(--match-line);
  box-shadow: 0 8px 18px var(--shadow);
}
.card:hover .photo, .card:focus-within .photo {
  filter: brightness(1.03);
}
.card.new { outline: 2px solid var(--new); }
.card.sweet { border-color: #6f8f55; }
.card.sweet:hover, .card.sweet:focus-within { border-color: var(--accent); }
.photo {
  height: 160px; background: var(--photo) center/cover no-repeat;
  transition: filter 0.15s ease;
}
.body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.price { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.title { font-weight: 600; line-height: 1.3; }
.sub { color: var(--muted); font-size: 0.88rem; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 0.72rem; letter-spacing: 0.02em;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted);
}
.badge.source { letter-spacing: 0.03em; }
.badge.new { color: var(--new); border-color: var(--new); }
.badge.sweet { color: var(--good); border-color: var(--good); }
.badge.exact { color: var(--good); border-color: var(--good); }
.badge.miss { color: var(--warn); border-color: var(--warn); }
.badge.olx { color: #8a5a12; }
.badge.rentola { color: #3d5a8a; }
.badge.otodom, .badge.morizon, .badge.gratka { color: #8a4a32; }
.badge.n-online { color: #6a3d7a; }
.badge.domiporta { color: #2f6a58; }
.badge.adresowo { color: #8a4a3a; }
.mirrors { position: relative; z-index: 2; color: var(--muted); font-size: 0.82rem; }
.mirrors a { color: var(--muted); }
.empty { color: var(--muted); padding: 24px 0; }
.jump {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.jump[hidden] { display: none !important; }
.jump button {
  width: 40px; height: 40px;
  margin: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 16px var(--shadow);
  font-weight: 400;
}
.jump button svg { width: 16px; height: 16px; display: block; }
.jump button:hover { border-color: var(--go); color: var(--go); }
.jump button:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
@media (max-width: 640px) {
  header h1 { font-size: 1.3rem; }
  .jump { right: 10px; bottom: 12px; }
}

.home { margin-top: 8px; }
.country-find {
  display: flex; flex-direction: column; gap: 6px;
  color: var(--muted); font-size: 0.82rem;
  margin: 0 0 10px;
}
.country-find input {
  background: var(--field); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 1rem;
  width: 100%;
}
.country-count {
  margin: 0 0 12px; color: var(--muted); font-size: 0.82rem;
}
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.country-card {
  display: flex; flex-direction: column; gap: 4px;
  text-align: left;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px;
  font: inherit; font-weight: 500;
  min-height: 96px;
}
.country-card:hover, .country-card:focus {
  border-color: var(--go); color: var(--ink);
  background: var(--card);
}
.country-card.is-dead { opacity: 0.72; }
.country-card-top {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.country-card-name { font-weight: 650; }
.country-card-cur { color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.country-live { color: var(--good); font-size: 0.75rem; font-weight: 500; }
.country-dead { color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.country-sites { color: var(--muted); font-size: 0.75rem; font-weight: 400; line-height: 1.35; }
.country-picked {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  color: var(--muted); font-size: 0.72rem;
}
.country-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 34px; margin: 0; padding: 0 10px;
  background: #faf8f3; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 0.88rem; font-weight: 400;
  cursor: pointer;
}
.country-switch:hover { background: var(--hover); color: var(--ink); }
.country-switch-action { color: var(--accent); font-size: 0.75rem; white-space: nowrap; }
#picked-country-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
