/* 开奖区 — 对齐六合宝典 66852 风格（彩种 Tab + 白底金边结果卡） */

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) {
  --lottery66852-active: #f79b1f;
  --lottery66852-border: #e8c96a;
}

/* 顶栏彩种：文字 Tab，选中橙色 */
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .lottery-types.lottery-tabs-66852 {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0 0 8px;
  padding: 0;
  overflow: visible;
  background: #fff;
  border-radius: 0;
  border-bottom: 1px solid #eee;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .lottery-tabs-66852 .type-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 46px;
  padding: 10px 6px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: #333 !important;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .lottery-tabs-66852 .type-btn.active {
  color: var(--lottery66852-active) !important;
  font-weight: 700;
  border-bottom: 2px solid var(--lottery66852-active);
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .lottery-time-bar {
  display: none !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .header-top {
  margin-bottom: 4px;
}

/* 顶栏 + 开奖区外层白底（对齐目标站，不要 49zz 黄底/酒红底） */
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox.header {
  background: #fff !important;
  border-radius: 0;
  box-shadow: none !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryStickyWrap {
  background: #fff;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryStickyWrap .lottery-info {
  background: transparent !important;
  box-shadow: none !important;
}

/* 开奖卡片 — 白底金边，覆盖 lottery-balls-49zz 的 #fff9c4 */
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-49zz.lottery-panel-66852,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852.lottery-info {
  background: #fff !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 6px 8px 8px !important;
  margin-bottom: 10px;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .numbers-container.lottery-66852-body {
  position: relative;
  background: #fff !important;
  padding: 8px 10px 6px !important;
  border: 1px solid #f79b1f;
  border-radius: 10px;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .lottery-66852-corners {
  pointer-events: none;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .lottery-66852-corner {
  position: absolute;
  width: 13px;
  height: 13px;
  background: #fff url("ref-balls-66852/corner-fret.png") center/contain no-repeat;
  z-index: 2;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .lottery-66852-corner.tl {
  left: -1px;
  top: -1px;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .lottery-66852-corner.tr {
  right: -1px;
  top: -1px;
  transform: rotate(90deg);
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .lottery-66852-corner.bl {
  left: -1px;
  bottom: -1px;
  transform: rotate(270deg);
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .lottery-66852-corner.br {
  right: -1px;
  bottom: -1px;
  transform: rotate(180deg);
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .info-header,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .numbers-header {
  display: none !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .numbers-title,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .lottery-nav-history-row {
  display: none !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-head-66852 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 2px;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-head-66852-countdown {
  flex: 1 1 100%;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center;
  margin: 2px 0 4px;
  gap: 4px;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-head-66852-countdown #nextDrawPeriod {
  display: block !important;
  font-size: 15px;
  font-weight: 700;
  color: #c41e3a;
  text-align: center;
  line-height: 1.2;
}

/* 新香港彩：开奖前 2 分钟预切换为下一期「未开奖」时保留开奖区高度，避免布局跳动 */
body[data-lottery-type="macau_second"].macau-second-pre-draw #lotteryInfo.lottery-panel-66852 .lottery-66852-body,
body[data-lottery-type="macau_second"].macau-second-pre-draw #lotteryInfo #numbersWrapper {
  min-height: 92px;
}

body[data-lottery-type="macau_second"].macau-second-pre-draw #lotteryInfo .lottery-head-66852-countdown .countdown {
  visibility: visible !important;
  opacity: 1 !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-head-66852-countdown .countdown {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #c41e3a;
  background: #fff;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(196, 30, 58, 0.35);
  line-height: 1.25;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-head-66852-countdown #countdown {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-head-66852-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  line-height: 1.35;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-head-66852-link {
  flex-shrink: 0;
  padding: 2px 8px;
  line-height: 1.3;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #f79b1f;
  text-decoration: none;
  border: 1px solid #f79b1f;
  border-radius: 12px;
  white-space: nowrap;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .home-top-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px 8px;
  background: #fff;
}

body:is([data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .home-top-actions.hidden {
  display: none !important;
}

body[data-lottery-type="hongkong"] #headerBox #homeTopActions {
  display: none !important;
}

body[data-lottery-type="hongkong"] #galleryBarAfterLottery:not(.hidden) {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 12px 8px;
  margin: 0;
  background: #fff;
  border-top: 1px solid #eee;
}

body[data-lottery-type="hongkong"] #galleryBarAfterLottery .gallery-btn-top {
  font-size: 14px;
  padding: 8px 16px;
  margin: 0;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .top-gallery-bar {
  flex: 0 1 auto;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .gallery-btn-top {
  font-size: 14px;
  padding: 8px 16px;
  margin: 0;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .history-top-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-foot-66852 {
  margin-top: 6px;
  padding: 5px 0 3px;
  font-size: clamp(12px, 3.15vw, 14px);
  color: #c41e3a;
  line-height: 1.25;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  text-align: center;
  border-top: 1px solid #f0f0f0;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-foot-66852::-webkit-scrollbar {
  display: none;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-foot-66852-period {
  font-size: clamp(14px, 3.75vw, 17px);
  font-weight: 800;
  color: #b71c1c;
  letter-spacing: -0.03em;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo .lottery-foot-66852-detail {
  font-size: 1em;
  font-weight: 600;
  color: #c41e3a;
}

/* 号码区：按容器宽度等比缩放（6 正码 + 「+」+ 特码） */
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #lotteryInfo.lottery-panel-66852 .numbers-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) .lottery-66852-draw-host {
  width: 100% !important;
  max-width: min(100%, 420px) !important;
  margin: 0 auto !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .numbers-row.draw-sequence-row {
  --66852-gap: clamp(1px, 0.65vw, 5px);
  --66852-plus: clamp(8px, 2.2vw, 14px);
  /* 7 个球位 + 加号宽度 + 间距 */
  --66852-ball: min(50px, calc((100% - 6 * var(--66852-gap) - var(--66852-plus)) / 7));

  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  align-items: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 6px 0 4px !important;
  margin: 0 !important;
  gap: var(--66852-gap) !important;
  overflow: hidden !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .draw-sequence-row .ball-wrap {
  flex: 0 1 var(--66852-ball) !important;
  width: var(--66852-ball) !important;
  min-width: 0 !important;
  max-width: 50px !important;
  min-height: calc(var(--66852-ball) * 1.32) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .plus-sign {
  flex: 0 0 var(--66852-plus) !important;
  width: var(--66852-plus) !important;
  margin: 0 0 calc(var(--66852-ball) * 0.22) !important;
  padding: 0 !important;
  font-size: clamp(12px, calc(var(--66852-ball) * 0.42), 18px) !important;
  line-height: 1 !important;
  align-self: center !important;
  text-align: center !important;
}

/* 号码：66852 台球质感 PNG（与六合宝典同源球图） */
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  aspect-ratio: 1 !important;
  font-size: max(18px, calc(var(--66852-ball) * 0.69)) !important;
  border: none !important;
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 100% 100% !important;
  box-shadow: none !important;
  animation: none !important;
  overflow: visible !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.red {
  background-image: url("ref-balls-66852/red_ball.ce0ca3c6.png") !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.blue {
  background-image: url("ref-balls-66852/blue_ball.130b2912.png") !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.green {
  background-image: url("ref-balls-66852/green_ball.0ce5b40b.png") !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.gray {
  background-image: url("ref-balls-66852/blue_ball.130b2912.png") !important;
  opacity: 0.92;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-waiting,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-next,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-confirmed,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-revealed,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.special,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.red.special,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.blue.special,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.green.special,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.gray.special {
  animation: none !important;
  box-shadow: none !important;
  outline: none !important;
  transform: none !important;
  filter: none !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-waiting,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-next {
  opacity: 0.88 !important;
}

/* 数字对齐球图白色内圆（略偏上，与 66852 球 PNG 一致） */
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball {
  --66852-num-x: 51%;
  --66852-num-y: 43%;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .ball-inner {
  position: absolute !important;
  left: var(--66852-num-x) !important;
  top: var(--66852-num-y) !important;
  right: auto !important;
  bottom: auto !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translate(-50%, -50%) !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #111 !important;
  font-weight: 800 !important;
  font-size: 1em !important;
  text-align: center !important;
  letter-spacing: -0.04em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  animation: none !important;
  -webkit-font-smoothing: antialiased !important;
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 0 1px rgba(0, 0, 0, 0.35) !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-confirmed .ball-inner,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-waiting .ball-inner,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.ball-next .ball-inner,
body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .number-ball.special .ball-inner {
  transform: translate(-50%, -50%) !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .small-ellipse {
  display: none !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .ball-wrap .zodiac-info {
  color: #666 !important;
  font-size: max(9px, calc(var(--66852-ball) * 0.26)) !important;
  font-weight: 400 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  margin-top: 2px !important;
  box-shadow: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
}

body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) :is(#lotteryInfo.lottery-panel-66852, .lottery-66852-draw-host) .plus-sign {
  color: #999 !important;
  font-weight: 400 !important;
}

@media (max-width: 380px) {
  body:is([data-lottery-type="hongkong"], [data-lottery-type="macau_second"], [data-lottery-type="macau_new"]) #headerBox .lottery-tabs-66852 .type-btn {
    font-size: 14px;
    padding: 8px 4px;
  }
}
