:root {
  --bg: #ffffff;
  --bg-soft: #f4f6f9;
  --card: #ffffff;
  --text: #16202c;
  --muted: #6a7686;
  --line: #dfe4ec;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --price: #0d7a3d;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 6px 18px rgba(20, 30, 45, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151c;
    --bg-soft: #161d26;
    --card: #1a222d;
    --text: #e8edf4;
    --muted: #93a1b3;
    --line: #2a3644;
    --accent: #4c8dff;
    --accent-ink: #0b1017;
    --price: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.top__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 700; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.logo span { margin-left: 2px; }
.tg-link { color: var(--accent); text-decoration: none; font-size: 15px; font-weight: 500; }
.tg-link:hover { text-decoration: underline; }

/* hero */
.hero { background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 44px 0 38px; }
h1 { margin: 0 0 6px; font-size: clamp(27px, 4.4vw, 38px); letter-spacing: -.022em; }
.hero__sub { margin: 0 0 24px; color: var(--muted); font-size: 17px; }

/* вкладки режимов */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 8px 15px; font-size: 14.5px; font-weight: 500; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
}
.tab:hover { color: var(--text); border-color: var(--muted); }
.tab--on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tab--on:hover { color: var(--accent-ink); border-color: var(--accent); }

/* плашки подборок */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  padding: 7px 13px; font-size: 14px; cursor: pointer; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
}
.chip:hover { border-color: var(--accent); }
.chip--on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* страны, раскрываются */
.country { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--card); }
.country__head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  cursor: pointer; padding: 13px 16px; list-style-position: inside;
}
.country__head:hover { color: var(--accent); }
.country__name { font-weight: 600; font-size: 16px; }
.country__price { color: var(--price); font-weight: 700; }
.country__count { color: var(--muted); font-size: 13.5px; margin-left: auto; }
.country[open] .country__head { border-bottom: 1px solid var(--line); }
.country .cards { padding: 14px 16px; }

/* расширенный поиск */
.adv { margin-top: 12px; }
.adv summary {
  cursor: pointer; font-size: 14.5px; font-weight: 500; color: var(--accent);
  width: fit-content; padding: 4px 0; list-style-position: inside;
}
.adv summary:hover { text-decoration: underline; }
.adv__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px; align-items: end;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-top: 10px;
}
.check--adv { grid-column: 1 / -1; height: auto; color: var(--text); font-weight: 500; }
.btn--ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); font-weight: 500;
}
.btn--ghost:hover { color: var(--text); border-color: var(--muted); filter: none; }

/* form */
.search {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 190px; min-width: 0; }
.field--sm { flex: 1 1 160px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.field input {
  height: 42px; padding: 0 12px; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; width: 100%;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.check { display: flex; align-items: center; gap: 7px; font-size: 14.5px; height: 42px; white-space: nowrap; color: var(--muted); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.btn {
  height: 42px; padding: 0 24px; font-size: 15px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 9px; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }

.hint { color: var(--muted); font-size: 13.5px; margin: 12px 0 0; }
.hint code { background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }

/* sections */
main { padding: 34px 0 10px; }
h2 { font-size: 21px; letter-spacing: -.015em; margin: 0 0 4px; }
.results, .deals, .tg { margin-bottom: 40px; }
.deals__sub { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
.muted { color: var(--muted); }

/* offers */
.offer {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
}
.offer__price { font-size: 20px; font-weight: 700; color: var(--price); min-width: 110px; }
.offer__main { flex: 1 1 220px; min-width: 0; }
.offer__route { font-weight: 600; }
.offer__meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.offer .btn { padding: 0 18px; height: 38px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.card {
  display: block; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 16px; transition: border-color .12s, transform .12s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card__city { font-weight: 600; font-size: 16px; }
.card__price { color: var(--price); font-weight: 700; font-size: 18px; margin-top: 6px; }
.card__meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* соседние даты */
.flex__sub { color: var(--muted); margin: 0 0 14px; font-size: 15px; }
.flex__strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.day {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px;
  min-width: 104px; text-align: center; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; transition: border-color .12s;
}
.day:hover { border-color: var(--accent); }
.day__date { font-size: 13px; color: var(--muted); }
.day__price { font-weight: 700; font-size: 15px; }
.day--chosen { border-color: var(--accent); }
.day--best { background: color-mix(in srgb, var(--price) 10%, var(--card)); border-color: var(--price); }
.day--best .day__price { color: var(--price); }

/* telegram */
.tg { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.tg p { color: var(--muted); max-width: 620px; }
.btn--tg { display: inline-flex; align-items: center; text-decoration: none; margin-top: 6px; }

/* footer */
.foot { border-top: 1px solid var(--line); margin-top: 20px; padding: 22px 0 34px; font-size: 14px; color: var(--muted); }
.foot p { margin: 0 0 6px; }

.error { background: var(--card); border: 1px solid var(--line); border-left: 3px solid #d9534f; border-radius: 9px; padding: 13px 15px; }

@media (max-width: 620px) {
  .search { padding: 14px; }
  .btn { width: 100%; }
  .offer__price { min-width: auto; }
}
