.global-chat-launcher {
  position: fixed;
  z-index: 2147483000;
  top: 72px;
  right: 14px;
  display: inline-grid;
  grid-template-columns: 1fr;
  width: max-content;
  min-width: 58px;
  min-height: 38px;
  align-items: center;
  overflow: hidden;
  border: 2px solid #ffe08a;
  border-radius: 6px;
  background: #d82736;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48), 0 0 0 3px rgba(255, 224, 138, 0.16);
  color: #fff;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  text-decoration: none;
}

/* 分析页面内的并行聊天面板：保留底层K线、图表和计算工具可继续操作。 */
.global-chat-panel {
  position: fixed;
  /* 高于父页面右下角的账号版本浮标，避免遮住聊天输入区和右侧控件。 */
  z-index: 2147483500;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: 42px 40px minmax(0, 1fr);
  width: min(1180px, 100vw);
  min-width: min(620px, 100vw);
  height: min(860px, 100vh);
  min-height: min(460px, 100vh);
  max-width: 100vw;
  max-height: 100vh;
  box-sizing: border-box;
  resize: both;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #cdd8e2;
  border-radius: 8px;
  background: #f3f5f8;
  box-shadow: 0 18px 48px rgba(39, 49, 61, 0.24);
}

.global-chat-panel::after {
  content: "↘ 拖拽缩放";
  position: absolute;
  right: 3px;
  bottom: 2px;
  z-index: 2;
  padding: 1px 4px;
  border: 1px solid #cdd8e2;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.94);
  color: #647773;
  font-size: 10px;
  line-height: 14px;
  pointer-events: none;
  white-space: nowrap;
}

.global-chat-panel[hidden] {
  display: none;
}

.global-chat-panel__header {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #d8dee7;
  border-radius: 7px 7px 0 0;
  background: #ffffff;
  color: #27313d;
  cursor: move;
  user-select: none;
}

.global-chat-panel__header::before {
  content: "↕";
  display: inline-grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid #a8d5c8;
  border-radius: 50%;
  color: #16846c;
  font-size: 13px;
  line-height: 1;
}

.global-chat-panel__header strong {
  color: #27313d;
  font-size: 15px;
  white-space: nowrap;
}

.global-chat-panel__ticker {
  min-width: 0;
  overflow: hidden;
  color: #768292;
  font-size: 11px;
  white-space: nowrap;
}

.global-chat-panel__ticker > span {
  display: inline-block;
  min-width: max-content;
  padding-left: 100%;
  animation: global-chat-ticker 44s linear infinite;
  animation-delay: -22s;
  will-change: transform;
}

@keyframes global-chat-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .global-chat-panel__ticker > span {
    padding-left: 0;
    animation: none;
  }
}

.global-chat-panel__minimize,
.global-chat-panel__close {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #d8dee7;
  border-radius: 5px;
  background: #ffffff;
  color: #27313d;
  font-size: 20px;
  line-height: 1;
}

.global-chat-panel__minimize {
  font-size: 20px;
  font-weight: 900;
}

.global-chat-panel__minimize:hover,
.global-chat-panel__minimize:focus-visible,
.global-chat-panel__close:hover,
.global-chat-panel__close:focus-visible {
  border-color: #8fc9b9;
  background: #e5f4ef;
  color: #16846c;
  outline: 2px solid #8fc9b9;
  outline-offset: 1px;
}

