@import url("./f7-approved-chat-bubbles.css");
@import url("./f7-common-proof-native-chat.css");

/**
 * CHAT-ROUTE-CLEAN-ROOM-C1/…/C1N/C5 — scoped clean Common/DM visual shell.
 * Approved bubble component: f7-approved-chat-bubbles.css (also linked directly in index.html before this file).
 * C5B — stable bounds lock; host CSS aligned with Q2B-2 (inset:0).
 */

.clean-chat-page {
  --clean-chat-header-button: 28px;
  --clean-chat-header-icon: 15px;
  --clean-chat-header-x: 8px;
  --clean-chat-back-size: 32px;
  --clean-chat-back-icon: 16px;
  --clean-chat-header-action-size: 36px;
  --clean-chat-header-action-icon: 18px;
  --clean-chat-composer-button: 36px;
  position: relative;
  overflow: hidden;
  background: rgb(10, 10, 14);
  min-height: 100%;
  height: 100%;
}

#f7-app-root .page.clean-chat-page {
  background: rgb(10, 10, 14);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* C5 — Q2B-2 full-page route Matrix host (absolute inset:0, aligned with chat-page) */
#f7-app-root .page.clean-chat-page .f7-chat-route-matrix-host {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

#f7-app-root .page.clean-chat-page .f7-chat-route-matrix-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--f7-chat-route-surface-atmosphere), var(--f7-chat-route-surface-base);
  background-color: var(--f7-chat-route-surface-base);
  z-index: 0;
}

#f7-app-root .page.clean-chat-page .f7-chat-route-matrix-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: var(--mx-rain-opacity, 0.038);
  z-index: 1;
}

#f7-app-root .page.clean-chat-page .f7-chat-route-matrix-phrases {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  z-index: 2;
  font-family: "Hair 2", "Courier New", monospace;
  font-weight: var(--mx-phrase-font-weight, 600);
  letter-spacing: 1px;
}

#f7-app-root .page.clean-chat-page .f7-chat-route-matrix-phrases .ph {
  position: absolute;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  line-height: 1;
  background: transparent;
  opacity: 0;
  z-index: 0;
  will-change: opacity, filter, text-shadow;
  animation: mxPhShow var(--mx-ph-dur, 5.4s)
    var(--mx-ph-easing, cubic-bezier(0.45, 0.05, 0.55, 0.95)) forwards;
}

#f7-app-root .page.clean-chat-page .f7-chat-route-matrix-phrases .ph span {
  display: block;
  text-align: center;
}

@keyframes mxPhShowRouteInitialClean {
  0%,
  72% {
    opacity: var(--ph-peak, 0.45);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    filter: blur(6px);
  }
}

#f7-app-root .page.clean-chat-page .f7-chat-route-matrix-phrases .ph.ph-route-initial {
  opacity: var(--ph-peak, 0.45);
  filter: blur(0);
  animation: mxPhShowRouteInitialClean var(--mx-ph-dur, 5.4s)
    var(--mx-ph-easing, cubic-bezier(0.45, 0.05, 0.55, 0.95)) forwards;
}

/* C5 — optional dark scrim above Matrix, below header/content */
#f7-app-root .page.clean-chat-page .clean-chat-matrix-bg {
  position: absolute;
  inset: 0;
  min-height: 100%;
  z-index: 1;
  pointer-events: none;
  background: rgba(10, 10, 14, 0.18);
}

#f7-app-root .page.clean-chat-page .clean-chat-matrix-bg::after {
  content: none;
  display: none;
}

/* C1B — header pill removal (F7 iOS .left/.right capsules) */
#f7-app-root .navbar.clean-chat-header .navbar-bg,
#f7-app-root .page.clean-chat-page .navbar.clean-chat-header .navbar-bg {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: none !important;
}

#f7-app-root .page.clean-chat-page .navbar.clean-chat-header .navbar-bg::before,
#f7-app-root .page.clean-chat-page .navbar.clean-chat-header .navbar-bg::after {
  display: none !important;
}

#f7-app-root .navbar.clean-chat-header .left,
#f7-app-root .navbar.clean-chat-header .right {
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: 0 !important;
}

#f7-app-root .navbar.clean-chat-header .navbar-inner,
#f7-app-root .clean-chat-page .clean-chat-header .navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* C13RT4 — back slot + title slot siblings (no F7 .left shared highlight rect) */
#f7-app-root .clean-chat-page .clean-chat-header-back-slot {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  padding-left: var(--clean-chat-header-x);
  padding-right: 0;
  pointer-events: auto;
  z-index: 2;
  isolation: isolate;
}

