/* IMO Helper Stability R6
   Scope: desktop background outside .phone, chat bottom-stack geometry,
   room entry button, and in-phone action cards.
*/
:root{
  --imo-r6-safe-bottom:max(8px, env(safe-area-inset-bottom));
  --imo-r6-composer-h:54px;
  --imo-r6-nav-h:62px;
  --imo-r6-gap:8px;
}

/* Desktop browser: decorate the empty web canvas only. Never draw a foreground overlay. */
@media (min-width:720px) and (display-mode:browser){
  html,body{background:#07110d !important;}
  #app{
    background-image:
      linear-gradient(90deg,rgba(0,10,6,.76),rgba(1,19,10,.38) 42%,rgba(0,10,6,.76)),
      linear-gradient(180deg,rgba(0,8,5,.20),rgba(0,8,5,.64)),
      url('/static/images/imo/intro/first_page_background_original_v8817.png') !important;
    background-position:center center !important;
    background-size:cover !important;
    background-repeat:no-repeat !important;
  }
  #app::before,#app::after{content:none !important;display:none !important;}
  .phone{position:relative !important;z-index:2 !important;}
}

@media (max-width:719px), (display-mode:standalone){
  #app{
    background:radial-gradient(circle at 50% 50%,#f3f7fb 0,#e7eef7 64%) !important;
  }
}

/* A single bottom-stack coordinate system. */
html.imo-real-tour-0704q body[data-view="chat"]{
  --imo-r6-composer-bottom:var(--imo-r6-safe-bottom);
  --imo-r6-utility-bottom:calc(var(--imo-r6-safe-bottom) + var(--imo-r6-composer-h) + var(--imo-r6-gap));
  --imo-r6-content-bottom:calc(var(--imo-r6-safe-bottom) + var(--imo-r6-composer-h) + 50px);
}
html.imo-real-tour-0704q body[data-view="chat"].imo-bottom-open-0704q{
  --imo-r6-composer-bottom:calc(var(--imo-r6-safe-bottom) + var(--imo-r6-nav-h) + 4px);
  --imo-r6-utility-bottom:calc(var(--imo-r6-safe-bottom) + var(--imo-r6-nav-h) + var(--imo-r6-composer-h) + 12px);
  --imo-r6-content-bottom:calc(var(--imo-r6-safe-bottom) + var(--imo-r6-nav-h) + var(--imo-r6-composer-h) + 57px);
}

html.imo-real-tour-0704q body[data-view="chat"] #composer{
  position:absolute !important;
  left:12px !important;
  right:12px !important;
  bottom:var(--imo-r6-composer-bottom) !important;
  height:var(--imo-r6-composer-h) !important;
  min-height:var(--imo-r6-composer-h) !important;
  max-height:var(--imo-r6-composer-h) !important;
  padding:5px 7px !important;
  display:grid !important;
  grid-template-columns:42px minmax(0,1fr) 48px !important;
  align-items:center !important;
  gap:6px !important;
  border-radius:28px !important;
  z-index:140 !important;
  transform:none !important;
  overflow:visible !important;
}
html.imo-real-tour-0704q body[data-view="chat"] #composer .plus,
html.imo-real-tour-0704q body[data-view="chat"] #composer .send{
  position:relative !important;
  inset:auto !important;
  width:42px !important;
  min-width:42px !important;
  height:42px !important;
  min-height:42px !important;
  margin:0 !important;
  transform:none !important;
  z-index:2 !important;
}
html.imo-real-tour-0704q body[data-view="chat"] #composer .send{width:48px !important;min-width:48px !important;}
html.imo-real-tour-0704q body[data-view="chat"] #msg{
  position:relative !important;
  inset:auto !important;
  width:100% !important;
  min-width:0 !important;
  max-width:none !important;
  height:42px !important;
  min-height:42px !important;
  max-height:42px !important;
  margin:0 !important;
  padding:0 11px !important;
  line-height:42px !important;
  font-size:13px !important;
  transform:none !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
}

html.imo-real-tour-0704q body[data-view="chat"] #bottomNav{
  position:absolute !important;
  left:10px !important;
  right:10px !important;
  bottom:var(--imo-r6-safe-bottom) !important;
  height:var(--imo-r6-nav-h) !important;
  min-height:var(--imo-r6-nav-h) !important;
  z-index:108 !important;
  transform:none !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
}
html.imo-real-tour-0704q body[data-view="chat"]:not(.imo-bottom-open-0704q) #bottomNav{
  pointer-events:none !important;
}
html.imo-real-tour-0704q body[data-view="chat"].imo-bottom-open-0704q #bottomNav{
  pointer-events:auto !important;
}

