.mcf-chat {
  --mcf-chat-font-family: system-ui, -apple-system, "Segoe UI Emoji", "Apple Color Emoji",
    "Noto Color Emoji", "Twemoji Mozilla", "Segoe UI", Roboto, Arial, sans-serif;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 1px solid #263746;
  border-radius: 8px;
  color: #d7e2ea;
  background: #091018;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(154, 200, 224, 0.04);
  font-family: var(--mcf-chat-font-family);
  user-select: text;
}

.mcf-chat button,
.mcf-chat a {
  -webkit-tap-highlight-color: rgba(116, 166, 200, 0.18);
  touch-action: manipulation;
}

.mcf-chat input {
  -webkit-tap-highlight-color: rgba(116, 166, 200, 0.18);
}

.mcf-chat button:not(:disabled),
.mcf-chat a {
  cursor: pointer;
}

.mcf-chat[data-collapsed="true"] {
  grid-template-rows: 1fr;
  border-radius: 8px;
  background: #0d1721;
}

.mcf-chat__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid #243443;
  background: #0d1721;
}

.mcf-chat__title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mcf-chat__title strong,
.mcf-chat__room {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcf-chat__room {
  color: #8ea6b8;
  font-size: 11px;
}

.mcf-chat__collapse {
  width: 30px;
  height: 30px;
  border: 1px solid #355066;
  border-radius: 7px;
  background: #111f2b;
  color: #cde6ff;
}

.mcf-chat__cosmetics-toggle {
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid #355066;
  border-radius: 7px;
  background: #111f2b;
  color: #a9bfce;
  font: 700 10px/1 var(--mcf-chat-font-family);
}

.mcf-chat__cosmetics-toggle[aria-pressed="true"] {
  border-color: #4d7693;
  color: #dff2ff;
}

.mcf-chat__body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.mcf-chat__status {
  padding: 7px 10px;
  border-bottom: 1px solid #1d2b38;
  color: #a9bfce;
  font-size: 12px;
  line-height: 1.3;
  user-select: text;
}

.mcf-chat__status[data-tone="warn"] {
  color: #ffd38a;
}

.mcf-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  overflow-y: auto;
  user-select: text;
}

.mcf-chat__message {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.mcf-chat__message--royal {
  gap: 5px;
}

.mcf-chat__message--royal .mcf-chat__meta {
  color: #f6d77f;
}

.mcf-chat__message--royal .mcf-chat__sender:not(.mcf-chat__username--equipped) {
  color: #fff4bf;
  text-shadow: 0 0 10px rgba(255, 194, 58, 0.42);
}

.mcf-chat__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #8fa6b8;
  font-size: 11px;
}

.mcf-chat__sender {
  color: #d9edf7;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcf-chat__text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.38;
  user-select: text;
}

.mcf-chat__message--cosmetic,
.mcf-chat__message--cosmetic * {
  font-family: var(--mcf-chat-font-family);
}

.mcf-chat__message--cosmetic .mcf-chat__text,
.mcf-chat__message--cosmetic .mcf-chat__sender,
.mcf-chat__username-decoration {
  pointer-events: none;
}

/* Color emoji must not inherit the transparent fill used to clip cosmetic
   gradients and materials into surrounding text glyphs. */
.mcf-chat__emoji {
  background: none;
  color: inherit;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  -webkit-text-fill-color: currentColor;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.mcf-chat__username--name_color,
.mcf-chat__username--small_flourish,
.mcf-chat__username--framed_nameplate {
  color: var(--mcf-chat-username-primary);
}

.mcf-chat__username--thin_outline {
  color: var(--mcf-chat-username-primary);
  text-shadow: -1px 0 var(--mcf-chat-username-assist), 0 1px var(--mcf-chat-username-assist), 1px 0 var(--mcf-chat-username-assist), 0 -1px var(--mcf-chat-username-assist);
}

.mcf-chat__username--soft_glow {
  color: var(--mcf-chat-username-primary);
  text-shadow: 0 0 5px var(--mcf-chat-username-assist);
}

.mcf-chat__username--ornamental_nameplate,
.mcf-chat__username--luminous_nameplate,
.mcf-chat__username--spectral_nameplate {
  color: var(--mcf-chat-username-primary);
}

.mcf-chat__username--luminous_nameplate { text-shadow: 0 0 4px var(--mcf-chat-username-assist), 0 0 8px var(--mcf-chat-username-assist); }
.mcf-chat__username--spectral_nameplate {
  background-image: linear-gradient(
    var(--mcf-chat-gradient-angle, 90deg),
    var(--mcf-chat-username-primary) 0%,
    var(--mcf-chat-username-secondary) 36%,
    var(--mcf-chat-username-tertiary) 68%,
    var(--mcf-chat-username-primary) 100%
  );
  background-position: var(--mcf-chat-motion-start, 0% 50%);
  background-size: 360% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--mcf-chat-username-secondary) 72%, transparent));
}

