/* =========================================================
   Onboard Mode — prototype styles
   Map colours follow paper-chart convention: buff land,
   blue shallows, pale deep water, magenta active route.
   ========================================================= */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;

  /* alert ramp, BAM-derived: caution / warning / alarm + technical */
  --caution: #E3A900;
  --warning: #E66A00;
  --alarm:   #D3242B;
  --tech:    #5B6B76;
  --ok:      #1E7A4C;
}

/* ---------- display modes ---------- */
.phone[data-theme="day"] {
  --bg: #EEF2F3;
  --surface: #FFFFFF;
  --surface-2: #F5F7F8;
  --ink: #0F2230;
  --ink-2: #546674;
  --ink-3: #8696A1;
  --line: rgba(15, 34, 48, .10);
  --water: #F3F8FA;
  --shallow: #CBE1EA;
  --land: #EADCAC;
  --land-edge: #BFAE74;
  --hatch: rgba(140, 120, 60, .18);
  --route: #C0187A;
  --corridor: rgba(192, 24, 122, .12);
  --own: #0F2230;
  --own-edge: #FFFFFF;
  --target: #7E8E98;
  --target-fill: #FFFFFF;
  --ring: rgba(15, 34, 48, .16);
  --label: #3D4F5C;
  --ok-ink: #1E7A4C;
  --ok-bg: #E2F1E8;
  --btn: rgba(255, 255, 255, .92);
  --shadow: 0 1px 2px rgba(15, 34, 48, .08), 0 4px 14px rgba(15, 34, 48, .08);
}

.phone[data-theme="dusk"] {
  --bg: #0D171E;
  --surface: #15232C;
  --surface-2: #1B2C37;
  --ink: #E3EBEF;
  --ink-2: #93A6B2;
  --ink-3: #657A87;
  --line: rgba(227, 235, 239, .09);
  --water: #0A141A;
  --shallow: #10293A;
  --land: #2A271C;
  --land-edge: #4A4430;
  --hatch: rgba(200, 180, 110, .07);
  --route: #E04B9F;
  --corridor: rgba(224, 75, 159, .14);
  --own: #F2F6F8;
  --own-edge: #0A141A;
  --target: #8095A2;
  --target-fill: #15232C;
  --ring: rgba(227, 235, 239, .14);
  --label: #93A6B2;
  --ok-ink: #6FD39E;
  --ok-bg: #12301F;
  --btn: rgba(21, 35, 44, .92);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .3);
}

/* Night: monochrome red to protect dark adaptation.
   Hierarchy is carried by brightness and shape only. */
