/* Colors follow the user's Telegram theme; fallbacks are for a normal browser. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f2f4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #15181c);
  --hint: var(--tg-theme-hint-color, #7a828c);
  --link: var(--tg-theme-link-color, #2a7bd6);
  --btn: var(--tg-theme-button-color, #2a7bd6);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --line: color-mix(in srgb, var(--hint) 22%, transparent);
  --soft: color-mix(in srgb, var(--hint) 12%, transparent);
  --brand: #e2662b;
  --ok: #2f9e5a;
  --warn: #d9861a;
  --bad: #d64545;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #101214; --card: #1b1e22; --text: #eceef1; --hint: #8b939c; --link: #5aa2ee; --btn: #3b8de0;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.brand { display: flex; flex-direction: column; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--brand); }
.tag { color: var(--hint); font-size: 13px; }
.langs { display: flex; background: var(--soft); border-radius: 10px; padding: 2px; }
.langs button { padding: 5px 9px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--hint); }
.langs button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding: 4px 0; }
.inline-chips { display: contents; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px; background: var(--card); font-size: 14px;
  white-space: nowrap; border: 1px solid var(--line);
}
.chip.on { background: var(--btn); color: var(--btn-text); border-color: transparent; }
.filter-btn b { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px;
  background: var(--btn); color: var(--btn-text); font-size: 12px; line-height: 18px; text-align: center; }
.filter-btn b:empty { display: none; }

main { padding: 0 16px; }
.day { margin: 14px 2px 8px; font-size: 13px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .03em; }
.card {
  display: block; width: 100%; text-align: left; background: var(--card); border-radius: 14px;
  padding: 13px 14px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card:active { transform: scale(.99); }
.card .t { font-weight: 650; font-size: 16px; line-height: 1.3; }
.card .meta { color: var(--hint); font-size: 13px; margin-top: 3px; }
.card .row { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 9px; }
.price { font-weight: 700; font-size: 15px; white-space: nowrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--soft); color: var(--text); white-space: nowrap; }
.pill.few { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); font-weight: 600; }
.pill.full { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); font-weight: 600; }
.pill.open { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); font-weight: 600; }
.card.is-full .t, .card.is-full .price { opacity: .55; }

.empty { text-align: center; color: var(--hint); padding: 48px 20px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.foot { text-align: center; color: var(--hint); font-size: 12px; padding: 8px 16px; }
.skeleton { height: 92px; border-radius: 14px; background: var(--card); margin-bottom: 8px; opacity: .6; }

/* sheets */
#shade { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet {
  position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto;
  padding: 0 0 calc(90px + env(safe-area-inset-bottom));
}
.sheet.small {
  inset: auto 0 0 0; max-height: 85vh; border-radius: 16px 16px 0 0; background: var(--card);
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 4px; }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet h3 { margin: 14px 0 4px; font-size: 13px; color: var(--hint); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.x { font-size: 18px; color: var(--hint); padding: 6px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions button { flex: 1; padding: 12px; border-radius: 12px; font-weight: 600; }
.primary { background: var(--btn); color: var(--btn-text); }
.ghost { background: var(--soft); }

/* tour details */
.d-head { background: var(--card); padding: 16px 16px 14px; }
.d-back { color: var(--link); padding: 0 0 10px; font-size: 15px; }
.d-title { font-size: 21px; font-weight: 750; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.01em; }
.d-agency { color: var(--hint); }
.d-sec { background: var(--card); margin: 10px 0 0; padding: 4px 16px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--hint); flex: none; }
.kv span:last-child { text-align: right; }
.d-sec h3 { margin: 10px 0 2px; font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: .03em; }
.d-sec ul { margin: 4px 0 10px; padding-left: 20px; }
.d-sec li { margin: 3px 0; }
.note { padding: 10px 0; color: var(--text); }
.note.discount { color: var(--ok); }
.d-links { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.d-links a, .d-links button { color: var(--link); text-decoration: none; text-align: left; padding: 4px 0; }
.d-fallback-btn { position: fixed; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom));
  padding: 14px; border-radius: 12px; background: var(--btn); color: var(--btn-text); font-weight: 650; z-index: 31; }
.disclaimer { color: var(--hint); font-size: 12px; padding: 4px 16px 16px; }
.nowrap { white-space: nowrap; }