.mcf-chat__username-frame--ornamental { padding: 1px 5px; border-block: 1px double var(--mcf-chat-username-assist); }
.mcf-chat__username-frame--cosmic { padding: 1px 5px; border: 1px solid var(--mcf-chat-username-assist); border-radius: 4px 999px; }

.mcf-chat__username-decoration {
  margin-left: 3px;
  color: var(--mcf-chat-username-assist);
  font-size: 0.72em;
}

.mcf-chat__username-flourish--underline { border-bottom: 1px solid var(--mcf-chat-username-assist); }
.mcf-chat__username-frame--soft_capsule { padding: 1px 5px; border: 1px solid var(--mcf-chat-username-assist); border-radius: 999px; }
.mcf-chat__username-frame--underline_plate { padding: 1px 4px; border-bottom: 2px solid var(--mcf-chat-username-assist); }

.mcf-chat__username-assist--outline_dark_thin,
.mcf-chat__username-assist--outline_light_thin {
  text-shadow: -1px 0 var(--mcf-chat-username-assist), 0 1px var(--mcf-chat-username-assist), 1px 0 var(--mcf-chat-username-assist), 0 -1px var(--mcf-chat-username-assist);
}
.mcf-chat__username-assist--outline_dark_medium,
.mcf-chat__username-assist--outline_light_medium {
  text-shadow: -2px 0 var(--mcf-chat-username-assist), 0 2px var(--mcf-chat-username-assist), 2px 0 var(--mcf-chat-username-assist), 0 -2px var(--mcf-chat-username-assist);
}
.mcf-chat__username-assist--backing_dark_20,
.mcf-chat__username-assist--backing_light_88 { padding-inline: 3px; border-radius: 3px; }
.mcf-chat__username-assist--backing_dark_20 { background-color: rgba(0, 0, 0, 0.2); }
.mcf-chat__username-assist--backing_light_88 { background-color: rgba(255, 255, 255, 0.88); }

.mcf-chat__text--single_color,
.mcf-chat__text--outline_assisted_color,
.mcf-chat__text--soft_glow_color {
  color: var(--mcf-chat-text-primary);
}

.mcf-chat__text--outline_assisted_color,
.mcf-chat__assist--outline_dark_thin,
.mcf-chat__assist--outline_light_thin {
  text-shadow: -1px 0 var(--mcf-chat-text-assist), 0 1px var(--mcf-chat-text-assist), 1px 0 var(--mcf-chat-text-assist), 0 -1px var(--mcf-chat-text-assist);
}

.mcf-chat__assist--outline_dark_medium,
.mcf-chat__assist--outline_light_medium {
  text-shadow: -2px 0 var(--mcf-chat-text-assist), 0 2px var(--mcf-chat-text-assist), 2px 0 var(--mcf-chat-text-assist), 0 -2px var(--mcf-chat-text-assist);
}

.mcf-chat__text--soft_glow_color { text-shadow: 0 0 6px var(--mcf-chat-text-assist); }

.mcf-chat__text--shimmer_edge,
.mcf-chat__text--luminous_core,
.mcf-chat__text--spectral_shift,
.mcf-chat__text--void_star_edge { color: var(--mcf-chat-text-primary); }

.mcf-chat__text--shimmer_edge {
  background-image: linear-gradient(
    105deg,
    var(--mcf-chat-text-primary) 0%,
    var(--mcf-chat-text-primary) 46%,
    color-mix(in srgb, #fff 74%, var(--mcf-chat-text-primary)) 48.7%,
    #fff 50%,
    color-mix(in srgb, #fff 74%, var(--mcf-chat-text-primary)) 51.3%,
    var(--mcf-chat-text-primary) 54%,
    var(--mcf-chat-text-primary) 100%
  );
  background-position: 0% 50%;
  background-size: 560% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 1px var(--mcf-chat-text-assist));
}
.mcf-chat__text--luminous_core {
  text-shadow:
    0 0 2px color-mix(in srgb, #fff 72%, var(--mcf-chat-text-primary)),
    0 0 7px var(--mcf-chat-text-assist),
    0 0 13px color-mix(in srgb, var(--mcf-chat-text-primary) 72%, transparent);
}
.mcf-chat__text--spectral_shift {
  background-image: linear-gradient(
    var(--mcf-chat-gradient-angle, 90deg),
    var(--mcf-chat-text-primary) 0%,
    var(--mcf-chat-text-secondary) 24%,
    var(--mcf-chat-text-tertiary) 50%,
    var(--mcf-chat-text-secondary) 76%,
    var(--mcf-chat-text-primary) 100%
  );
  background-position: 0% 50%;
  background-size: 420% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 0 2px color-mix(in srgb, var(--mcf-chat-text-tertiary) 82%, transparent))
    drop-shadow(0 0 5px color-mix(in srgb, var(--mcf-chat-text-secondary) 62%, transparent));
}
.mcf-chat__text--void_star_edge {
  -webkit-text-stroke: 0.45px var(--mcf-chat-text-assist);
  text-shadow: 0 0 2px #fff, 0 0 5px var(--mcf-chat-text-assist), 0 0 10px var(--mcf-chat-text-primary), 1px -1px 0 var(--mcf-chat-text-assist);
}

.mcf-chat__text--two_tone_gradient {
  color: var(--mcf-chat-text-primary);
  background-image: linear-gradient(
    var(--mcf-chat-gradient-angle, 90deg),
    var(--mcf-chat-text-primary) 0%,
    var(--mcf-chat-text-primary) 36%,
    var(--mcf-chat-text-secondary) 64%,
    var(--mcf-chat-text-secondary) 100%
  );
  background-position: 0% 50%;
  background-size: 220% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 2px color-mix(in srgb, var(--mcf-chat-text-secondary) 42%, transparent));
}