.phone[data-theme="night"] {
  --bg: #000000;
  --surface: #0E0201;
  --surface-2: #140302;
  --ink: #C8301F;
  --ink-2: #8A2014;
  --ink-3: #5E160E;
  --line: rgba(200, 48, 31, .16);
  --water: #000000;
  --shallow: #0B0201;
  --land: #1A0503;
  --land-edge: #3B0C07;
  --hatch: rgba(200, 48, 31, .05);
  --route: #B32A1B;
  --corridor: rgba(179, 42, 27, .13);
  --own: #E2412C;
  --own-edge: #000000;
  --target: #6E1A10;
  --target-fill: #000000;
  --ring: rgba(200, 48, 31, .18);
  --label: #7A1C12;
  --ok-ink: #A82818;
  --ok-bg: #150302;
  --btn: rgba(14, 2, 1, .94);
  --shadow: none;
  --caution: #C8301F;
  --warning: #E0402A;
  --alarm:   #FF5A3C;
  --tech:    #7A1C12;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: #0F1C24;
  color: #E3EBEF;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid #4DA3FF; outline-offset: 2px; }

/* ---------- stage (desktop presentation) ---------- */
.stage {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  padding: 24px;
}
.device {
  flex: none;
  width: 393px;
  height: 852px;
  transform-origin: center center;
}
.phone {
  position: relative;
  width: 393px;
  height: 852px;
  border-radius: 56px;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 11px #1A2A33, 0 0 0 12px #2C3E49, 0 40px 80px rgba(0, 0, 0, .45);
  transition: background-color .8s ease, color .8s ease;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- iOS chrome ---------- */
.ios-bar {
  flex: none;
  height: 54px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 30px 0 32px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.2px;
}
.ios-time { font-variant-numeric: tabular-nums; }
.island {
  position: absolute;
  left: 50%;
  top: 11px;
  width: 124px;
  height: 36px;
  margin-left: -62px;
  border-radius: 20px;
  background: #000;
}
.ios-icons { display: flex; gap: 6px; align-items: center; }
.ios-icons svg { height: 12px; fill: currentColor; }
.ios-icons svg:first-child { width: 18px; }
.ios-icons svg:last-child { width: 27px; height: 13px; }
.ios-back {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #2F80ED;
}
.ios-back svg { width: 8px; height: 12px; }
.phone[data-theme="night"] .ios-back { color: var(--ink); }
.home-ind {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 134px;
  height: 5px;
  margin-left: -67px;
  border-radius: 3px;
  background: var(--ink);
  opacity: .8;
  pointer-events: none;
  z-index: 5;
}

/* ---------- status slot ---------- */
.status {
  flex: none;
  margin: 2px 12px 8px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: background-color .8s ease;
  position: relative;
  z-index: 3;
}
.status-calm {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 62px;
}
.status-mark {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ok-ink);
  background: var(--ok-bg);
}
.status-mark svg { width: 20px; height: 20px; }
.status-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.status-text strong { font-size: 19px; font-weight: 600; letter-spacing: -.3px; line-height: 1.15; }
.status-text span { font-size: 14px; color: var(--ink-2); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-aside { flex: none; font-size: 13px; color: var(--ink-3); text-align: right; max-width: 82px; line-height: 1.25; }

/* ---------- map ---------- */
.map-wrap {
  flex: 1;
  position: relative;
  margin: 0 12px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--water);
  touch-action: none;
  cursor: grab;
}
.map-wrap.dragging { cursor: grabbing; }
.map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map .water { fill: var(--water); transition: fill .8s ease; }
.map .hatch { stroke: var(--hatch); stroke-width: 1; }
.map .land { fill: var(--land); stroke: var(--land-edge); stroke-width: 1; vector-effect: non-scaling-stroke; transition: fill .8s ease; }
.map .land-tex { fill: url(#landHatch); }
.map .shallow { fill: none; stroke: var(--shallow); stroke-linejoin: round; transition: stroke .8s ease; }
.map .corridor { fill: none; stroke: var(--corridor); stroke-linecap: round; stroke-linejoin: round; }
.map .route-past { fill: none; stroke: var(--route); stroke-width: 2; opacity: .35; vector-effect: non-scaling-stroke; }
.map .route-ahead { fill: none; stroke: var(--route); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map .wp { fill: var(--water); stroke: var(--route); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.map .wp.done { opacity: .35; }
.map .dest { fill: var(--route); }
.map .place { fill: var(--label); font-size: 12px; font-weight: 500; letter-spacing: .2px; }
.map .place.big { font-size: 14px; font-weight: 600; }
.map .ring { fill: none; stroke: var(--ring); stroke-width: 1; stroke-dasharray: 2 4; }
.map .ring-l { fill: var(--ink-3); font-size: 11px; }
.map .target { fill: var(--target-fill); stroke: var(--target); stroke-width: 1.6; stroke-linejoin: round; }
.map .target-vec { stroke: var(--target); stroke-width: 1.4; stroke-dasharray: 3 3; }
.map .target-name { fill: var(--ink-3); font-size: 11px; }
.map .own { fill: var(--own); stroke: var(--own-edge); stroke-width: 2; stroke-linejoin: round; }
.map .own-vec { stroke: var(--own); stroke-width: 2; stroke-linecap: round; }
.map .own-halo { fill: var(--own); opacity: .08; }

.map-scale {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-2);
  pointer-events: none;
}
.map-scale span { display: block; height: 6px; border: 1.5px solid var(--ink-2); border-top: 0; }
.map-scale em { font-style: normal; }

.map-ctrls {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2;
}
.mbtn {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--btn);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  color: var(--ink);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background-color .8s ease, transform .12s ease;
}
.mbtn:active { transform: scale(.94); }
.mbtn svg { width: 22px; height: 22px; }
.mbtn .n { fill: var(--route); }
.mbtn .s { fill: var(--ink-3); }
.mbtn-label {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-3);
}
#btnRecenter { color: #2F80ED; }
#btnRecenter.following { color: var(--ink-3); }
.phone[data-theme="night"] #btnRecenter { color: var(--ink); }
.phone[data-theme="night"] #btnRecenter.following { color: var(--ink-3); }

/* ---------- instrument tiles ---------- */
.tiles {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 12px 30px;
}
.tile {
  height: 92px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: background-color .8s ease, transform .15s ease;
}
.tile:active { transform: scale(.97); }
.tile-v {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tile-l { font-size: 13px; color: var(--ink-2); }

.tile { touch-action: manipulation; -webkit-touch-callout: none; position: relative; overflow: hidden; }
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ink);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
.tile.pressing::after { opacity: .07; transform: scaleX(1); transition: transform .5s linear, opacity .1s; }
.tile.editing { box-shadow: 0 0 0 2.5px var(--route), var(--shadow); }

/* ---------- tile picker sheet ---------- */
.tile-sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  background: rgba(5, 12, 16, .35);
}
.phone[data-theme="night"] .tile-sheet { background: rgba(0, 0, 0, .6); }
.tile-sheet[hidden] { display: none; }
.tile-sheet-inner {
  width: 100%;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 8px 16px 34px;
  animation: sheetUp .22s ease-out;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--ink-3); opacity: .5; margin: 0 auto 8px; }
