/* FlightsAboveMe — Kiosk (LED-board / signage-grade)
   UI-only. Keeps existing IDs so app.js can populate fields unchanged.

   Baseline:
   - Logo plate is TRUE white (no gray cast)
   - Aircraft line bigger
   - Remove ALL stat “boxes” (no borders, no inset outlines, no tile backgrounds)
   - Remove divider lines that values were colliding with
   - Reduce dead space by preventing the top section from stretching
   - No ellipsis anywhere in kiosk text

   v1.2.8 (candidate):
   - REMOVE stat headers (ALT/SPD/TRK/DIST)
   - Use reclaimed vertical space to make stat values taller
   - Landscape: center-justify stat values in their cells
   - Portrait: codes-only route
   - ✅ iPhone portrait: compact mode (smaller typography + logo + stats)
   - ✅ Portrait: prevent right-side stat clipping (gutters + right align right column)
   - ✅ iPhone portrait stacks stats (no clipping, no overlap)
   - ✅ CHANGE: Center stats in iPhone portrait stacked mode
*/

:root{
  color-scheme: dark;

  --bg0:#05070c;
  --bg1:#070a12;

  --text: rgba(255,255,255,.94);
  --muted: rgba(255,255,255,.78);
  --faint: rgba(255,255,255,.55);

  --glowA: rgba(120,220,255,.18);
  --glowB: rgba(120,220,255,.10);

  --stroke: rgba(255,255,255,.12);

  --safeTop: env(safe-area-inset-top);
  --safeRight: env(safe-area-inset-right);
  --safeBottom: env(safe-area-inset-bottom);
  --safeLeft: env(safe-area-inset-left);

  --pad: clamp(8px, 1.2vmin, 14px);

  --airline: clamp(62px, 9.2vmin, 150px);
  --route:   clamp(50px, 7.6vmin, 118px);
  --sub:     clamp(44px, 6.2vmin, 96px);
  --tiny:    clamp(16px, 2.2vmin, 28px);

  /* Stats */
  --statV:   clamp(76px, 11.8vmin, 186px);
  --statK:   clamp(16px, 2.2vmin, 26px);

  --topBar:  clamp(14px, 1.9vmin, 20px);
  --exitH:   clamp(42px, 5.4vmin, 60px);
}

/* Landscape tuning */
@media (orientation: landscape){
  :root{
    --statV: clamp(66px, 9.6vmin, 158px);
    --route: clamp(46px, 6.6vmin, 104px);
    --sub:   clamp(42px, 5.6vmin, 88px);
  }
}

/* Portrait baseline safety */
@media (orientation: portrait){
  :root{
    --statV: clamp(56px, 8.8vmin, 128px);
    --route: clamp(44px, 6.6vmin, 98px);
    --sub:   clamp(38px, 5.2vmin, 82px);
  }
}

/* ✅ iPhone portrait COMPACT mode
   (Distance readability not critical; prioritize fit + polish) */
@media (orientation: portrait) and (max-width: 430px){
  :root{
    --pad:    clamp(6px, 1.0vmin, 10px);

    --airline: clamp(44px, 7.2vmin, 96px);
    --route:   clamp(34px, 5.4vmin, 72px);
    --sub:     clamp(30px, 4.8vmin, 64px);
    --tiny:    clamp(12px, 1.9vmin, 18px);

    /* This is the big win for avoiding overlap/cropping */
    --statV:   clamp(44px, 7.8vmin, 104px);

    --topBar:  clamp(12px, 1.7vmin, 16px);
    --exitH:   clamp(34px, 4.8vmin, 46px);
  }
}

/* ✅ iPhone compact landscape safety (short height) */
@media (orientation: landscape) and (max-height: 460px){
  :root{
    --pad:   clamp(6px, 0.9vmin, 10px);

    --airline: clamp(34px, 6.2vmin, 72px);
    --route:   clamp(28px, 5.0vmin, 60px);
    --sub:     clamp(24px, 4.2vmin, 52px);
    --tiny:    clamp(12px, 1.8vmin, 18px);

    --statV:   clamp(34px, 7.0vmin, 76px);

    --topBar:  clamp(12px, 1.7vmin, 16px);
    --exitH:   clamp(34px, 4.6vmin, 44px);
  }
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  overflow:hidden;
  background:
    radial-gradient(1200px 700px at 50% -120px, rgba(120,160,255,.12), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.06), transparent 22%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  color:var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: .2px;
}

