/* GEOINT intercept — fixed in the map margin. Visible whenever the plate is on. */

.geo-chat {
  --kb: 0px;
  position: fixed;
  left: max(1.25rem, env(safe-area-inset-left, 0px));
  bottom: calc(max(2.6rem, env(safe-area-inset-bottom, 0px) + 2.2rem) + var(--kb));
  z-index: 80;
  width: min(22rem, 36vw);
  max-width: calc(100vw - 2.4rem);
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

/* Hidden only while the intro curtain is up, or we've left the home plate */
.home.is-intro-boot ~ .geo-chat,
#app[data-phase="content"] .geo-chat {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.geo-chat__plate {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: max-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.home.is-nav ~ .geo-chat .geo-chat__plate,
#app:has(.home.is-nav) .geo-chat__plate {
  padding: 0.55rem 0.7rem 0.62rem;
  background: rgba(5, 14, 11, 0.42);
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  box-shadow: 0 0 0 1px rgba(143, 212, 168, 0.12);
}

.geo-chat__log {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: min(28vh, 13.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.geo-chat__log::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.geo-chat__line,
.geo-chat__compose {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  column-gap: 0.55rem;
  align-items: start;
  width: max-content;
  max-width: min(21rem, 100%);
}

.geo-chat__code {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8fd4a8;
  padding-top: 0.2em;
  text-shadow:
    0 0 14px rgba(143, 212, 168, 0.5),
    0 1px 8px rgba(0, 0, 0, 1);
  user-select: none;
}

.geo-chat__line--user .geo-chat__code {
  color: rgba(200, 230, 215, 0.7);
}

.geo-chat__text,
.geo-chat__name,
.geo-chat__input {
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(0.84rem, 1.6vw, 1.02rem);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #e8fff2;
  text-shadow:
    0 0 16px rgba(143, 212, 168, 0.45),
    0 1px 2px #000,
    0 2px 12px rgba(0, 0, 0, 0.95);
  line-height: 1.28;
}

.geo-chat__text {
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0.045em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.geo-chat__field {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 12rem;
  max-width: 17rem;
}

.geo-chat__name {
  display: block;
  width: max-content;
}

.geo-chat__type {
  display: flex;
  align-items: flex-end;
  gap: 0.15rem;
  width: 100%;
}

.geo-chat__input {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0 0 0.14rem;
  border: 0;
  border-bottom: 1px solid rgba(143, 212, 168, 0.55);
  outline: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  caret-color: #8fd4a8;
  color: #e8fff2;
}

.geo-chat__input::placeholder {
  color: rgba(210, 242, 220, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.geo-chat__caret {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: #8fd4a8;
  box-shadow: 0 0 10px rgba(143, 212, 168, 0.75);
  animation: geo-chat-blink 0.7s steps(1, end) infinite;
}

.geo-chat.is-focus .geo-chat__caret,
.geo-chat.is-busy .geo-chat__caret {
  display: none;
}

@keyframes geo-chat-blink {
  50% {
    opacity: 0;
  }
}

.geo-chat__input:focus {
  outline: none;
}

@media (max-width: 900px) {
  .geo-chat {
    width: min(22rem, 58vw);
  }
}

@media (max-width: 720px) {
  .geo-chat {
    width: calc(100vw - 1.7rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    max-width: none;
  }

  .geo-chat__field {
    min-width: 0;
    max-width: none;
  }

  .geo-chat__text,
  .geo-chat__name,
  .geo-chat__input {
    font-size: clamp(0.72rem, 3.4vw, 0.88rem);
  }
}
