/* ============================================================
   港澳新彩官方导航网 — 第二套网站
   完全仿照 http://118.107.0.160:804/#/  的样式重写
   ============================================================ */

/* ----- 1. Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  margin: 0 auto;
  max-width: 720px;
  background: #fff;
  color: #333;
  font-family: Arial, Helvetica, "STHeiti STXihei", "Microsoft YaHei", Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
ol, ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, h4, h5, h6 { font-size: 100%; margin: 0; padding: 0; font-weight: normal; }
p { margin: 0; }
a { color: #444; text-decoration: none; }
a:active, a:hover, a:visited { text-decoration: none; }
img { max-width: 100%; vertical-align: middle; border: 0; }
button, input { outline: none; cursor: pointer; }
table { width: 100%; border-collapse: collapse; }

/* ----- 2. Home Container ----- */
.home-container {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.home-container .main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
}

.home-container .main img { max-width: 100%; }

/* ----- 3. 顶部导航 nav2 ----- */
.nav2 {
  padding: 4px 0 0;
  background: #fff;
}

.nav2-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 4px 4px 0;
  width: 100%;
  list-style: none;
  margin: 0;
}

.nav2-label li {
  width: 20%;
  box-sizing: border-box;
  padding: 0 3px;
  margin-bottom: 6px;
  list-style: none;
}

.nav2-label li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 28px;
  padding: 4px 2px;
  text-align: center;
  color: #fff !important;
  border-radius: 50px;
  background: #1e90ff;
  font-size: 14px;
  line-height: 1.15;
  cursor: pointer;
  transition: background 0.2s;
  /* 关键：不截断、必须显示完整文字。允许换行，允许字符级断行（兜底） */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-all;
  box-sizing: border-box;
}

.nav2-label li a:hover,
.nav2-label li a:active {
  background: #da183b;
}

/* 手机端字号自适应：保证 4-5 个汉字也能显示完整 */
@media (max-width: 600px) {
  .nav2-label li { padding: 0 2px; margin-bottom: 5px; }
  .nav2-label li a { font-size: 12px; min-height: 26px; padding: 3px 2px; }
}
@media (max-width: 420px) {
  .nav2-label li a { font-size: 11px; min-height: 24px; }
}
@media (max-width: 360px) {
  .nav2-label li a { font-size: 10px; min-height: 22px; padding: 2px 1px; }
}

/* ----- 4. 主图横幅 ----- */
.main .head-banner {
  display: block;
  width: 100%;
  margin: 0;
}

.main .head-banner img {
  width: 100%;
  display: block;
}

/* ----- 5. 开奖号码面板 ----- */
.tab {
  display: flex;
  border-bottom: 1px solid #f94470;
}

.tab .menu {
  flex: 1;
  text-align: center;
  background-color: #fff;
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  padding: 5px;
  cursor: pointer;
  border: 1px solid #f94470;
  border-bottom: none;
  margin-right: -1px;
  font-size: 16px;
  position: relative;
}

.tab .menu:last-child { margin-right: 0; }

.tab .menu .tab-title {
  font-weight: 500;
  font-size: 18px;
  color: #f94470;
}

.tab .menu .tab-desc {
  color: #999;
  font-size: 14px;
}

.tab .menu.active {
  background-color: #f94470;
}

.tab .menu.active .tab-title,
.tab .menu.active .tab-desc {
  color: #fff;
}

.boxkj {
  background-color: #fff;
  width: 100%;
  min-height: 187px;
}

.boxkj .content {
  padding: 0 20px;
}

.boxkj .content .kjbt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.boxkj .content .kjbt .kjjg {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.boxkj .content .kjbt .kjjg h2 {
  font-weight: 400;
  font-size: 19px;
  margin: 0 0 0 5px;
  padding: 0;
}

.boxkj .content .kjbt .kjjg h2 span {
  color: #f94470;
}

.boxkj .content .kjbt a,
.boxkj .content .kjbt .live-btn {
  display: inline-block;
  text-decoration: none;
  font-size: 14px;
  color: #fff !important;
  border-radius: 5px;
  padding: 4px 10px;
  background: #f94470;
  cursor: pointer;
}

/* 号码方块 */
.boxkj .content .ball {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  gap: 5px;
}

.boxkj .content .ball .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  color: #fff;
  height: 72px;
  width: 13.5%;
  background-color: #888;
}