.hidden{ display:none !important; }

#app.kioskApp{
  height: 100svh;
  padding:
    calc(var(--safeTop) + var(--pad))
    calc(var(--safeRight) + var(--pad))
    calc(var(--safeBottom) + var(--pad))
    calc(var(--safeLeft) + var(--pad));
  display:flex;
  flex-direction:column;
  gap: clamp(8px, 1.2vmin, 12px);
}

@media (orientation: landscape) and (max-height: 460px){
  #app.kioskApp{ gap: clamp(6px, 0.9vmin, 10px); }
}

/* Top bar */
.topBar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  user-select:none;
}

.appName{
  font-size: var(--topBar);
  font-weight: 900;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.82);
  text-transform: uppercase;
}

.exitBtn{
  text-decoration:none;
  height: var(--exitH);
  padding: 0 clamp(14px, 2.2vmin, 24px);
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: var(--topBar);
  font-weight: 950;
  letter-spacing: 1px;
  color: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  box-shadow:
    0 16px 34px rgba(0,0,0,.40),
    inset 0 1px 0 rgba(255,255,255,.10);
  -webkit-tap-highlight-color: transparent;
}
.exitBtn:active{ transform: translateY(1px); }

/* Board */
.board{
  flex: 1;
  min-height: 0;

  border-radius: 0;
  border: 0;
  overflow:hidden;

  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.085) 1px, transparent 1.6px) 0 0 / 8px 8px,
    linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.42)),
    linear-gradient(180deg, rgba(20,30,55,.18), rgba(0,0,0,.0) 35%),
    linear-gradient(180deg, #070a12, #04060b);

  display:grid;
  grid-template-rows: auto 1fr;
}

/* Top section */
.topPane{
  display:grid;
  grid-template-columns: auto 1fr;
  gap: clamp(10px, 1.4vmin, 16px);
  padding: clamp(12px, 2.0vmin, 18px);
  align-items:center;
  min-height: 0;
}

@media (orientation: landscape) and (max-height: 460px){
  .topPane{
    padding: clamp(8px, 1.4vmin, 12px);
    gap: clamp(8px, 1.2vmin, 12px);
  }
}

@media (orientation: portrait){
  .topPane{
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    justify-items:center;
    align-items:start;
    gap: clamp(14px, 3.0vmin, 22px);
  }
}

.logoPane{
  height: 100%;
  min-height: 0;
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
  padding-top: clamp(4px, 0.9vmin, 8px);
}

@media (orientation: portrait){
  .logoPane{
    height: auto;
    align-items:center;
    justify-content:center;
    padding-top: 0;
  }
}

@media (orientation: landscape) and (max-height: 460px){
  .logoPane{ padding-top: 0; align-items:center; }
}

/* Logo plate */
.logo{
  width: clamp(150px, 22vmin, 270px);
  height: clamp(150px, 22vmin, 270px);
  object-fit: contain;

  padding: clamp(10px, 1.4vmin, 16px);
  border-radius: 22px;

  background:
    radial-gradient(120% 120% at 30% 25%, rgba(255,255,255,1), rgba(255,255,255,.98) 55%, rgba(255,255,255,.96)),
    #ffffff;

  border: 1px solid rgba(0,0,0,.10);

  box-shadow:
    0 20px 38px rgba(0,0,0,.60),
    inset 0 1px 0 rgba(255,255,255,.85),
    inset 0 -1px 0 rgba(0,0,0,.08);

  filter: drop-shadow(0 12px 18px rgba(0,0,0,.30));
}

/* Portrait logo size */
@media (orientation: portrait){
  .logo{
    width: clamp(108px, 15.5vmin, 170px);
    height: clamp(108px, 15.5vmin, 170px);
  }
}

/* Extra compact iPhone portrait logo */
@media (orientation: portrait) and (max-width: 430px){
  .logo{
    width: clamp(96px, 14.2vmin, 150px);
    height: clamp(96px, 14.2vmin, 150px);
    border-radius: 20px;
  }
}

@media (orientation: landscape) and (max-height: 460px){
  .logo{
    width: clamp(96px, 16vmin, 140px);
    height: clamp(96px, 16vmin, 140px);
    border-radius: 18px;
    padding: clamp(8px, 1.2vmin, 12px);
  }
}

