/* 翻滩聊天室：底部输入工具条完全沿用幸运五样式；仅保留翻滩专属虚拟键盘与消息样式。 */
body[data-game-type="fantan"] .p5-bottom-panel.keyboard-open .p5-virtual-keyboard {
  flex-basis: 188px !important;
  height: 188px !important;
  min-height: 188px !important;
  max-height: 188px !important;
}

body[data-game-type="fantan"] .p5-virtual-keyboard,
body[data-game-type="fantan"] .p5-virtual-keyboard-inner {
  background: #d1d5df !important;
}

body[data-game-type="fantan"] .p5-virtual-keyboard-inner {
  padding: 6px 10px calc(8px + var(--p5-safe-bottom)) !important;
  gap: 5px !important;
}

body[data-game-type="fantan"] .p5-krow {
  gap: 7px !important;
}

body[data-game-type="fantan"] .p5-krow .p5-key {
  border-radius: 7px !important;
  background: #fff !important;
  color: #050505 !important;
  font-size: clamp(16px, 3.45vw, 20px) !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 0 rgba(0,0,0,.12) !important;
}

body[data-game-type="fantan"] .p5-krow .p5-key-backspace {
  color: #ef1616 !important;
  font-size: 22px !important;
}

body[data-game-type="fantan"] .p5-krow .p5-key-enter {
  background: #ffa000 !important;
  color: #fff !important;
}

body[data-game-type="fantan"] .p5-key-space {
  position: relative;
  color: transparent !important;
}

body[data-game-type="fantan"] .p5-key-space::before {
  content: "";
  width: 27px;
  height: 9px;
  border-left: 3px solid #9b9da2;
  border-right: 3px solid #9b9da2;
  border-bottom: 4px solid #9b9da2;
  border-radius: 0 0 2px 2px;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.robot .player-message-meta {
  display: none !important;
}

body[data-game-type="fantan"] #p5-messages .avatar.bot-avatar {
  background: #fff !important;
  font-size: 38px !important;
  line-height: 1 !important;
}

body[data-game-type="fantan"] #p5-messages .system-bubble {
  font-size: 18px !important;
  line-height: 1.38 !important;
}

/* 翻滩快选 */
.fantan-quickpick-root {
  position: fixed;
  inset: 0;
  z-index: 10000030;
  display: flex;
  justify-content: center;
  background: rgba(237,238,242,.82);
  overscroll-behavior: none;
}

.fantan-quickpick-root.hidden { display: none !important; }

.fantan-qp-shell {
  position: relative;
  width: min(100vw, 590px);
  height: 100dvh;
  overflow: hidden;
  background: #f4f4f6;
  box-shadow: 0 0 24px rgba(0,0,0,.13);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.fantan-qp-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(214px + env(safe-area-inset-bottom, 0px));
  background: #f7f7f9;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.fantan-road-section {
  min-height: 171px;
  padding: 7px 8px 9px;
  background: #f7f7f9;
  border-bottom: 1px solid #b9b9b9;
  box-sizing: border-box;
}

.fantan-road-title {
  width: 316px;
  max-width: 82vw;
  height: 28px;
  margin: 0 auto;
  border: 1px solid #aaa;
  border-bottom: 0;
  background: #d5d5d8;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: 5px;
  box-sizing: border-box;
}

.fantan-road-grid {
  width: 316px;
  max-width: 82vw;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  border-top: 1px solid #888;
  border-left: 1px solid #888;
  background: #fff;
}

.fantan-road-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #777;
  border-bottom: 1px solid #777;
  color: #090909;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  box-sizing: border-box;
}

