.wevius-ai-chat {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 99999;
  width: min(1140px, calc(100vw - 48px));
  transform: translateX(-50%);
  font-family: inherit;
  pointer-events: none;
}

.wevius-ai-chat *,
.wevius-ai-chat *::before,
.wevius-ai-chat *::after {
  box-sizing: border-box;
}

.wevius-ai-chat a {
  color: #5d49d6;
  font-weight: 700;
}

.wevius-ai-chat__panel,
.wevius-ai-chat__toggle {
  pointer-events: auto;
}

.wevius-ai-chat__panel {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 28px;
  padding: 18px 20px 20px;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 32%),
    radial-gradient(circle at 52% 18%, rgba(218, 201, 246, 0.62), rgba(218, 201, 246, 0) 28%),
    radial-gradient(circle at 74% 68%, rgba(186, 160, 235, 0.30), rgba(186, 160, 235, 0) 24%),
    linear-gradient(90deg, rgba(239, 233, 250, 0.96), rgba(221, 208, 245, 0.92), rgba(205, 186, 240, 0.90));
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow:
    0 20px 60px rgba(109, 84, 170, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: visible;
}

.wevius-ai-chat__panel[hidden] {
  display: none !important;
}

.wevius-ai-chat__hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 190px;
}

.wevius-ai-chat__mascot {
  position: relative;
  flex: 0 0 170px;
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-top: -42px;
  margin-left: -10px;
  z-index: 2;
  pointer-events: none;
  transform: translateY(31px);
}


.wevius-ai-chat__mascot img {
  display: block;
  width: 220px;
  max-width: none;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(92, 68, 124, 0.14));
}

.wevius-ai-chat__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 148px;
  padding-left: 2px;
}

.wevius-ai-chat__close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  color: rgba(255, 255, 255, 0.95);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.wevius-ai-chat__close:hover {
  background: rgba(255, 255, 255, 0.38);
}

.wevius-ai-chat__messages {
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  width: auto;
  margin: 0;
  padding: 0 12px;
  z-index: 2;
  max-height: 138px;
  overflow-y: auto;
  overflow-x: hidden;
}

.wevius-ai-chat__messages::-webkit-scrollbar {
  width: 8px;
}

.wevius-ai-chat__messages::-webkit-scrollbar-thumb {
  background: rgba(122, 93, 160, 0.25);
  border-radius: 999px;
}

.wevius-ai-chat__message {
  display: flex;
  margin-bottom: 10px;
}

.wevius-ai-chat__message:last-child {
  margin-bottom: 0;
}

.wevius-ai-chat__message--assistant {
  display: block;
  width: 100%;
}

.wevius-ai-chat__message--assistant .wevius-ai-chat__bubble {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px 12px 0 12px;
  background: transparent;
  border: 0;
  text-align: left;
}

.wevius-ai-chat__message--assistant .wevius-ai-chat__bubble--thinking {
  display: inline-flex !important;
  width: auto !important;
  max-width: fit-content !important;
  margin: 0;
  padding: 14px 16px !important;
  background: rgba(255, 255, 255, 0.72) !important;
  border-radius: 20px;
  box-shadow: inset 0 0 0 1px rgba(132, 111, 166, 0.08);
}

.wevius-ai-chat__message--user {
  justify-content: flex-end;
}

.wevius-ai-chat__bubble {
  max-width: 100%;
  color: #23212c;
  font-size: 17px;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

.wevius-ai-chat__message--user .wevius-ai-chat__bubble {
  max-width: min(68%, 700px);
  padding: 14px 18px;
  border-radius: 22px;
  background: rgba(123, 92, 197, 0.94);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(113, 77, 171, 0.18);
}

.wevius-ai-chat__bubble--thinking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px !important;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72) !important;
  box-shadow: inset 0 0 0 1px rgba(132, 111, 166, 0.08);
}

.wevius-ai-chat__bubble--thinking span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9f8ac8;
  animation: wevius-ai-chat-bounce 1.2s infinite ease-in-out;
}

.wevius-ai-chat__bubble--thinking span:nth-child(2) {
  animation-delay: 0.15s;
}

.wevius-ai-chat__bubble--thinking span:nth-child(3) {
  animation-delay: 0.3s;
}

.wevius-ai-chat__status {
  display: none;
  align-items: flex-start;
  gap: 6px;

  /* Match the composer on desktop */
  margin: 6px 0 10px -108px;
  width: calc(100% + 98px);
  max-width: none;

  padding: 8px 12px;
  box-sizing: border-box;
  border-radius: 12px;

  font-size: 13px;
  line-height: 1.4;

  background: rgba(255, 255, 255, 0.7);
  color: #5f5971;

  box-shadow:
    inset 0 0 0 1px rgba(178, 159, 194, 0.18),
    0 4px 10px rgba(135, 112, 189, 0.10);
}