.ts-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 10px; }
.ts-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.ts-link { font-size: 16px; color: var(--ink-2); justify-self: start; padding: 8px 4px; }
.ts-done { justify-self: end; font-weight: 600; color: var(--route); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  min-height: 74px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  gap: 4px;
}
.opt:active { transform: scale(.98); }
.opt.current { border-color: var(--route); }
.opt-text strong { display: block; font-size: 15px; font-weight: 600; }
.opt-text em { display: block; font-style: normal; font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.opt.used .opt-text em { color: var(--ink-3); }
.opt-val { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.opt-val small { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-left: 3px; letter-spacing: 0; }
.phone[data-theme="night"] .opt-val { color: var(--ink); }

/* =========================================================
   STEP 2 — alerts
   ========================================================= */
.phone { --lv: var(--ok-ink); }
.phone .lv-caution, .status[data-level="caution"] { --lv: var(--caution); }
.phone .lv-warning, .status[data-level="warning"] { --lv: var(--warning); }
.phone .lv-alarm,   .status[data-level="alarm"]   { --lv: var(--alarm); }

/* compact row states */
.status-calm { cursor: default; }
.status-calm[hidden] { display: none; }
.status-aside:has(.chip) { max-width: none; }
.status[data-state="alert"] .status-calm { cursor: pointer; }
.status-mark svg { width: 20px; height: 20px; }
.status[data-state="alert"] .status-mark { width: 38px; height: 38px; background: none; color: var(--lv); }
.status[data-state="alert"] .status-mark svg { width: 38px; height: 38px; }
.status[data-state="alert"] { box-shadow: 0 0 0 2px var(--lv), var(--shadow); }
.status[data-state="alert"] .status-text strong { font-size: 17px; }
.status[data-state="tech"] .status-mark,
.status[data-state="reconnected"] .status-mark { color: var(--ink-2); background: var(--surface-2); }
.status[data-state="tech"] { box-shadow: 0 0 0 1.5px var(--ink-3), var(--shadow); }
.status[data-state="tech"] .status-text strong { color: var(--ink); }
.status[data-state="off"] .status-mark { color: var(--caution); background: transparent; }
.status-aside .chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; white-space: nowrap;
}
.status-aside .chip svg { width: 14px; height: 14px; }

/* bearing dial */
.dial { display: block; overflow: visible; }
.dial-ring { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.dial-tick { stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.dial-own { fill: var(--ink); }
.dial-ray { stroke: var(--lv); stroke-width: 2; stroke-dasharray: 2 3; opacity: .7; }
.dial-dot { fill: var(--lv); stroke: var(--surface); stroke-width: 2; }
.dial-dot.hollow { fill: var(--surface); stroke: var(--lv); stroke-width: 2.5; stroke-dasharray: 3 2; }
.status-mark .dial-ring { fill: none; }

/* expanded alert card */
.status[data-mode="card"] { background: var(--surface); box-shadow: 0 0 0 2.5px var(--lv), var(--shadow); }
.alert-card { padding: 14px 16px 14px; }
.alert-card[hidden] { display: none; }
.ac-top { display: flex; gap: 14px; align-items: center; }
.ac-dial { flex: none; }
.ac-main { min-width: 0; }
.ac-kicker { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--lv); }
.ac-dir { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; }
.ac-line { margin: 4px 0 0; font-size: 15px; color: var(--ink-2); line-height: 1.3; }
.ac-line b { color: var(--ink); font-weight: 600; }
.ac-bar { margin: 12px 0 0; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.ac-bar span { display: block; height: 100%; background: var(--lv); border-radius: 4px; transform-origin: left; transition: transform .6s ease; }
.ac-stale {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 10px 0 0; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); font-size: 13px; line-height: 1.35; color: var(--ink-2);
}
.ac-stale[hidden] { display: none; }
.ac-stale svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.ac-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.ac-btn {
  height: 48px; border-radius: 14px; font-size: 16px; font-weight: 600;
  background: var(--surface-2); color: var(--ink);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 10px;
}
.ac-btn:active { transform: scale(.98); }
.ac-primary { background: var(--lv); color: #fff; }
.phone[data-theme="night"] .ac-primary { color: #000; }
.status[data-level="caution"] .ac-primary { color: #1b1300; }

/* alarm: the border breathes so it reads in peripheral vision */
.status[data-mode="card"][data-level="alarm"] { animation: alarmPulse 1.1s ease-in-out infinite; }
@keyframes alarmPulse {
  0%, 100% { box-shadow: 0 0 0 2.5px var(--lv), var(--shadow); }
  50% { box-shadow: 0 0 0 6px var(--lv), var(--shadow); }
}
.phone[data-alert="alarm"] .map-wrap { box-shadow: inset 0 0 0 3px var(--alarm); }

/* map: alert target and graphic CPA */
.map .target.alert { fill: var(--lv); stroke: var(--surface); stroke-width: 2; }
.map .target.alert.ghost { fill: var(--surface); stroke: var(--lv); stroke-width: 2.2; stroke-dasharray: 3 2.5; }
.map .target.ghost { fill: none; stroke-dasharray: 2.5 2.5; }
.map .target.est { fill: none; stroke: var(--target); stroke-width: 1.4; stroke-dasharray: 2 3; opacity: .8; }
.map .target.est.lv-caution, .map .target.est.lv-warning, .map .target.est.lv-alarm { stroke: var(--lv); stroke-width: 2; }
.map .target-vec.lv-caution, .map .target-vec.lv-warning, .map .target-vec.lv-alarm { stroke: var(--lv); stroke-width: 2; }
.map .target-name.strong { fill: var(--ink); font-weight: 600; font-size: 12px; }
.map .halo { fill: var(--lv); opacity: .16; }
.map .cpa-track { stroke: var(--lv); stroke-width: 2; stroke-dasharray: 5 4; opacity: .8; }
.map .cpa-link { stroke: var(--lv); stroke-width: 1.5; opacity: .7; }
.map .cpa-own { fill: none; stroke: var(--own); stroke-width: 2; stroke-dasharray: 3 2; }
.map .cpa-pt { fill: var(--lv); stroke: var(--surface); stroke-width: 2; }
.map .cone { fill: var(--target); opacity: .12; }
.map .cone.lv-caution, .map .cone.lv-warning, .map .cone.lv-alarm { fill: var(--lv); opacity: .18; }
.map .dr-line { stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 2 3; }
.map .edge-bg { fill: var(--lv); }
.map .edge-arrow { fill: #fff; }
.phone[data-theme="night"] .map .edge-arrow { fill: #000; }

/* offline: signal bars dim */
.phone.offline .ios-icons .sig3, .phone.offline .ios-icons .sig4 { opacity: .25; }

/* vessel sheet */
.vs { padding-bottom: 30px; }
.vs-head { display: flex; justify-content: space-between; align-items: flex-start; margin: 4px 0 14px; }
.vs-head h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.vs-head p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.vs-close { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.vs-close svg { width: 18px; height: 18px; }
.vs-where { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-2); --lv: var(--warning); }
.vs-where .dial-ring { fill: var(--surface); }
.vs-where strong { display: block; font-size: 19px; font-weight: 600; }
.vs-where span { display: block; font-size: 14px; color: var(--ink-2); }
.vs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.vs-grid div { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.vs-grid span { display: block; font-size: 12px; color: var(--ink-2); }
.vs-grid strong { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vs-copy {
  width: 100%; height: 50px; border-radius: 14px; margin-top: 4px;
  background: var(--ink); color: var(--surface);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600;
}
.vs-copy svg { width: 18px; height: 18px; }
.vs-copy.done { background: var(--ok-ink); }
.vs-call { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }
.vs-age { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; display: flex; gap: 6px; justify-content: center; align-items: center; }
.vs-age svg { width: 14px; height: 14px; }
.vs-age.stale { color: var(--ink-2); }

/* =========================================================
   Lock screen + Live Activity
   The lock screen is always dark; the activity follows the
   app's night mode so it never flashes white at the helm.
   ========================================================= */
.lock {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 70px 12px 34px;
  color: #fff;
  background:
    radial-gradient(120% 70% at 50% 0%, #2F5A74 0%, rgba(47, 90, 116, 0) 60%),
    linear-gradient(180deg, #13324A 0%, #0A1B28 55%, #050D14 100%);
  animation: lockIn .25s ease-out;
  cursor: pointer;
}
.lock[hidden] { display: none; }
@keyframes lockIn { from { opacity: 0; } to { opacity: 1; } }
.phone[data-theme="night"] .lock { background: #000; }
.lock-clock { text-align: center; margin-bottom: auto; }
.lock-date { margin: 0; font-size: 19px; font-weight: 500; opacity: .85; }
.lock-time { margin: -6px 0 0; font-size: 92px; font-weight: 600; letter-spacing: -2px; line-height: 1; font-variant-numeric: tabular-nums; }
.phone[data-theme="night"] .lock-date,
.phone[data-theme="night"] .lock-time,
.phone[data-theme="night"] .lock-hint { color: #8A2014; }
.lock-hint { margin: 14px 0 0; font-size: 13px; opacity: .55; }

.la {
  --lv: #34C77B;
  width: 100%;
  border-radius: 26px;
  padding: 14px 16px 16px;
  background: rgba(16, 22, 28, .82);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #F2F6F8;
  cursor: default;
}
.la[data-level="caution"] { --lv: #F5BE1E; }
.la[data-level="warning"] { --lv: #FF8A1F; }
.la[data-level="alarm"]   { --lv: #FF4D52; box-shadow: 0 0 0 2.5px var(--lv); }
.la[data-level="tech"]    { --lv: #9AA9B3; }
.phone[data-theme="night"] .la { background: #0E0201; color: #C8301F; --lv: #A82818; }
.phone[data-theme="night"] .la[data-level="caution"] { --lv: #C8301F; }
.phone[data-theme="night"] .la[data-level="warning"] { --lv: #E0402A; }
.phone[data-theme="night"] .la[data-level="alarm"]   { --lv: #FF5A3C; }

.la-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.la-app { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; opacity: .7; }
.la-app svg { width: 14px; height: 14px; }
.la-state { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--lv); }
.la-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lv); }

.la-calm[hidden], .la-alert[hidden], .la-stale[hidden] { display: none; }
.la-nums { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.la-nums b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -.8px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.la-nums span { font-size: 12px; opacity: .65; }
.la-trip { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; opacity: .75; }
.la-track { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .15); position: relative; }
.la-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: currentColor; opacity: .9; }
.la-track i::after { content: ""; position: absolute; right: -5px; top: -3px; width: 11px; height: 11px; border-radius: 50%; background: #fff; }
.phone[data-theme="night"] .la-track { background: rgba(200, 48, 31, .2); }
.phone[data-theme="night"] .la-track i::after { background: #C8301F; }

.la-al-top { display: flex; gap: 12px; align-items: center; }
.la-al-text strong { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.3px; line-height: 1.15; }
.la-al-text span { display: block; margin-top: 2px; font-size: 14px; opacity: .75; }
.la .dial-ring { fill: rgba(255, 255, 255, .08); stroke: rgba(255, 255, 255, .18); }
.la .dial-own { fill: currentColor; }
.la .dial-dot { stroke: #10161C; }
.la .dial-dot.hollow { fill: #10161C; }
.la-bar { margin-top: 12px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.la-bar i { display: block; height: 100%; background: var(--lv); transform-origin: left; transition: transform .6s ease; }
.la-ack {
  width: 100%; height: 44px; margin-top: 12px; border-radius: 14px;
  background: var(--lv); color: #10161C; font-size: 16px; font-weight: 600;
}
.la-ack[hidden] { display: none; }
.la-stale { display: flex; gap: 6px; align-items: center; margin: 12px 0 0; font-size: 13px; opacity: .8; }
.la-stale svg { width: 15px; height: 15px; flex: none; }

/* demo panel extras */
.scn-group { margin: 10px 0 2px; font-size: 12px; color: #6F8694; }
.scn-group:first-child { margin-top: 0; }
.ctl-btn.off { background: #3A2A20; color: #F2C9A8; }

/* ---------- desktop demo panel ---------- */
.panel {
  flex: none;
  width: 330px;
  max-height: 100%;
  overflow: auto;
}
.ctl-head { margin-bottom: 28px; }
.ctl-kicker { margin: 0 0 6px; font-size: 13px; color: #7F95A3; }
.ctl h1 { margin: 0 0 10px; font-size: 30px; font-weight: 600; letter-spacing: -.6px; color: #F2F6F8; }
.ctl-lede { margin: 0; font-size: 15px; line-height: 1.5; color: #A9BAC5; }
.ctl-group { margin-bottom: 26px; }
.ctl h2 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: #7F95A3; }
.ctl-note { margin: -4px 0 10px; font-size: 13px; line-height: 1.45; color: #7F95A3; }
.ctl-row { display: flex; gap: 8px; align-items: center; }
.ctl-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  background: #1B2C37;
  color: #E3EBEF;
  font-size: 14px;
  font-weight: 500;
}
.ctl-btn:hover { background: #22384A; }
.seg { display: flex; background: #16252F; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #A9BAC5;
}
.seg button.on { background: #2B4252; color: #F2F6F8; }
.seg-wide { width: 100%; }
.seg-wide button { flex: 1; }
.scn-list { display: flex; flex-direction: column; gap: 6px; }
.scn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: #16252F;
  border: 1px solid transparent;
}
.scn:hover { background: #1B2C37; }
.scn.on { border-color: #4DA3FF; background: #17293A; }
.scn strong { display: block; font-size: 15px; font-weight: 600; color: #F2F6F8; }
.scn span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.4; color: #8DA2AF; }
.scn[disabled] { opacity: .45; cursor: default; }
.scn[disabled]:hover { background: #16252F; }
.ctl-foot { margin: 0; font-size: 12px; line-height: 1.5; color: #5E7482; }

/* ---------- mobile ---------- */
.demo-sheet {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(5, 12, 16, .55);
  display: flex;
  align-items: flex-end;
}
.demo-sheet[hidden] { display: none; }
.demo-sheet-inner {
  width: 100%;
  max-height: 88%;
  overflow: auto;
  background: #0F1C24;
  border-radius: 24px 24px 0 0;
  padding: 26px 20px 40px;
  color: #E3EBEF;
}

@media (max-width: 760px) {
  body { background: #000; }
  .stage { padding: 0; gap: 0; display: block; }
  .panel { display: none; }
  .device { width: 100vw; height: 100dvh; transform: none !important; }
  .phone {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .island { display: none; }
  .ios-time, .ios-icons { visibility: hidden; }
  .ios-bar { height: calc(env(safe-area-inset-top, 0px) + 40px); padding: env(safe-area-inset-top, 0px) 16px 0; }
  .ios-back { display: flex; }
  .tiles { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); }
  .home-ind { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