#f7-app-root .clean-chat-page .clean-chat-header-title-slot {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  width: auto !important;
  max-width: calc(100% - 96px - var(--clean-chat-back-size)) !important;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  pointer-events: none;
  z-index: 1;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-header-back-slot .clean-chat-back {
  pointer-events: auto;
  flex: 0 0 auto;
}

#f7-app-root .clean-chat-page .clean-chat-title-host {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  pointer-events: none;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-header-actions {
  pointer-events: auto;
}

/* C1K — no .right class: avoids F7 touch-highlight on shared navbar .right rect */
#f7-app-root .clean-chat-page .clean-chat-header-actions {
  position: relative;
  flex: 0 0 auto;
  width: auto !important;
  max-width: none !important;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  margin-bottom: 0;
  margin-right: 0;
  padding-right: 10px;
  padding-left: 0;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.clean-chat-header {
  position: relative;
  z-index: 2;
  background: transparent !important;
}

#f7-app-root .clean-chat-page .clean-chat-back.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--clean-chat-back-size);
  height: var(--clean-chat-back-size);
  min-width: var(--clean-chat-back-size);
  min-height: var(--clean-chat-back-size);
  margin: 0;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
}

#f7-app-root .clean-chat-page .clean-chat-back .icon-back {
  font-size: var(--clean-chat-back-icon);
  line-height: 1;
}

#f7-app-root .clean-chat-page .clean-chat-title-text,
.clean-chat-title-text {
  position: static !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  width: auto !important;
  max-width: 100%;
  margin: 0 !important;
  padding: 0;
  text-align: left;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
  display: block;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: default;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-title-noninteractive,
#f7-app-root .clean-chat-page .clean-chat-title-visual-only,
#f7-app-root .clean-chat-page .clean-chat-header-title-slot,
#f7-app-root .clean-chat-page .clean-chat-title-host {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-header-title-slot:active,
#f7-app-root .clean-chat-page .clean-chat-header-title-slot:hover,
#f7-app-root .clean-chat-page .clean-chat-header-title-slot:focus,
#f7-app-root .clean-chat-page .clean-chat-header-title-slot:focus-visible,
#f7-app-root .clean-chat-page .clean-chat-title-visual-only:active,
#f7-app-root .clean-chat-page .clean-chat-title-visual-only:hover,
#f7-app-root .clean-chat-page .clean-chat-title-visual-only:focus,
#f7-app-root .clean-chat-page .clean-chat-title-visual-only:focus-visible,
#f7-app-root .clean-chat-page .clean-chat-title-host:active,
#f7-app-root .clean-chat-page .clean-chat-title-host:hover,
#f7-app-root .clean-chat-page .clean-chat-title-host:focus,
#f7-app-root .clean-chat-page .clean-chat-title-host:focus-visible,
#f7-app-root .clean-chat-page .clean-chat-title-text:active,
#f7-app-root .clean-chat-page .clean-chat-title-text:hover,
#f7-app-root .clean-chat-page .clean-chat-title-text:focus,
#f7-app-root .clean-chat-page .clean-chat-title-text:focus-visible,
#f7-app-root .clean-chat-page .clean-chat-title-noninteractive:active,
#f7-app-root .clean-chat-page .clean-chat-title-noninteractive:hover,
#f7-app-root .clean-chat-page .clean-chat-title-noninteractive:focus,
#f7-app-root .clean-chat-page .clean-chat-title-noninteractive:focus-visible {
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
}

#f7-app-root .clean-chat-page .clean-chat-header-title-slot.active-state,
#f7-app-root .clean-chat-page .clean-chat-title-visual-only.active-state,
#f7-app-root .clean-chat-page .clean-chat-title-host.active-state,
#f7-app-root .clean-chat-page .clean-chat-title-text.active-state,
#f7-app-root .clean-chat-page .clean-chat-title-noninteractive.active-state {
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-header-title-slot .ripple,
#f7-app-root .clean-chat-page .clean-chat-header-title-slot .touch-ripple,
#f7-app-root .clean-chat-page .clean-chat-title-host .ripple,
#f7-app-root .clean-chat-page .clean-chat-title-host .touch-ripple,
#f7-app-root .clean-chat-page .clean-chat-title-text .ripple,
#f7-app-root .clean-chat-page .clean-chat-title-text .touch-ripple {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* C1L — bell/search: controlled circular press (no F7 touch-highlight / ripple) */
#f7-app-root .clean-chat-page .clean-chat-header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
  contain: paint;
  isolation: isolate;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  appearance: none;
  -webkit-appearance: none;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.06);
  border: none;
  box-shadow: none;
  transition:
    background-color 120ms ease,
    transform 120ms ease,
    opacity 120ms ease;
}

