#mj-chat-launcher,
#mj-chat-overlay,
#mj-chat-overlay * {
  box-sizing: border-box;
  font-family: var(--mj-body-font, "Poppins", system-ui, sans-serif);
}

#mj-chat-launcher {
  position: fixed;
  z-index: 40;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #041b10;
  background: #f5b921;
  box-shadow: 0 10px 28px rgba(4, 27, 16, 0.28);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

#mj-chat-launcher > span:first-child { font-size: 20px; }

#mj-chat-badge {
  position: absolute;
  top: -5px;
  right: -3px;
  display: grid;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #a83a32;
  font-size: 10px;
  line-height: 1;
}

#mj-chat-badge[hidden],
#mj-chat-overlay[hidden],
#mj-chat-new[hidden],
#mj-chat-form[hidden] { display: none !important; }

#mj-chat-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  padding: 16px;
  background: rgba(4, 27, 16, 0.62);
  backdrop-filter: blur(4px);
}

body.mj-chat-open { overflow: hidden; }

#mj-chat-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(440px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  outline: none;
  background: #f6f4ec;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
}

.mj-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  color: #fff;
  background: #072818;
}

.mj-chat-kicker {
  margin: 0 0 1px;
  color: #f5b921;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#mj-chat-title {
  margin: 0;
  font-family: var(--mj-scoreboard-font, "Bebas Neue", sans-serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.025em;
  line-height: 1.05;
  text-transform: uppercase;
}

#mj-chat-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font: 400 28px/1 system-ui, sans-serif;
  cursor: pointer;
}

#mj-chat-status {
  min-height: 0;
  padding: 0 18px;
  color: #8e2417;
  background: #f6f4ec;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

#mj-chat-status:not(:empty) { padding-block: 8px; }

#mj-chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 20px;
  scroll-behavior: smooth;
}

.mj-chat-message {
  position: relative;
  width: min(88%, 350px);
  margin: 0 auto 11px 0;
  padding: 10px 12px 9px;
  border: 1px solid #d9d2c3;
  border-radius: 7px 18px 18px 18px;
  background: #fff;
  box-shadow: 0 4px 13px rgba(7, 40, 24, 0.06);
}

.mj-chat-message--mine {
  margin-right: 0;
  margin-left: auto;
  border-color: #b9dcc8;
  border-radius: 18px 7px 18px 18px;
  background: #ddeee4;
}

.mj-chat-author {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 5px;
}

.mj-chat-team-mark {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: #186b3f;
  font-size: 13px;
}

.mj-chat-author strong {
  min-width: 0;
  overflow: hidden;
  color: #072818;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mj-chat-author time {
  margin-left: auto;
  color: #667168;
  font-size: 9px;
  white-space: nowrap;
}

.mj-chat-message > p {
  margin: 0;
  color: #17251d;
  font-size: 13px;
  line-height: 1.48;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.mj-chat-delete {
  display: block;
  margin: 5px 0 -3px auto;
  padding: 3px 0;
  border: 0;
  color: #8e2417;
  background: transparent;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.mj-chat-empty,
.mj-chat-login {
  display: flex;
  min-height: 100%;
  padding: 32px 25px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #667168;
  text-align: center;
}

.mj-chat-empty > span,
.mj-chat-login > span { margin-bottom: 9px; font-size: 36px; }
.mj-chat-empty strong,
.mj-chat-login strong { color: #072818; font-size: 15px; }
.mj-chat-empty p,
.mj-chat-login p { max-width: 300px; margin: 6px 0 0; font-size: 12px; line-height: 1.5; }

#mj-chat-new {
  position: absolute;
  right: 50%;
  bottom: 108px;
  transform: translateX(50%);
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #186b3f;
  box-shadow: 0 5px 18px rgba(7, 40, 24, 0.25);
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

#mj-chat-form {
  padding: 11px 12px calc(11px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #d9d2c3;
  background: #fff;
}

#mj-chat-form > label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.mj-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#mj-chat-input {
  width: 100%;
  min-height: 44px;
  max-height: 116px;
  resize: none;
  padding: 11px 13px;
  border: 1.5px solid #cfc8ba;
  border-radius: 14px;
  outline: none;
  color: #17251d;
  background: #faf7f0;
  font-size: 13px;
  line-height: 1.45;
}

#mj-chat-input:focus { border-color: #186b3f; box-shadow: 0 0 0 3px rgba(24, 107, 63, 0.12); }

#mj-chat-send {
  min-width: 72px;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  color: #041b10;
  background: #f5b921;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

#mj-chat-send:disabled { cursor: wait; opacity: 0.6; }

.mj-chat-form-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 4px 0;
  color: #667168;
  font-size: 9px;
}

@media (max-width: 560px) {
  #mj-chat-launcher {
    width: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
  }
  .mj-chat-launcher__label { display: none; }
  #mj-chat-overlay { padding: 0; }
  #mj-chat-panel { width: 100%; border: 0; border-radius: 0; }
  .mj-chat-header { padding-top: calc(15px + env(safe-area-inset-top, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  #mj-chat-messages { scroll-behavior: auto; }
}
