.chat-history {
  --chat-hue: 218;
  --chat-glass-base: hsl(var(--chat-hue) 77% 97%);
  --chat-glass-veil: rgb(255 255 255 / 56%);
  --chat-glass-center: rgb(255 255 255 / 84%);
  --chat-glass-grain: rgb(55 87 129 / 7%);
  --chat-metal-highlight: hsl(var(--chat-hue) 100% 98%);
  --chat-metal-silver: hsl(var(--chat-hue) 66% 82%);
  --chat-metal-mid: hsl(var(--chat-hue) 58% 52%);
  --chat-metal-deep: hsl(var(--chat-hue) 65% 33%);
  position: relative;
  isolation: isolate;
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  overflow: clip;
}

.chat-glass {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: var(--chat-glass-base);
}

.chat-glass span {
  position: absolute;
  width: 75%;
  height: 98%;
  border-radius: 64% 36% 62% 38% / 57% 48% 52% 43%;
  background:
    radial-gradient(ellipse at 30% 22%, var(--chat-metal-highlight), transparent 52%),
    linear-gradient(138deg, var(--chat-metal-mid) 8%, var(--chat-metal-silver) 30%,
      var(--chat-metal-highlight) 47%, var(--chat-metal-mid) 61%,
      var(--chat-metal-deep) 72%, var(--chat-metal-silver) 92%);
  opacity: .55;
  filter: blur(12px);
  will-change: transform;
  animation: chat-metal-drift 14s ease-in-out -2.4s infinite alternate;
}

.chat-glass span:first-child {
  top: -39%;
  left: 40%;
}

.chat-glass span:nth-child(2) {
  bottom: -51%;
  left: -28%;
  width: 86%;
  animation-delay: -9s;
  animation-duration: 18s;
}

[data-pattern="ribbons"] .chat-glass span {
  width: 117%;
  height: 38%;
  border-radius: 78% 22% 72% 28% / 90% 33% 67% 10%;
}
[data-pattern="ribbons"] .chat-glass span:first-child { top: 12%; left: 26%; }
[data-pattern="ribbons"] .chat-glass span:nth-child(2) { bottom: 3%; left: 3%; }

[data-pattern="pebbles"] .chat-glass span {
  width: 49%;
  height: 57%;
  border-radius: 55% 45% 60% 40% / 47% 60% 40% 53%;
}
[data-pattern="pebbles"] .chat-glass span:first-child { top: 7%; left: 63%; }
[data-pattern="pebbles"] .chat-glass span:nth-child(2) { bottom: -10%; left: 9%; }

[data-pattern="canopy"] .chat-glass span:first-child { top: -72%; left: -20%; width: 148%; height: 127%; }
[data-pattern="canopy"] .chat-glass span:nth-child(2) { bottom: -66%; left: 56%; }

[data-pattern="crossing"] .chat-glass span {
  width: 26%;
  height: 122%;
  border-radius: 90% 44% 90% 23%;
}
[data-pattern="crossing"] .chat-glass span:first-child { top: -5%; left: 68%; }
[data-pattern="crossing"] .chat-glass span:nth-child(2) { bottom: -58%; left: 30%; width: 28%; }

[data-pattern="petals"] .chat-glass span {
  width: 64%;
  height: 62%;
  border-radius: 6% 74% 21% 78% / 27% 77% 22% 67%;
}
[data-pattern="petals"] .chat-glass span:first-child { top: 32%; left: 52%; }
[data-pattern="petals"] .chat-glass span:nth-child(2) { bottom: 44%; left: 11%; }

[data-pattern="rings"] .chat-glass span {
  background: radial-gradient(ellipse, transparent 37%, var(--chat-metal-silver) 42%,
    var(--chat-metal-mid) 54%, var(--chat-metal-highlight) 61%, transparent 66%);
  border-radius: 50%;
}
[data-pattern="rings"] .chat-glass span:first-child { top: 2%; left: 40%; }
[data-pattern="rings"] .chat-glass span:nth-child(2) { bottom: -51%; left: 3%; }

.chat-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle, var(--chat-glass-grain) .5px, transparent .85px) 0 0 / 4px 4px,
    linear-gradient(90deg, var(--chat-glass-center), var(--chat-glass-veil));
}

.chat-history > .messages {
  position: relative;
  min-width: 0;
}

@keyframes chat-metal-drift {
  0% { transform: translate(-17%, -8%) rotate(-23deg) scale(.92, 1.08); }
  48% { transform: translate(10%, 8%) rotate(9deg) scale(1.14, .85); }
  100% { transform: translate(-6%, 19%) rotate(38deg) scale(.94, 1.16); }
}

.main {
  --chat-hue: 218;
  position: relative;
}

.main.room-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  animation: room-inward-glow 5s ease-out both;
}

@keyframes room-inward-glow {
  0% { box-shadow: inset 0 0 0 0 hsl(var(--chat-hue) 76% 46% / 0); }
  16% { box-shadow: inset 0 0 46px 12px hsl(var(--chat-hue) 76% 46% / .55); }
  68% { box-shadow: inset 0 0 32px 8px hsl(var(--chat-hue) 76% 46% / .36); }
  100% { box-shadow: inset 0 0 0 0 hsl(var(--chat-hue) 76% 46% / 0); }
}

@media (max-width: 760px) {
  .app.mobile-work-open .chat-history { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-glass span { animation: chat-metal-drift 14s ease-in-out -2.4s infinite alternate !important; }
  .chat-glass span:nth-child(2) { animation-duration: 18s !important; animation-delay: -9s !important; }
  .main.room-pulse::after { animation: room-inward-glow 5s ease-out both !important; }
}

.reduce-chat-motion .chat-glass span { animation: none; }

.brand .brand-wordmark,
.brand .brand-wordmark img {
  display: block;
  width: 150px;
  max-width: 100%;
  height: auto;
  flex-shrink: 1;
  min-width: 0;
}

.brand .brand-still,
.pause-brand .brand-motion { display: none; }
.pause-brand .brand .brand-still { display: block; }

@media (forced-colors: active) {
  .chat-glass { display: none; }
}