#f7-app-root .clean-chat-page .clean-chat-header-action::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  opacity: 0;
  transform: scale(0.72);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  pointer-events: none;
}

#f7-app-root .clean-chat-page .clean-chat-header-action .ripple-wave {
  display: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-header-action:active::before,
#f7-app-root .clean-chat-page .clean-chat-header-action.clean-chat-pressed::before {
  opacity: 1;
  transform: scale(1);
}

#f7-app-root .clean-chat-page .clean-chat-header-action.active-state,
#f7-app-root .clean-chat-page .clean-chat-header-action:active,
#f7-app-root .clean-chat-page .clean-chat-header-action.clean-chat-pressed,
#f7-app-root .clean-chat-page .clean-chat-header-action:focus,
#f7-app-root .clean-chat-page .clean-chat-header-action:focus-visible {
  opacity: 1 !important;
  border-radius: 50%;
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.1) !important;
  outline: none !important;
  box-shadow: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-header-icon {
  width: var(--clean-chat-header-action-icon);
  height: var(--clean-chat-header-action-icon);
  display: block;
}

#f7-app-root .page.clean-chat-page .page-content.clean-chat-content,
#f7-app-root .clean-chat-page .clean-chat-content {
  position: relative;
  z-index: 2;
  background: transparent !important;
  background-color: transparent !important;
  margin-bottom: 0 !important;
  padding-bottom: 64px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* C10A — official F7 messages-content scroll surface (not composer / not body) */
#f7-app-root .page.clean-chat-page .page-content.messages-content,
#f7-app-root .page.clean-chat-page .page-content.clean-chat-content.messages-content {
  display: block;
  flex-direction: unset;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

#f7-app-root .page.clean-chat-page .page-content.messages-content .clean-chat-history-shell {
  display: block;
  height: auto;
  min-height: 0;
  flex: unset;
}

#f7-app-root .clean-chat-page .clean-chat-content::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.clean-chat-empty-state {
  min-height: 1px;
  height: 100%;
  pointer-events: none;
}

/* C7A — messages surface inside clean content (Matrix visible behind) */
#f7-app-root .clean-chat-page .clean-chat-history-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#f7-app-root .clean-chat-page .clean-chat-content {
  display: flex;
  flex-direction: column;
}

#f7-app-root .clean-chat-page .clean-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}

/* C10A-FIX1 — official first-paint anchor gate (mirror f7-dm-awaiting-history) */
#f7-app-root .page.clean-chat-page.clean-chat-awaiting-anchor .clean-chat-messages,
#f7-app-root .page.clean-chat-page.clean-chat-awaiting-anchor .messages {
  visibility: hidden !important;
  opacity: 0 !important;
  min-height: 40vh;
}

#f7-app-root .page.clean-chat-page.clean-chat-anchor-ready .clean-chat-messages,
#f7-app-root .page.clean-chat-page.clean-chat-anchor-ready .messages {
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 0;
}

#f7-app-root .clean-chat-page .clean-chat-history-loading,
#f7-app-root .clean-chat-page .clean-chat-history-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease;
}

#f7-app-root .clean-chat-page .clean-chat-history-loading.clean-chat-history-visible,
#f7-app-root .clean-chat-page .clean-chat-history-empty.clean-chat-history-visible {
  opacity: 1;
  visibility: visible;
}

#f7-app-root .clean-chat-page {
  --bl-x: 50%;
  --bl-y: 50%;
  --bl-opacity: 0;
  --bubble-gap: 9px;
}

/* ═══ Common Chat — literal proof v23 bubble (f7-approved-chat-bubbles.css imported at file top) ═══ */

/* CT-B4A — hide external F7 author/footer; author is inside bubble */
#f7-app-root .clean-chat-page .clean-chat-messages .message-name {
  display: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message-footer,
#f7-app-root .clean-chat-page .clean-chat-messages .message-time,
#f7-app-root .clean-chat-page .clean-chat-messages .message-text-footer {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

#f7-app-root .clean-chat-page .clean-chat-messages.messages,
#f7-app-root .clean-chat-page .clean-chat-messages .messages {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  gap: var(--bubble-gap);
  padding: var(--bubble-gap);
  background: transparent !important;
}

#f7-app-root .clean-chat-page .clean-chat-messages .messages .message,
#f7-app-root .clean-chat-page .clean-chat-messages.messages .message {
  display: block !important;
  max-width: 100%;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  box-sizing: border-box;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message.message-sent,