.wevius-ai-chat__status:not(:empty) {
  display: flex;
}

.wevius-ai-chat__status::before {
  content: '';
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 999px;
  background: #8d74d1;
}

.wevius-ai-chat__status[data-error="true"] {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid rgba(190, 24, 93, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(244, 63, 94, 0.08),
    0 4px 12px rgba(244, 63, 94, 0.12);
}

.wevius-ai-chat__status[data-error="true"]::before {
  background: #e11d48;
}

.wevius-ai-chat__form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 14px 16px 12px;
  margin-left: -108px;
  width: calc(100% + 98px);
  border-radius: 18px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.9),
    rgba(251, 247, 250, 0.82),
    rgba(255, 255, 255, 0.88)
  );
  box-shadow:
    inset 0 0 0 1px rgba(178, 159, 194, 0.18),
    0 6px 18px rgba(155, 127, 174, 0.08);
}

.wevius-ai-chat [data-wevius-chat-input] {
  width: calc(100% - 8px);
  margin-left: 8px;
  min-height: 78px;
  max-height: 160px;
  resize: none;
  border: 0;
  padding: 24px 2px 0 0;
  background: transparent;
  color: #23212c;
  outline: none;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 400;
}

.wevius-ai-chat [data-wevius-chat-input]::placeholder {
  color: #9a90a7;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.2;
}

.wevius-ai-chat__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.wevius-ai-chat__tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 10px; /* give Area Tutor some breathing room on the left */
}

.wevius-ai-chat__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #6f5bb4;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.wevius-ai-chat__tutor-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(123, 95, 214, 0.10);
  color: #6f42d8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.wevius-ai-chat__tutor-link {
  background: rgba(123, 95, 214, 0.12);
  color: #5e38b8;
}

.wevius-ai-chat__tutor-link:hover {
  background: rgba(123, 95, 214, 0.20);
  color: #4f2da8;
}

.wevius-ai-chat__bubble--thinking span {
  background: #8d74d1;
}

.wevius-ai-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.wevius-ai-chat__send span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, #9272dc 0%, #7e60cf 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(121, 89, 198, 0.22);
}

.wevius-ai-chat__send:hover span {
  background: linear-gradient(180deg, #8765da 0%, #714ec7 100%);
}

.wevius-ai-chat__send:disabled,
.wevius-ai-chat__plus:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.wevius-ai-chat__toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  width: 190px;
}

.wevius-ai-chat__toggle-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.wevius-ai-chat[data-open="false"] {
  width: auto;
  left: auto;
  right: 24px;
  bottom: 18px;
  transform: none;
}

.wevius-ai-chat[data-open="false"] .wevius-ai-chat__toggle {
  display: inline-flex;
}

