:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --card: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --line: color-mix(in srgb, var(--hint) 25%, transparent);
  --ok: #34c759;
}
* { box-sizing: border-box; }
html, body { touch-action: manipulation; margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#bar { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 12px 16px 6px; font-weight: 600; font-size: 17px; }
#progress { height: 4px; margin: 0 16px 8px; background: var(--line); border-radius: 2px; }
#progress i { display: block; height: 4px; width: 25%; background: var(--accent); border-radius: 2px; transition: width .2s; }
#progress[hidden] { display: none; }
main { padding: 0 16px 96px; }
section { margin: 0 0 18px; }
h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); }
h2 { margin: 22px 0 4px; font-size: 18px; }
.note { color: var(--hint); font-size: 13px; margin: 6px 0 0; }
.seg { display: flex; background: var(--card); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; padding: 9px 4px; border-radius: 8px; background: transparent; color: var(--text); font: inherit; }
.seg button.on { background: var(--bg); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tiles button { border: 1.5px solid var(--line); background: var(--bg); color: var(--text); border-radius: 12px;
  padding: 14px 6px; font: inherit; min-height: 48px; }
.tiles button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 0; background: var(--card); color: var(--text); border-radius: 16px; padding: 7px 12px; font: inherit; font-size: 14px; min-height: 34px; }
.chips button.on { background: var(--accent); color: var(--accent-text); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; border-bottom: 1px solid var(--line); }
.row label { flex: 1; }
.pair { display: flex; align-items: center; gap: 8px; }
input[type=number], input[type=text], input[type=search] { font: inherit; color: var(--text); background: var(--card);
  border: 0; border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px; }
.pair input { width: 104px; text-align: center; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 15px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { left: 23px; }
.results { margin-top: 6px; }
.results button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.results small { color: var(--hint); }
.picked button[data-place]::after { content: " ×"; }
#fallback-main { position: fixed; left: 16px; right: 16px; bottom: 16px; padding: 14px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; }
.linkbtn { border: 0; background: transparent; color: var(--accent); font: inherit; padding: 12px 0; }
.dual { position: relative; height: 40px; margin: 4px 0 0; }
.dual .rail { position: absolute; left: 13px; right: 13px; top: 18px; height: 4px; border-radius: 2px; background: var(--line); }
.dual .fill { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; }
.dual input[type=range] { position: absolute; left: 0; top: 7px; width: 100%; height: 26px; margin: 0; background: transparent;
  pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 26px; }
.dual input[type=range]::-moz-range-track { background: transparent; }
.dual input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 26px; height: 26px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; }
.dual input[type=range]::-moz-range-thumb { pointer-events: auto; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; }
.marks { display: flex; justify-content: space-between; color: var(--hint); font-size: 12px; margin: 0 2px 4px; }
#map { height: 280px; border-radius: 12px; margin: 4px 0 0; z-index: 0; }
.pin { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 13px; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); }
