:root {
  --bg: #0a0e14;
  --bg-row: #0f1520;
  --bg-row-alt: #121a28;
  --header-bg: #06090e;
  --line: #1e2a3a;
  --text: #e8eef6;
  --muted: #8a9bb0;
  --amber: #f0b429;
  --amber-dim: #b8860b;
  --green: #3ddc97;
  --red: #ff6b6b;
  --blue: #5b9fd4;
  --status-on: #3ddc97;
  --status-delay: #f0b429;
  --status-cancel: #ff6b6b;
  --status-board: #5b9fd4;
  --status-land: #a8e6cf;
  --font-display: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

.kiosk {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #152033 0%, transparent 55%),
    linear-gradient(180deg, #0c121c 0%, var(--bg) 40%, #080b10 100%);
}

.board-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.5rem 0.45rem;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.logo-slot {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #0d1420;
}

.logo-img {
  max-width: 44px;
  max-height: 44px;
  object-fit: contain;
}

.logo-fallback {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  padding: 0.25rem;
}

.brand-name {
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.1;
}

.brand-place {
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  color: var(--muted);
  margin-top: 0.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.airport-block {
  text-align: center;
}

.airport-code {
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 2.8vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--amber);
  line-height: 1;
}

.airport-name {
  font-size: clamp(0.65rem, 0.95vw, 0.8rem);
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.clock-block {
  text-align: right;
  justify-self: end;
}

.clock-time {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 2.4vw, 2.05rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
  tabular-nums: true;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: clamp(0.65rem, 0.95vw, 0.8rem);
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

.mode-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 1.5rem 0.3rem;
  border-bottom: 2px solid var(--amber-dim);
}

.mode-title {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 2.3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--amber);
}

.mode-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  color: var(--muted);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.live-badge::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 2s ease-out infinite;
}

.live-badge.live {
  color: var(--green);
}

.live-badge.delayed {
  color: var(--amber);
  animation: none;
}

.live-badge.delayed::before {
  animation: none;
  opacity: 0.85;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

.board-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 1.25rem 0.2rem;
}

.fids-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-mono);
}

.fids-table thead th {
  text-align: left;
  padding: 0.5rem 0.55rem 0.4rem;
  font-size: clamp(0.65rem, 0.95vw, 0.8rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.fids-table tbody td {
  padding: 0.5rem 0.55rem;
  font-size: clamp(0.88rem, 1.4vw, 1.2rem);
  font-weight: 500;
  border-bottom: 1px solid rgba(30, 42, 58, 0.7);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fids-table tbody tr {
  background: var(--bg-row);
  animation: rowIn 0.35s ease-out both;
}

.fids-table tbody tr:nth-child(even) {
  background: var(--bg-row-alt);
}

.fids-table tbody tr.page-enter {
  animation: rowIn 0.4s ease-out both;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.col-time { width: 12%; }
.col-flight { width: 14%; }
.col-airline { width: 28%; }
.col-place { width: 24%; }
.col-status { width: 22%; }

.time-cell {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.time-cell .est {
  display: block;
  font-size: 0.72em;
  color: var(--amber);
  font-weight: 500;
  margin-top: 0.1rem;
}

.flight-cell {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.airline-cell,
.place-cell {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 500;
}

.status-cell {
  font-weight: 700;
  letter-spacing: 0.06em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
}

.status-pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  flex-shrink: 0;
  border-radius: 1px;
  background: currentColor;
}

.status-ON_TIME,
.status-SCHEDULED,
.status-EXPECTED { color: var(--status-on); }

.status-DELAYED { color: var(--status-delay); }

.status-CANCELLED,
.status-DIVERTED { color: var(--status-cancel); text-decoration: line-through; }

.status-BOARDING,
.status-GATE,
.status-LAST_CALL,
.status-APPROACHING { color: var(--status-board); }

.status-LANDED,
.status-DEPARTED { color: var(--status-land); }

.status-OTHER,
.status-UNKNOWN { color: var(--muted); }

.empty-state {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  letter-spacing: 0.18em;
  color: var(--muted);
  text-align: center;
  padding: 2rem;
  pointer-events: none;
}

/* Must beat any display:grid / attribute quirk — only show when truly empty */
.empty-state.is-visible {
  display: grid;
}

.empty-state[hidden] {
  display: none !important;
}

.board-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3rem 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  background: var(--header-bg);
  white-space: nowrap;
}

.footer-left,
.footer-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem 0.55rem;
  min-width: 0;
}

.disclaimer {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-sep {
  opacity: 0.55;
}

.credit-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.02em;
  font-weight: 600;
}

.credit-link:hover,
.credit-link:focus-visible {
  color: var(--text);
  border-bottom-color: var(--text);
  outline: none;
}

.mock-banner,
.stale-banner {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.mock-banner {
  color: var(--amber);
  font-weight: 600;
}

.stale-banner {
  color: var(--amber);
  font-weight: 600;
  animation: fadePulse 2.5s ease-in-out infinite;
}

@keyframes fadePulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Mode crossfade */
.mode-title.flip {
  animation: titleFlip 0.45s ease;
}

@keyframes titleFlip {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .board-header {
    grid-template-columns: 1fr;
    text-align: left;
    gap: 0.75rem;
  }
  .airport-block,
  .clock-block {
    text-align: left;
    justify-self: start;
  }
  .col-airline { display: none; }
  .fids-table thead th.col-airline,
  .fids-table tbody td.col-airline { display: none; }
}

/* Admin page */
.admin-body {
  overflow: auto;
  padding: 2rem;
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.admin-body h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.admin-body pre {
  background: #121a28;
  border: 1px solid var(--line);
  padding: 1rem;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.admin-meta {
  color: var(--muted);
  margin-bottom: 1rem;
}
