.af-momo-launcher {
  position: fixed;
  z-index: 25;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 16px 6px 8px;
  color: #172034;
  background: #fff;
  border: 1px solid #d9e0ee;
  border-radius: 30px;
  box-shadow: 0 5px 24px #1e376924;
  font: 650 14px/1.3 system-ui, sans-serif;
  cursor: pointer;
}
.af-momo-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 2px;
  border-radius: 50%;
  background: #eef3ff;
}
.af-momo-avatar .momo-mascot { width: 100%; }
#af-momo {
  position: fixed;
  inset: auto max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) auto;
  margin: 0;
  width: min(400px, calc(100% - 32px));
  max-width: none;
  height: min(530px, calc(100dvh - 40px));
  max-height: none;
  padding: 0;
  border: 1px solid #d9e0ee;
  border-radius: 22px;
  background: #fff;
  color: #172034;
  box-shadow: 0 14px 54px #172a5340;
  font: 400 14px/1.55 system-ui, sans-serif;
}
#af-momo[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
#af-momo::backdrop { background: #0f203516; }
.af-momo-head { display: flex; align-items: center; gap: 11px; padding: 12px 15px; border-bottom: 1px solid #e7ebf3; }
.af-momo-head .af-momo-avatar { width: 44px; height: 44px; }
.af-momo-head h2 { margin: 0; color: #172034; font: 650 16px/1.4 system-ui, sans-serif; }
.af-momo-head p { margin: 0; color: #505f76; font-size: 12px; }
.af-momo-head button {
  margin-left: auto; flex: 0 0 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: #f0f3f9; color: #263750;
  font: 400 24px/1 system-ui, sans-serif; cursor: pointer;
}
.af-momo-thread { overflow-y: auto; overscroll-behavior: contain; padding: 15px; }
.af-momo-thread > p { margin: 0 0 10px; }
.af-momo-starters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.af-momo-starters button {
  padding: 6px 9px; min-height: 44px; border: 1px solid #dbe5fc; border-radius: 10px;
  color: #1e4898; background: #f4f7ff; font: inherit; font-size: 13px; cursor: pointer;
}
.af-momo-message { margin-bottom: 10px; max-width: 93%; padding: 9px 12px; border-radius: 12px; background: #f0f3f8; overflow-wrap: anywhere; }
.af-momo-message[data-speaker="user"] { margin-left: auto; background: #e8efff; }
.af-momo-message p { margin: 0; white-space: pre-wrap; }
.af-momo-sources { display: grid; gap: 3px; margin: 8px 0 0; }
#af-momo a { color: #1547a0; text-decoration: underline; text-underline-offset: 2px; }
.af-momo-form { padding: 11px 15px; border-top: 1px solid #e7ebf3; }
.af-momo-compose { display: flex; align-items: stretch; gap: 7px; }
.af-momo-compose input {
  min-width: 0; width: 100%; min-height: 44px; padding: 0 10px;
  border: 1px solid #b8c5da; border-radius: 10px; background: #fff; color: #172034; font: inherit; font-size: 16px;
}
.af-momo-compose button {
  flex: 0 0 auto; min-height: 44px; padding: 0 13px;
  border: 0; border-radius: 10px; background: #2556c5; color: #fff; font: 650 14px/1 system-ui, sans-serif; cursor: pointer;
}
.af-momo-compose button:disabled { opacity: .58; cursor: wait; }
.af-momo-privacy { margin: 7px 0 0; color: #505f76; font-size: 11px; }
.af-momo-launcher:focus-visible, #af-momo :focus-visible { outline: 2px solid #2556c5; outline-offset: 3px; }
@media (max-width: 500px) {
  .af-momo-launcher { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  #af-momo {
    inset: auto max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) auto;
    width: calc(100% - 20px);
    height: min(520px, calc(100dvh - 20px));
    border-radius: 18px;
  }
}

.af-momo-launcher[hidden], .af-momo-starters[hidden] { display: none; }