.wevius-ai-chat[data-open="true"] .wevius-ai-chat__toggle {
  display: none;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.wevius-ai-chat__bubble p {
  margin: 0 0 10px;
}

.wevius-ai-chat__bubble p:last-child {
  margin-bottom: 0;
}

.wevius-ai-chat__bubble strong {
  font-weight: 700;
}

.wevius-ai-chat__bubble em {
  font-style: italic;
}

.wevius-ai-chat__table-wrap {
  margin: 12px 0 4px;
  overflow-x: auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.wevius-ai-chat__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.45;
}

.wevius-ai-chat__table th,
.wevius-ai-chat__table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.wevius-ai-chat__table th {
  background: rgba(248, 244, 252, 0.9);
  color: #2d2737;
  font-weight: 700;
}

.wevius-ai-chat__table tbody tr:last-child td {
  border-bottom: 0;
}

.wevius-ai-chat[data-open="false"] .wevius-ai-chat__panel {
  display: none !important;
}

math-field::part(virtual-keyboard-toggle) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

@keyframes wevius-ai-chat-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.wevius-modal-box button:hover {
  background: linear-gradient(180deg, #8765da 0%, #714ec7 100%);
}

/* ---------- Consent modal ---------- */

.wevius-tutor-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100dvh;
  padding: 20px;
  background: rgba(35, 33, 44, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.wevius-tutor-modal {
  width: min(460px, 100%);
  border-radius: 24px;
  padding: 24px 22px 20px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow:
    0 20px 60px rgba(126, 95, 150, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.42);
  text-align: center;
  color: #2d2737;
}

.wevius-tutor-modal-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.wevius-tutor-modal-icon {
  display: block;
  background: transparent;
  width: auto;
  height: auto;
  border-radius: 0;
  font-size: 28px;
  line-height: 1;
}

.wevius-tutor-modal-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
  color: #43395b;
}

.wevius-tutor-modal-text {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.5;
  color: #5b516d;
}

.wevius-tutor-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.wevius-tutor-modal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #9272dc 0%, #7e60cf 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(121, 89, 198, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.wevius-tutor-modal-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #8765da 0%, #714ec7 100%);
  box-shadow: 0 10px 22px rgba(121, 89, 198, 0.26);
}

.wevius-tutor-modal-button--secondary {
  background: #f4edff;
  color: #6f42d8;
  box-shadow: inset 0 0 0 1px rgba(123, 95, 214, 0.18);
}

.wevius-tutor-modal-button--secondary:hover {
  transform: translateY(-1px);
  background: #ede3ff;
  color: #5e38b8;
  box-shadow: inset 0 0 0 1px rgba(123, 95, 214, 0.24);
}

.wevius-tutor-consent-terms {
  margin: 0 0 18px;
  text-align: left;
  background: #faf7ff;
  border: 1px solid rgba(123, 95, 214, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
}

.wevius-tutor-consent-terms summary {
  cursor: pointer;
  font-weight: 700;
  color: #5e38b8;
  user-select: none;
}

.wevius-tutor-consent-terms .terms-content {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #5b516d;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
}

@media (max-width: 960px) {
  .wevius-ai-chat {
    width: min(calc(100vw - 24px), 100%);
    bottom: 12px;
  }

  .wevius-ai-chat__panel {
    padding: 16px 14px 14px;
    border-radius: 24px;
  }

  .wevius-ai-chat__hero {
    gap: 12px;
    min-height: auto;
  }

  .wevius-ai-chat__mascot {
    flex: 0 0 138px;
    margin-top: -26px;
    margin-left: -6px;
    transform: translateY(23px);
  }


  .wevius-ai-chat__mascot img {
    width: 168px;
  }

  .wevius-ai-chat__body {
    padding-top: 136px;
  }

  .wevius-ai-chat__messages {
    max-height: 126px;
    left: 10px;
    right: 10px;
    padding: 0 10px;
  }

}

@media (max-width: 640px) {

.wevius-ai-chat [data-wevius-chat-input] {
    width: calc(100% - 8px);
    margin-left: 8px;
    min-height: 64px;
    padding: 24px 2px 0 0;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 400;
  }

  .wevius-ai-chat [data-wevius-chat-input]::placeholder {
    font-size: 14px;
    line-height: 1.3;
  }

  .wevius-ai-chat__form {
    margin-left: -85px;
    width: calc(100% + 64px);
    padding: 12px 12px 10px;
    gap: 8px;
  }

  .wevius-ai-chat__footer {
    gap: 10px;
    align-items: center;
  }

  .wevius-ai-chat__tools {
    gap: 6px;
  }

  .wevius-ai-chat__plus {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 22px;
  }

  .wevius-ai-chat__tutor-link {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }

  .wevius-ai-chat__bubble {
    font-size: 14px;
    line-height: 1.3;
  }

  .wevius-ai-chat__message--user .wevius-ai-chat__bubble {
    max-width: 86%;
    padding: 12px 14px;
    border-radius: 18px;
  }

  .wevius-ai-chat {
    left: 12px;
    right: 12px;
    bottom: 10px;
    width: auto;
    transform: none;
  }

  .wevius-ai-chat__panel {
    border-radius: 22px;
    padding: 14px 12px 12px;
  }

    .wevius-ai-chat__body {
    padding-top: 128px;
    padding-left: 2px;
  }

  .wevius-ai-chat__messages {
    top: 0;
    left: 6px;
    right: 6px;
    width: auto;
    margin: 0;
    padding: 0 6px;
    max-height: 120px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .wevius-ai-chat__hero {
    align-items: flex-end;
    gap: 6px;
    min-height: 168px;
  }

  .wevius-ai-chat__mascot {
    flex: 0 0 138px;
    align-self: flex-end;
    margin-top: -26px;
    margin-left: -6px;
    transform: translateY(23px);
  }

  .wevius-ai-chat__mascot img {
    width: 168px;
  }

  .wevius-ai-chat[data-open="false"] {
    right: 12px;
    left: auto;
    bottom: 12px;
    width: auto;
  }

  .wevius-ai-chat__toggle {
    width: 145px;
  }

  .wevius-ai-chat__status {
    margin-left: -85px;
    width: calc(100% + 64px);
  }

}

.wevius-ai-chat.wevius-ai-chat--compact .wevius-ai-chat__body {
  padding-top: 72px !important;
}

@media (max-width: 960px) {
  .wevius-ai-chat.wevius-ai-chat--compact .wevius-ai-chat__body {
    padding-top: 72px !important;
  }
}

@media (max-width: 640px) {
  .wevius-ai-chat.wevius-ai-chat--compact .wevius-ai-chat__body {
    padding-top: 100px !important;
  }
}

/* Temporarily hide upload (+) buttons in chat widget and tutor page */
.wevius-ai-chat__plus,
.wevius-tutor-composer__plus {
  display: none !important;
}