/* FlightGo — сайт. Сначала телефон, на широком экране — та же колонка по центру. */

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --text: #0f1828;
  --muted: #5e6a7d;
  --line: #e2e7ee;
  --accent: #1f5fd6;
  --accent-ink: #ffffff;
  --accent-soft: #e8effc;
  --green: #17955a;
  --green-soft: #e4f5ec;
  --yellow: #c58a00;
  --yellow-soft: #fdf4dc;
  --red: #d33a3a;
  --red-soft: #fbe7e7;
  --grey: #a3adbb;
  --shadow: 0 1px 2px rgba(15, 24, 40, .05), 0 4px 16px rgba(15, 24, 40, .05);
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1220;
    --surface: #141c2d;
    --text: #e7ecf4;
    --muted: #95a1b5;
    --line: #243049;
    --accent: #5b98ff;
    --accent-ink: #08101f;
    --accent-soft: #1a2a48;
    --green: #3ccf86;
    --green-soft: #13301f;
    --yellow: #f2bd3c;
    --yellow-soft: #33290f;
    --red: #ff6b6b;
    --red-soft: #3a1719;
    --grey: #5d6a80;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main, .top, .foot { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ── Шапка ── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: 6px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.01em;
  font-size: 18px;
}
.brand svg {
  width: 26px;
  height: 26px;
  padding: 4px;
  border-radius: 8px;
  background: var(--accent);
  fill: var(--accent-ink);
  transform: rotate(45deg);
}
.tag { color: var(--muted); font-size: 13px; }

h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 18px 0 6px; }
.lead { color: var(--muted); margin: 0 0 18px; font-size: 15px; }

/* ── Поля выбора ── */
.field { margin-bottom: 18px; }
.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 8px 2px;
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.seg button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 8px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

.chips { display: grid; gap: 8px; }
.chips.two { grid-template-columns: 1fr 1fr; }
.chips.grid { grid-template-columns: repeat(5, 1fr); }
.chips.list { grid-template-columns: 1fr; }
.chips button {
  min-height: 46px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 15px;
  transition: background .15s, border-color .15s, color .15s;
}
.chips.list button { text-align: left; padding: 10px 14px; }
.chips.list small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.chips button[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.chips button[aria-checked="true"] small { color: inherit; opacity: .8; }

.at {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}
.at input {
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px; /* меньше 16 — iOS приближает страницу при вводе */
}
.at input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.at small { font-size: 12px; }

.form-error { color: var(--red); font-weight: 600; margin: 0 0 12px; }

button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Кнопка внизу ── */
.bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
}
.bar .primary { max-width: 528px; margin: 0 auto; }
.primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 6px 18px rgba(31, 95, 214, .25);
  transition: transform .1s, opacity .15s;
}
.primary:active { transform: scale(.985); }
.primary:disabled { opacity: .55; }
.primary small { font-weight: 500; font-size: 13px; opacity: .85; }
.primary.small { width: auto; min-height: 44px; padding: 0 20px; font-size: 15px; box-shadow: none; }

.ghost {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
  font-size: 15px;
}

/* ── Ответ ── */
.back {
  border: 0;
  background: none;
  padding: 10px 0;
  margin: 6px 0 4px;
  color: var(--accent);
  font-weight: 600;
}

.loading { text-align: center; padding: 56px 0 40px; color: var(--muted); }
.loading p { color: var(--text); font-weight: 600; margin: 20px 0 4px; }
.radar {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: conic-gradient(from 0deg, transparent 0 75%, var(--accent-soft) 85%, var(--accent) 100%);
  animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .radar { animation-duration: 4s; } }

.fail { text-align: center; padding: 40px 0; }
.fail p { font-weight: 600; }

.verdict {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  font-size: 18px;
  line-height: 1.2;
  margin-top: 4px;
}
.verdict strong { font-weight: 800; letter-spacing: .01em; }
.lamp { flex: none; width: 18px; height: 18px; border-radius: 50%; background: currentColor; }
.v-green { background: var(--green-soft); color: var(--green); }
.v-yellow { background: var(--yellow-soft); color: var(--yellow); }
.v-red { background: var(--red-soft); color: var(--red); }
.v-green .lamp { box-shadow: 0 0 0 5px rgba(23, 149, 90, .15); }
.v-yellow .lamp { box-shadow: 0 0 0 5px rgba(197, 138, 0, .15); }
.v-red .lamp { box-shadow: 0 0 0 5px rgba(211, 58, 58, .15); }

h2 { font-size: 20px; margin: 18px 0 6px; letter-spacing: -.01em; }
.meta { list-style: none; padding: 0; margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.meta li + li { margin-top: 2px; }
.meta .cond { color: var(--yellow); font-weight: 600; }

.params {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.params li {
  display: grid;
  grid-template-columns: 12px 1fr;
  column-gap: 12px;
  padding: 12px 14px;
}
.params li + li { border-top: 1px solid var(--line); }
.params .dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--grey); }
.params .s-green .dot { background: var(--green); }
.params .s-yellow .dot { background: var(--yellow); }
.params .s-red .dot { background: var(--red); }
.params .s-yellow { background: linear-gradient(90deg, var(--yellow-soft), transparent 70%); }
.params .s-red { background: linear-gradient(90deg, var(--red-soft), transparent 70%); }
.p-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.p-name { font-size: 15px; }
.p-fact { font-weight: 700; font-size: 15px; text-align: right; margin-left: auto; }
.p-lim { color: var(--muted); font-size: 13px; margin-top: 2px; }
.p-lim::before { content: "⤷ "; }
sup a {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  margin-left: 2px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  text-decoration: none;
}

.notes-block h3 { font-size: 15px; margin: 22px 0 8px; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 10px 0;
  font-size: 14px;
  scroll-margin-top: 16px;
}
.notes li + li { border-top: 1px dashed var(--line); }
.notes li:target { background: var(--accent-soft); border-radius: 10px; }
.notes .n {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.notes .src { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.hints { color: var(--muted); font-size: 13px; margin: 14px 0; }
.errors { list-style: none; padding: 12px 14px; margin: 14px 0; border-radius: 12px; background: var(--yellow-soft); font-size: 14px; }
.errors li::before { content: "⚠ "; color: var(--yellow); }

.raw {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.raw summary { padding: 12px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.raw pre {
  margin: 0;
  padding: 0 14px 14px;
  font: 12.5px/1.55 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }

.feedback { margin: 0 0 16px; }
.feedback label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.feedback textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px;
  resize: vertical;
}
.fb-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.fb-done { color: var(--green); font-weight: 600; }

.disclaimer {
  margin: 20px 0 6px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 12px 12px 0;
  font-weight: 600;
  font-size: 14px;
}
.sources { color: var(--muted); font-size: 12px; margin: 0 0 8px; }

.foot {
  padding-top: 8px;
  padding-bottom: 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.foot a { color: inherit; }

/* Узкие телефоны (SE, старые Android): маршруты в 4 колонки, время мельче */
@media (max-width: 360px) {
  .chips.grid { grid-template-columns: repeat(4, 1fr); }
  .seg button { font-size: 14px; padding: 8px 2px; }
  h1 { font-size: 25px; }
}