.global-chat-restore {
  position: fixed;
  z-index: 2147483501;
  left: 16px;
  display: inline-flex;
  min-width: 100px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 2px solid #ffe08a;
  border-radius: 6px;
  background: #d82736;
  color: #fff;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .35);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

.global-chat-restore[hidden] { display: none; }
.global-chat-restore span { display: inline-grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; background: #fff; color: #b80f21; }
.global-chat-restore:hover,
.global-chat-restore:focus-visible { border-color: #fff; background: #f03643; outline: 2px solid #fff; outline-offset: 2px; }

.global-chat-panel__frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #f3f5f8;
}

/* 批TGWDEV661：模拟账号管理是独立的非模态工作窗，主页面仍可继续操作。 */
.global-simulated-operations-panel {
  position: fixed;
  z-index: 2147483600;
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  width: min(1120px, calc(100vw - 20px));
  min-width: min(620px, 100vw);
  height: min(780px, calc(100vh - 20px));
  min-height: min(420px, 100vh);
  max-width: 100vw;
  max-height: 100vh;
  box-sizing: border-box;
  resize: both;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #57717d;
  border-radius: 6px;
  background: #0f1a21;
  box-shadow: 0 18px 52px rgba(0, 0, 0, .52);
}

.global-simulated-operations-panel[hidden] { display: none; }

.global-simulated-operations-panel::after {
  content: "↘ 拖拽缩放";
  position: absolute;
  right: 3px;
  bottom: 2px;
  z-index: 2;
  padding: 1px 4px;
  border: 1px solid #57717d;
  border-radius: 3px;
  background: rgba(15, 26, 33, .94);
  color: #9fb4be;
  font-size: 10px;
  line-height: 14px;
  pointer-events: none;
  white-space: nowrap;
}

.global-simulated-operations-panel__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0 9px 0 13px;
  border-bottom: 1px solid #38505b;
  background: #182b35;
  color: #eef4f7;
  cursor: move;
  user-select: none;
}

.global-simulated-operations-panel__header strong { font-size: 15px; white-space: nowrap; }
.global-simulated-operations-panel__header > span { overflow: hidden; color: #9fb4be; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.global-simulated-operations-panel__minimize,
.global-simulated-operations-panel__close {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid #58727e;
  border-radius: 4px;
  background: #102029;
  color: #eef4f7;
  font-size: 20px;
  line-height: 1;
}

.global-simulated-operations-panel__minimize:hover,
.global-simulated-operations-panel__minimize:focus-visible,
.global-simulated-operations-panel__close:hover,
.global-simulated-operations-panel__close:focus-visible {
  border-color: #48c596;
  background: #174333;
  outline: 2px solid #48c596;
  outline-offset: 1px;
}

.global-simulated-operations-panel__frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #0f1a21;
}

.global-simulated-operations-restore {
  position: fixed;
  z-index: 2147483601;
  left: 128px;
  display: inline-flex;
  min-width: 126px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 2px solid #77d8b2;
  border-radius: 6px;
  background: #126247;
  color: #fff;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .38);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.global-simulated-operations-restore[hidden] { display: none; }
.global-simulated-operations-restore span { display: inline-grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; background: #fff; color: #126247; }
.global-simulated-operations-restore:hover,
.global-simulated-operations-restore:focus-visible { border-color: #fff; background: #16865f; outline: 2px solid #fff; outline-offset: 2px; }

.global-chat-panel__nav {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid #d8dee7;
  background: #eef1f5;
  scrollbar-width: thin;
}

.global-chat-panel__nav button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid #c5d1dc;
  border-radius: 5px;
  background: #ffffff;
  color: #31404d;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.global-chat-panel__nav button:hover,
.global-chat-panel__nav button:focus-visible,
.global-chat-panel__nav button[aria-current="page"] {
  border-color: #16846c;
  background: #dff2ec;
  color: #0f6757;
  outline: none;
}

.global-chat-launcher[hidden] {
  display: none;
}

.global-chat-launcher:hover,
.global-chat-launcher:focus-visible {
  border-color: #fff2bd;
  background: #f03643;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.56), 0 0 0 4px rgba(255, 224, 138, 0.24);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.global-chat-launcher__mark {
  display: none;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  margin-left: 3px;
  border-radius: 50%;
  background: #fff;
  color: #b80f21;
  font-size: 13px;
}

.global-chat-launcher__text {
  display: grid;
  place-items: center;
  padding: 4px 10px;
  text-align: center;
}

.global-chat-launcher__text small {
  display: none;
}

.global-chat-launcher--toolbar,
.global-chat-launcher--chart-toolbar {
  position: static;
  z-index: auto;
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 34px;
  height: 34px;
  grid-template-columns: 1fr;
  border-width: 2px;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.34);
}

.global-live-channel-link {
  position: static;
  z-index: auto;
  min-width: 76px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  margin-left: 3px;
  padding: 0 9px;
  border: 2px solid #3faeff;
  border-radius: 5px;
  background: #075f9d;
  color: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.global-live-channel-link--welfare {
  border-color: #ffd35c;
  background: #986100;
  color: #fff8dc;
}

.global-live-channel-link--sports {
  border-color: #61b9ff;
  background: #086aab;
}

.global-live-channel-link--platform {
  border-color: #ff7a8b;
  background: #b71931;
  cursor: pointer;
}

.global-live-channel-link:hover,
.global-live-channel-link:focus-visible {
  border-color: #fff;
  color: #fff;
  filter: brightness(1.18);
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.global-live-channel-link[hidden] {
  display: none;
}

.global-chat-launcher--toolbar {
  margin-left: 3px;
}

.global-chat-launcher--chart-toolbar {
  margin-left: 3px;
}

.global-chat-launcher--toolbar .global-chat-launcher__mark,
.global-chat-launcher--chart-toolbar .global-chat-launcher__mark {
  width: 23px;
  height: 23px;
  font-size: 13px;
}

.global-chat-launcher--toolbar .global-chat-launcher__text,
.global-chat-launcher--chart-toolbar .global-chat-launcher__text {
  padding-top: 3px;
  padding-bottom: 3px;
}

.global-chat-launcher--toolbar .global-chat-launcher__text small,
.global-chat-launcher--chart-toolbar .global-chat-launcher__text small {
  font-size: 8px;
}

dialog > .global-chat-launcher {
  top: 62px;
  right: 12px;
}

.global-moderation-notice {
  position: fixed;
  z-index: 2147483645;
  top: 68px;
  left: 50%;
  width: min(560px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 14px;
  padding: 14px 16px;
  border: 2px solid #f25d5d;
  border-radius: 6px;
  background: #111d27;
  color: #f4f8fb;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.48);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.global-moderation-notice strong,
.global-moderation-notice p,
.global-moderation-notice small { grid-column: 1; margin: 0; }
.global-moderation-notice strong { color: #ff8a8a; font-size: 17px; }
.global-moderation-notice p { line-height: 1.55; }
.global-moderation-notice small { color: #aec3d2; }
.global-moderation-notice button {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #78b6a7;
  border-radius: 5px;
  background: #14745c;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.global-moderation-notice--mute { border-color: #efb93f; }
.global-moderation-notice--mute strong { color: #ffd568; }
.global-moderation-notice--ban { border-color: #ff3f56; }

@media (max-width: 720px) {
  .global-moderation-notice {
    top: 52px;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .global-moderation-notice button {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }

  .global-chat-launcher,
  dialog > .global-chat-launcher {
    top: 58px;
    right: 7px;
    grid-template-columns: 1fr;
    min-width: 56px;
    min-height: 36px;
    font-size: 13px;
  }

  .global-chat-launcher__mark {
    width: 23px;
    height: 23px;
    font-size: 13px;
  }

  .global-chat-launcher__text small {
    font-size: 8px;
  }

  .global-chat-launcher--toolbar,
  .global-chat-launcher--chart-toolbar {
    position: static;
    min-width: 56px;
    min-height: 32px;
    height: 32px;
  }

  .global-live-channel-link {
    min-width: 66px;
    height: 32px;
    padding: 0 6px;
    font-size: 12px;
  }

  .global-chat-panel {
    width: min(100vw, 1180px);
    min-width: 0;
    height: min(860px, calc(100vh - 24px));
    min-height: 0;
  }

  .global-simulated-operations-panel {
    width: calc(100vw - 12px);
    min-width: 0;
    height: calc(100vh - 12px);
    min-height: 0;
  }

  .global-simulated-operations-panel__header > span { display: none; }
  .global-simulated-operations-restore { left: 76px; min-width: 118px; }
}