/* Text */
.mainText{
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  gap: clamp(8px, 1.2vmin, 12px);
  min-width: 0;
  width: 100%;
}

@media (orientation: portrait){
  .mainText{
    align-items: center;
    text-align: center;
  }
}

@media (orientation: landscape) and (max-height: 460px){
  .mainText{ gap: clamp(6px, 0.9vmin, 10px); }
}

.line{
  text-shadow:
    0 0 12px var(--glowA),
    0 0 28px var(--glowB);
}

.airline{
  font-size: var(--airline);
  font-weight: 950;
  letter-spacing: .6px;
  line-height: 1.02;
  text-wrap: balance;
  max-width: 100%;
}

/* Route block */
.routeBlock{
  display:flex;
  flex-direction:column;
  gap: clamp(6px, 1.0vmin, 10px);
}

.route{
  font-size: var(--route);
  font-weight: 950;
  color: rgba(255,255,255,.92);
  line-height: 1.04;

  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}
.route2{ color: rgba(255,255,255,.88); }

/* ✅ Kiosk portrait: keep airport codes on ONE line */
@media (orientation: portrait){
  body.kiosk .route{
    white-space: nowrap;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: clip;
  }
}

/* Callsign + model */
.sub{
  font-size: var(--sub);
  font-weight: 950;
  color: rgba(255,255,255,.90);
  display:flex;
  flex-wrap: wrap;
  align-items:baseline;
  gap: 14px;
  line-height: 1.10;
}

@media (orientation: portrait){
  .sub{ justify-content: center; }
}

/* iPhone portrait kiosk: split callsign and aircraft onto two lines (kiosk-only) */
@media (max-width: 430px) and (orientation: portrait){
  body.kiosk .sub{
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
  }
  body.kiosk .sub .sep{ display:none; }
  body.kiosk .sub .callsign,
  body.kiosk .sub .model{
    display:block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    max-width: 100%;
  }
  body.kiosk .sub .model{
    font-size: 0.86em; /* shrink aircraft line only in this mode */
    letter-spacing: .4px;
  }
}


/* iPad portrait kiosk: split callsign/aircraft and allow aircraft to wrap to two rows */
@media (orientation: portrait) and (min-width: 431px) and (max-width: 1024px){
  body.kiosk .sub{
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
  }
  body.kiosk .sub .sep{ display:none; }
  body.kiosk .sub .callsign{
    display:block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    max-width: 100%;
  }
  body.kiosk .sub .model{
    display:block;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.06;
    max-height: calc(2 * 1.06em); /* two rows max */
    font-size: 0.92em; /* slight shrink for balance */
    letter-spacing: .3px;
  }
}


.callsign{ color: rgba(255,255,255,.98); }
.model{ color: rgba(255,255,255,.90); }
.sep{ color: rgba(255,255,255,.50); }

.tiny{
  font-size: var(--tiny);
  font-weight: 850;
  color: rgba(255,255,255,.62);
  letter-spacing: .9px;
  display:flex;
  gap: 12px;
  align-items:baseline;
}
.tinyLabel{ color: rgba(255,255,255,.52); text-transform: uppercase; }
.tinyValue{ color: rgba(255,255,255,.78); }

/* Bottom stats */
.bottomPane{
  padding: clamp(12px, 2.0vmin, 18px);
  display:flex;
  flex-direction:column;
  gap: clamp(10px, 1.6vmin, 14px);

  border-top: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.18));
}

.statsRow{
  display:grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  column-gap: clamp(22px, 4.6vmin, 40px);
  row-gap: clamp(10px, 1.6vmin, 14px);
  min-height: 0;

  /* ✅ Inner gutter so right column never clips */
  padding-inline: clamp(8px, 1.6vmin, 14px);
}

@media (orientation: portrait){
  .statsRow{
    column-gap: clamp(26px, 6.2vmin, 56px);
    row-gap: clamp(12px, 2.2vmin, 18px);
    padding-inline: clamp(12px, 3.0vmin, 20px);
  }
}

/* ✅ iPhone portrait: stack stats */
@media (orientation: portrait) and (max-width: 430px){
  .bottomPane{
    padding: clamp(10px, 1.6vmin, 14px);
    gap: clamp(8px, 1.2vmin, 10px);
  }

  .statsRow{
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: clamp(10px, 2.0vmin, 16px);
    padding-inline: clamp(8px, 2.4vmin, 16px);
    justify-items: center; /* ✅ center each stat row */
  }
}