html.imo-real-tour-0704q body[data-view="chat"] #rightRail{
  position:absolute !important;
  top:96px !important;
  right:10px !important;
  bottom:var(--imo-r6-content-bottom) !important;
  max-height:none !important;
  z-index:112 !important;
  transform:none !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  overscroll-behavior:contain !important;
}
html.imo-real-tour-0704q body[data-view="chat"] #imoRightNavToggle0704q{
  z-index:116 !important;
}
html.imo-real-tour-0704q body[data-view="chat"] #imoBottomNavToggle0704q{
  position:absolute !important;
  bottom:var(--imo-r6-utility-bottom) !important;
  z-index:118 !important;
}
html.imo-real-tour-0704q body[data-view="chat"] #mossyRoomFixedEntry{
  position:absolute !important;
  left:14px !important;
  right:auto !important;
  bottom:var(--imo-r6-utility-bottom) !important;
  width:auto !important;
  height:34px !important;
  min-height:34px !important;
  z-index:119 !important;
  display:flex !important;
  align-items:center !important;
  overflow:visible !important;
  background:transparent !important;
  border:0 !important;
  pointer-events:auto !important;
}
html.imo-real-tour-0704q body[data-view="chat"] #mossyRoomFixedEntry .mossy-room-chip{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:6px !important;
  width:auto !important;
  min-width:94px !important;
  height:34px !important;
  min-height:34px !important;
  margin:0 !important;
  padding:0 13px !important;
  border:1px solid rgba(118,255,45,.36) !important;
  border-radius:999px !important;
  background:rgba(3,31,13,.94) !important;
  color:rgba(247,255,244,.96) !important;
  box-shadow:0 9px 24px rgba(0,0,0,.24),inset 0 0 0 1px rgba(255,255,255,.025) !important;
  font-size:11.5px !important;
  font-weight:900 !important;
  line-height:1 !important;
  letter-spacing:-.02em !important;
  white-space:nowrap !important;
  opacity:1 !important;
  visibility:visible !important;
}
html.imo-real-tour-0704q body[data-view="chat"] #mossyRoomFixedEntry .mossy-room-chip::before{content:"🤝";font-size:13px;}
html.imo-real-tour-0704q body[data-view="chat"] #mossyRoomFixedEntry .mossy-room-chip:active{transform:translateY(1px) scale(.985) !important;}

html.imo-real-tour-0704q body[data-view="chat"] #feed{
  bottom:var(--imo-r6-content-bottom) !important;
  padding:4px 3px 12px 0 !important;
  scroll-padding-bottom:16px !important;
  overscroll-behavior:contain !important;
}
/* State-specific selectors deliberately match the legacy stylesheet specificity. */
html.imo-real-tour-0704q body[data-view="chat"].imo-bottom-open-0704q #composer{bottom:var(--imo-r6-composer-bottom) !important;}
html.imo-real-tour-0704q body[data-view="chat"].imo-bottom-open-0704q #mossyRoomFixedEntry,
html.imo-real-tour-0704q body[data-view="chat"].imo-bottom-open-0704q #imoBottomNavToggle0704q{bottom:var(--imo-r6-utility-bottom) !important;}
html.imo-real-tour-0704q body[data-view="chat"].imo-bottom-open-0704q #feed{bottom:var(--imo-r6-content-bottom) !important;}
html.imo-real-tour-0704q body[data-view="chat"].imo-input-focused-0704q #composer{bottom:var(--imo-r6-composer-bottom) !important;height:var(--imo-r6-composer-h) !important;min-height:var(--imo-r6-composer-h) !important;max-height:var(--imo-r6-composer-h) !important;}
html.imo-real-tour-0704q body[data-view="chat"].imo-input-focused-0704q #msg{height:42px !important;min-height:42px !important;max-height:42px !important;line-height:42px !important;}
html.imo-real-tour-0704q body[data-view="chat"].imo-input-focused-0704q #feed{bottom:var(--imo-r6-content-bottom) !important;}
html.imo-real-tour-0704q body[data-view="chat"].imo-right-open-0704q #feed{
  padding-right:94px !important;
}

/* Never let thinking/presence layers receive user input. */
.imo-presence-layer-0704q,
.imo-answer-curtain-0704q,
.imo-presence-layer-0704q *,
.imo-answer-curtain-0704q *{pointer-events:none !important;}

