.arena-chat {
  --chat-navy: var(--blue);
  --chat-blue: var(--action);
  --chat-muted: var(--muted);
  --chat-pale: var(--pale);
  --chat-border: var(--line);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 720px;
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--chat-border);
  border-top: 2px solid var(--arena-accent);
  font-family: var(--font, "InterVariable", "Noto Sans SC", sans-serif);
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden;
}

.arena-chat *, .arena-chat *::before, .arena-chat *::after { box-sizing: border-box; }
.arena-chat [hidden] { display: none !important; }
.arena-chat button, .arena-chat textarea { font: inherit; }
.arena-chat button { cursor: pointer; }
.arena-chat button:focus-visible, .arena-chat textarea:focus-visible, .arena-chat__messages:focus-visible {
  outline: 2px solid var(--chat-navy);
  outline-offset: 3px;
}
.arena-chat button:disabled, .arena-chat textarea:disabled { cursor: not-allowed; }
.arena-chat__header { padding: 16px 16px 12px; }
.arena-chat__heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.arena-chat__title { margin: 0; color: var(--chat-navy); font-size: 20px; font-weight: 600; line-height: 1.4; }
.arena-chat__identity { padding: 2px 8px; color: var(--chat-navy); background: var(--chat-pale); font-size: 14px; line-height: 1.6; white-space: nowrap; }
.arena-chat__caption { margin: 4px 0 0; color: var(--chat-muted); font-size: 14px; line-height: 1.6; }
.arena-chat__tabs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--chat-border); border-bottom: 1px solid var(--chat-border); }
.arena-chat__tab { position: relative; display: flex; min-width: 0; min-height: 76px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 4px; color: var(--chat-muted); background: var(--surface); border: 0; font-size: 16px; font-weight: 600; line-height: 1.5; }
.arena-chat__tab + .arena-chat__tab { border-left: 1px solid var(--chat-border); }
.arena-chat__tab:hover { color: var(--chat-navy); background: var(--arena-hover); }
.arena-chat__tab.is-active { color: var(--chat-navy); background: var(--chat-pale); }
.arena-chat__tab.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; content: ""; background: var(--chat-blue); }
.arena-chat__tab-label { display: flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; }
.arena-chat__tab-label svg { flex: 0 0 16px; }
.arena-chat__tab-label > span { overflow-wrap: anywhere; }
.arena-chat__online { color: var(--chat-muted); font-size: 14px; font-weight: 400; font-variant-numeric: tabular-nums; line-height: 1.6; }
.arena-chat__online::before { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--positive); content: ""; vertical-align: 1px; }
.arena-chat__panel { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.arena-chat__room-note { flex: 0 0 auto; margin: 0; padding: 9px 16px; color: var(--chat-muted); background: var(--arena-raised); border-bottom: 1px solid var(--chat-border); font-size: 14px; line-height: 1.6; }
.arena-chat__body { position: relative; display: flex; flex: 1 1 auto; min-height: 120px; }
.arena-chat__messages { width: 100%; min-height: 0; padding: 16px 12px 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--arena-control) var(--arena-raised); }
.arena-chat__message { display: flex; gap: 8px; margin: 0 0 16px; }
.arena-chat__message:last-child { margin-bottom: 0; }
.arena-chat__avatar { display: flex; flex: 0 0 32px; width: 32px; height: 32px; align-items: center; justify-content: center; color: var(--chat-navy); background: var(--chat-pale); font-size: 14px; font-weight: 600; line-height: 1; }
.arena-chat__avatar--host { color: var(--arena-button-ink); background: var(--arena-button-bg); }
.arena-chat__message-content { flex: 1 1 auto; min-width: 0; }
.arena-chat__message-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; line-height: 1.6; }
.arena-chat__sender { min-width: 0; color: var(--chat-navy); font-weight: 600; overflow-wrap: anywhere; }
.arena-chat__time { flex: 0 0 auto; color: var(--chat-muted); font-variant-numeric: tabular-nums; }
.arena-chat__sender-role { display: block; margin-top: 0; color: var(--chat-muted); font-size: 14px; line-height: 1.6; }
.arena-chat__message-text { margin: 4px 0 0; color: var(--ink); font-size: 16px; font-weight: 400; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.arena-chat__message--own .arena-chat__avatar { color: var(--arena-button-ink); background: var(--chat-blue); }
.arena-chat__message--own .arena-chat__message-text { padding: 8px; background: var(--chat-pale); }
.arena-chat__new { position: absolute; bottom: 12px; left: 50%; z-index: 1; max-width: calc(100% - 32px); min-height: 44px; padding: 8px 16px; transform: translateX(-50%); color: var(--arena-button-ink); background: var(--arena-button-bg); border: 1px solid var(--chat-navy); box-shadow: 0 3px 10px #00356b26; font-size: 16px; font-weight: 600; white-space: nowrap; }
.arena-chat__new:hover { background: var(--action); }
.arena-chat__composer { flex: 0 0 auto; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--chat-border); }
.arena-chat__input-label { display: block; margin: 0 0 8px; color: var(--chat-navy); font-size: 16px; font-weight: 600; line-height: 1.5; }
.arena-chat__input { display: block; width: 100%; min-height: 72px; max-height: 144px; margin: 0; padding: 8px 10px; resize: vertical; color: var(--ink); background: var(--surface); border: 1px solid var(--arena-control); border-radius: 0; font-size: 16px; font-weight: 400; line-height: 1.5; }
.arena-chat__input::placeholder { color: var(--chat-muted); opacity: 1; }
.arena-chat__input:hover { border-color: var(--chat-navy); }
.arena-chat__input[aria-invalid="true"] { border-color: var(--negative); }
.arena-chat__help { margin: 6px 0 0; color: var(--chat-muted); font-size: 14px; line-height: 1.6; }
.arena-chat__error { margin: 6px 0 0; color: var(--negative); font-size: 14px; line-height: 1.6; }
.arena-chat__compose-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.arena-chat__character-count { color: var(--chat-muted); font-size: 14px; font-variant-numeric: tabular-nums; line-height: 1.6; }
.arena-chat__send, .arena-chat__switch-role { min-height: 44px; padding: 8px 20px; color: var(--arena-button-ink); background: var(--chat-blue); border: 1px solid var(--chat-blue); font-size: 16px; font-weight: 600; line-height: 1.5; }
.arena-chat__send:hover, .arena-chat__switch-role:hover { background: var(--chat-navy); border-color: var(--chat-navy); }
.arena-chat__send:disabled { color: var(--chat-muted); background: var(--chat-pale); border-color: var(--chat-border); }
.arena-chat__status { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; margin: 0; padding: 8px 16px; color: var(--chat-muted); background: var(--arena-raised); border-top: 1px solid var(--chat-border); font-size: 14px; line-height: 1.6; }
.arena-chat__status-dot { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
.arena-chat__status.is-paused .arena-chat__status-dot { background: var(--arena-gold); }
.arena-chat__locked { display: flex; flex: 1 1 auto; min-height: 0; align-items: center; justify-content: center; flex-direction: column; padding: 32px 24px; text-align: center; overflow-y: auto; }
.arena-chat__lock-icon { display: flex; flex: 0 0 56px; width: 56px; height: 56px; align-items: center; justify-content: center; margin-bottom: 16px; color: var(--chat-navy); background: var(--chat-pale); }
.arena-chat__lock-title { margin: 0; color: var(--chat-navy); font-size: 20px; font-weight: 600; line-height: 1.4; }
.arena-chat__lock-text { margin: 12px 0 24px; color: var(--chat-muted); font-size: 16px; line-height: 1.6; }
.arena-chat__switch-role { max-width: 100%; white-space: normal; }
.arena-chat__lock-footnote { margin: 12px 0 0; color: var(--chat-muted); font-size: 14px; line-height: 1.6; }
.arena-chat__sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 47.999rem) {
  .arena-chat { height: 720px; }
}

@media (prefers-reduced-motion: reduce) {
  .arena-chat *, .arena-chat *::before, .arena-chat *::after { scroll-behavior: auto !important; }
}
