.mc-help-launcher {
  position: fixed;
  z-index: 2100;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: max(
    14px,
    calc((100vw - 430px) / 2 + 14px),
    env(safe-area-inset-right, 0px)
  );
  width: 44px;
  height: 44px;
  border: 1px solid rgba(232, 236, 244, 0.42);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #002b30;
  color: var(--text);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.26);
  cursor: pointer;
}

.mc-help-launcher .icon {
  width: 23px;
  height: 23px;
}

.mc-help-launcher[aria-expanded="true"],
.mc-help-launcher:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status-legend-info {
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.ringtone-audio-enable {
  top: calc(env(safe-area-inset-top, 0px) + 62px);
}

.mc-help-layer {
  position: fixed;
  z-index: 4000;
  inset: 0;
  display: grid;
  justify-items: center;
}

.mc-help-layer[hidden] {
  display: none;
}

.mc-help-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 20, 23, 0.62);
  cursor: default;
}

.mc-help-panel {
  position: relative;
  box-sizing: border-box;
  width: min(430px, 100%);
  max-width: 100%;
  height: 100%;
  display: grid;
  grid-template:
    "header" auto
    "suggestions" auto
    "messages" minmax(0, 1fr)
    "footer" auto
    / minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: #00434a;
  color: var(--text);
  box-shadow: -18px 0 44px rgba(0, 0, 0, 0.36);
}

.mc-help-header {
  grid-area: header;
  min-height: 68px;
  padding:
    calc(env(safe-area-inset-top, 0px) + 12px)
    14px
    10px
    20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.mc-help-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.mc-help-context {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-help-close,
.mc-help-send,
.mc-help-feedback {
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text);
  cursor: pointer;
}

.mc-help-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
}

.mc-help-close .icon,
.mc-help-send .icon,
.mc-help-feedback .icon {
  width: 20px;
  height: 20px;
}

.mc-help-suggestions {
  grid-area: suggestions;
  min-height: 0;
  padding: 12px 16px 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mc-help-suggestions:empty {
  display: none;
}

.mc-help-suggestions::-webkit-scrollbar {
  display: none;
}

.mc-help-suggestion {
  flex: 0 0 auto;
  max-width: 250px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.mc-help-suggestion:hover {
  border-color: var(--accent);
}

.mc-help-messages {
  grid-area: messages;
  min-height: 0;
  padding: 12px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mc-help-empty {
  margin: auto 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.mc-help-message {
  max-width: 92%;
  display: grid;
  gap: 8px;
}

.mc-help-message.is-user {
  align-self: end;
}

.mc-help-message.is-assistant {
  align-self: start;
}

.mc-help-bubble {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.48;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mc-help-message.is-user .mc-help-bubble {
  border-color: rgba(var(--accent-rgb), 0.62);
  background: #00606a;
}

.mc-help-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mc-help-source {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.mc-help-actions {
  display: grid;
  gap: 6px;
}

.mc-help-action {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.mc-help-feedback-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-help-feedback-label {
  margin-right: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.mc-help-feedback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
}

.mc-help-feedback.is-selected {
  border-color: var(--accent);
  color: var(--accent);
}

.mc-help-status {
  min-height: 20px;
  padding: 0 16px 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.mc-help-panel > footer {
  grid-area: footer;
}

.mc-help-composer {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: end;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: #00363c;
}

.mc-help-input {
  width: 100%;
  min-height: 46px;
  max-height: 132px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #002b30;
  color: var(--text);
  font: inherit;
  line-height: 1.4;
}

.mc-help-input::placeholder {
  color: var(--text-muted);
}

.mc-help-send {
  width: 46px;
  height: 46px;
  border-color: var(--accent);
  border-radius: 50%;
  background: var(--accent);
  color: #002b30;
}

.mc-help-send:disabled,
.mc-help-input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

body.mc-help-open {
  overflow: hidden;
}

@media (max-width: 560px) {
  .mc-help-layer {
    align-items: end;
    justify-items: stretch;
  }

  .mc-help-panel {
    width: 100%;
    height: min(92dvh, 780px);
    border-top: 1px solid var(--border);
    border-left: 0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.36);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .mc-help-panel {
    animation: mc-help-panel-in 160ms ease-out;
  }

  @keyframes mc-help-panel-in {
    from {
      opacity: 0;
      transform: translateX(18px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
}