.mcf-chat__gradient--horizontal {
  --mcf-chat-gradient-angle: 90deg;
  --mcf-chat-motion-start: 0% 50%;
  --mcf-chat-motion-end: 100% 50%;
  --mcf-chat-material-motion-start: center, 0% 50%, 0% 50%;
  --mcf-chat-material-motion-end: center, 100% 50%, 100% 50%;
}
.mcf-chat__gradient--vertical {
  --mcf-chat-gradient-angle: 180deg;
  --mcf-chat-motion-start: 50% 0%;
  --mcf-chat-motion-end: 50% 100%;
  --mcf-chat-material-motion-start: center, 50% 0%, 50% 0%;
  --mcf-chat-material-motion-end: center, 50% 100%, 50% 100%;
}
.mcf-chat__gradient--diagonal_up {
  --mcf-chat-gradient-angle: 45deg;
  --mcf-chat-motion-start: 0% 100%;
  --mcf-chat-motion-end: 100% 0%;
  --mcf-chat-material-motion-start: center, 0% 100%, 0% 100%;
  --mcf-chat-material-motion-end: center, 100% 0%, 100% 0%;
}
.mcf-chat__gradient--diagonal_down {
  --mcf-chat-gradient-angle: 135deg;
  --mcf-chat-motion-start: 0% 0%;
  --mcf-chat-motion-end: 100% 100%;
  --mcf-chat-material-motion-start: center, 0% 0%, 0% 0%;
  --mcf-chat-material-motion-end: center, 100% 100%, 100% 100%;
}
.mcf-chat__text--two_tone_gradient.mcf-chat__gradient--vertical,
.mcf-chat__text--spectral_shift.mcf-chat__gradient--vertical,
.mcf-chat__username--spectral_nameplate.mcf-chat__gradient--vertical { background-size: 100% 420%; }
.mcf-chat__text--two_tone_gradient.mcf-chat__gradient--diagonal_up,
.mcf-chat__text--two_tone_gradient.mcf-chat__gradient--diagonal_down,
.mcf-chat__text--spectral_shift.mcf-chat__gradient--diagonal_up,
.mcf-chat__text--spectral_shift.mcf-chat__gradient--diagonal_down,
.mcf-chat__username--spectral_nameplate.mcf-chat__gradient--diagonal_up,
.mcf-chat__username--spectral_nameplate.mcf-chat__gradient--diagonal_down { background-size: 380% 380%; }

.mcf-chat__assist--backing_dark_20,
.mcf-chat__assist--backing_light_88 { padding-inline: 3px; border-radius: 3px; }
.mcf-chat__assist--backing_dark_20 { background-color: rgba(0, 0, 0, 0.2); }
.mcf-chat__assist--backing_light_88 { background-color: rgba(255, 255, 255, 0.88); }
.mcf-chat__assist--panel_dim_16 { box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.16); }

.mcf-chat__cosmetic-panel {
  --mcf-chat-panel-color-layer: linear-gradient(var(--mcf-chat-panel-primary), var(--mcf-chat-panel-primary));
  width: fit-content;
  max-width: 100%;
  padding: 7px 9px;
  border: var(--mcf-chat-panel-width) solid var(--mcf-chat-panel-border);
  background-color: color-mix(in srgb, var(--mcf-chat-panel-primary) var(--mcf-chat-panel-alpha), transparent);
  box-sizing: border-box;
}

.mcf-chat__panel--soft_gradient_panel {
  background-image: linear-gradient(var(--mcf-chat-gradient-angle, 90deg), var(--mcf-chat-panel-primary), var(--mcf-chat-panel-secondary));
}

