:root {
  --bg: #060a14;
  --panel: #0c1222;
  --line: #1f2942;
  --text: #eef2fb;
  --muted: #8b94ad;
  --accent: #ff7a66;
  --accent-deep: #f4503c;
  --amber: #ffb020;
  --green: #3ddc84;
  --red: #ff5d5d;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(255,122,102,.08), transparent 60%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  max-width: 760px;
  margin: 0 auto;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
}

.brand .plane {
  color: var(--accent);
  margin-right: 8px;
}

.demo-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 999px;
  padding: 4px 10px;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 18px 40px;
}

.search form {
  display: flex;
  gap: 10px;
}

.search input {
  flex: 1;
  font-size: 20px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  outline: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.search input:focus { border-color: var(--accent); }

.search button {
  font-size: 17px;
  font-weight: 700;
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ff8a5c, var(--accent-deep));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(244,80,60,.35);
}

.search button:active { transform: scale(.97); }

.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 12px 2px 0;
}

.hint b { color: var(--text); }

.error {
  color: var(--red);
  font-size: 14px;
  margin: 12px 2px 0;
}

.card {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.airline {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.flightno {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
}

.status {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.status.scheduled { color: var(--accent); border: 1px solid var(--accent); }
.status.active    { color: var(--green);  border: 1px solid var(--green); }
.status.landed    { color: var(--muted);  border: 1px solid var(--muted); }
.status.cancelled, .status.diverted, .status.incident { color: var(--red); border: 1px solid var(--red); }

.route {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}

.airport { flex: 1; }
.airport.right { text-align: right; }

.airport .code {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 2px;
}

.airport .name {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.airport .time {
  font-size: 15px;
  margin-top: 8px;
  line-height: 1.5;
}

.airport .time .lbl {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.route-line { flex: 0 0 90px; height: 2px; background: var(--line); position: relative; overflow: visible; }
.route-line span {
  position: absolute; left: 0; top: 50%;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px var(--accent);
}
.route.flying .route-line span {
  animation: travel 3s ease-in-out infinite alternate;
}
@keyframes travel {
  from { left: 0; }
  to { left: 100%; }
}

.delay {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
}

.delay.late { background: rgba(255,176,32,.1); color: var(--amber); border: 1px solid rgba(255,176,32,.4); }
.delay.ontime { background: rgba(61,220,132,.08); color: var(--green); border: 1px solid rgba(61,220,132,.35); }

.live {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.live b { color: var(--text); }

.data-age { font-size: 12px; opacity: .7; }

#mapWrap {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: #02040a;
}

#map { width: 100%; height: 420px; }

.map-error {
  padding: 40px 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.plane-marker { width: 36px; height: 36px; position: relative; }
.plane-marker .plane-rot {
  width: 100%; height: 100%;
  transition: transform 1s linear;
  filter: drop-shadow(0 0 8px rgba(255, 122, 102, .9));
}
.plane-marker.landing::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid var(--coral);
  border-radius: 50%;
  animation: ping 1.6s ease-out infinite;
  pointer-events: none;
}
@keyframes ping {
  0% { transform: scale(.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.plane-marker.takeoff .plane-rot {
  filter: drop-shadow(0 0 16px rgba(255, 122, 102, 1));
}

.moment {
  margin-top: 12px;
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 122, 102, .14);
  border: 1px solid var(--coral);
  color: var(--coral);
  font-weight: 600;
  font-size: 14px;
}

.photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.photo { margin: 0; cursor: zoom-in; }
.photo img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  background: #141a2e;
}
.photo figcaption {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.photo figcaption .tap { opacity: .65; }

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 12, .94);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lbImg {
  max-width: 94vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 12px;
}
.lb-cap {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.lb-cap a { color: var(--muted); }

.attrib {
  position: absolute;
  right: 8px; bottom: 6px;
  font-size: 10px;
  color: rgba(139,148,173,.8);
}

.foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 22px 30px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 520px) {
  .flightno { font-size: 24px; }
  .airport .code { font-size: 26px; }
  #map { height: 340px; }
  .search input { font-size: 17px; }
}
