/* Render-time detail recovery for the low-resolution alternate portrait. */
.live-image-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.live-alternate-image {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #081020;
  transform: translateZ(0);
  transition: none;
}

.live-alternate-image::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  background-image: var(--live-male-image);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  filter: contrast(1.08) brightness(1.055) saturate(1.08);
  filter: url(#liveImageDetail) contrast(1.08) brightness(1.055) saturate(1.08);
  transform: scale(1.002);
  transform-origin: center;
  backface-visibility: hidden;
  will-change: transform, filter;
  transition: transform .7s cubic-bezier(.2,.7,.2,1), filter .32s ease;
}

.live-alternate-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(14,17,28,.96) 0%, rgba(14,17,28,.34) 24%, rgba(14,17,28,.04) 52%, transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,.025), transparent 22%, rgba(3,6,16,.12));
}

@media (hover:hover) and (pointer:fine) {
  .live-alternate:hover .live-alternate-image {
    transform: translateZ(0);
  }

  .live-alternate:hover .live-alternate-image::before {
    filter: contrast(1.1) brightness(1.07) saturate(1.1);
    filter: url(#liveImageDetail) contrast(1.1) brightness(1.07) saturate(1.1);
    transform: scale(1.018);
  }
}

@media (max-width:900px) {
  .live-alternate-image {
    background: #081020;
  }

  .live-alternate-image::before {
    background-position: 50% 44%;
  }

  .live-alternate-image::after {
    background:
      linear-gradient(0deg, #0e111c 0%, rgba(14,17,28,.3) 24%, transparent 56%),
      linear-gradient(180deg, rgba(3,6,16,.08), transparent 38%);
  }
}

@media (prefers-reduced-motion:reduce) {
  .live-alternate-image::before {
    transform: none;
  }
}

.live-product #dialogView .messages > .inline-service-card {
  position: static;
  inset: auto;
  z-index: auto;
  justify-self: start;
  width: min(680px, calc(100% - 51px));
  max-height: none;
  margin: 8px 0 6px 51px;
  overflow: visible;
  padding: 20px;
  border-color: rgba(177,135,255,.24);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(177,135,255,.11), rgba(242,217,148,.035)),
    rgba(24,20,39,.94);
  box-shadow: inset 0 1px rgba(255,255,255,.045);
}

.live-product #dialogView .inline-service-card h3 {
  margin: 5px 0 9px;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.15;
  letter-spacing: -.035em;
}

.live-product #dialogView .inline-service-card > p:not(.eyebrow) {
  margin: 0;
  color: #bbb3c7;
  font-size: 13px;
  line-height: 1.56;
}

.live-product #dialogView .inline-service-card > small {
  display: block;
  margin-top: 9px;
  color: #91899b;
  font-size: 11px;
  text-align: center;
}

.live-product #dialogView .inline-offer-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 16px;
}

.live-product #dialogView .inline-offer-actions button {
  min-height: 44px;
}

.live-product #dialogView .inline-offer-actions .primary {
  flex: 1 1 auto;
}

.live-product #dialogView .inline-offer-actions .ghost {
  flex: 0 0 auto;
  color: #c8c0d0;
}

.live-product #dialogView .jump-to-latest {
  position: absolute;
  left: 50%;
  bottom: 126px;
  z-index: 10;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid rgba(177,135,255,.28);
  border-radius: 999px;
  background: rgba(24,20,39,.96);
  color: #eee8f7;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  box-shadow: 0 14px 38px rgba(0,0,0,.34);
  cursor: pointer;
  transform: translateX(-50%);
}