#f7-app-root .clean-chat-page .clean-chat-messages .message.message-sent {
  align-self: flex-end !important;
  text-align: right;
  margin-left: auto;
  margin-right: calc(12px + env(safe-area-inset-right, 0px));
}

#f7-app-root .clean-chat-page .clean-chat-messages .message.message-received,
#f7-app-root .clean-chat-page .clean-chat-messages .message.message-received {
  align-self: flex-start !important;
  text-align: left;
  margin-right: auto;
  margin-left: calc(12px + env(safe-area-inset-left, 0px));
}

#f7-app-root .clean-chat-page .clean-chat-messages .message-content {
  max-width: 100%;
  margin: 0;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message.message-sent .message-content,
#f7-app-root .clean-chat-page .clean-chat-messages .message.message-received .message-content {
  display: flex;
  flex-direction: column;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message.message-sent .message-content {
  align-items: flex-end;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message.message-received .message-content {
  align-items: flex-start;
}

/* F7 wrapper — neutral layout shell only */
#f7-app-root .clean-chat-page .clean-chat-messages .message .message-bubble {
  margin: 0;
  padding: 0 !important;
  width: auto;
  max-width: none;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
  position: static;
  display: block;
  box-sizing: border-box;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message-bubble::before,
#f7-app-root .clean-chat-page .clean-chat-messages .message-bubble::after {
  content: none !important;
  display: none !important;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message-text {
  display: block;
  position: relative;
  margin: 0;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  color: inherit;
  opacity: 1 !important;
  max-width: 100%;
}

#f7-app-root .clean-chat-page .clean-chat-messages .message-text::after {
  content: none;
  display: none;
}

/* ═══ Common bubble device visual diag overlay (commonBubbleDiag=1 only) ═══ */
#f7-app-root .page.clean-chat-page .f7-common-bubble-diag-overlay {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 24000;
  max-height: min(42vh, 320px);
  display: none;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.82);
  color: #e8fff0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 10px;
  line-height: 1.35;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}

#f7-app-root .page.clean-chat-page .f7-common-bubble-diag-overlay__head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#f7-app-root .page.clean-chat-page .f7-common-bubble-diag-overlay__title {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#f7-app-root .page.clean-chat-page .f7-common-bubble-diag-overlay__btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  padding: 6px 8px;
}

#f7-app-root .page.clean-chat-page .f7-common-bubble-diag-overlay__body {
  margin: 0;
  padding: 8px 10px 10px;
  max-height: calc(min(42vh, 320px) - 44px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d7ffe4;
}

/* C1C — neutralize Framework7 / global messagebar leakage */
#f7-app-root .clean-chat-page .messagebar,
#f7-app-root .clean-chat-page .toolbar.messagebar,
#f7-app-root .clean-chat-page .clean-chat-composer {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  border-top: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#f7-app-root .clean-chat-page .toolbar-inner,
#f7-app-root .clean-chat-page .clean-chat-composer-inner {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

#f7-app-root .clean-chat-page .messagebar-area {
  flex: 1;
  min-width: 0;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* C1D — messagebar-area is structural only when not the pill owner */
#f7-app-root .clean-chat-page .messagebar-area:not(.clean-chat-input-wrap) {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
}

/* C1B — composer on same page background; no full-width gray strip */
#f7-app-root .page.clean-chat-page .toolbar.messagebar.clean-chat-composer,
#f7-app-root .clean-chat-page .clean-chat-composer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  margin: 0 !important;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

#f7-app-root .clean-chat-page .clean-chat-composer .toolbar-inner,
#f7-app-root .clean-chat-page .clean-chat-composer-inner {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  margin: 0 !important;
  padding-left: var(--clean-chat-header-x);
  padding-right: var(--clean-chat-header-x);
  padding-top: 5px;
  padding-bottom: 5px;
}

/* C1O — autogrow input pill + textarea scrollbar layout */
#f7-app-root .clean-chat-page .clean-chat-input-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  isolation: isolate;
  contain: paint;
  height: 42px;
  min-height: 42px;
  max-height: 190px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  margin: 0 !important;
  background: rgba(255, 255, 255, 0.075) !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  border-radius: 21px;
  padding: 4px 7px 4px 16px !important;
  box-shadow: none !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
}

#f7-app-root .clean-chat-page .clean-chat-input-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: var(--clean-chat-press-opacity, 0);
  background:
    radial-gradient(
      circle at var(--clean-chat-press-x, 50%) var(--clean-chat-press-y, 50%),
      rgba(255, 255, 255, 0.16) 0%,
      rgba(255, 255, 255, 0.08) 26%,
      rgba(255, 255, 255, 0) 58%
    );
  transition: opacity 120ms ease;
  z-index: 0;
}

