/* Chat-only styling; the customer page and CMS keep their existing styles. */
html.chat-page {
  height: 100%;
  overflow: hidden;
}
body[data-area="chat"] {
  --chat-green: #16a34a;
  --chat-ink: #333333;
  --chat-muted: #9a9a9a;
  --chat-line: #e5e5e5;
  background: #f4f5f7;
  color: var(--chat-ink);
  height: 100vh;
  height: var(--chat-height, 100dvh);
  position: fixed;
  top: 0;
  right: 0;
  bottom: auto;
  left: 0;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  touch-action: pan-y;
}
body[data-area="chat"] button { touch-action: manipulation; }
body[data-area="chat"] button:disabled { cursor: default; }
body[data-area="chat"] button:focus-visible,
body[data-area="chat"] summary:focus-visible {
  outline: 2px solid var(--chat-green);
  outline-offset: 2px;
}
body[data-area="chat"] .room-header {
  width: 100%;
  max-width: 760px;
  flex: none;
  padding: calc(7px + env(safe-area-inset-top, 0px)) 12px 7px;
  gap: 8px;
  background: #f4f5f7;
  color: var(--chat-ink);
  border-bottom: 1px solid var(--chat-line);
}
body[data-area="chat"] .room-header { display: none !important; }
.room-logo {
  display: none;
}
.room-heading { flex: 1; min-width: 0; }
body[data-area="chat"] .room-heading strong {
  display: block;
  font-size: 14px;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-area="chat"] #connection {
  display: block;
  color: var(--chat-muted);
  font-size: 10px;
  line-height: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body[data-area="chat"] #connection[data-tone="online"] { color: var(--chat-green); }