.mcf-chat__panel--translucent_spectral_panel,
.mcf-chat__panel--void_cosmic_panel,
.mcf-chat__panel--ethereal_reign_bubble {
  --mcf-chat-panel-color-layer: linear-gradient(
    var(--mcf-chat-gradient-angle, 90deg),
    var(--mcf-chat-panel-primary) 0%,
    var(--mcf-chat-panel-secondary) 35%,
    var(--mcf-chat-panel-primary) 65%,
    var(--mcf-chat-panel-secondary) 100%
  );
  background-image: linear-gradient(
    var(--mcf-chat-gradient-angle, 90deg),
    var(--mcf-chat-panel-primary) 0%,
    var(--mcf-chat-panel-secondary) 35%,
    var(--mcf-chat-panel-primary) 65%,
    var(--mcf-chat-panel-secondary) 100%
  );
}

.mcf-chat__panel--layered_material_panel {
  --mcf-chat-panel-color-layer: linear-gradient(
    var(--mcf-chat-gradient-angle, 135deg),
    var(--mcf-chat-panel-primary),
    var(--mcf-chat-panel-secondary)
  );
}

.mcf-chat__panel--cosmic_monarch_bubble {
  --mcf-chat-panel-color-layer: linear-gradient(
    var(--mcf-chat-gradient-angle, 135deg),
    var(--mcf-chat-panel-primary) 0%,
    var(--mcf-chat-king-assist) 48%,
    var(--mcf-chat-panel-primary) 100%
  );
}