#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-multiline {
  align-items: flex-end;
}

#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-multiline .clean-chat-action-btn {
  align-self: flex-end !important;
  margin-bottom: 1px;
}

#f7-app-root .clean-chat-page .clean-chat-input,
#f7-app-root .clean-chat-page textarea.clean-chat-input,
#f7-app-root .clean-chat-page .messagebar-input.clean-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  position: relative;
  z-index: 2;
  height: 22px;
  min-height: 22px !important;
  max-height: 176px !important;
  line-height: 22px !important;
  font-size: 16px !important;
  display: block;
  align-self: center;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 4px 0 0 !important;
  margin: 0 !important;
  box-sizing: border-box;
  border-radius: 0 !important;
  color: rgba(255, 255, 255, 0.92);
  resize: none !important;
  overflow-x: hidden !important;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-multiline .clean-chat-input,
#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-multiline textarea.clean-chat-input,
#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-multiline .messagebar-input.clean-chat-input {
  align-self: center;
}

#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-scroll .clean-chat-input,
#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-scroll textarea.clean-chat-input,
#f7-app-root .clean-chat-page .clean-chat-input-wrap.clean-chat-input-scroll .messagebar-input.clean-chat-input {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#f7-app-root .clean-chat-page .clean-chat-input::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

#f7-app-root .clean-chat-page .clean-chat-input::placeholder {
  font-size: 16px;
  line-height: 22px;
}

#f7-app-root .clean-chat-page .clean-chat-gift-btn,
#f7-app-root .clean-chat-page .clean-chat-gift-btn * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  user-drag: none;
}

#f7-app-root .clean-chat-page .clean-chat-gift-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: flex-end !important;
  margin-bottom: 1px;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.9);
  transition:
    transform 120ms ease,
    opacity 120ms ease,
    background-color 120ms ease;
}

#f7-app-root .clean-chat-page .clean-chat-gift-btn.clean-chat-pressed {
  transform: scale(0.96);
  opacity: 0.88;
  background: rgba(255, 255, 255, 0.12) !important;
}

#f7-app-root .clean-chat-page .clean-chat-plus-icon,
#f7-app-root .clean-chat-page .clean-chat-plus-svg {
  pointer-events: none;
}

#f7-app-root .clean-chat-page .clean-chat-action-btn,
#f7-app-root .clean-chat-page .clean-chat-action-btn * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  user-drag: none;
}

#f7-app-root .clean-chat-page .clean-chat-action-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: center !important;
  position: relative;
  z-index: 3;
  pointer-events: auto;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  text-align: center;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    transform 120ms ease,
    background-color 120ms ease;
}

#f7-app-root .clean-chat-page .clean-chat-action-btn:active,
#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-pressed {
  transform: scale(0.96);
}

#f7-app-root .clean-chat-page .clean-chat-plus-icon,
#f7-app-root .clean-chat-page .clean-chat-plus-svg,
#f7-app-root .clean-chat-page .clean-chat-heart-icon,
#f7-app-root .clean-chat-page .clean-chat-send-icon,
#f7-app-root .clean-chat-page .clean-chat-send-svg {
  display: block;
  line-height: 1;
}

#f7-app-root .clean-chat-page .clean-chat-plus-svg {
  width: 18px;
  height: 18px;
}

#f7-app-root .clean-chat-page .clean-chat-heart-icon,
#f7-app-root .clean-chat-page .clean-chat-send-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  margin: 0;
  pointer-events: none;
}

#f7-app-root .clean-chat-page .clean-chat-heart-icon {
  font-size: 30px;
  line-height: 1;
  display: block;
}

#f7-app-root .clean-chat-page .clean-chat-send-icon {
  display: block;
  line-height: 1;
  width: 22px;
  height: 22px;
}

#f7-app-root .clean-chat-page .clean-chat-send-svg {
  display: block;
  width: 22px;
  height: 22px;
  transform: translateY(-1px);
}

#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-heart,
#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-heart:active,
#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-heart.clean-chat-pressed {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #ff4870;
}

#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-send {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #fff;
}

#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-send::before {
  content: "";
  position: absolute;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #ff7a1a;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  transition: background-color 120ms ease;
}

#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-send:active::before,
#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-send.clean-chat-pressed::before {
  background: #e86a10;
}

#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-send:active,
#f7-app-root .clean-chat-page .clean-chat-action-btn.clean-chat-action-send.clean-chat-pressed {
  background: transparent !important;
}