.fantan-road-cell.fan-1 { background: #4da1ef; }
.fantan-road-cell.fan-2 { background: #52ce8a; }
.fantan-road-cell.fan-3 { background: #ffd91d; }
.fantan-road-cell.fan-4 { background: #ff5155; }
.fantan-road-empty { grid-column: 1 / -1; align-self: center; color: #8a969d; font-size: 12px; padding: 8px 4px; }

.fantan-main-board {
  position: relative;
  width: 100%;
  background: #fff;
  border-top: 1px solid #b9b9b9;
  border-left: 1px solid #b9b9b9;
  box-sizing: border-box;
  overflow: hidden;
}

/* 外围投注必须完整保留：上 34角/3念* /23角，下 14角/1念* /12角 */
.fantan-outer-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  height: clamp(74px, 17.7vw, 106px);
  background: #fff;
}

.fantan-outer-row .fantan-bet {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #b9b9b9;
  border-bottom: 1px solid #b9b9b9;
  box-sizing: border-box;
}

.fantan-main-center {
  display: grid;
  grid-template-columns: 20% 60% 20%;
  width: 100%;
  aspect-ratio: 447 / 238;
  background: #fff;
}

.fantan-side-column {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.fantan-side-column .fantan-bet {
  min-height: 0;
  border-right: 1px solid #b9b9b9;
  border-bottom: 1px solid #b9b9b9;
  box-sizing: border-box;
}

.fantan-fan-layout {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #b9b9b9;
  border-bottom: 1px solid #b9b9b9;
  box-sizing: border-box;
  background: #fff;
  overflow: hidden;
}

.fantan-bet {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 5px 3px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #242424;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.fantan-bet strong {
  font-size: clamp(13px, 3.15vw, 16px);
  font-weight: 600;
  line-height: 1.05;
  white-space: nowrap;
}

.fantan-bet .fantan-bet-stake {
  display: block;
  margin: 0;
  color: #3f3f3f;
  font-size: clamp(11px, 2.45vw, 13px);
  font-style: normal;
  font-weight: 500;
  line-height: 1;
}

.fantan-bet .fantan-bet-stake[hidden] { display: none; }

.fantan-bet.selected {
  background: #f6b3c2 !important;
  background-image: none !important;
  box-shadow: none !important;
  outline: 0 !important;
  transform: none !important;
}

.fantan-bet:active,
.fantan-bet.selected:active {
  transform: none !important;
}

.fantan-fan-layout .fan-shape {
  position: absolute;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  padding: 3px 2px;
  box-sizing: border-box;
  transform: none !important;
}

.fantan-fan-layout .fan-top {
  left: 0;
  top: 0;
  width: 100%;
  height: 33.3334%;
  background: #fee89a;
  clip-path: polygon(0 0, 100% 0, 75% 100%, 25% 100%);
}

.fantan-fan-layout .fan-bottom {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 33.3334%;
  background: #dedede;
  clip-path: polygon(25% 0, 75% 0, 100% 100%, 0 100%);
}

.fantan-fan-layout .fan-left {
  left: 0;
  top: 0;
  width: 25%;
  height: 100%;
  background: #f5aaa4;
  clip-path: polygon(0 0, 100% 33.3334%, 100% 66.6667%, 0 100%);
}

.fantan-fan-layout .fan-right {
  right: 0;
  top: 0;
  width: 25%;
  height: 100%;
  background: #9bd5c3;
  clip-path: polygon(100% 0, 0 33.3334%, 0 66.6667%, 100% 100%);
}

.fantan-fan-layout .fan-single,
.fantan-fan-layout .fan-double {
  top: 33.3334%;
  width: 25%;
  height: 33.3334%;
  background: #fff;
}

.fantan-fan-layout .fan-single { left: 25%; }
.fantan-fan-layout .fan-double { left: 50%; }

.fantan-fan-layout .fan-shape.selected {
  background: #f6b3c2 !important;
}

.fantan-fan-lines {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.fantan-fan-lines path {
  fill: none;
  stroke: #b9b9b9;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
}

.fantan-standard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border-left: 1px solid #d2d2d2;
}

.fantan-standard-grid .fantan-bet {
  height: 76px;
  border-right: 1px solid #d2d2d2;
  border-bottom: 1px solid #d2d2d2;
  box-sizing: border-box;
}

.fantan-special-grid .fantan-bet { height: 76px; }

.fantan-standard-grid .fantan-bet {
  padding-top: 4px;
  padding-bottom: 4px;
  gap: 3px;
}
.fantan-qp-spacer { height: 12px; background: #f7f7f9; }

.fantan-qp-close {
  position: absolute;
  right: 10px;
  top: 9px;
  z-index: 20;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(92,92,92,.35);
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: #555;
  font-family: Arial, sans-serif;
  font-size: 25px;
  font-weight: 300;
  line-height: 31px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fantan-qp-close:active {
  background: #f6b3c2;
  color: #333;
}

.fantan-qp-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  min-height: calc(214px + env(safe-area-inset-bottom, 0px));
  padding: 7px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #438351;
  box-sizing: border-box;
}

.fantan-qp-status {
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 42px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.fantan-qp-status b { font-weight: 600; }

.fantan-qp-actions {
  height: 42px;
  display: grid;
  grid-template-columns: 116px 1fr 174px 116px;
  gap: 6px;
  margin-bottom: 8px;
}

.fantan-qp-actions button,
.fantan-qp-actions input,
.fantan-amount-keys button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #3c4650;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-sizing: border-box;
  outline: none;
}

.fantan-qp-actions .quick-submit {
  background: #9bdac7;
  color: #356259;
}

.fantan-qp-actions input {
  padding: 0 10px;
  font-weight: 500;
  text-align: left;
  color: #e34b37;
  background: #fff;
  caret-color: #e34b37;
}

.fantan-qp-actions input::placeholder { color: #b9b9b9; }

.fantan-amount-keys {
  display: grid;
  gap: 5px;
}

.fantan-amount-keys.digits {
  grid-template-columns: repeat(10, 1fr);
  margin-bottom: 10px;
}

.fantan-amount-keys.presets { grid-template-columns: repeat(6, 1fr); }

.fantan-amount-keys button {
  height: 40px;
  font-size: 14px;
  font-weight: 500;
}

.fantan-qp-tip {
  position: absolute;
  left: 50%;
  bottom: calc(206px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: 80%;
  padding: 5px 10px;
  border-radius: 5px;
  background: rgba(24,43,31,.86);
  color: #fff;
  font-size: 13px;
  opacity: 1;
  pointer-events: none;
  white-space: nowrap;
}

.fantan-qp-tip:empty { opacity: 0; }
.fantan-qp-tip.error { background: rgba(151,29,29,.92); }

@media (max-width: 590px) {
  .fantan-qp-actions { grid-template-columns: 116px 1fr 174px 116px; }
}

@media (max-width: 470px) {

  .fantan-outer-row { height: 80px; }
  .fantan-road-section { min-height: 155px; }
  .fantan-road-title, .fantan-road-grid { width: 292px; }
  .fantan-road-cell { font-size: 13px; }
  .fantan-standard-grid .fantan-bet, .fantan-special-grid .fantan-bet { height: 72px; }
  .fantan-bet strong { font-size: 15px; }
  .fantan-qp-status { gap: 18px; font-size: 13px; }
  .fantan-qp-actions { grid-template-columns: 82px 1fr 126px 82px; height: 40px; gap: 5px; }
  .fantan-qp-actions button, .fantan-qp-actions input { font-size: 13px; }
  .fantan-amount-keys button { height: 39px; font-size: 13px; }
}

@media (max-width: 380px) {
  .fantan-qp-actions { grid-template-columns: 70px 1fr 108px 70px; }
  .fantan-qp-status { font-size: 12px; gap: 10px; }
  .fantan-amount-keys.digits { gap: 3px; }
  .fantan-amount-keys.presets { gap: 4px; }
}

body[data-game-type="fantan"] .p5-krow .p5-key {
  flex: var(--p5-key-grow, 1) 1 0 !important;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.robot .msg-row {
  position: relative;
  padding-top: 18px;
  align-items: flex-start;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.robot .player-message-meta {
  position: absolute;
  top: 0;
  left: 2px;
  display: flex !important;
  align-items: center;
  gap: 4px;
  color: #ff1d1d;
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.robot .player-message-time {
  display: none !important;
}

/* 后端尚未配置结算规则的翻摊玩法保留版面，但明确标记为暂不可下注。 */
.fantan-bet.is-unsupported { opacity: .42; cursor: not-allowed; }
.fantan-bet.is-unsupported.selected { transform: none; box-shadow: none; }

/* 2026-08-18 翻滩开盘自动开奖：仅作用于翻滩聊天室开奖/历史两类机器人消息。 */
body[data-game-type="fantan"] #p5-messages .msg-wrap.fantan-result-announcement .msg-row {
  padding-top: 0 !important;
  width: min(440px, 100%) !important;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.fantan-result-announcement .player-message-meta {
  display: none !important;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.fantan-result-announcement .msg,
body[data-game-type="fantan"] #p5-messages .msg-wrap.fantan-history-announcement .msg {
  width: min(440px, 100%) !important;
  max-width: 440px !important;
  box-sizing: border-box;
  background: #fff !important;
  border: 1px solid #c7c7c7 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.fantan-result-announcement .msg {
  padding: 10px 11px 13px !important;
}

body[data-game-type="fantan"] #p5-messages .msg-wrap.fantan-history-announcement .msg {
  padding: 6px !important;
}

body[data-game-type="fantan"] #p5-messages .fantan-result-message,
body[data-game-type="fantan"] #p5-messages .fantan-history-message {
  width: 100%;
  white-space: normal;
  overflow: visible;
}

body[data-game-type="fantan"] #p5-messages .fantan-open-result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 75px;
  column-gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 144px;
  color: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

body[data-game-type="fantan"] #p5-messages .fantan-open-result-main {
  min-width: 0;
}

body[data-game-type="fantan"] #p5-messages .fantan-open-result-header {
  display: flex;
  align-items: baseline;
  gap: 13px;
  margin-bottom: 24px;
  white-space: nowrap;
}

body[data-game-type="fantan"] #p5-messages .fantan-open-result-title {
  color: #ff1111;
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
}

body[data-game-type="fantan"] #p5-messages .fantan-open-result-issue {
  color: #050505;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-game-type="fantan"] #p5-messages .fantan-open-result-time {
  margin-bottom: 28px;
  color: #000;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}

body[data-game-type="fantan"] #p5-messages .fantan-result-numbers {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}

body[data-game-type="fantan"] #p5-messages .fantan-number-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  box-sizing: border-box;
  border: 2px solid #ff1d1d;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
}

body[data-game-type="fantan"] #p5-messages .fantan-number-ball.last {
  border-color: #1492da;
}

body[data-game-type="fantan"] #p5-messages .fantan-result-equals {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 75px;
  height: 75px;
  box-sizing: border-box;
  background: #ff0909;
  color: #fff;
  font-size: 37px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-card {
  width: 100%;
  overflow: hidden;
  color: #555;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
  line-height: 1;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-table th {
  height: 35px;
  box-sizing: border-box;
  padding: 0 6px;
  background: #3bb0d8;
  color: #fff;
  border: 0;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-table th:nth-child(1),
body[data-game-type="fantan"] #p5-messages .fantan-history-table td:nth-child(1) { width: 66px; }
body[data-game-type="fantan"] #p5-messages .fantan-history-table th:nth-child(2),
body[data-game-type="fantan"] #p5-messages .fantan-history-table td:nth-child(2) { width: 86px; }
body[data-game-type="fantan"] #p5-messages .fantan-history-table th:nth-child(4),
body[data-game-type="fantan"] #p5-messages .fantan-history-table td:nth-child(4) { width: 82px; }

body[data-game-type="fantan"] #p5-messages .fantan-history-table td {
  height: 29px;
  box-sizing: border-box;
  padding: 2px 6px;
  border: 0;
  background: #fff;
  color: #555;
  font-size: 14px;
  font-weight: 400;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-table tbody tr:nth-child(odd) td {
  background: #f4f4f4;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-table tbody tr.is-latest td {
  border-bottom: 1px solid #ff5b5b;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-issue,
body[data-game-type="fantan"] #p5-messages .fantan-history-time {
  text-align: center;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-result {
  overflow: visible;
}

body[data-game-type="fantan"] #p5-messages .fantan-result-numbers.compact {
  gap: 2px;
}

body[data-game-type="fantan"] #p5-messages .fantan-result-numbers.compact .fantan-number-ball {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
  border-width: 1.5px;
  font-size: 14px;
}

body[data-game-type="fantan"] #p5-messages .fantan-result-numbers.compact .fantan-result-equals {
  margin: 0 1px;
  font-size: 13px;
  font-weight: 600;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-fan {
  display: flex;
  align-items: center;
  gap: 7px;
}

body[data-game-type="fantan"] #p5-messages .fantan-fan-square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  box-sizing: border-box;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

body[data-game-type="fantan"] #p5-messages .fantan-fan-square.fan-1,
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-1 { background: #4d91ed; }
body[data-game-type="fantan"] #p5-messages .fantan-fan-square.fan-2,
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-2 { background: #49c985; }
body[data-game-type="fantan"] #p5-messages .fantan-fan-square.fan-3,
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-3 { background: #ffd400; color: #222; }
body[data-game-type="fantan"] #p5-messages .fantan-fan-square.fan-4,
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-4 { background: #ff4447; }

/* 顶部开奖结果番块按参考图固定红色，不随路子色变化。 */
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-1,
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-2,
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-3,
body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge.fan-4 {
  background: #ff0909;
  color: #fff;
}

body[data-game-type="fantan"] #p5-messages .fantan-fan-label {
  color: #555;
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
}

body[data-game-type="fantan"] #p5-messages .fantan-road-title-grid,
body[data-game-type="fantan"] #p5-messages .fantan-history-road-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  width: 100%;
}

body[data-game-type="fantan"] #p5-messages .fantan-road-title-grid {
  margin-top: 0;
}

body[data-game-type="fantan"] #p5-messages .fantan-road-title-grid > span,
body[data-game-type="fantan"] #p5-messages .fantan-history-road-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 29px;
  box-sizing: border-box;
  margin: 0 -1px -1px 0;
  border: 1px solid #797979;
  background: #d2d2d2;
  color: #555;
  font-size: 15px;
  font-weight: 600;
}

body[data-game-type="fantan"] #p5-messages .fantan-history-road-cell .fantan-fan-square {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  font-size: 16px;
}

@media (max-width: 520px) {
  body[data-game-type="fantan"] #p5-messages .fantan-open-result-card {
    grid-template-columns: minmax(0, 1fr) 62px;
    column-gap: 8px;
    min-height: 126px;
  }
  body[data-game-type="fantan"] #p5-messages .fantan-open-result-badge {
    width: 62px;
    height: 62px;
    font-size: 30px;
  }
  body[data-game-type="fantan"] #p5-messages .fantan-open-result-title { font-size: 23px; }
  body[data-game-type="fantan"] #p5-messages .fantan-open-result-issue,
  body[data-game-type="fantan"] #p5-messages .fantan-open-result-time { font-size: 16px; }
  body[data-game-type="fantan"] #p5-messages .fantan-open-result-header { gap: 8px; margin-bottom: 19px; }
  body[data-game-type="fantan"] #p5-messages .fantan-open-result-time { margin-bottom: 22px; }
  body[data-game-type="fantan"] #p5-messages .fantan-result-numbers { gap: 4px; }
  body[data-game-type="fantan"] #p5-messages .fantan-number-ball {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    font-size: 17px;
  }
  body[data-game-type="fantan"] #p5-messages .fantan-history-table th:nth-child(1),
  body[data-game-type="fantan"] #p5-messages .fantan-history-table td:nth-child(1) { width: 54px; }
  body[data-game-type="fantan"] #p5-messages .fantan-history-table th:nth-child(2),
  body[data-game-type="fantan"] #p5-messages .fantan-history-table td:nth-child(2) { width: 68px; }
  body[data-game-type="fantan"] #p5-messages .fantan-history-table th:nth-child(4),
  body[data-game-type="fantan"] #p5-messages .fantan-history-table td:nth-child(4) { width: 70px; }
  body[data-game-type="fantan"] #p5-messages .fantan-history-table th { padding: 0 4px; font-size: 14px; }
  body[data-game-type="fantan"] #p5-messages .fantan-history-table td { padding: 2px 3px; font-size: 12px; }
  body[data-game-type="fantan"] #p5-messages .fantan-result-numbers.compact { gap: 1px; }
  body[data-game-type="fantan"] #p5-messages .fantan-result-numbers.compact .fantan-number-ball {
    width: 19px;
    height: 19px;
    flex-basis: 19px;
    font-size: 12px;
  }
  body[data-game-type="fantan"] #p5-messages .fantan-fan-square {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 13px;
  }
  body[data-game-type="fantan"] #p5-messages .fantan-fan-label { font-size: 13px; }
  body[data-game-type="fantan"] #p5-messages .fantan-road-title-grid > span,
  body[data-game-type="fantan"] #p5-messages .fantan-history-road-cell { height: 26px; }
  body[data-game-type="fantan"] #p5-messages .fantan-history-road-cell .fantan-fan-square {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
    font-size: 14px;
  }
}