body[data-area="chat"] #connection[data-tone="offline"] { color: #a07235; }
.room-profile { display: flex; align-items: center; gap: 8px; min-width: 0; }
body[data-area="chat"] #identity { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #777777; font-size: 11px; }
body[data-area="chat"] #main { width: 100%; max-width: 760px; padding: 0; margin: 0; min-height: 0; flex: 1; overflow: hidden; background: #f2f3f5; position: relative; }
body[data-area="chat"] .chat { position: relative; isolation: isolate; max-width: none; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; display: flex; flex-direction: column; background: #f4f5f7; }
.chat-period-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; height: 28px; border-bottom: 1px solid #eeeeee; }
.chat-game { display: inline-flex; align-items: center; gap: 3px; min-width: 0; height: 27px; padding: 0; border: 0; background: transparent; color: #315b43; font-size: 14px; font-weight: 400; line-height: 27px; }
.chat-game { flex: none; white-space: nowrap; }
.chat-head-side { display: flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 0; flex: 1; color: #242424; }
.chat-head-stat { min-width: 10px; color: #242424; font-size: 12px; line-height: 26px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-head-player { max-width: 76px; overflow: hidden; text-overflow: ellipsis; color: #3d5147; }
.chat-head-balance { flex: none; color: #278453; font-weight: 600; }
.chat-head-balance[data-stale="true"] { color: #8b9690; }
.chat-head-latency, .chat-connection { flex: none; }
.chat-head-latency { min-width: 38px; color: #8b9690; font-size: 11px; }
.chat-head-latency[data-tone="good"] { color: #3b9a66; }
.chat-head-latency[data-tone="slow"] { color: #b2763f; }
.chat-connection { display: inline-flex; align-items: center; justify-content: center; width: 7px; height: 7px; padding: 0; border-radius: 50%; color: transparent; background: #d4a55c; font-size: 0; line-height: 0; white-space: nowrap; }
.chat-connection[data-tone="online"] { color: transparent; background: #22a464; }
.chat-connection[data-tone="offline"] { background: #d4a55c; }
/* Match the reference's 28 / 37 / 28px rows; never scale the entire chat. */
.chat-period-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 52px; align-items: center; gap: 4px; min-width: 0; height: 37px; }
.chat-issue { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #2f61b9; font-size: 14px; line-height: 26px; font-variant-numeric: tabular-nums; font-weight: 400; }
.chat-draw-numbers { display: flex; align-items: center; justify-content: center; gap: 1px; min-width: 0; overflow: hidden; }
.chat-ball { position: relative; overflow: hidden; display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border: 1.5px solid #1198df; border-radius: 50%; color: #333333; background: #ffffff; font-size: 14px; font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; }
.chat-ball[data-tone="red"] { border-color: #ff3434; }
.chat-ball-digit { display: grid; place-items: center; width: 100%; height: 100%; }
.chat-ball-reel { position: absolute; top: 0; left: 0; width: 100%; height: 2100%; }
.chat-ball-reel > .chat-ball-digit { height: calc(100% / 21); }
.chat-draw-anchor { position: relative; min-width: 0; }
body[data-area="chat"] .chat-draw-toggle { display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0; height: 37px; padding: 4px 0; border: 0; border-radius: 0; background: transparent; }
.chat-draw-chevron { display: grid; place-items: center; flex: none; width: 8px; height: 16px; color: #28516a; line-height: 0; transition: transform .15s; }
.chat-draw-chevron svg { display: block; width: 8px; height: 8px; }
.chat-draw-toggle[aria-expanded="true"] .chat-draw-chevron { transform: rotate(180deg); }
.chat-draw-history { position: absolute; z-index: 4; top: 100%; left: -5px; right: -5px; background: #fff; color: #203f58; box-shadow: 0 4px 10px #00000018; }
.chat-draw-history-scroll { max-height: min(210px, calc(var(--chat-height, 100dvh) - 125px)); overflow: auto; overscroll-behavior: contain; }
.chat-draw-table { table-layout: fixed; width: 100%; }
.chat-draw-table .draw-col-issue { width: 32px; }
.chat-draw-table .draw-col-time { width: 69px; }
.chat-draw-table .draw-col-fan { width: 57px; }
.chat-draw-table th, .chat-draw-table td { padding: 4px 2px; height: 28px; border: 0; text-align: center; font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; background: #fff; }
.chat-draw-table thead th { position: sticky; top: 0; z-index: 1; height: 22px; padding: 3px 2px; color: #fff; background: #36b4d9; }
.chat-history-numbers { display: flex; justify-content: center; gap: 1px; }
.chat-history-ball { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border: 1px solid #009de3; border-radius: 50%; font-size: 11px; line-height: 1; background: #fff; color: #214360; }
.chat-history-ball[data-tone="red"] { border-color: #ff3434; }
.chat-history-result { display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.chat-fan { display: inline-grid; place-items: center; width: 13px; height: 20px; border: 1px solid #305078; color: #142d48; background: #74aaff; font-size: 13px; line-height: 1; }
.chat-fan[data-fan="2"] { background: #62cf7a; }
.chat-fan[data-fan="3"] { background: #ffdc18; }
.chat-fan[data-fan="4"] { background: #ff515a; }
.chat-draw-history-footer { display: flex; justify-content: flex-end; align-items: center; gap: 12px; min-height: 25px; padding: 1px 8px; border-top: 1px solid #eef1f4; color: #8696a2; font-size: 10px; }
.chat-draw-history-footer > span { margin-right: auto; }
body[data-area="chat"] .chat-draw-history-footer button { padding: 3px 0; border: 0; color: #267ca6; font-size: 11px; background: transparent; }
.chat-draw-history-notice { padding: 14px 8px; text-align: center; color: #788a98; font-size: 12px; }
body[data-area="chat"] .chat-draw-backdrop { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: #0006; cursor: default; }
.chat-draw-numbers.is-revealing .chat-ball > .chat-ball-digit { animation: lottery-digit-reveal .35s ease-out var(--ball-delay, 0ms) both; }
.chat-draw-numbers.is-drawing .chat-ball-reel { animation: lottery-digit-roll 2.8s linear var(--ball-delay, 0ms) infinite; }
.chat-period.draw-updated .chat-period-row { animation: draw-row-flash .72s ease-out both; }
.chat-room-row { display: flex; align-items: center; justify-content: space-between; min-width: 0; height: 28px; border-top: 1px solid #eeeeee; border-bottom: 1px solid #d9d9d9; }
.chat-room-name { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0; border: 0; background: transparent; color: #343434; font-size: 14px; line-height: 26px; }
.chat-view-menu { position: absolute; z-index: 8; top: calc(93px + env(safe-area-inset-top, 0px)); left: 5px; min-width: 80px; padding: 4px 0; border: 1px solid #e1e4e6; border-radius: 0 0 3px 3px; background: #fff; box-shadow: 0 4px 12px #0002; }
.chat-view-menu[hidden], .chat-data-pane[hidden], .chat-chat-pane[hidden] { display: none; }
.chat-view-menu button { display: block; width: 100%; height: 32px; padding: 0 12px; border: 0; background: #fff; color: #4b4b4b; text-align: left; font-size: 13px; }
.chat-view-menu button:hover, .chat-view-menu button:focus-visible { background: #f1f7f9; color: #23799a; }
.chat-runtime { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #777777; font-size: 14px; line-height: 26px; font-variant-numeric: tabular-nums; }
.chat-runtime[data-tone="online"] { color: #4f8d6a; }
.chat-runtime[data-tone="offline"] { color: #b47b3d; }
.chat-countdown { justify-self: end; min-width: 0; color: #f33d38; font-size: 14px; font-weight: 400; line-height: 26px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-countdown[data-state="urgent"] { color: #df3d35; animation: countdown-pulse 1.2s ease-in-out infinite; }
.chat-countdown[data-state="closed"] { color: #b7673c; }
@keyframes countdown-pulse { 50% { opacity: .62; } }
@keyframes lottery-digit-reveal {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
@keyframes lottery-digit-roll {
  from { transform: translateY(-95.2380952381%); }
  to { transform: translateY(0); }
}
@keyframes draw-row-flash {
  0% { background: #fff3ef; }
  100% { background: transparent; }
}
.chat-status { display: none; flex: none; margin: 1px -9px -5px; padding: 3px 9px 4px; border-top: 1px solid #f1e8db; background: #fff8eb; color: #9a6a31; font-size: 9px; line-height: 15px; }
.chat-status[data-alert="true"] { display: block; }
.chat-status[data-state="Open"] { color: #13754f; background: #eaf7ef; border-color: #d9eee1; }
.chat-status[data-state="Closed"] { color: #9b6030; background: #fff5e6; }
body[data-area="chat"] .chat-bulletins { margin: 0; max-width: none; padding: 0 14px; flex: none; border: 0; border-bottom: 1px solid #ede5ce; border-radius: 0; background: #fff9e9; max-height: 140px; overflow: auto; overscroll-behavior: contain; }
body[data-area="chat"] .chat-bulletins h2 { margin: 7px 0 0; font-size: 11px; color: #a17d3b; }
body[data-area="chat"] .chat-bulletins details { border: 0; padding: 6px 0; color: #806636; }
body[data-area="chat"] .chat-bulletins .bulletin-body { max-height: 72px; margin: 6px 0; color: #796b4e; }
.chat-message-area { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-view-container, .chat-chat-pane, body[data-area="chat"] .chat-data-pane { display: flex; flex: 1; min-height: 0; flex-direction: column; }
body[data-area="chat"] .chat-data-pane { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #fff; overflow: hidden; }
body[data-area="chat"] .chat-data-pane[hidden], body[data-area="chat"] .chat-controls[hidden] { display: none; }
.chat-pane-heading { display: flex; align-items: center; gap: 8px; flex: none; min-height: 30px; padding: 0 8px; border-bottom: 1px solid #edf0f1; color: #3d5966; font-size: 12px; }
.chat-pane-heading .chat-pane-hint { margin-left: auto; }
.chat-pane-heading button { padding: 3px 6px; font-size: 11px; background: #fff; }
.chat-pane-heading .chat-view-ball { width: 56px; height: 26px; min-height: 0; margin: 0; padding: 0 2px; background: #fff; border: 1px solid #ddd; border-radius: 3px; font-size: 16px; }
.chat-pane-hint { color: #98a5aa; font-size: 10px; }
.chat-table-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.chat-order-table, .chat-result-table { width: 100%; table-layout: fixed; border-collapse: collapse; color: #4c555a; }
.chat-order-table th, .chat-order-table td, .chat-result-table th, .chat-result-table td { height: 25px; padding: 1px 2px; border: 0; text-align: center; font-size: 11px; font-weight: 400; vertical-align: middle; font-variant-numeric: tabular-nums; }
.chat-order-table thead th, .chat-result-table thead th { position: sticky; top: 0; z-index: 1; height: 29px; color: #63737a; background: #f5f7f8; }
.chat-order-table tbody th, .chat-result-table tbody th { background: #fff; }
.chat-result-table th:first-child { width: 9%; }
.chat-result-table th:nth-child(2) { width: 20%; }
.chat-order-table th:first-child { width: 24%; }
.chat-order-table th:nth-child(2) { width: 22%; }
.chat-order-table th:nth-child(3) { width: 22%; }
.chat-order-table td, .chat-order-table th { overflow-wrap: anywhere; }
.chat-order-table { white-space: normal; }
.chat-order-table td:last-child { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-result-tabs { display: flex; flex: none; gap: 5px; justify-content: flex-end; margin-left: auto; background: #fff; }
.chat-result-tabs button { min-width: 34px; height: 24px; padding: 0 5px; border: 1px solid #cfd6da; border-radius: 4px; background: #fff; color: #4d5e66; font-size: 11px; }
.chat-result-tabs button[aria-selected="true"] { border-color: #7751d5; background: #7751d5; color: #fff; }
.chat-result-table .chat-result-line { display: flex; align-items: center; justify-content: center; gap: 1px; min-width: 0; }
.chat-result-table .chat-history-ball, .chat-result-table .chat-result-pill { display: inline-grid; place-items: center; flex: none; width: clamp(16px, 4.6vw, 22px); height: clamp(16px, 4.6vw, 22px); border: 1px solid #009de3; border-radius: 50%; background: #fff; color: #274b61; font-size: 11px; line-height: 1; }
.chat-result-table .chat-result-pill { border: 0; background: #0063ff; color: #fff; font-size: 13px; }
.chat-result-table .chat-result-pill[data-fan] { border: 1px solid #305078; border-radius: 0; background: #669bfa; color: #142d48; }
.chat-result-table .chat-result-pill[data-fan="2"] { background: #33bd71; }
.chat-result-table .chat-result-pill[data-fan="3"] { background: #ffd51b; color: #534500; }
.chat-result-table .chat-result-pill[data-fan="4"] { background: #ff5055; }
.chat-result-table .chat-result-pill[data-kind="warm"] { background: #ffac2b; }
.chat-result-summary { display: inline-flex; flex: none; align-items: center; gap: 3px; margin-left: 3px; font-size: 11px; color: #555; }
.chat-result-table .chat-result-line > [data-tone="red"] { border-color: #ff3434; }
.chat-result-table .chat-result-pill[data-tone="red"] { box-shadow: 0 0 0 1px #ff3434 inset; }
.chat-pane-empty { padding: 28px 12px; color: #98a5aa; text-align: center; font-size: 12px; }
.chat-period { position: relative; z-index: 2; flex: none; display: grid; gap: 0; margin: 0; padding: env(safe-area-inset-top, 0px) 5px 0; background: #ffffff; box-shadow: 0 2px 8px #263b3010; backdrop-filter: blur(14px); font-size: 14px; }
body[data-area="chat"] .messages { flex: 1; height: auto; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 8px 9px 13px; background: #f2f3f5; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #d4d4d4 transparent; touch-action: pan-y; }
.chat-history-note { text-align: center; color: #9aa79f; font-size: 11px; line-height: 1.8; padding: 0 15px 10px; }
.chat-empty { min-height: 120px; display: grid; align-content: center; justify-items: center; color: #92a097; padding: 20px; gap: 6px; }
.chat-empty strong { color: #6c8274; font-size: 14px; }
.chat-empty p { margin: 0; font-size: 12px; text-align: center; }
.chat-time { text-align: center; color: #a7ada9; font-size: 9px; margin: 8px 0 10px; font-variant-numeric: tabular-nums; }
.message-row { display: flex; align-items: flex-start; gap: 7px; margin: 0 0 10px; }
.message-row.own { flex-direction: row-reverse; }
.chat-avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 5px; background: #e2e2e2; color: #999999; font-weight: 600; font-size: 15px; margin-top: 16px; user-select: none; }
.chat-avatar[data-hue="1"] { background: #e2e8ed; color: #7d8d9b; }
.chat-avatar[data-hue="2"] { background: #e9e3ec; color: #95829e; }
.chat-avatar[data-hue="3"] { background: #eee6dd; color: #a18d74; }
.message-row.own .chat-avatar { background: #dcebdc; color: #579064; }
.message-row.robot .chat-avatar { background: #f2e4e2; color: #c7665c; }
.chat-avatar.has-image { padding: 0; overflow: hidden; background: #eeeeee; }
.chat-avatar.has-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-avatar svg { width: 20px; height: 20px; }
.message-content { min-width: 0; max-width: min(83%, calc(100% - 48px)); display: flex; flex-direction: column; align-items: flex-start; }
.message-row.has-image .message-content { max-width: min(87%, calc(100% - 44px)); }
.own .message-content { align-items: flex-end; }
.chat-message-meta { display: flex; align-items: center; gap: 4px; font-size: 10px; line-height: 14px; margin: 0 1px 3px; max-width: 100%; color: #9a9a9a; }
.chat-message-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.chat-companion-badge { flex: none; padding: 0 4px; border: 1px solid #c8dce4; border-radius: 3px; background: #edf5f8; color: #406676; font-size: 10px; line-height: 14px; white-space: nowrap; }
.robot .chat-message-name { color: #e25a50; }
.chat-message-meta time { font-size: 10px; flex: none; opacity: .78; font-variant-numeric: tabular-nums; }
body[data-area="chat"] .bubble { position: relative; margin: 0; padding: 8px 10px; max-width: 100%; border: 0; border-radius: 3px 9px 9px; background: white; box-shadow: 0 1px 2px #22372b0b; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; user-select: text; }
body[data-area="chat"] .bubble.bot { background: white; }
.message-row.has-draw-result .message-content { width: 310px; max-width: calc(100% - 43px); }
body[data-area="chat"] .bubble.draw-result-card {
  width: 100%; padding: 8px 10px 9px; border-radius: 3px 9px 9px;
  color: #25282c; white-space: normal; line-height: 1.5; font-size: 14px;
  font-family: Arial, "Microsoft YaHei", sans-serif; font-variant-numeric: tabular-nums;
}
.draw-result-heading { display: flex; align-items: baseline; gap: 8px; font-weight: 700; }
.draw-result-time, .draw-result-period strong, .draw-result-number-text, .draw-result-values { color: #df3443; }
.draw-result-period { min-width: 0; overflow-wrap: anywhere; }
.draw-result-number-line { display: flex; align-items: baseline; gap: 3px; margin-top: 2px; }
.draw-result-label { flex: none; font-weight: 700; }
.draw-result-number-text { min-width: 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.draw-result-summary { display: flex; align-items: baseline; gap: 9px; margin: 3px 0 5px; }
.draw-result-values { display: inline-flex; gap: 17px; }
.draw-result-fan { min-width: 10px; }
.draw-result-ball-scope { margin-left: auto; color: #89939e; font-size: 10px; white-space: nowrap; }
.draw-result-balls { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px; }
.draw-result-ball {
  display: grid; place-items: center; width: 100%; max-width: 25px; aspect-ratio: 1;
  border: 1.3px solid #24a7db; border-radius: 50%; color: #e33345;
  background: radial-gradient(circle at 35% 28%, #ffffff 26%, #edf8ff 65%, #afd9ed 100%);
  box-shadow: inset 0 0 0 1px #ffffff, 0 1px 1px #548ea129;
  font: 700 13px/1 Arial, sans-serif; font-variant-numeric: tabular-nums;
}
.draw-result-ball[data-selected="true"] { border-color: #ed7884; background: radial-gradient(circle at 35% 28%, #fff 26%, #fff1f3 70%, #f3c5cc 100%); }
.draw-result-custom-text { margin-top: 7px; padding-top: 6px; border-top: 1px solid #edf0f2; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; font-weight: 400; }
@media (max-width: 340px) {
  body[data-area="chat"] .bubble.draw-result-card { padding: 7px 8px 8px; font-size: 13px; }
  .draw-result-number-line { gap: 1px; }
  .draw-result-number-text { font-size: 11px; letter-spacing: -.1px; }
  .draw-result-balls { gap: 5px; }
  .draw-result-ball { font-size: 12px; }
}
.message-row.has-draw-report .message-content { width: 286px; max-width: calc(100% - 43px); }
.draw-report-scope { margin-left: 3px; color: #959da6; font-size: 10px; }
body[data-area="chat"] .bubble.draw-report {
  width: 100%; padding: 6px; border-radius: 3px 8px 8px; box-shadow: none;
  white-space: normal; overflow-wrap: normal; word-break: normal; line-height: 1;
}
.draw-report-table { table-layout: fixed; width: 100%; white-space: nowrap; background: #f4f4f5; }
.draw-report-table .report-col-time { width: 35px; }
.draw-report-table .report-col-issue { width: 22px; }
.draw-report-table .report-col-result { width: 26px; }
.draw-report-table .report-col-fan { width: 14px; }
.draw-report-table .report-col-parity, .draw-report-table .report-col-size { width: 14px; }
.draw-report-head {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.draw-report-table tbody td, .draw-report-table tbody th {
  height: 16px; padding: 0; border: 0; text-align: center; background: transparent;
  font: 600 10px/16px Arial, "Microsoft YaHei", sans-serif; font-variant-numeric: tabular-nums;
  letter-spacing: 0; vertical-align: middle; color: #253546;
}
.draw-report-table .report-time { color: #ff355b; }
.draw-report-table .report-result { color: #ff6284; }
.draw-report-table .report-fan, .draw-report-table [data-tone="cool"] { color: #063be1; }
.draw-report-table [data-tone="warm"] { color: #ff3c6a; }
.message-row.has-draw-road .message-content { width: 286px; max-width: calc(100% - 43px); }
body[data-area="chat"] .bubble.draw-road {
  width: 100%; padding: 7px 9px; border-radius: 3px 8px 8px; line-height: 1;
  white-space: normal; overflow-wrap: normal; word-break: normal;
}
.draw-road-title { color: #202c39; font: 700 12px/18px Arial, "Microsoft YaHei", sans-serif; }
.draw-road-period { color: #6d7d89; font: 11px/18px Arial, "Microsoft YaHei", sans-serif; }
.draw-road-values {
  display: grid; grid-template-columns: repeat(10, minmax(18px, 1fr)); gap: 2px;
  margin-top: 2px; padding-top: 4px; border-top: 1px solid #edf0f2;
  max-height: 240px; overflow-y: auto; align-content: start; scrollbar-width: thin;
  overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
}
.draw-road-value {
  display: grid; place-items: center; min-height: 18px; border-radius: 2px;
  background: #f2f4f6; color: #2f4052; font: 600 11px/18px Arial, sans-serif;
}
.report-numbers { display: flex; justify-content: center; align-items: center; gap: 0; }
.report-ball {
  display: inline-grid; place-items: center; flex: none; width: 13px; height: 13px;
  border: 1px solid #009fe8; border-radius: 50%; color: #24445f; background: transparent;
  font: 400 9px/1 Arial, sans-serif; font-variant-numeric: tabular-nums;
}
@media (max-width: 340px) {
  .draw-report-table .report-col-time { width: 31px; }
  .draw-report-table .report-col-issue { width: 18px; }
  .draw-report-table .report-col-result { width: 23px; }
}
body[data-area="chat"] .own .bubble { background: #c9efbd; color: #315b38; border-radius: 10px 3px 10px 10px; }
.bubble.image-bubble { padding: 7px; overflow: hidden; background: #ffffff; }
.bubble.image-bubble img { display: block; width: min(100%, 360px); max-width: 100%; height: auto; border-radius: 7px; }
.image-caption { margin: 6px 3px 1px; color: #87988d; font-size: 10px; line-height: 1.4; }
.own .bubble.image-bubble .image-caption { color: #557a5d; }
.message-caption { display: block; margin-top: 5px; font-size: 10px; color: #87988d; }
.message-caption[data-kind="offline"] { color: #b28041; }
body[data-area="chat"] .jump-latest { position: absolute; bottom: 10px; right: 12px; padding: 7px 12px; border: 1px solid #dce8de; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--chat-green); background: white; box-shadow: 0 3px 12px #2343320d; }
.chat-controls { flex: none; background: #fafafa; border-top: 1px solid #dfe2e0; box-shadow: 0 -2px 10px #253a2e0a; padding-bottom: env(safe-area-inset-bottom, 0px); }
.chat-shortcuts { display: none; }
body[data-area="chat"] .chat-shortcuts button { min-width: 0; border: 1px solid #e0e6e2; padding: 6px 1px; background: white; color: #5b7663; font-size: 12px; border-radius: 6px; }
body[data-area="chat"] .chat-shortcuts button[data-command="取消"] { color: #ab705e; }
body[data-area="chat"] .compose { display: flex; align-items: flex-end; gap: 6px; padding: 6px 7px; }
body[data-area="chat"] .compose textarea { flex: 1; min-width: 0; min-height: 38px; height: 38px; max-height: 92px; resize: none; padding: 7px 9px; font-size: 16px; line-height: 22px; border-radius: 6px; border: 1px solid #d9ddda; outline: 0; background: white; }
body[data-area="chat"] .compose textarea:focus { border-color: #a8d5b0; box-shadow: 0 0 0 2px #16a34a0b; }
body[data-area="chat"] .compose button { height: 38px; flex: none; padding: 7px 12px; border-radius: 5px; }
body[data-area="chat"] .compose .primary { min-width: 52px; background: var(--chat-green); border-color: var(--chat-green); color: white; font-weight: 600; }
body[data-area="chat"] .compose .chat-ball-select { flex: none; width: 57px; min-width: 0; height: 38px; margin: 0; padding: 5px 2px; border: 1px solid #d9ddda; border-radius: 5px; background: white; color: #333; font-size: 16px; }
body[data-area="chat"] .compose .chat-ball-select[hidden] { display: none; }
body[data-area="chat"] .compose .keyboard-toggle { border: 0; padding: 5px 0; width: 28px; background: transparent; color: #929a95; }
body[data-area="chat"] .keyboard-toggle[aria-expanded="true"] { color: var(--chat-green); }
.keyboard-toggle svg { width: 24px; height: 24px; vertical-align: middle; }
.chat-compose-hint { display: none; }
.chat-keyboard { border-top: 1px solid #c9cdd6; background: #d2d5df; padding: 7px 9px; }
.chat-key-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.chat-key-row:last-child { margin-bottom: 0; }
body[data-area="chat"] .chat-key { min-width: 0; padding: 0; height: 28px; line-height: 26px; border-radius: 3px; font-size: 15px; font-weight: 600; background: #fff; border: 0; color: #101010; }
body[data-area="chat"] .chat-key.erase { color: #ff3038; font-size: 20px; font-weight: 400; }
body[data-area="chat"] .chat-key:active,
body[data-area="chat"] .chat-shortcuts button:active { background: #c9e7d0; transform: translateY(1px); }
body[data-area="chat"] #notice { position: fixed; z-index: 30; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(92vw, 680px); max-height: 25vh; overflow: auto; margin: 0; padding: 9px 12px; min-height: 0; border-radius: 7px; font-size: 12px; line-height: 1.55; background: #333333ed; color: white; box-shadow: 0 4px 18px #00000015; pointer-events: none; }
body[data-area="chat"] #notice:empty { display: none; }
body[data-area="chat"]>footer { width: 100%; max-width: 760px; flex: none; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); color: #8a9b90; font-size: 11px; background: #f0f3f1; }
body[data-area="chat"].room-ready>footer { display: none; }
body[data-area="chat"] .chat-entry { margin: 56px 20px 20px; padding: 28px 20px; text-align: center; border: 1px solid #e0e8e2; border-radius: 12px; background: white; }
.chat-entry-mark { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 15px; background: #edf5ef; color: #5b8d6b; font-size: 27px; }
body[data-area="chat"] .chat-entry h1 { font-size: 18px; margin: 0 0 10px; }
.chat-entry p { color: #89988e; margin: 0 0 20px; font-size: 13px; line-height: 1.9; }
body[data-area="chat"] .chat-entry button { border-color: #cde0d1; color: var(--chat-green); }
body[data-area="chat"] .chat-dialog { width: min(440px, calc(100vw - 24px)); max-height: 85dvh; overflow: auto; padding: 22px; margin: auto; border: 1px solid #dfe7e1; border-radius: 14px; color: var(--chat-ink); box-shadow: 0 20px 70px #203d3325; }
.chat-dialog::backdrop { background: #20342b66; }
.chat-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.chat-dialog p { color: #7f9184; font-size: 12px; line-height: 1.8; }
.chat-dialog form { display: block; }
.chat-dialog label { color: #66826f; }
.chat-dialog input { font-size: 16px; border-color: #dbe5dd; }
.chat-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
body[data-area="chat"] .chat-dialog .primary { background: var(--chat-green); border-color: var(--chat-green); }
.chat-dialog .dialog-error { color: #aa594c; white-space: pre-wrap; }
.chat-help-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; padding: 14px 0; font-size: 13px; line-height: 1.7; }
.chat-help-list code { color: var(--chat-green); font-size: 13px; }
.chat-help-list span { color: #7e8b83; }
@media (min-width: 800px) {
  body[data-area="chat"] { padding: 16px 0; }
  body[data-area="chat"] .room-header { border-radius: 14px 14px 0 0; }
  body[data-area="chat"] #main { border-radius: 0 0 14px 14px; box-shadow: 0 16px 60px #2446330a; }
  body[data-area="chat"] .chat-key { height: 38px; }
}
@media (max-width: 370px) {
  body[data-area="chat"] .room-header { padding-left: 12px; padding-right: 10px; gap: 8px; }
  body[data-area="chat"] #identity { max-width: 48px; }
  .chat-head-side { gap: 6px; }
  .chat-head-player { max-width: 58px; }
  .chat-head-balance { font-size: 11px; }
  .chat-head-latency { min-width: 34px; font-size: 10px; }
  body[data-area="chat"] .messages { padding-left: 7px; padding-right: 7px; }
  .chat-draw-table .draw-col-issue { width: 28px; }
  .chat-draw-table .draw-col-time { width: 58px; }
  .chat-draw-table .draw-col-fan { width: 52px; }
  .chat-period-row { gap: 3px; grid-template-columns: 70px minmax(0, 1fr) 46px; }
  .chat-issue, .chat-countdown { font-size: 13px; }
  .message-row { gap: 6px; }
  .chat-avatar { width: 33px; height: 33px; }
  .message-content { max-width: calc(100% - 42px); }
}
@media (max-width: 340px) {
  .chat-period-row { grid-template-columns: 64px minmax(0, 1fr) 40px; }
  .chat-issue, .chat-countdown { font-size: 12px; }
  .chat-ball { width: 22px; height: 22px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-draw-chevron { transition: none; }
  .chat-draw-numbers.is-revealing .chat-ball > .chat-ball-digit,
  .chat-draw-numbers.is-drawing .chat-ball-reel,
  .chat-period.draw-updated .chat-period-row { animation: none; }
}
@media (max-height: 560px) {
  body[data-area="chat"] .room-header { padding-top: 6px; padding-bottom: 6px; }
  .chat-compose-hint { display: none; }
  body[data-area="chat"] .chat-key { height: 26px; line-height: 24px; }
  .chat-shortcuts { padding-top: 5px; }
}
