/* Pocket AI assistant: compact, accessible chat using the site's type and color tokens. */
.assistant-widget {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 100;
  color: var(--paper);
  font-family: var(--display);
}

.assistant-launcher,
.assistant-close,
.assistant-prompt,
.assistant-send,
.assistant-clear {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.assistant-launcher {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 0 18px;
  border: 1px solid #ffffff;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .4);
  color: #111111;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: background-color .18s ease, border-color .18s ease;
}

.assistant-launcher svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
}

.assistant-launcher:hover {
  border-color: #e8e8e8;
  background: #e8e8e8;
}

.assistant-panel:not([open]) {
  display: none;
}

.assistant-panel[open] {
  position: fixed;
  inset-block: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-bottom, 0px));
  inset-inline: 12px;
  display: flex;
  width: min(460px, calc(100vw - 24px));
  height: min(740px, calc(100vh - 24px));
  max-height: calc(100vh - max(12px, env(safe-area-inset-top, 0px)) - max(12px, env(safe-area-inset-bottom, 0px)));
  flex-direction: column;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(240, 241, 239, .22);
  border-radius: 20px;
  background: #111316;
  box-shadow: 0 24px 100px rgba(0, 0, 0, .62);
  color: var(--paper);
  font-family: var(--display);
}

@supports (height: 100dvh) {
  .assistant-panel[open] {
    height: min(740px, calc(100dvh - 24px));
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px)) - max(12px, env(safe-area-inset-bottom, 0px)));
  }
}

.assistant-panel::backdrop {
  background: rgba(3, 4, 5, .74);
  backdrop-filter: blur(5px);
}

.assistant-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.assistant-panel-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.assistant-panel h2 {
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.2;
}

.assistant-close {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(240, 241, 239, .3);
  border-radius: 12px;
  background: transparent;
}

.assistant-close:hover {
  background: rgba(240, 241, 239, .08);
  border-color: rgba(240, 241, 239, .66);
}

.assistant-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.assistant-transcript {
  display: flex;
  min-height: 90px;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  margin: 0 20px;
  padding: 14px 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.assistant-message {
  max-width: 92%;
  margin: 0;
  padding: 13px 16px;
  border-radius: 16px;
  color: var(--paper);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.assistant-message--assistant {
  align-self: flex-start;
  background: rgba(240, 241, 239, .08);
}

.assistant-message--user {
  align-self: flex-end;
  background: rgba(240, 241, 239, .14);
}

.assistant-message--status {
  align-self: flex-start;
  background: transparent;
  color: var(--muted);
  font-style: italic;
}

.assistant-prompts {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 112px;
  overflow-y: auto;
  padding: 10px 20px 14px;
}

.assistant-prompts[hidden] {
  display: none;
}

.assistant-prompt {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid rgba(240, 241, 239, .24);
  border-radius: 12px;
  background: transparent;
  color: var(--paper);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.assistant-prompt:hover {
  background: rgba(240, 241, 239, .08);
  border-color: rgba(240, 241, 239, .55);
}

.assistant-form {
  flex: 0 0 auto;
  padding: 0 20px 14px;
}

.assistant-composer {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  border: 1px solid rgba(240, 241, 239, .3);
  border-radius: 999px;
  background: #0a0b0d;
}

.assistant-composer:focus-within {
  border-color: rgba(240, 241, 239, .82);
  box-shadow: 0 0 0 1px rgba(240, 241, 239, .3);
}

.assistant-form textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 132px;
  flex: 1 1 auto;
  padding: 12px 9px;
  border: 0;
  border-radius: 999px;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font: 16px/1.35 var(--display);
  resize: none;
  overflow-y: auto;
}

.assistant-form textarea::placeholder {
  color: var(--quiet);
}

.assistant-send {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--black);
  transition: opacity .18s ease, transform .18s ease;
}

.assistant-send:hover:not(:disabled) {
  transform: scale(1.04);
}

.assistant-send:disabled {
  cursor: wait;
  opacity: .55;
}

.assistant-send svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-panel-footer {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 20px max(14px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line-soft);
}

.assistant-clear {
  justify-self: end;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.assistant-clear:hover {
  color: var(--paper);
}

.assistant-launcher:focus-visible,
.assistant-panel :focus-visible:not(#assistant-question) {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.assistant-resize {
  display: none;
}

@media (min-width: 601px) {
  .assistant-panel.assistant-panel--placed[open] {
    inset: var(--assistant-top) auto auto var(--assistant-left);
    width: var(--assistant-width);
    height: var(--assistant-height);
    margin: 0;
  }

  .assistant-panel-header {
    cursor: grab;
    touch-action: none;
    user-select: none;
  }

  .assistant-panel-header:active {
    cursor: grabbing;
  }

  .assistant-resize {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: nwse-resize;
    touch-action: none;
  }

  .assistant-resize::after {
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    content: "";
  }

  .assistant-clear {
    margin-right: 18px;
  }
}

@media (max-width: 600px) {
  .assistant-widget {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .assistant-launcher {
    width: 54px;
    height: 54px;
    min-height: 54px;
    padding: 0;
    border-radius: 50%;
  }

  .assistant-launcher span {
    display: none;
  }

  .assistant-panel[open] {
    inset-inline: 10px;
    width: calc(100vw - 20px);
    height: min(700px, calc(100vh - 20px));
    max-height: calc(100vh - max(10px, env(safe-area-inset-top, 0px)) - max(10px, env(safe-area-inset-bottom, 0px)));
    border-radius: 18px;
  }

  .assistant-panel-header {
    gap: 10px;
    padding: 16px;
  }

  .assistant-transcript {
    margin-inline: 16px;
    padding-block: 12px;
  }

  .assistant-prompts {
    max-height: 152px;
    gap: 7px;
    padding: 8px 16px 12px;
  }

  .assistant-prompt {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 11px;
  }

  .assistant-form {
    padding: 0 16px 12px;
  }

  .assistant-panel-footer {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 10px 16px max(12px, env(safe-area-inset-bottom, 0px));
  }

  .assistant-clear {
    justify-self: start;
    text-align: left;
  }
}

@media (max-height: 560px) {
  .assistant-panel-header {
    padding-block: 12px;
  }

  .assistant-prompts {
    max-height: 72px;
    padding-block: 7px 10px;
  }

  .assistant-panel-footer {
    padding-block: 8px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-launcher,
  .assistant-send {
    transition: none;
  }
}