.stat{
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;

  padding: clamp(6px, 1.0vmin, 10px) 0;

  display:flex;
  flex-direction:column;
  justify-content:center;
  gap: clamp(2px, 0.5vmin, 6px);

  min-width: 0;
}

.stat .k{ display:none; }

.stat .v{
  font-size: var(--statV);
  font-weight: 950;
  color: rgba(255,255,255,.95);
  line-height: .96;

  letter-spacing: .12px;

  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;

  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";

  text-shadow:
    0 0 10px rgba(255,255,255,.14),
    0 0 26px rgba(255,255,255,.08);
}

/* Portrait: right column aligns right (prevents unit clipping) */
@media (orientation: portrait){
  .stat .v{
    letter-spacing: .08px;
    line-height: .94;
  }
  .statsRow .stat:nth-child(2),
  .statsRow .stat:nth-child(4){
    align-items: flex-end;
  }
  .statsRow .stat:nth-child(2) .v,
  .statsRow .stat:nth-child(4) .v{
    text-align: right;
  }
}

/* ✅ CHANGE: When stacked (iPhone portrait), center the stat values */
@media (orientation: portrait) and (max-width: 430px){
  .stat{
    align-items: center;
    text-align: center;
  }
  .stat .v{
    width: auto;
    text-align: center;
  }

  /* override the nth-child right-align rules */
  .statsRow .stat:nth-child(2),
  .statsRow .stat:nth-child(4){
    align-items: center;
  }
  .statsRow .stat:nth-child(2) .v,
  .statsRow .stat:nth-child(4) .v{
    text-align: center;
  }
}

/* Landscape: center stats */
@media (orientation: landscape){
  .stat{ align-items: center; }
  .stat .v{ text-align: center; }
}

.statusLine{
  margin-top: auto;
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content:center;
  align-items:center;

  font-size: clamp(14px, 2.0vmin, 20px);
  font-weight: 900;
  letter-spacing: .7px;
  color: rgba(255,255,255,.70);

  padding-top: clamp(8px, 1.4vmin, 12px);
  border-top: 0;
}

.dot{ color: rgba(255,255,255,.45); }

.errBox{
  position:fixed;
  left: calc(var(--safeLeft) + var(--pad));
  right: calc(var(--safeRight) + var(--pad));
  bottom: calc(var(--safeBottom) + var(--pad));
  background: rgba(60,16,26,.95);
  border: 1px solid rgba(255,138,160,.35);
  color: rgba(255,215,222,.98);
  padding: 14px 16px;
  border-radius: 16px;
  font-size: clamp(14px, 2.0vmin, 18px);
  font-weight: 800;
  z-index: 999;
}

.compatHidden{
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
/* =============================
   v1.3.2 KIOSK PATCH (iPhone Portrait)
   Fix: prevent logo overlap when aircraft model runs long
   Change: show code-only route on ONE line in compact portrait
   Scope: kiosk mode only
   ============================= */

@media (orientation: portrait) and (max-width: 430px){
  /* Slightly smaller logo plate to buy vertical room */
  body.kiosk .logo{
    width: clamp(84px, 12.8vmin, 132px);
    height: clamp(84px, 12.8vmin, 132px);
    padding: clamp(8px, 1.2vmin, 12px);
    border-radius: 18px;
  }

  /* Route: collapse to single line in this compact mode
     (kiosk.html will already feed routeLine2="" for code-only routes) */
  body.kiosk .routeBlock{ gap: 0; }
  body.kiosk #routeLine2{ display:none; }
  body.kiosk #routeLine1{ white-space: nowrap; }

  /* Aircraft line: keep single row, shrink model, and allow safe clipping */
  body.kiosk .sub{
    flex-wrap: nowrap;
    gap: 10px;
    max-width: 100%;
    overflow: hidden;
  }
  body.kiosk .sub .callsign,
  body.kiosk .sub .sep{ flex: 0 0 auto; }

  body.kiosk .sub .model{
    flex: 1 1 auto;
    min-width: 0;
    font-size: calc(var(--sub) * 0.86);
    letter-spacing: .06px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip; /* (no ellipsis in kiosk) */
  }
}