.mcf-chat__panel--ornamental_frame,
.mcf-chat__panel--layered_material_panel,
.mcf-chat__panel--mythic_edict { border-style: double; }
.mcf-chat__panel--crownlit_bubble,
.mcf-chat__panel--luminous_nameplate { box-shadow: 0 0 8px var(--mcf-chat-king-assist), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.mcf-chat__panel--void_cosmic_panel,
.mcf-chat__panel--cosmic_monarch_bubble { box-shadow: 0 0 7px var(--mcf-chat-panel-border), inset 0 0 0 1px rgba(255, 255, 255, 0.1); }

.mcf-chat__panel--bordered_panel,
.mcf-chat__panel--king_border,
.mcf-chat__panel--decree_panel { border-width: var(--mcf-chat-panel-width); }
.mcf-chat__panel--crownlit_bubble { box-shadow: 0 0 8px var(--mcf-chat-king-assist), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.mcf-chat__geometry--plain { border-radius: 0; }
.mcf-chat__geometry--soft_rect { border-radius: 7px; }
.mcf-chat__geometry--soft_pill { border-radius: 999px; }
.mcf-chat__geometry--notched { border-radius: 7px 7px 7px 2px; }
.mcf-chat__geometry--decree { border-radius: 3px 9px 3px 9px; }
.mcf-chat__geometry--ornamental { border-radius: 4px 10px; }
.mcf-chat__geometry--spectral { border-radius: 10px 4px 10px 4px; }
.mcf-chat__geometry--cosmic { border-radius: 5px 12px; }

/* Derivatives execute only after fixed-manifest resolution and the feed-wide budget grants the row. */
.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--static_material_wash,
.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--panel_crop,
.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--translucent_overlay,
.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--seamless_small_pattern {
  background-image:
    linear-gradient(color-mix(in srgb, #000 var(--mcf-chat-overlay-alpha), transparent), color-mix(in srgb, #000 var(--mcf-chat-overlay-alpha), transparent)),
    var(--mcf-chat-derivative-url),
    var(--mcf-chat-panel-color-layer);
  background-blend-mode: multiply, luminosity, normal;
  background-position: center, center, center;
  background-size: auto, cover, cover;
}
.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--seamless_small_pattern { background-size: auto, 64px 64px, cover; }
.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--edge_motif,
.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--border_strip {
  border-image: none;
  border-style: solid;
  border-color: var(--mcf-chat-panel-border);
}
.mcf-chat__motion-active.mcf-chat__motion-target--text.mcf-chat__motion--shimmer_slow .mcf-chat__text-treatment,
.mcf-chat__motion-active.mcf-chat__motion-target--username.mcf-chat__motion--shimmer_slow .mcf-chat__sender {
  animation:
    mcf-chat-shimmer 5.3s ease-in-out infinite alternate,
    mcf-chat-text-luster 7.9s ease-in-out -2.1s infinite alternate;
}
.mcf-chat__motion-active.mcf-chat__motion-target--text.mcf-chat__motion--pulse_soft .mcf-chat__text-treatment,
.mcf-chat__motion-active.mcf-chat__motion-target--username.mcf-chat__motion--pulse_soft .mcf-chat__sender { animation: mcf-chat-pulse 4.1s ease-in-out infinite; }
.mcf-chat__motion-active.mcf-chat__motion-target--text.mcf-chat__motion--spectral_drift .mcf-chat__text-treatment,
.mcf-chat__motion-active.mcf-chat__motion-target--username.mcf-chat__motion--spectral_drift .mcf-chat__sender {
  animation:
    mcf-chat-spectral 6.1s ease-in-out infinite alternate,
    mcf-chat-spectral-luster 8.7s ease-in-out -2.7s infinite alternate;
}
.mcf-chat__motion-active.mcf-chat__motion-target--text.mcf-chat__motion--star_twinkle .mcf-chat__text-treatment,
.mcf-chat__motion-active.mcf-chat__motion-target--username.mcf-chat__motion--star_twinkle .mcf-chat__sender { animation: mcf-chat-twinkle 4.7s ease-in-out -1.1s infinite; }

/* Panels need a larger paint surface before background-position can visibly travel. */
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__panel--soft_gradient_panel,
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__panel--layered_material_panel,
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__panel--translucent_spectral_panel,
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__panel--void_cosmic_panel,
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__panel--mythic_edict,
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__panel--cosmic_monarch_bubble,
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__panel--ethereal_reign_bubble {
  background-position: 0% 50%;
  background-size: 340% 160%;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__cosmetic-panel.mcf-chat__gradient--vertical { background-size: 160% 340%; }
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__cosmetic-panel.mcf-chat__gradient--diagonal_up,
.mcf-chat__motion-active.mcf-chat__motion-target--panel .mcf-chat__cosmetic-panel.mcf-chat__gradient--diagonal_down { background-size: 300% 300%; }
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__derivative-active .mcf-chat__cosmetic-panel {
  background-position: var(--mcf-chat-material-motion-start, center, 0% 50%, 0% 50%);
  background-size: auto, 170% auto, 340% 160%;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__gradient--vertical { background-size: auto, auto 190%, 160% 340%; }
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__derivative-active .mcf-chat__cosmetic-panel.mcf-chat__derivative--seamless_small_pattern {
  background-size: auto, 72px 72px, 340% 160%;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__motion--shimmer_slow .mcf-chat__cosmetic-panel {
  animation:
    mcf-chat-panel-shimmer 5.7s ease-in-out infinite alternate,
    mcf-chat-panel-shimmer-glow 8.9s ease-in-out -2.3s infinite alternate;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__motion--pulse_soft .mcf-chat__cosmetic-panel { animation: mcf-chat-panel-pulse 4.1s ease-in-out -0.9s infinite; }
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__motion--spectral_drift .mcf-chat__cosmetic-panel {
  animation:
    mcf-chat-panel-spectral 7.1s ease-in-out infinite alternate,
    mcf-chat-panel-spectral-glow 9.7s ease-in-out -3.1s infinite alternate;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__motion--star_twinkle .mcf-chat__cosmetic-panel {
  animation:
    mcf-chat-panel-twinkle 5.3s ease-in-out infinite alternate,
    mcf-chat-panel-twinkle-glow 8.3s ease-in-out -1.9s infinite;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__motion--shimmer_slow.mcf-chat__derivative-active .mcf-chat__cosmetic-panel {
  animation:
    mcf-chat-panel-material-shimmer 5.7s ease-in-out infinite alternate,
    mcf-chat-panel-shimmer-glow 8.9s ease-in-out -2.3s infinite alternate;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__motion--spectral_drift.mcf-chat__derivative-active .mcf-chat__cosmetic-panel {
  animation:
    mcf-chat-panel-material-spectral 7.1s ease-in-out infinite alternate,
    mcf-chat-panel-spectral-glow 9.7s ease-in-out -3.1s infinite alternate;
}
.mcf-chat__motion-active.mcf-chat__motion-target--panel.mcf-chat__motion--star_twinkle.mcf-chat__derivative-active .mcf-chat__cosmetic-panel {
  animation:
    mcf-chat-panel-material-twinkle 5.3s ease-in-out infinite alternate,
    mcf-chat-panel-twinkle-glow 8.3s ease-in-out -1.9s infinite;
}
@keyframes mcf-chat-shimmer {
  from { background-position: var(--mcf-chat-motion-start, 0% 50%); }
  to { background-position: var(--mcf-chat-motion-end, 100% 50%); }
}
@keyframes mcf-chat-text-luster {
  from { filter: brightness(0.94) drop-shadow(0 0 1px currentColor); }
  to { filter: brightness(1.34) drop-shadow(0 0 5px currentColor); }
}
@keyframes mcf-chat-pulse {
  0%, 100% { opacity: 1; filter: brightness(0.92) drop-shadow(0 0 0 currentColor); }
  50% { opacity: 0.72; filter: brightness(1.72) drop-shadow(0 0 9px currentColor); }
}
@keyframes mcf-chat-spectral {
  from { background-position: var(--mcf-chat-motion-start, 0% 50%); }
  to { background-position: var(--mcf-chat-motion-end, 100% 50%); }
}
@keyframes mcf-chat-spectral-luster {
  from { filter: brightness(0.9) saturate(0.9) drop-shadow(0 0 1px currentColor); }
  to { filter: brightness(1.5) saturate(1.65) drop-shadow(0 0 7px currentColor); }
}
@keyframes mcf-chat-twinkle {
  0%, 100% { filter: brightness(0.9); text-shadow: 0 0 1px var(--mcf-chat-text-assist); }
  50% { filter: brightness(1.7); text-shadow: 0 0 14px var(--mcf-chat-text-assist), 0 0 4px #fff; }
}
@keyframes mcf-chat-panel-shimmer {
  from { background-position: var(--mcf-chat-motion-start, 0% 50%); }
  to { background-position: var(--mcf-chat-motion-end, 100% 50%); }
}
@keyframes mcf-chat-panel-shimmer-glow {
  from { filter: brightness(0.86) saturate(0.9) drop-shadow(0 0 0 var(--mcf-chat-panel-border)); }
  to { filter: brightness(1.52) saturate(1.58) drop-shadow(0 0 10px var(--mcf-chat-panel-border)); }
}
@keyframes mcf-chat-panel-pulse {
  0%, 100% { filter: brightness(0.84) saturate(0.9) drop-shadow(0 0 0 var(--mcf-chat-panel-border)); transform: scale(1); }
  50% { filter: brightness(1.55) saturate(1.65) drop-shadow(0 0 12px var(--mcf-chat-panel-border)); transform: scale(1.025); }
}
@keyframes mcf-chat-panel-spectral {
  from { background-position: var(--mcf-chat-motion-start, 0% 50%); }
  to { background-position: var(--mcf-chat-motion-end, 100% 50%); }
}
@keyframes mcf-chat-panel-spectral-glow {
  from { filter: brightness(0.78) saturate(0.8) hue-rotate(-12deg); }
  to { filter: brightness(1.55) saturate(1.8) hue-rotate(18deg); }
}
@keyframes mcf-chat-panel-twinkle {
  from { background-position: 12% 28%; }
  to { background-position: 88% 72%; }
}
@keyframes mcf-chat-panel-twinkle-glow {
  0%, 100% { filter: brightness(0.82) saturate(0.88) drop-shadow(0 0 0 var(--mcf-chat-panel-border)); }
  47% { filter: brightness(1.68) saturate(1.9) drop-shadow(0 0 18px var(--mcf-chat-panel-border)); }
}
@keyframes mcf-chat-panel-material-shimmer {
  from { background-position: var(--mcf-chat-material-motion-start, center, 0% 50%, 0% 50%); }
  to { background-position: var(--mcf-chat-material-motion-end, center, 100% 50%, 100% 50%); }
}
@keyframes mcf-chat-panel-material-spectral {
  from { background-position: var(--mcf-chat-material-motion-start, center, 0% 50%, 0% 50%); }
  to { background-position: var(--mcf-chat-material-motion-end, center, 100% 50%, 100% 50%); }
}
@keyframes mcf-chat-panel-material-twinkle {
  from { background-position: center, 35% 42%, 12% 28%; }
  to { background-position: center, 65% 58%, 88% 72%; }
}

.mcf-chat__royal-bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border: 2px solid #ffd469;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 217, 104, 0.22), rgba(117, 48, 191, 0.35)),
    #151325;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Royal typography is a King-state concern, independent of which bubble
   surface is active. Font-color recipes only paint this established type. */
.mcf-chat__royal-typography {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.32;
}

.mcf-chat__royal-bubble::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 16px;
  width: 12px;
  height: 12px;
  border-top: 2px solid #ffd469;
  border-left: 2px solid #ffd469;
  background: #241739;
  transform: rotate(45deg);
}

/* Authentication/safe-mode King messages have no cosmetic snapshot. */
.mcf-chat__royal-bubble:not(.mcf-chat__royal-bubble--cosmetic) {
  color: #fff8d8;
}

/* Equipped King cosmetics build on the recognizable production King bubble. */
.mcf-chat__royal-bubble--cosmetic {
  padding: 11px 14px;
  border-color: var(--mcf-chat-panel-border, #ffd469);
  background-color: var(--mcf-chat-panel-primary, #151325);
  background-image:
    linear-gradient(118deg, rgba(255, 235, 157, 0.2), transparent 38%, rgba(255, 212, 105, 0.14)),
    linear-gradient(150deg, color-mix(in srgb, var(--mcf-chat-panel-primary) 88%, #26163b), color-mix(in srgb, var(--mcf-chat-panel-primary) 62%, #080d13));
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.36),
    0 0 10px color-mix(in srgb, var(--mcf-chat-panel-border, #ffd469) 38%, transparent),
    inset 0 0 0 1px rgba(255, 244, 199, 0.28),
    inset 0 -5px 12px rgba(0, 0, 0, 0.2);
}

.mcf-chat__royal-bubble--cosmetic::before {
  border-color: var(--mcf-chat-panel-border, #ffd469);
  background: color-mix(in srgb, var(--mcf-chat-panel-primary, #241739) 82%, #241739);
}

.mcf-chat__royal-bubble--cosmetic::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 8px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--mcf-chat-panel-border, #ffd469);
  background: color-mix(in srgb, var(--mcf-chat-panel-border, #ffd469) 64%, transparent);
  box-shadow: 0 0 6px var(--mcf-chat-panel-border, #ffd469);
  transform: rotate(45deg);
}

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--royal_tint {
  border-style: double;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.3),
    0 0 5px color-mix(in srgb, var(--mcf-chat-panel-primary) 28%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--mcf-chat-panel-border) 18%, transparent);
}
.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--royal_tint::after { display: none; }

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--king_border,
.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--decree_panel {
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.38),
    0 0 12px color-mix(in srgb, var(--mcf-chat-panel-border) 52%, transparent),
    inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--crownlit_bubble {
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.38),
    0 0 16px var(--mcf-chat-king-assist, #ffd469),
    inset 0 0 0 2px rgba(255, 248, 211, 0.2);
}
.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--crownlit_bubble::after {
  top: -7px;
  right: 18px;
  width: 14px;
  height: 10px;
  border: 0;
  clip-path: polygon(0 100%, 8% 20%, 32% 62%, 50% 0, 68% 62%, 92% 20%, 100% 100%);
  transform: none;
}

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--throne_material_bubble::after {
  top: auto;
  right: 9px;
  bottom: -6px;
  width: 16px;
  height: 8px;
  border: 0;
  clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
  transform: none;
}

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--mythic_edict,
.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--ethereal_reign_bubble {
  background-image:
    linear-gradient(118deg, rgba(255, 235, 157, 0.2), transparent 38%),
    linear-gradient(var(--mcf-chat-gradient-angle, 135deg), var(--mcf-chat-panel-primary), var(--mcf-chat-panel-secondary));
}

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--mythic_edict::after {
  top: 24%;
  right: -6px;
  width: 10px;
  height: 10px;
  border: 0;
  clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%);
  transform: none;
  box-shadow: 0 18px 0 color-mix(in srgb, var(--mcf-chat-panel-border) 72%, transparent);
}

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--ethereal_reign_bubble {
  border-width: 3px;
  background-size: 220% 100%;
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.42),
    0 0 18px color-mix(in srgb, var(--mcf-chat-panel-secondary) 64%, transparent),
    inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}
.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--ethereal_reign_bubble::after {
  top: 50%;
  right: -6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow:
    0 -11px 0 -2px color-mix(in srgb, var(--mcf-chat-panel-secondary) 84%, transparent),
    0 11px 0 -2px color-mix(in srgb, var(--mcf-chat-panel-primary) 84%, transparent),
    0 0 10px var(--mcf-chat-panel-border);
}

.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--cosmic_monarch_bubble {
  padding: 13px 17px;
  border-width: 3px;
  border-style: double;
  box-shadow:
    0 11px 28px rgba(0, 0, 0, 0.46),
    0 0 20px color-mix(in srgb, var(--mcf-chat-panel-border) 72%, transparent),
    0 0 7px var(--mcf-chat-panel-border),
    inset 0 0 0 2px rgba(255, 250, 222, 0.25),
    inset 0 -8px 18px rgba(0, 0, 0, 0.28);
}
.mcf-chat__royal-bubble--cosmetic.mcf-chat__panel--cosmic_monarch_bubble::after {
  top: 50%;
  right: -9px;
  width: 14px;
  height: 14px;
  border: 3px double var(--mcf-chat-panel-border);
  background: color-mix(in srgb, var(--mcf-chat-panel-primary) 76%, #171126);
  box-shadow:
    inset 0 0 0 2px #fff4bd,
    0 0 10px var(--mcf-chat-panel-border);
  transform: translateY(-50%) rotate(45deg);
}

/* Royal family rules are intentionally later than the generic derivative rule.
   Re-assert panel derivatives here so the real material remains the visible fill. */
.mcf-chat__derivative-active .mcf-chat__royal-bubble--cosmetic.mcf-chat__derivative--static_material_wash,
.mcf-chat__derivative-active .mcf-chat__royal-bubble--cosmetic.mcf-chat__derivative--panel_crop,
.mcf-chat__derivative-active .mcf-chat__royal-bubble--cosmetic.mcf-chat__derivative--translucent_overlay,
.mcf-chat__derivative-active .mcf-chat__royal-bubble--cosmetic.mcf-chat__derivative--seamless_small_pattern {
  background-image:
    linear-gradient(color-mix(in srgb, #000 var(--mcf-chat-overlay-alpha), transparent), color-mix(in srgb, #000 var(--mcf-chat-overlay-alpha), transparent)),
    var(--mcf-chat-derivative-url),
    var(--mcf-chat-panel-color-layer);
  background-blend-mode: multiply, luminosity, normal;
  background-position: center, center, center;
  background-size: auto, cover, cover;
}

.mcf-chat__private {
  padding: 7px 8px;
  border: 1px solid #31475a;
  border-radius: 7px;
  background: #101b25;
}

.mcf-chat__private .mcf-chat__meta {
  color: #ffd38a;
}

.mcf-chat__private-visual {
  display: block;
  margin: 6px 0 0;
  min-width: 0;
}

.mcf-chat__private-image {
  display: block;
  width: 100%;
  max-height: 220px;
  border: 1px solid #375066;
  border-radius: 7px;
  background: #081018;
  object-fit: contain;
  user-select: none;
}

.mcf-chat__private-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mcf-chat__private-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #42627a;
  border-radius: 7px;
  color: #d7f0ff;
  background: #142333;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
}

.mcf-chat__private-link:focus-visible {
  border-color: #74a6c8;
  color: #ffffff;
  text-decoration: underline;
}

@media (hover: hover) and (pointer: fine) {
  .mcf-chat__private-link:hover {
    border-color: #74a6c8;
    color: #ffffff;
    text-decoration: underline;
  }
}

.mcf-chat__vip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 15px;
  padding: 0 5px;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  user-select: none;
}

.mcf-chat__mod-badge {
  display: inline-flex;
  align-items: center;
  height: 15px;
  padding: 0 5px;
  border: 1px solid rgba(255, 211, 138, 0.72);
  border-radius: 999px;
  background: rgba(83, 52, 15, 0.72);
  color: #ffd38a;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.mcf-chat__royal-badge {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  flex: 0 0 auto;
  border: 1px solid #ffd469;
  border-radius: 999px;
  background: linear-gradient(135deg, #7d4df2, #b242d0 45%, #e8a931);
  color: #fff8d8;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
}

.mcf-chat__composer {
  position: relative;
  display: grid;
  gap: 0;
  padding: 7px 8px 8px;
  border-top: 1px solid #243443;
  background: #0b121a;
}

.mcf-chat__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.mcf-chat__input {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #355066;
  border-radius: 7px;
  background: #09131d;
  color: #dbeaf2;
  font-size: 16px;
  line-height: 1.25;
}

.mcf-chat__send {
  padding: 0 12px;
  border: 1px solid #3e637f;
  border-radius: 7px;
  background: #15304a;
  color: #dff2ff;
  font-weight: 700;
}

.mcf-chat__input:disabled,
.mcf-chat__send:disabled {
  opacity: 0.55;
}

.mcf-chat__suggestions {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 4px);
  display: grid;
  gap: 4px;
  max-height: 172px;
  padding: 6px;
  border: 1px solid #345064;
  border-radius: 7px;
  background: #0c1721;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
  z-index: 8;
}

.mcf-chat__suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #101e2a;
  color: #d9e8f0;
  text-align: left;
}

.mcf-chat__suggestion:focus {
  border-color: #4d7693;
}

@media (hover: hover) and (pointer: fine) {
  .mcf-chat__suggestion:hover {
    border-color: #4d7693;
  }
}

@media (hover: none), (pointer: coarse) {
  .mcf-chat button:hover {
    filter: none;
  }

  .mcf-chat__send:hover {
    border-color: #3e637f;
    background: #15304a;
    color: #dff2ff;
  }

  .mcf-chat__private-link:hover {
    border-color: #42627a;
    color: #d7f0ff;
    text-decoration: none;
  }

  .mcf-chat__suggestion:hover {
    border-color: transparent;
  }
}

@media (max-width: 520px) {
  .mcf-chat__username-decoration { display: none; }
  .mcf-chat__username-frame--soft_capsule,
  .mcf-chat__username-frame--underline_plate { padding-inline: 2px; border-left: 0; border-right: 0; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mcf-chat__message--cosmetic:not(.mcf-chat__motion-review-forced) * { animation: none !important; transition: none !important; }
}

@media (forced-colors: active), (prefers-contrast: more) {
  .mcf-chat__message--cosmetic .mcf-chat__text,
  .mcf-chat__message--cosmetic .mcf-chat__sender {
    color: CanvasText;
    background: Canvas;
    -webkit-text-fill-color: CanvasText;
    text-shadow: none;
    box-shadow: none;
  }
}

.mcf-chat__mod {
  color: #ffd38a;
  font-size: 10px;
}

.mcf-chat[data-collapsed="true"] .mcf-chat__body,
.mcf-chat[data-collapsed="true"] .mcf-chat__composer,
.mcf-chat[data-collapsed="true"] .mcf-chat__cosmetics-toggle {
  display: none;
}

.mcf-chat[data-collapsed="true"] .mcf-chat__header {
  grid-template-columns: 1fr;
  align-content: start;
  justify-items: center;
  min-height: 100%;
  padding: 8px 5px;
  border-bottom: 0;
  background: #0d1721;
  writing-mode: vertical-rl;
}

.mcf-chat[data-collapsed="true"] .mcf-chat__collapse {
  writing-mode: horizontal-tb;
}

.mcf-chat[data-presentation="portrait"] {
  border-radius: 8px;
}

.mcf-chat[data-presentation="portrait"] .mcf-chat__collapse {
  display: none;
}