/* Mobile app shell: one controlled scroll area, no overlapping floating layers. */
@media (max-width: 900px) {
  .live-alternate-image::before {
    filter: contrast(1.08) brightness(1.055) saturate(1.08);
  }

  html:has(body.live-product .workspace:not(.hidden)),
  body.live-product:has(.workspace:not(.hidden)) {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.live-product:has(.workspace:not(.hidden)) {
    touch-action: manipulation;
  }

  .live-product .workspace:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 72px 8px calc(80px + env(safe-area-inset-bottom));
    overflow: hidden;
    background:
      radial-gradient(circle at 85% 0, rgba(126, 91, 229, .12), transparent 24rem),
      #07070d;
  }

  .live-product .workspace:not(.hidden) .panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .live-product .workspace:not(.hidden):has(#createView:not(.hidden)),
  .live-product .workspace:not(.hidden):has(#buildingView:not(.hidden)) {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .live-product .workspace:not(.hidden):has(#createView:not(.hidden)) .side,
  .live-product .workspace:not(.hidden):has(#buildingView:not(.hidden)) .side {
    display: none !important;
  }

  .live-product #dialogView:not(.hidden) {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .live-product #dialogView:not(.hidden) .conversation {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(16, 14, 27, .96);
    box-shadow: 0 18px 55px rgba(0, 0, 0, .28);
  }

  .live-product #dialogView .conversation-head {
    position: relative;
    z-index: 4;
    flex: 0 0 auto;
    min-height: 0;
    padding: 12px 12px 10px;
    border-bottom-color: rgba(255,255,255,.07);
    background: rgba(16, 14, 27, .92);
  }

  .live-product #dialogView .conversation-head h2 {
    max-width: calc(100% - 110px);
    margin: 0;
    font-size: 20px;
    line-height: 1.15;
    letter-spacing: -.03em;
  }

  .live-product #dialogView .conversation-head .eyebrow {
    display: none;
  }

  .live-product #dialogView .allowance {
    display: inline-flex;
    width: fit-content;
    max-width: calc(100% - 84px);
    margin: 5px 0 0;
    padding: 4px 8px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .live-product #dialogView .conversation-head .ghost {
    top: 11px;
    right: 10px;
    min-width: 44px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 10px;
  }

  .live-product #dialogView .messages {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 14px 12px 12px;
    scroll-padding: 16px 0;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }

  .live-product #dialogView .message {
    gap: 8px;
  }

  .live-product #dialogView .mini-avatar {
    width: 28px;
    height: 28px;
    margin-top: 2px;
    font-size: 11px;
  }

  .live-product #dialogView .message > div,
  .live-product #dialogView .message.user > div {
    max-width: calc(100% - 38px);
  }

  .live-product #dialogView .message.clone > div {
    padding: 2px 0 12px;
  }

  .live-product #dialogView .message.clone p,
  .live-product #dialogView .message.user p {
    font-size: 14px;
    line-height: 1.52;
  }

  .live-product #dialogView .chips {
    position: static;
    inset: auto;
    z-index: 1;
    display: flex;
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    gap: 6px;
    margin: 0;
    padding: 7px 10px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background: linear-gradient(180deg, rgba(16,14,27,.18), rgba(16,14,27,.96) 38%);
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
  }

  .live-product #dialogView .chips::-webkit-scrollbar {
    display: none;
  }

  .live-product #dialogView .chips button {
    min-height: 34px;
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    font-size: 11px;
    scroll-snap-align: start;
  }

  .live-product #dialogView .composer {
    position: static;
    inset: auto;
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    width: auto;
    flex: 0 0 auto;
    gap: 6px;
    margin: 0 8px 8px;
    padding: 6px;
    border-radius: 17px;
    background: rgba(30, 26, 47, .94);
    box-shadow: 0 10px 30px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.045);
  }

  .live-product #dialogView .composer textarea {
    min-height: 48px;
    max-height: 120px;
    padding: 12px 10px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-size: 16px;
    line-height: 1.35;
    resize: none;
    field-sizing: content;
    box-shadow: none;
  }

  .live-product #dialogView .composer textarea:focus {
    border: 0;
    box-shadow: none;
  }

  .live-product #dialogView .composer .primary {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    align-self: end;
    padding: 0;
    border-radius: 14px;
    font-size: 0;
  }

  .live-product #dialogView .composer .primary::before {
    content: "↑";
    display: grid;
    height: 100%;
    place-items: center;
    font-size: 23px;
    font-weight: 760;
    line-height: 1;
  }

  .live-product #dialogView .composer-note,
  .live-product #dialogView #dialogError:empty {
    display: none;
  }

  .live-product #dialogView #dialogError:not(:empty) {
    position: static;
    margin: 0 12px 7px;
    font-size: 11px;
  }

  .live-product #dialogView .messages > .alignment-offer:not(.hidden) {
    position: static;
    inset: auto;
    z-index: auto;
    width: calc(100% - 39px);
    max-height: none;
    margin: 4px 0 4px 39px;
    overflow: visible;
    padding: 15px;
    border-radius: 17px;
  }

  .live-product #dialogView .inline-service-card h3 {
    font-size: 20px;
  }

  .live-product #dialogView .inline-offer-actions {
    display: grid;
  }

  .live-product #dialogView .inline-offer-actions .primary,
  .live-product #dialogView .inline-offer-actions .ghost {
    width: 100%;
  }

  .live-product #dialogView .jump-to-latest {
    bottom: 72px;
  }

  .live-product #dialogView .logic {
    display: none !important;
  }

  .live-product #dialogView .logic.profile-mode {
    display: block !important;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    margin: 0;
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 20px;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .live-product .workspace .side {
    position: fixed;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    z-index: 60;
    width: auto;
    height: 64px;
    padding: 6px;
    border-radius: 20px;
    background: rgba(18, 17, 25, .94);
    box-shadow: 0 18px 50px rgba(0,0,0,.4), inset 0 1px rgba(255,255,255,.045);
    backdrop-filter: blur(22px) saturate(130%);
    transition: transform .2s ease, opacity .2s ease;
  }

  .live-product .workspace .side nav {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .live-product .workspace .side nav button {
    min-width: 0;
    min-height: 50px;
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 11px;
  }

  body.live-product:has(#question:focus) .workspace:not(.hidden) {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body.live-product:has(#question:focus) .workspace .side {
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(100% + 18px));
  }

  body.live-product:has(#question:focus) #dialogView .chips {
    display: none;
  }
}

@media (max-width: 380px) {
  .live-product .workspace:not(.hidden) {
    padding-right: 5px;
    padding-left: 5px;
  }

  .live-product #dialogView .conversation-head h2 {
    font-size: 18px;
  }

  .live-product #dialogView .conversation-head .ghost {
    width: 40px;
    min-width: 40px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  .live-product #dialogView .conversation-head .ghost::before {
    content: "+";
    display: grid;
    height: 100%;
    place-items: center;
    font-size: 22px;
    line-height: 1;
  }

  .live-product #dialogView .messages {
    padding-right: 9px;
    padding-left: 9px;
  }

  .live-product #dialogView .message.clone p,
  .live-product #dialogView .message.user p {
    font-size: 13.5px;
  }
}