.boxkj .content .ball .item.green { background-color: #1fb61d; }
.boxkj .content .ball .item.blue  { background-color: #2389e9; }
.boxkj .content .ball .item.red   { background-color: #e71607; }

.boxkj .content .ball .item.jiabox {
  width: 5.5%;
  background-color: transparent !important;
  color: #000;
}

.boxkj .content .ball .item .number {
  font-weight: 700;
}

.boxkj .content .ball .item .number span {
  display: block;
  text-align: center;
  font-size: 28px;
  line-height: 1.1;
}

.boxkj .content .ball .item .name {
  text-align: center;
  font-size: 14px;
  background-color: #fff;
  color: #000;
  font-weight: 400;
  border-radius: 2px;
  padding: 2px 4px;
  margin-top: 4px;
  min-width: 40px;
}

.boxkj .content .ball .item .jia {
  font-size: 28px;
  color: #000;
  font-weight: 700;
}

@media (max-width: 600px) {
  .boxkj .content .ball .item { height: 62px; }
  .boxkj .content .ball .item .number span { font-size: 26px; }
  .boxkj .content .ball .item .name { font-size: 12px; min-width: 36px; }
}

@media (max-width: 400px) {
  .boxkj .content .ball .item .number span { font-size: 22px; }
  .boxkj .content .ball .item .name { font-size: 11px; min-width: 30px; padding: 1px 2px; }
}

.boxkj .content .kjrq {
  display: flex;
  justify-content: space-between;
  padding: 15px 0 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.boxkj .content .kjrq .xqkj {
  display: flex;
  font-size: 14px;
  align-items: center;
  line-height: 1;
  flex-wrap: wrap;
}

.boxkj .content .kjrq .xqkj span,
.boxkj .content .kjrq .xqkj .countdown {
  color: red;
}

.boxkj .content .kjrq .xqkj .countdown {
  font-size: 14px;
}

@media (max-width: 500px) {
  .boxkj .content .kjrq .xqkj { font-size: 12px; }
}

/* ----- 6. 快捷工具 more-tool ----- */
.more-tool {
  padding: 10px 0;
}

.more-tool ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.more-tool ul li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 25%;
  gap: 8px;
  cursor: pointer;
}

.more-tool ul li img {
  width: 60%;
  max-width: 80px;
  border-radius: 50%;
  display: block;
}

.more-tool ul li span {
  font-size: 16px;
  color: #333;
}

@media (max-width: 500px) {
  .more-tool ul li span { font-size: 14px; }
}

/* ----- 7. 广告/横幅 banner ----- */
.ad-banner {
  display: block;
  width: 100%;
  margin: 0;
}

.ad-banner img {
  width: 100%;
  display: block;
}

/* ----- 8. 跑马灯公告 ----- */
.marquee-box {
  display: flex;
  align-items: center;
  background: #fff5f5;
  margin: 8px 0;
  padding: 0 10px;
  height: 36px;
  border-top: 1px solid #ffd9d9;
  border-bottom: 1px solid #ffd9d9;
}

.marquee-badge {
  flex-shrink: 0;
  background: #f94470;
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 8px;
  font-weight: bold;
}

.marquee-text {
  flex: 1;
  overflow: hidden;
  font-size: 13px;
  color: #d11;
  white-space: nowrap;
}

.marquee-text marquee {
  line-height: 36px;
}

/* ----- 9. CMS 表格区块 (仿目标 .nc-page .cms-box) ----- */
.nc-page {
  margin: 8px 0;
}

.nc-page .cms-box {
  padding: 3px;
}

.nc-page .cms-box .cms-cont {
  overflow: hidden;
}

.nc-page .cms-box .cms-main {
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(111, 81, 96, 0.3);
  border-radius: 10px;
}

.nc-page .cms-box .cms-main .cms-head {
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  border-bottom: 1px solid rgba(111, 81, 96, 0.3);
  background-image: linear-gradient(rgba(231, 111, 81, 0.376), rgba(231, 111, 81, 0.13));
  display: flex;
  height: 40px;
  justify-content: center;
  align-items: center;
  gap: 5px;
  font-size: 22px;
  font-weight: 700;
  position: relative;
  color: #fff;
}

.nc-page .cms-box .cms-main .cms-head .title {
  font-size: 22px;
}

.nc-page .cms-box .cms-main .cms-head .cms-name {
  color: #fff;
}

@media (max-width: 500px) {
  .nc-page .cms-box .cms-main .cms-head,
  .nc-page .cms-box .cms-main .cms-head .title {
    font-size: 18px;
  }
}

.nc-page .cms-box .cms-main .cms-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nc-page .cms-box .cms-main .cms-list li {
  display: flex;
  align-items: center;
  font-size: 16px;
  border-bottom: 0.5px solid rgba(111, 81, 96, 0.3);
  background: #fcece8;
}

.nc-page .cms-box .cms-main .cms-list li:last-child {
  border-bottom: none;
}

.nc-page .cms-box .cms-main .cms-list li.cms-hide { display: none; }
.nc-page .cms-box .cms-main .cms-list li.active   { display: flex; }

.nc-page .cms-box .cms-main .cms-list li > div {
  font-weight: 700;
  padding: 10px 5px;
}

.nc-page .cms-box .cms-main .cms-list li .qh {
  min-width: 70px;
  max-width: 130px;
  text-align: center;
}

.nc-page .cms-box .cms-main .cms-list li .kj {
  flex: 1;
  word-break: break-all;
  border-left: 1px solid rgba(111, 81, 96, 0.3);
  border-right: 1px solid rgba(111, 81, 96, 0.3);
  text-align: center;
}

.nc-page .cms-box .cms-main .cms-list li .js {
  width: 100px;
  color: red;
  text-align: center;
}

.nc-page .cms-box .cms-main .cms-list li .js.cms-green {
  color: #43a643;
}

.nc-page .cms-box .cms-main .cms-foot {
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
  display: flex;
  height: 30px;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  color: rgba(231, 111, 81, 0.6);
  background: rgba(231, 111, 81, 0.13);
  font-size: 14px;
}

.nc-page .cms-box .cms-main .cms-foot .cms-more {
  cursor: pointer;
  color: #e76f51;
}

.nc-page .cms-box .cms-main .cms-foot .cms-sq {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.nc-page .cms-box .cms-main .cms-green {
  color: #43a643;
}

.nc-page .cms-box .cms-dq {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  overflow: auto;
}

.nc-page .cms-box .cms-dq span {
  width: 25%;
  line-height: 24px;
  border-radius: 5px;
  font-size: 15px;
  padding: 5px 5px;
  background: rgba(231, 111, 81, 0.13);
  color: #000;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
}

.nc-page .cms-box .cms-dq span.active {
  background: rgba(231, 111, 81, 0.376);
  color: #fff;
}

/* ----- 10. 文本/HTML 模块 ----- */
.text-module,
.custom-html-module {
  margin: 8px 5px;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.custom-html-module img {
  max-width: 100% !important;
  height: auto !important;
}

/* ----- 11. Toast ----- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  z-index: 9999;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
}

/* ----- 12. 回到顶部 ----- */
.back-to-top {
  position: fixed;
  bottom: 60px;
  right: 8px;
  z-index: 999;
  cursor: pointer;
  width: 50px;
  height: 50px;
  display: none;
}

.back-to-top.show { display: block; }
.back-to-top img { width: 100%; height: 100%; display: block; }

/* ----- 13. 历史记录页 ----- */
.record-page {
  background: #f5f5f5;
  min-height: 100vh;
}

.record-header {
  background: #f94470;
  color: #fff;
  padding: 12px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.record-header .back-btn {
  width: 50px;
  cursor: pointer;
  font-size: 14px;
}

.record-header h3 {
  flex: 1;
  text-align: center;
  margin: 0;
  font-size: 17px;
  color: #fff;
  font-weight: 500;
}

.record-list {
  padding: 8px;
}

.record-item {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.record-period {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

.record-period b {
  color: #f94470;
  font-size: 15px;
}

.record-item .ball {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px;
}

.record-item .ball .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #fff;
  height: 56px;
  flex: 1;
  min-width: 40px;
  background-color: #888;
}

.record-item .ball .item.red   { background-color: #e71607; }
.record-item .ball .item.blue  { background-color: #2389e9; }
.record-item .ball .item.green { background-color: #1fb61d; }

.record-item .ball .item.jiabox {
  flex: 0 0 16px;
  background: transparent !important;
}

.record-item .ball .item .number span {
  display: block;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
}

.record-item .ball .item .name {
  background: #fff;
  color: #000;
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 2px;
  margin-top: 3px;
}

.record-item .ball .item .jia {
  color: #000;
  font-size: 22px;
  font-weight: 700;
}

.load-more-btn {
  display: block;
  width: 80%;
  margin: 16px auto;
  padding: 8px 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 20px;
  color: #666;
  font-size: 14px;
}

/* ----- 14. iOS 安全区底部 ----- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ============================================================
   ===== 15. 手机端整体响应式适配（≤ 600px / ≤ 420px / ≤ 360px）
   ============================================================ */

/* ---- 平板/小屏 (≤ 600px) ---- */
@media (max-width: 600px) {
  body { font-size: 13px; }

  /* 开奖号码面板 */
  .boxkj { min-height: auto; }
  .boxkj .content { padding: 0 10px; }
  .boxkj .content .kjbt { margin-top: 6px; gap: 4px; }
  .boxkj .content .kjbt .kjjg h2 { font-size: 16px; margin-left: 0; }
  .boxkj .content .kjbt a,
  .boxkj .content .kjbt .live-btn { font-size: 13px; padding: 3px 8px; }

  /* Tab */
  .tab .menu { padding: 4px 2px; font-size: 13px; }
  .tab .menu .tab-title { font-size: 15px; }
  .tab .menu .tab-desc { font-size: 11px; }

  /* 倒计时区 */
  .boxkj .content .kjrq { padding: 10px 0 8px; gap: 4px; }
  .boxkj .content .kjrq .xqkj { font-size: 12px; }
  .boxkj .content .kjrq .xqkj .countdown { font-size: 12px; }

  /* 快捷工具 */
  .more-tool { padding: 8px 0; }
  .more-tool ul li img { width: 50%; max-width: 60px; }
  .more-tool ul li span { font-size: 13px; }

  /* 跑马灯 */
  .marquee-box { height: 32px; padding: 0 8px; margin: 6px 0; }
  .marquee-text { font-size: 12px; }
  .marquee-text marquee { line-height: 32px; }

  /* CMS 表格 */
  .nc-page { margin: 6px 0; }
  .nc-page .cms-box { padding: 2px; }
  .nc-page .cms-box .cms-main .cms-list li { font-size: 13px; }
  .nc-page .cms-box .cms-main .cms-list li > div { padding: 8px 4px; }
  .nc-page .cms-box .cms-main .cms-list li .qh {
    min-width: 56px; max-width: 80px; font-size: 12px;
  }
  .nc-page .cms-box .cms-main .cms-list li .kj { font-size: 14px; }
  .nc-page .cms-box .cms-main .cms-list li .js {
    width: 60px; font-size: 13px;
  }
  .nc-page .cms-box .cms-dq { padding: 4px; gap: 4px; }
  .nc-page .cms-box .cms-dq span {
    font-size: 12px; padding: 4px 3px; line-height: 20px;
  }
  .nc-page .cms-box .cms-main .cms-foot { padding: 0 12px; font-size: 12px; }

  /* 文本/HTML */
  .text-module, .custom-html-module { margin: 6px 4px; font-size: 13px; }

  /* 历史记录 */
  .record-header { padding: 10px; }
  .record-header h3 { font-size: 15px; }
  .record-item { padding: 8px; margin-bottom: 6px; }
  .record-item .ball .item { height: 50px; }
  .record-item .ball .item .number span { font-size: 17px; }
  .record-item .ball .item .name { font-size: 10px; padding: 0 3px; }

  /* 回到顶部按钮 */
  .back-to-top { width: 40px; height: 40px; bottom: 50px; right: 6px; }
}

/* ---- 中等手机 (≤ 420px) ---- */
@media (max-width: 420px) {
  body { font-size: 12px; }

  .boxkj .content { padding: 0 8px; }
  .boxkj .content .kjbt .kjjg h2 { font-size: 15px; }
  .boxkj .content .kjbt a,
  .boxkj .content .kjbt .live-btn { font-size: 12px; padding: 2px 6px; }

  .tab .menu .tab-title { font-size: 14px; }
  .tab .menu .tab-desc { font-size: 10px; }

  /* CMS 表格 - 进一步压缩 */
  .nc-page .cms-box .cms-main .cms-head,
  .nc-page .cms-box .cms-main .cms-head .title { font-size: 16px; }
  .nc-page .cms-box .cms-main .cms-list li > div { padding: 6px 3px; }
  .nc-page .cms-box .cms-main .cms-list li .qh {
    min-width: 48px; max-width: 70px; font-size: 11px;
  }
  .nc-page .cms-box .cms-main .cms-list li .kj { font-size: 13px; }
  .nc-page .cms-box .cms-main .cms-list li .js {
    width: 50px; font-size: 12px;
  }
  .nc-page .cms-box .cms-dq span { font-size: 11px; }
  .nc-page .cms-box .cms-main .cms-foot { padding: 0 8px; font-size: 11px; }

  /* 跑马灯 */
  .marquee-badge { font-size: 11px; padding: 2px 6px; }
  .marquee-text { font-size: 11px; }

  /* 快捷工具 */
  .more-tool ul li img { max-width: 50px; }
  .more-tool ul li span { font-size: 12px; }

  /* Toast */
  .toast { font-size: 12px; padding: 8px 16px; max-width: 80vw; white-space: normal; }

  /* 历史记录 */
  .record-header h3 { font-size: 14px; }
  .record-item .ball .item { height: 44px; min-width: 34px; }
  .record-item .ball .item .number span { font-size: 15px; }
  .record-item .ball .item .name { font-size: 9px; }
}

/* ---- 超小屏 (≤ 360px) ---- */
@media (max-width: 360px) {
  .boxkj .content { padding: 0 6px; }
  .boxkj .content .kjbt .kjjg h2 { font-size: 13px; }
  .boxkj .content .ball { gap: 3px; }
  .boxkj .content .ball .item .name { font-size: 10px; min-width: 26px; }

  .tab .menu { padding: 3px 1px; }
  .tab .menu .tab-title { font-size: 13px; }
  .tab .menu .tab-desc { font-size: 9px; }

  /* CMS 表格 - 极限压缩 */
  .nc-page .cms-box .cms-main .cms-list li .qh {
    min-width: 40px; max-width: 60px; font-size: 10px;
  }
  .nc-page .cms-box .cms-main .cms-list li .kj { font-size: 12px; }
  .nc-page .cms-box .cms-main .cms-list li .js {
    width: 40px; font-size: 11px;
  }

  .more-tool ul li img { max-width: 44px; }
  .more-tool ul li span { font-size: 11px; }
}

/* ---- 横屏适配（手机横屏时不显示太大）---- */
@media (max-width: 900px) and (orientation: landscape) {
  body { max-width: 720px; }
}

/* ---- 通用：所有图片在窄屏不溢出 ---- */
img { max-width: 100%; height: auto; }

/* ---- 通用：表格 / 自定义 HTML 内容防溢出 ---- */
.custom-html-module table,
.text-module table { max-width: 100% !important; width: 100% !important; }
.custom-html-module pre,
.text-module pre { white-space: pre-wrap; word-break: break-all; }
