:root {
  --bg: #0e1117;
  --card: #171b24;
  --line: #262c38;
  --text: #e8ecf3;
  --muted: #8b93a3;
  --accent: #4c9aff;
  --ok: #3ecf8e;
  --warn: #ffb020;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 760px; margin: 0 auto; padding: 48px 20px 80px; }
main.page { max-width: 680px; }

h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -0.02em; }
.sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.language-control { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.language-icon { width: 19px; height: 19px; flex: 0 0 auto; fill: var(--accent); }
#language {
  max-width: 180px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  cursor: pointer;
}
.brand {
  display: inline-block; margin-bottom: 18px; color: var(--text);
  text-decoration: none; font-weight: 700;
}

form { display: flex; gap: 10px; margin-bottom: 22px; }

#code {
  flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 14px 16px; font-size: 18px; letter-spacing: 0.08em;
  text-transform: uppercase; outline: none;
}
#code:focus { border-color: var(--accent); }

#go {
  background: var(--accent); border: 0; color: #08121f; font-weight: 600;
  border-radius: 10px; padding: 0 22px; font-size: 15px; cursor: pointer;
}
#go:disabled { opacity: 0.55; cursor: default; }

.note {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--warn);
  border-radius: 8px; padding: 12px 14px; color: var(--muted); font-size: 14px; margin-bottom: 18px;
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; margin-bottom: 16px;
}

.tdac-alert {
  background: rgba(255, 48, 64, 0.14);
  border: 1px solid #ff3040;
  border-left: 5px solid #ff3040;
  border-radius: 10px;
  color: #ffd9dc;
}

[dir="rtl"] .tdac-alert {
  border-left-width: 1px;
  border-right: 5px solid #ff3040;
}

.tdac-alert-short {
  margin-bottom: 10px;
  padding: 8px 12px;
  font-size: 14px;
}

.tdac-inline-link {
  display: inline-block;
  margin-left: 5px;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.tdac-alert-detail {
  margin: -6px 0 20px;
  padding: 14px 16px;
}

.tdac-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tdac-heading strong {
  color: #ff7b86;
  font-size: 16px;
}

.tdac-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  fill: #ff3040;
}

.tdac-alert-detail p {
  margin: 10px 0 14px;
}

.tdac-button {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #ff3040;
  color: #fff;
  padding: 12px 16px;
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  font-weight: 750;
}

.tdac-button:hover,
.tdac-button:focus-visible {
  background: #ff5360;
}

.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.flightno { font-size: 22px; font-weight: 700; letter-spacing: 0.02em; }
.airline { color: var(--muted); font-size: 14px; }

.badge {
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600;
  background: #223; color: var(--muted); white-space: nowrap;
}
.badge.ok { background: rgba(62,207,142,0.15); color: var(--ok); }
.badge.warn { background: rgba(255,176,32,0.15); color: var(--warn); }
.badge.bad { background: rgba(255,107,107,0.15); color: var(--bad); }

.legs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.leg-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.iata { font-size: 28px; font-weight: 700; line-height: 1.1; }
.apt { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.arrow { color: var(--muted); font-size: 20px; }
.legs > div:last-child { text-align: right; }

.times { font-size: 14px; }
.times div { display: flex; gap: 8px; justify-content: inherit; }
.legs > div:last-child .times div { justify-content: flex-end; }
.k { color: var(--muted); }
.v.late { color: var(--warn); }
.v.early { color: var(--ok); }

.departure-countdown {
  display: inline-block;
  margin-top: 9px;
  border-radius: 999px;
  background: rgba(76, 154, 255, 0.14);
  color: #83b9ff;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.meta { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 16px; }

.copy {
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.copy p { margin: 0 0 14px; }

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover { color: var(--text); }

@media (max-width: 560px) {
  main { padding-top: 24px; }
  .header-row { align-items: flex-start; gap: 10px; }
  .language-control { gap: 5px; }
  .language-icon { width: 17px; height: 17px; margin-top: 8px; }
  #language { width: 104px; max-width: 31vw; min-width: 0; }
  #go { flex: 0 0 auto; padding: 0 16px; }
  .legs { grid-template-columns: 1fr; text-align: left; }
  .legs > div:last-child { text-align: left; }
  .legs > div:last-child .times div { justify-content: flex-start; }
  .arrow { display: none; }
}
