/* VayDyne Live — viewer app. Brand: Air blue #3264A6, Cream #FCFAF0, Slate #4E5B73, Outfit; numbers in Barlow.
   Colours follow VayDyne Ground (custom/qml/Operator/XTheme.qml): colour only when something is wrong —
   yellow = caution, red = danger, green = good. No orange anywhere. */

@font-face { font-family: "Outfit"; src: url("fonts/Outfit-Variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/Barlow-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/Barlow-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("fonts/Barlow-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --air: #3264A6; --cream: #FCFAF0; --slate: #4E5B73; --ink: #1C2533;
  --glass: rgba(14, 28, 48, .45); --glass-strong: rgba(14, 28, 48, .72); --glass-line: rgba(255, 255, 255, .12);
  --label-on-glass: #B7C6D4; --on-glass: #FCFAF0;
  --green: #97C459; --amber: #FFDB4D; --amber-ink: #2E2600; --red: #F09595; --red-fill: #E24B4A;
  --cyan: #2FD3E6;
  --hair: rgba(78, 91, 115, .22);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
/* What shows behind the browser's own bars (iPhone Chrome leaves a gap there): the screen's own colour, never white */
html { background: #0B1420; }
html.cream { background: var(--cream); }
body {
  font-family: "Outfit", system-ui, sans-serif; color: var(--ink); background: #0B1420;
  overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }

section { position: fixed; left: 0; right: 0; top: 0; height: 100%; height: 100dvh; display: none; }   /* dvh: the visible height, bars included or not */
body.scr-signin #signin, body.scr-waiting #waiting { display: flex; }
body.scr-live #live { display: flex; }

/* ---------- cream screens ---------- */
.cream-screen { background: var(--cream); flex-direction: column; }
#signin { align-items: center; justify-content: center; padding: calc(24px + var(--safe-t)) 28px calc(24px + var(--safe-b)); gap: 22px; }

.lockup { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lockup img { width: 64px; height: 64px; }
.lk-words { display: flex; flex-direction: column; align-items: center; }
.lk-name { font-weight: 500; font-size: 34px; letter-spacing: .01em; color: var(--air); line-height: 1.05; }
.lk-rule { width: 118px; height: 1px; background: var(--air); opacity: .55; margin: 5px 0; }
.lk-second { font-weight: 400; font-size: 13px; letter-spacing: .5em; padding-left: .5em; color: var(--slate); }

#signin-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
#signin-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--slate); letter-spacing: .02em; }
#signin-form input {
  font: 500 17px "Outfit", sans-serif; color: var(--ink); background: #fff; border: 1px solid var(--hair);
  border-radius: 3px; padding: 12px 12px; outline: none;
}
#signin-form input:focus { border-color: var(--air); box-shadow: 0 0 0 3px rgba(50, 100, 166, .15); }
.btn-primary { margin-top: 6px; background: var(--air); color: var(--cream); font-weight: 500; font-size: 17px; padding: 13px; border-radius: 3px; }
.btn-primary:active { filter: brightness(.92); }
.form-error { font-size: 14px; color: #A12C2B; background: rgba(226, 75, 74, .10); border-left: 3px solid var(--red-fill); padding: 8px 10px; }
.quiet { font-size: 13px; color: var(--slate); opacity: .8; margin: 0; text-align: center; }

.lang-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lang-row button { font-size: 15px; padding: 7px 12px; border-radius: 3px; color: var(--slate); border: 1px solid var(--hair); background: rgba(255,255,255,.6); }
.lang-row button.on { color: var(--cream); background: var(--slate); border-color: var(--slate); }

/* ---------- top bar ---------- */
.bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: calc(6px + var(--safe-t)) calc(10px + var(--safe-r)) 6px calc(10px + var(--safe-l)); min-height: 50px;
}
.bar-cream { background: rgba(252, 250, 240, .96); border-bottom: 1px solid var(--hair); color: var(--ink); }
.brand-chip { display: flex; align-items: center; gap: 6px; padding: 5px 9px 5px 7px; border-radius: 3px; background: rgba(78, 91, 115, .08); white-space: nowrap; }
.brand-chip img { width: 18px; height: 18px; }
.brand-chip b { font-weight: 500; font-size: 15px; color: var(--ink); }
.brand-chip span { font-weight: 400; font-size: 15px; color: var(--slate); }
.bar-block { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.bar-block small { font-size: 9px; letter-spacing: .14em; color: var(--slate); opacity: .85; }
.bar-block span { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-spacer { flex: 1; }
.live-pill { display: flex; align-items: center; gap: 6px; font: 600 12px "Barlow", sans-serif; letter-spacing: .12em; color: var(--ink); padding: 4px 8px; border: 1px solid var(--hair); border-radius: 3px; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(151, 196, 89, .25); }
.live-pill.caution i { background: #D9B200; box-shadow: 0 0 0 3px rgba(255, 219, 77, .35); }
.live-pill.danger i { background: var(--red-fill); box-shadow: 0 0 0 3px rgba(226, 75, 74, .25); }
.live-pill.idle i { background: #9AA5B4; box-shadow: none; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 3px; }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.menu-btn { color: var(--slate); }

/* ---------- live (portrait) ---------- */
#live { flex-direction: column; background: #0B1420; }
#stage { position: relative; flex: 0 0 auto; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
#vid, #poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#poster:not([src]), #poster[src=""] { display: none; }
#cross { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; transform: translate(-50%, -50%); pointer-events: none; }
#cross::before, #cross::after { content: ""; position: absolute; background: rgba(252, 250, 240, .85); box-shadow: 0 0 2px rgba(0,0,0,.6); }
#cross::before { left: 12px; top: 0; width: 2px; height: 26px; }
#cross::after { top: 12px; left: 0; height: 2px; width: 26px; }
.v-corner { position: absolute; display: flex; align-items: baseline; gap: 6px; padding: 4px 7px; border-radius: 2px; background: var(--glass); color: var(--on-glass); font: 600 12px "Barlow", sans-serif; letter-spacing: .12em; }
.v-corner span { font-weight: 500; letter-spacing: .02em; opacity: .9; }
.v-tl { left: 8px; top: 8px; }
.v-tr { right: 8px; top: 8px; align-items: center; }
.v-tr i { width: 8px; height: 8px; border-radius: 50%; background: var(--red-fill); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
#btn-full { position: absolute; right: 8px; bottom: 8px; }
.glass-btn { background: var(--glass); color: var(--on-glass); border: 1px solid var(--glass-line); }
.glass-btn.on { background: rgba(50, 100, 166, .9); }

#banner { position: absolute; left: 8px; right: 54px; bottom: 8px; display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: 2px; background: var(--glass-strong); color: var(--on-glass); border-left: 3px solid var(--amber); font-size: 13px; }
#banner b { font: 600 11px "Barlow", sans-serif; letter-spacing: .14em; color: var(--amber); }
#banner.danger { border-left-color: var(--red-fill); }
#banner.danger b { color: var(--red); }
#banner.idle { border-left-color: #9AA5B4; }
#banner.idle b { color: var(--label-on-glass); }

#readouts { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); background: #0E1C30; color: var(--on-glass); border-bottom: 1px solid var(--glass-line); }
.blk { display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 7px 9px 8px; min-width: 0; border-right: 1px solid var(--glass-line); border-top: 1px solid var(--glass-line); }
.blk:nth-child(4n) { border-right: 0; }
.blk:nth-child(-n+4) { border-top: 0; }
.blk small { font: 500 9.5px "Outfit", sans-serif; letter-spacing: .14em; color: var(--label-on-glass); white-space: nowrap; }
.blk span { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; overflow: hidden; }
.blk b { font: 600 22px "Barlow", sans-serif; font-variant-numeric: tabular-nums; letter-spacing: .01em; line-height: 1.1; }
.blk b.word { font: 500 16px "Outfit", sans-serif; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; }
.blk.longword span { white-space: normal; }
.blk.longword b.word { font-size: 13px; line-height: 1.15; white-space: normal; padding-top: 2px; }
.blk u { text-decoration: none; font: 500 12px "Barlow", sans-serif; color: var(--label-on-glass); }
.blk.caution { background: rgba(255, 219, 77, .16); } .blk.caution b { color: var(--amber); }
.blk.danger { background: rgba(226, 75, 74, .22); } .blk.danger b { color: var(--red); }
.blk.stale b { color: #8592A3; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; margin-right: 4px; align-self: center; }
.bars i { width: 3px; background: rgba(252, 250, 240, .25); border-radius: 1px; }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 8px; } .bars i:nth-child(3) { height: 11px; } .bars i:nth-child(4) { height: 14px; }
.bars[data-n="1"] i:nth-child(-n+1), .bars[data-n="2"] i:nth-child(-n+2), .bars[data-n="3"] i:nth-child(-n+3), .bars[data-n="4"] i:nth-child(-n+4) { background: var(--on-glass); }

#mapwrap { position: relative; flex: 1 1 auto; min-height: 120px; overflow: hidden; background: #1B2633; }
#map { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.map-btns { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; }
.spot { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 11px; background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 3px; color: var(--on-glass); }
.spot-what { font: 500 9.5px "Outfit", sans-serif; letter-spacing: .14em; color: var(--label-on-glass); writing-mode: horizontal-tb; }
.spot.look .spot-what { color: var(--cyan); }
.spot-ll { flex: 1 0 auto; display: flex; gap: 10px; font: 500 16px "Barlow", sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.spot-share { flex: 0 1 auto; min-width: 38px; overflow: hidden; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 3px; background: rgba(252, 250, 240, .12); font-size: 13px; color: var(--on-glass); }
.spot-share svg { flex: 0 0 16px; width: 16px; height: 16px; stroke: currentColor; }
.spot-share span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attrib { position: absolute; right: 4px; bottom: 2px; font-size: 9px; color: rgba(255,255,255,.55); pointer-events: none; display: none; }

/* map layers (map.js) */
.tm-tiles, .tm-over { position: absolute; left: 0; top: 0; }
.tm-tiles img { position: absolute; width: 256px; height: 256px; user-select: none; -webkit-user-drag: none; }
.tm-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.tm-mark { position: absolute; transform: translate(-50%, -50%); pointer-events: none; }
.mk-drone { width: 34px; height: 34px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.mk-drone svg { width: 100%; height: 100%; }
.mk-home { width: 26px; height: 26px; border-radius: 50%; background: var(--cream); display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.6); }
.mk-home svg { width: 16px; height: 16px; fill: var(--air); }
.mk-look { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--cyan); box-shadow: 0 0 0 1px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.45); pointer-events: auto; }
.mk-look::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: var(--cyan); }
.mk-stale { opacity: .45; filter: grayscale(1); }

/* ---------- menu sheet ---------- */
#sheet { position: fixed; inset: 0; background: rgba(11, 20, 32, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet-card { width: 100%; max-width: 480px; background: var(--cream); border-radius: 6px 6px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; }
.sheet-who { font-size: 14px; color: var(--slate); }
.sheet-label { font-size: 11px; letter-spacing: .14em; color: var(--slate); text-transform: uppercase; }
#sheet .lang-row { justify-content: flex-start; }
.btn-quiet { text-align: left; font-size: 16px; padding: 12px 2px; border-top: 1px solid var(--hair); color: var(--ink); }

/* ---------- waiting ---------- */
.wait-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 30px 60px; text-align: center; }
.wait-body h1 { font-weight: 500; font-size: 24px; color: var(--ink); margin: 14px 0 0; }
.wait-body p { margin: 0; font-size: 15px; color: var(--slate); max-width: 300px; line-height: 1.4; }
.wait-mark { width: 84px; height: 84px; display: grid; place-items: center; position: relative; }
.wait-mark img { width: 52px; height: 52px; opacity: .9; }
.wait-mark::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(50, 100, 166, .35); animation: ring 2.4s ease-out infinite; }
@keyframes ring { from { transform: scale(.7); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

/* ---------- landscape: picture fills the screen (like VayDyne Ground's view 2) ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  #live { display: block; }
  body.scr-live #live { display: block; }
  #live-bar { position: absolute; left: 0; right: 0; top: 0; z-index: 3; background: linear-gradient(rgba(8, 14, 24, .55), rgba(8, 14, 24, 0)); border: 0; color: var(--on-glass); min-height: 44px; }
  #live-bar .brand-chip { background: var(--glass); }
  #live-bar .brand-chip b { color: var(--on-glass); } #live-bar .brand-chip span { color: var(--label-on-glass); }
  #live-bar .brand-chip img { content: url("img/mark-cream.svg"); }
  #live-bar .bar-block small { color: var(--label-on-glass); }
  #live-bar .live-pill { color: var(--on-glass); border-color: var(--glass-line); background: var(--glass); }
  #live-bar .menu-btn { color: var(--on-glass); }
  #stage { position: absolute; inset: 0; aspect-ratio: auto; height: 100%; }
  .v-tl { top: 52px; left: calc(10px + var(--safe-l)); } .v-tr { top: 52px; right: calc(10px + var(--safe-r)); }
  #btn-full { display: none; }
  #readouts { position: absolute; right: calc(10px + var(--safe-r)); bottom: 10px; z-index: 2; grid-template-columns: repeat(4, auto); background: var(--glass); border: 1px solid var(--glass-line); border-radius: 3px; }
  #readouts .blk:nth-child(n+5) { display: none; }
  #readouts .blk { padding: 6px 12px 7px; border-top: 0; }
  #readouts .blk b { font-size: 20px; }
  #mapwrap { position: absolute; left: calc(10px + var(--safe-l)); bottom: 10px; width: 210px; height: 128px; z-index: 2; border-radius: 3px; border: 1px solid var(--glass-line); min-height: 0; }
  #mapwrap .map-btns, #mapwrap .spot { display: none; }
  #banner { left: 50%; right: auto; transform: translateX(-50%); bottom: 64px; max-width: 46%; }
  body.no-panels #readouts, body.no-panels #mapwrap, body.no-panels .v-corner { display: none; }
}
@media (orientation: landscape) and (max-height: 400px) { #bb-drone { display: none; } }

/* Larger screens (tablets, laptops): side-by-side */
@media (min-width: 900px) and (min-height: 561px) {
  body.scr-live #live { display: grid; grid-template-columns: 1fr 380px; grid-template-rows: auto auto 1fr; }
  #live-bar { grid-column: 1 / -1; }
  #stage { grid-column: 1; grid-row: 2 / 4; aspect-ratio: auto; height: 100%; }
  #readouts { grid-column: 2; grid-row: 2; }
  #mapwrap { grid-column: 2; grid-row: 3; }
}
