/* Single-pane room tabs: roster, messages and composer share the chat pane. */
#game-panel-split {
  --room-chat-text: #e3eee8;
  --room-chat-muted: #96ada2;
  --room-chat-line: #29473a;
  --room-chat-surface: #0c211a;
  --room-chat-chip: #173229;
  --room-chat-accent: #8ed7b6;
  grid-template-rows: 44px minmax(0, 1fr);
  min-width: 0;
}
html[data-theme="light"] #game-panel-split {
  --room-chat-text: #173c35;
  --room-chat-muted: #61786c;
  --room-chat-line: #d0dbcf;
  --room-chat-surface: #fffdf8;
  --room-chat-chip: #eef3eb;
  --room-chat-accent: #215e4a;
}
#game-panel-split [hidden] { display: none !important; }
#game-panel-split .game-panel-tabs { border-color: var(--room-chat-line); }
#game-panel-split .game-panel-tab {
  color: var(--room-chat-muted) !important;
  background: var(--room-chat-surface) !important;
}
#game-panel-split .game-panel-tab.active {
  color: var(--room-chat-accent) !important;
  border-bottom-color: var(--room-chat-accent);
  background: var(--room-chat-chip) !important;
}
#game-panel-split .chat-section {
  grid-template-rows: var(--room-roster-height, 43%) 12px minmax(50px, 1fr) auto;
  min-height: 0;
  padding: 10px;
  gap: 4px;
}
#game-panel-split .room-chat-roster { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; color: var(--room-chat-text); }
#game-panel-split .room-chat-players { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
#game-panel-split .room-chat-person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--room-chat-line);
  border-radius: 7px;
  background: var(--room-chat-chip);
}
#game-panel-split .room-chat-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}
#game-panel-split .room-chat-avatar > * {
  width: 32px !important;
  height: 32px !important;
  font-size: 14px;
  flex: 0 0 32px;
}
#game-panel-split .room-chat-person-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
#game-panel-split .room-chat-person-name { color: var(--room-chat-text) !important; font-size: 12px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#game-panel-split .room-chat-person-role { font-size: 10px; line-height: 1.3; color: var(--room-chat-muted); }
#game-panel-split .room-chat-seat { margin-left: auto; width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
#game-panel-split .room-chat-seat.black { background: radial-gradient(circle at 30% 25%, #626762, #0a0d0b 70%); }
#game-panel-split .room-chat-seat.white { background: radial-gradient(circle at 30% 25%, #fff, #deded4 70%); border: 1px solid #aab9ae; }
#game-panel-split .room-chat-spectator-heading { display: flex; align-items: center; gap: 6px; margin: 5px 0; font-size: 11px; color: var(--room-chat-muted); }
#game-panel-split .room-chat-spectator-heading span { color: var(--room-chat-accent); font-weight: 600; }
#game-panel-split .room-chat-spectators { display: flex; flex-direction: column; gap: 4px; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; }
#game-panel-split .room-chat-spectators .room-chat-person { max-width: 100%; padding: 3px 6px; }
#game-panel-split .room-chat-spectators .room-chat-avatar,
#game-panel-split .room-chat-spectators .room-chat-avatar > * { width: 24px !important; height: 24px !important; flex-basis: 24px; font-size: 11px; }
#game-panel-split .room-chat-empty { font-size: 11px; color: var(--room-chat-muted); }
#game-panel-split .game-chat-box {
  color: var(--room-chat-text) !important;
  background: var(--room-chat-surface) !important;
  border-color: var(--room-chat-line) !important;
  min-width: 0;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}
#game-panel-split .game-chat-box:empty::before { content: "本局消息将在这里显示"; font-size: 12px; color: var(--room-chat-muted); }
#game-panel-split .chat-msg { padding: 8px; border-radius: 7px; background: var(--room-chat-chip); margin-bottom: 8px; }
#game-panel-split .room-chat-message-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--room-chat-muted); }
#game-panel-split .room-chat-message-heading > span { min-width: 0; overflow-wrap: anywhere; }
#game-panel-split .room-chat-message-heading time { white-space: nowrap; font-size: 10px; }
#game-panel-split .room-chat-message-body { margin-top: 3px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
#game-panel-split .room-chat-own { border-left: 2px solid var(--room-chat-accent); }
#game-panel-split .room-chat-system { padding: 4px 0; font-size: 11px; color: var(--room-chat-muted) !important; background: transparent; }
#game-panel-split .chat-input-row { min-width: 0; }
#game-panel-split .chat-input { min-width: 0; border-color: var(--room-chat-line) !important; }
#game-panel-split .chat-input::placeholder { color: var(--room-chat-muted) !important; opacity: 1; }
#game-panel-split .chat-send { background: #215e4a !important; color: #f4faf6 !important; border-color: #215e4a !important; }
#game-panel-split .chat-send:disabled { opacity: .45; }
@media (max-width: 1050px) {
  #game-panel-split { min-height: 360px; height: 420px; }
  #game-panel-split .room-chat-players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #game-panel-split .room-chat-player { gap: 5px; padding: 5px; }
  #game-panel-split .room-chat-person-name { font-size: 11px; }
}

/* Keep game facts legible and compact in both themes. */
body.view-game-view .room-info-compact {
  --room-info-text: #e3eee8;
  --room-info-muted: #a3b8ae;
  --room-info-line: #29473a;
  --room-info-fill: #173229;
  padding: 10px 12px;
}
html[data-theme="light"] body.view-game-view .room-info-compact {
  --room-info-text: #173c35;
  --room-info-muted: #546e61;
  --room-info-line: #d0dbcf;
  --room-info-fill: #eef3eb;
}
body.view-game-view .room-info-compact .room-info-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
body.view-game-view .room-info-compact .room-panel-title { color: var(--room-info-text) !important; font-size: 13px; font-weight: 700; line-height: 1.5; }
body.view-game-view #room-info-move-count { color: var(--room-info-text); background: var(--room-info-fill); padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 600; }
body.view-game-view .room-info-compact .game-info-card { margin-top: 7px; gap: 5px; font-size: 12px; }
body.view-game-view .room-info-compact .room-info-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 10px; padding-bottom: 5px; border-bottom: 1px solid var(--room-info-line); color: var(--room-info-text); }
body.view-game-view .room-info-compact :is(.room-info-row, .room-winrate) { gap: 10px; align-items: baseline; }
body.view-game-view .room-info-compact :is(.room-info-row, .room-winrate) span { color: var(--room-info-muted) !important; font-weight: 500; }
body.view-game-view .room-info-compact strong { color: var(--room-info-text) !important; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
body.view-game-view .room-info-compact .ai-state-badge.error { color: #d5756b !important; }
html[data-theme="light"] body.view-game-view .room-info-compact .ai-state-badge.error { color: #ad3f34 !important; }
body.view-game-view .room-info-compact .room-winrate { display: flex; justify-content: space-between; margin-top: 0; padding-top: 5px; border-color: var(--room-info-line); }
body.view-game-view .room-info-compact .room-winrate strong { font-size: 12px; }

/* The roster and messages have separate scrolling; the composer stays visible. */
#game-panel-split .room-chat-divider { display: grid; place-items: center; cursor: row-resize; touch-action: none; border-radius: 4px; background: var(--room-chat-chip); user-select: none; }
#game-panel-split .room-chat-divider span { width: 40px; height: 3px; border-radius: 3px; background: var(--room-chat-muted); }
#game-panel-split .room-chat-divider:is(:hover, :focus-visible, .dragging) { outline: 2px solid var(--room-chat-accent); outline-offset: -2px; }