/* In-phone fullscreen result / image handoff card. */
.imo-r6-fullcard{
  position:absolute;
  inset:0;
  z-index:600;
  display:grid;
  place-items:center;
  padding:14px;
  background:rgba(0,9,5,.76);
  backdrop-filter:blur(9px);
  -webkit-backdrop-filter:blur(9px);
}
.imo-r6-fullcard[hidden]{display:none !important;}
.imo-r6-fullcard__panel{
  width:100%;
  max-height:calc(100% - 4px);
  overflow:auto;
  border:1px solid rgba(118,255,45,.45);
  border-radius:26px;
  background:linear-gradient(180deg,rgba(5,53,22,.985),rgba(1,20,8,.99));
  color:#f5fff1;
  box-shadow:0 28px 80px rgba(0,0,0,.5),inset 0 0 0 1px rgba(255,255,255,.035);
  padding:18px;
  scrollbar-width:none;
}
.imo-r6-fullcard__panel::-webkit-scrollbar{display:none;}
.imo-r6-fullcard__head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px;}
.imo-r6-fullcard__eyebrow{color:#8cff4b;font-size:10px;font-weight:1000;letter-spacing:.09em;text-transform:uppercase;}
.imo-r6-fullcard__title{margin:4px 0 0;font-size:19px;line-height:1.18;font-weight:1000;letter-spacing:-.045em;}
.imo-r6-fullcard__close{
  flex:0 0 auto;width:39px;height:39px;border-radius:999px;
  border:1px solid rgba(118,255,45,.42);background:#03190a;color:#8cff4b;
  font-size:24px;line-height:1;font-weight:900;
}
.imo-r6-driver-sentence{
  margin:0 0 13px;padding:19px 14px;border-radius:20px;
  background:#f5fff1;color:#06200d;text-align:center;
  font-size:23px;line-height:1.28;font-weight:1000;letter-spacing:-.04em;
}
.imo-r6-fullcard__name{margin:0 0 6px;font-size:18px;font-weight:1000;letter-spacing:-.035em;}
.imo-r6-fullcard__address{margin:0;color:rgba(245,255,241,.78);font-size:13px;line-height:1.55;font-weight:760;word-break:keep-all;overflow-wrap:anywhere;}
.imo-r6-fullcard__body{margin:12px 0 0;color:rgba(245,255,241,.76);font-size:12.5px;line-height:1.55;}
.imo-r6-fullcard__preview{width:100%;max-height:220px;object-fit:contain;border-radius:18px;background:#001006;border:1px solid rgba(118,255,45,.22);margin:0 0 13px;}
.imo-r6-fullcard__actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:16px;}
.imo-r6-fullcard__actions button{
  min-width:0;min-height:44px;border:1px solid rgba(118,255,45,.36);border-radius:15px;
  background:rgba(3,31,13,.98);color:#f5fff1;font-size:12.5px;font-weight:900;
  padding:9px 10px;line-height:1.2;
}
.imo-r6-fullcard__actions button.primary{background:#76ff2d;color:#041408;border-color:#76ff2d;}
.imo-r6-fullcard__actions button.wide{grid-column:1/-1;}

/* Consistent compact result cards. */
.imo-r6-card{margin:8px 0 11px;padding:13px;border:1px solid rgba(118,255,45,.24);border-radius:19px;background:rgba(3,42,18,.78);box-shadow:0 12px 30px rgba(0,0,0,.18);color:#f5fff1;}
.imo-r6-card h3{margin:0 0 5px;font-size:14px;line-height:1.25;font-weight:1000;letter-spacing:-.03em;}
.imo-r6-card p{margin:0;color:rgba(245,255,241,.72);font-size:11.5px;line-height:1.48;white-space:pre-wrap;word-break:keep-all;overflow-wrap:anywhere;}
.imo-r6-card__meta{margin-top:6px;color:rgba(245,255,241,.52);font-size:10.5px;line-height:1.4;}
.imo-r6-card__actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px;}
.imo-r6-card__actions button{min-height:32px;padding:7px 10px;border:1px solid rgba(118,255,45,.33);border-radius:999px;background:#041f0d;color:#f5fff1;font-size:10.5px;font-weight:900;}
.imo-r6-card__actions button.primary{background:#76ff2d;color:#031307;border-color:#76ff2d;}
.imo-r6-bubble{max-width:84%;margin:6px 0;padding:8px 11px;border:1px solid rgba(118,255,45,.18);border-radius:16px;background:rgba(4,48,20,.7);font-size:11.5px;line-height:1.48;color:#f5fff1;white-space:pre-wrap;overflow-wrap:anywhere;}
.imo-r6-bubble.user{margin-left:auto;background:rgba(37,112,48,.84);}
.imo-r6-bubble.pending{opacity:.65;}

@media (max-width:380px){
  html.imo-real-tour-0704q body[data-view="chat"] #composer{left:8px !important;right:8px !important;grid-template-columns:40px minmax(0,1fr) 46px !important;}
  html.imo-real-tour-0704q body[data-view="chat"] #mossyRoomFixedEntry .mossy-room-chip{min-width:86px !important;padding:0 10px !important;font-size:10.5px !important;}
  .imo-r6-driver-sentence{font-size:20px;}
}
