.scene-chat {
  position: absolute;
  z-index: 20;
  left: 18px;
  bottom: 18px;
  width: min(382px, calc(100vw - 36px));
  padding: 8px 12px 9px;
  color: #14234b;
  background: rgba(255, 253, 242, .66);
  border: 2px solid #203258;
  border-radius: 15px;
  box-shadow: 0 4px 0 rgba(21, 38, 72, .18), inset 0 0 0 3px rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  font-size: 14px;
  line-height: 1.5;
}
.scene-chat [hidden] { display: none !important; }
.scene-chat__header { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid #ccd1df; }
.scene-chat__tabs { display: flex; min-width: 0; gap: 0; }
.scene-chat__tabs button { position: relative; min-width: 44px; min-height: 44px; padding: 2px 13px 6px; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; }
.scene-chat__tabs button[aria-selected="true"] { color: #2855eb; }
.scene-chat__tabs button[aria-selected="true"]::after { content: ''; position: absolute; height: 3px; bottom: -1px; left: 8px; right: 8px; border-radius: 3px; background: #2855eb; }
.scene-chat__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 4px 0; }
.scene-chat__latest { flex: none; min-height: 44px; padding: 5px 8px; border: 1px solid #667c9c; border-radius: 6px; background: #fffdf2b8; color: #234890; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.scene-chat__toggle { margin-left: auto; flex: none; min-width: 44px; min-height: 44px; padding: 4px 6px; border: 1px solid #667c9c; border-radius: 7px; background: #fffdf2b8; color: #234890; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.scene-chat__summary { flex: 1; min-width: 0; font-size: 13px; font-weight: 800; }
.scene-chat.is-collapsed { width: min(290px, calc(100vw - 36px)); padding-top: 6px; padding-bottom: 6px; }
.scene-chat.is-collapsed .scene-chat__header { border-bottom: 0; }
.scene-chat__history { --chat-history-height: 99px; display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: 5px; }
.scene-chat__progress { writing-mode: vertical-lr; direction: ltr; appearance: none; -webkit-appearance: none; align-self: stretch; width: 18px; height: var(--chat-history-height); margin: 0; padding: 0; cursor: ns-resize; background: transparent; touch-action: none; }
.scene-chat__progress::-webkit-slider-runnable-track { width: 5px; border-radius: 4px; background: #314a7430; }
.scene-chat__progress::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 13px; height: 26px; margin-left: -4px; border: 1px solid #3b537e; border-radius: 5px; background: #a8bddb; }
.scene-chat__progress::-moz-range-track { width: 5px; border-radius: 4px; background: #314a7430; }
.scene-chat__progress::-moz-range-thumb { width: 13px; height: 26px; border: 1px solid #3b537e; border-radius: 5px; background: #a8bddb; }
.scene-chat__conversation { height: var(--chat-history-height); overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; scrollbar-width: none; }
.scene-chat__conversation::-webkit-scrollbar { display: none; }
.scene-chat__messages { display: flow-root; list-style: none; margin: 0; padding: 0; }
.scene-chat__message { display: flex; align-items: flex-start; gap: 7px; margin: 4px 0; }
.scene-chat__message > div { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.scene-chat__message b { font-weight: 700; }
.scene-chat__avatar { display: inline-block; flex: 0 0 25px; width: 25px; height: 29px; background-repeat: no-repeat; image-rendering: pixelated; }
.scene-chat__message img { display: block; max-width: 160px; max-height: 90px; margin: 5px 0; border-radius: 4px; object-fit: contain; }
.scene-chat__time { margin-left: 7px; color: #596a84; font-size: 10px; white-space: nowrap; }
.scene-chat__legacy { margin-left: 6px; color: #74818d; font-size: 9px; }
.scene-chat__image-note { display: block; color: #687794; font-size: 11px; }
.scene-chat__form { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
.scene-chat__form textarea { min-width: 0; flex: 1; height: 44px; min-height: 44px; max-height: 90px; box-sizing: border-box; resize: none; padding: 8px 10px; border: 1.5px solid #adb8d2; border-radius: 7px; background: rgba(255,255,255,.84); color: #14234b; font: inherit; line-height: 20px; }
.scene-chat__form textarea::placeholder { color: #8895b1; }
.scene-chat__send { display: grid; place-items: center; flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 7px; background: #2855eb; color: #fff; cursor: pointer; }
.scene-chat__send img { display: block; filter: brightness(0) invert(1); }
.scene-chat__send:hover { background: #1946d5; }
.scene-chat :focus-visible { outline: 3px solid #f2b93c; outline-offset: 2px; }
.scene-chat__status { min-height: 16px; margin: 5px 0 0; color: #687794; font-size: 11px; }
.scene-chat__status.is-error { color: #a03c2f; }
@media (max-height: 520px) {
  .scene-chat { left: 12px; bottom: 12px; width: 300px; padding: 6px 10px; border-radius: 12px; font-size: 13px; }
  .scene-chat__tabs button { min-width: 44px; min-height: 44px; font-size: 15px; padding-bottom: 4px; }
  .scene-chat__send { flex-basis: 44px; width: 44px; min-height: 44px; }
  .scene-chat__history { --chat-history-height: 62px; }
  .scene-chat__form { margin-top: 5px; }
  .scene-chat__form textarea { height: 44px; min-height: 44px; padding: 10px 8px; font-size: 13px; }
  .scene-chat__status { font-size: 9px; margin-top: 3px; }
}
@media (max-width: 540px) {
  .scene-chat { left: 10px; bottom: 78px; width: min(325px, calc(100vw - 20px)); }
}
@media (max-width: 680px) and (orientation: landscape) {
  .scene-chat { width: min(248px, 43vw); bottom: 10px; }
  .scene-chat__tabs button { padding-left: 5px; padding-right: 5px; }
  .scene-chat__history { --chat-history-height: 40px; }
}
