/* ============================================================
   版面 / 元件 — 風格取自 igkjw_web，內容結構取自 kjw-pc
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: "微软雅黑", "Microsoft YaHei", sans-serif, "Helvetica Neue", Tahoma, Helvetica, Arial;
  line-height: 1.5;
  font-size: 16px;
  overflow-y: scroll;
  color: var(--text-color);
  letter-spacing: 1px;
}
body { margin: 0; background: var(--bg); font-size: 0.875rem; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

.w-label {
  max-width: var(--w-label);
  margin: auto;
  padding-left: var(--padding);
  padding-right: var(--padding);
}

/* ---------- 頁首 ---------- */
.headerBg { background: var(--header-bg); position: relative; z-index: 30; }
.headerBg header {
  max-width: var(--w-label);
  margin: auto;
  display: flex;
  align-items: center;
  padding: 0 var(--padding);
}
.logo { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 0; color: #fff; }
.logo svg { display: block; }
.logo .logo-text { font-size: 1.125rem; font-weight: bold; letter-spacing: 2px; }

.mainNav { margin-left: 1.5rem; flex: 1; }
.nav-list { display: flex; align-items: center; }
.nav-list > li > a {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 1.125rem;
  height: 52px;
  color: var(--header-color);
  transition: var(--transition);
}
.nav-list > li > a:hover { background: var(--navList-bg-hover); color: var(--header-color-hover); }
.nav-list > li.current > a { background: var(--navList-current-bg); color: var(--header-color-hover); }
.nav-list .caret { width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; margin-top: 3px; }

.navTop { margin-left: auto; display: flex; align-items: center; gap: 1rem; color: var(--header-color); }
.navTop .live-clock { font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.navTop a:hover { color: var(--navTop-color-hover); }

/* ---------- 彩票大廳下拉（kjw-pc 的 lotteryNamebox） ---------- */
.lotteryNamebox {
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: var(--navList-submenu-bg);
  box-shadow: var(--navList-submenu-boxShadow);
  border-top: var(--navList-submenu-border);
  border-radius: var(--navList-submenu-borderRadius);
  display: none;
}
.lotteryNamebox.is-open { display: block; }
.lotteryNamebox .content_middle { max-width: var(--w-label); margin: auto; padding: 0.5rem var(--padding) 1rem; }
.lotteryNamebox .LineOne { display: flex; align-items: flex-start; padding: 0.75rem 0; border-bottom: var(--navList-submenu-border); }
.lotteryNamebox .LineOne:last-child { border-bottom: 0; }
.lotteryNamebox .group-title {
  flex: 0 0 5.5em;
  color: #fff;
  background: var(--header-bg);
  border-radius: var(--borderRadius);
  text-align: center;
  padding: 0.25rem 0;
  margin-right: 1rem;
}
.lotteryNamebox .LineOne.hot .group-title { background: var(--style-color1); }
.lotteryNamebox ul { display: flex; flex-wrap: wrap; flex: 1; }
.lotteryNamebox ul li a {
  display: block;
  padding: 0.25rem 0.75rem;
  margin: 0.125rem;
  border-radius: var(--borderRadius);
  color: var(--text-color2);
  transition: var(--transition);
  white-space: nowrap;
}
.lotteryNamebox ul li a:hover { background: var(--navList-submenu-bg-hover); color: var(--header-bg); }
.lotteryNamebox ul li a.current { background: var(--navList-current-bg); color: #fff; }

/* ---------- 主內容 ---------- */
.content { padding: var(--padding) 0 2rem; }

/* 開獎頭（kjw-pc 的 haomaqu_resetPar） */
.lottery-header {
  display: flex;
  flex-flow: row wrap;
  align-items: stretch;
  background: var(--card-bg);
  border: var(--lottery-header-border);
  border-radius: var(--borderRadius);
  margin-bottom: var(--padding);
}
.lottery-header .current,
.lottery-header .next,
.lottery-header .result {
  display: flex;
  align-items: center;
  padding: var(--padding);
}
.lottery-header .current { flex: 0 0 320px; gap: 0.75rem; border-right: var(--lottery-header-border); }
.lottery-header .game-icon {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--lottery-header-number-bg2);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.lottery-header .latest { flex: 1; min-width: 0; }
.lottery-header .game-name { font-size: 1rem; font-weight: bold; margin-bottom: 0.25rem; }
.lottery-header .period { color: var(--text-color2); }
.lottery-header .period .preDrawIssue { color: var(--style-color1); font-weight: bold; margin: 0 0.25em; }

.issue-nav { display: flex; align-items: center; margin-top: 0.375rem; }
.issue-nav button {
  width: 24px; height: var(--lottery-header-select-height);
  background: #fff;
  border: var(--lottery-header-select-border);
  color: var(--text-color2);
  line-height: 1;
}
.issue-nav button:first-child { border-radius: var(--borderRadius) 0 0 var(--borderRadius); }
.issue-nav button:last-child { border-radius: 0 var(--borderRadius) var(--borderRadius) 0; }
.issue-nav button:disabled { color: var(--lottery-header-button-disabled); cursor: default; }
.issue-nav .select {
  height: var(--lottery-header-select-height);
  border-top: var(--lottery-header-select-border);
  border-bottom: var(--lottery-header-select-border);
  padding: 0 0.75em;
  display: flex; align-items: center;
  min-width: 110px;
  font-variant-numeric: tabular-nums;
}

/* 倒數 */
.lottery-header .next { flex: 0 0 260px; flex-direction: column; align-items: flex-start; justify-content: center; border-right: var(--lottery-header-border); }
.lottery-header .next .linetit { color: var(--text-color2); margin-bottom: 0.375rem; }
.countdown { display: flex; align-items: center; gap: 0.25rem; color: var(--text-color2); }
.countdown .bgtime {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px;
  background: var(--text-color);
  color: #fff;
  border-radius: var(--borderRadius);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.countdown.is-hurry .bgtime { background: var(--style-color1); }
.drawing-tip { display: none; color: var(--style-color1); font-size: 1rem; }
.next.is-drawing .drawing-tip { display: block; }
.next.is-drawing .countdown { display: none; }

/* 開獎結果 */
.lottery-header .result { flex: 1; gap: 0.75rem; flex-wrap: wrap; }
.numberbox { display: flex; align-items: center; gap: 0.375rem; }
.numberbox .sep { color: var(--text-color3); }
.numberbox .total {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--lottery-header-number-width); height: var(--lottery-header-number-width);
  border-radius: 50%;
  background: var(--lottery-header-number-bg2);
  color: var(--lottery-header-number-color3);
  font-size: 1.125rem; font-weight: bold;
}
.result .line { width: 1px; align-self: stretch; background: #eee; margin: 0 0.25rem; }
.badgeBg { display: flex; gap: 0.375rem; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 0.5em;
  border-radius: var(--borderRadius);
  color: #fff;
}
.badge.big, .badge.dragon { background: var(--style-color1); }
.badge.small, .badge.tiger { background: var(--style-color2); }
.badge.odd { background: var(--lottery-header-number-color7); }
.badge.even { background: var(--style-color3); }
.badge.tie { background: var(--lottery-header-number-color8); }

/* 開獎球 */
.ball {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--lottery-header-number-width); height: var(--lottery-header-number-width);
  border-radius: 50%;
  color: #fff; font-size: 1rem; font-weight: bold;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.18);
}
.ball.sm { width: 26px; height: 26px; font-size: 0.8125rem; }
.ball.plain { background: var(--lottery-header-number-color5); }
.ball.c1 { background: var(--ball-1); } .ball.c2 { background: var(--ball-2); }
.ball.c3 { background: var(--ball-3); } .ball.c4 { background: var(--ball-4); }
.ball.c5 { background: var(--ball-5); } .ball.c6 { background: var(--ball-6); }
.ball.c7 { background: var(--ball-7); } .ball.c8 { background: var(--ball-8); }
.ball.c9 { background: var(--ball-9); } .ball.c10 { background: var(--ball-10); }

/* 骰子（快3） */
.dice {
  width: var(--lottery-header-number-width); height: var(--lottery-header-number-width);
  border-radius: 6px; background: #fff;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  display: block;
}
.dice.sm { width: 26px; height: 26px; border-radius: 4px; }

/* 立體紅鈕 */
.btn-red {
  background: var(--btn-red-bg);
  border: var(--btn-red-border);
  border-radius: 18px;
  box-shadow: var(--btn-red-shadow);
  color: #fff;
  font-size: 0.9375rem;
  padding: 0.4rem 1rem;
  transition: var(--transition);
}
.btn-red:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 0 #8a2a21; }

/* ---------- 次選單（歷史/走勢/路子/長龍/遺漏） ---------- */
.zoushimap { display: flex; background: var(--card-bg); border: var(--lottery-header-border); border-radius: var(--borderRadius); overflow: hidden; margin-bottom: var(--padding); }
.zoushimap li a {
  display: block; padding: 0.625rem 1.5rem;
  color: var(--text-color2);
  border-right: var(--lottery-header-border);
  transition: var(--transition);
}
.zoushimap li a:hover { background: #f9f9f9; color: var(--header-bg); }
.zoushimap li a.active { background: var(--header-bg); color: #fff; }

/* ---------- 開獎記錄 ---------- */
.panel { background: var(--card-bg); border: var(--lottery-header-border); border-radius: var(--borderRadius); }
.listhead {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--padding);
  border-bottom: var(--lottery-table-border);
  flex-wrap: wrap; gap: 0.5rem;
}
.listhead .lmms { font-size: 1rem; font-weight: bold; position: relative; padding-left: 0.625rem; }
.listhead .lmms::before {
  content: ""; position: absolute; left: 0; top: 0.15em; bottom: 0.15em;
  width: 3px; background: var(--header-bg); border-radius: 2px;
}
.listheadr { display: flex; align-items: center; gap: 0.75rem; }
.day-switch { display: flex; }
.day-switch span {
  padding: 0.25rem 0.875rem;
  border: var(--border);
  margin-left: -1px;
  cursor: pointer;
  color: var(--text-color2);
  transition: var(--transition);
}
.day-switch span:first-child { border-radius: var(--borderRadius) 0 0 var(--borderRadius); margin-left: 0; }
.day-switch span:last-child { border-radius: 0 var(--borderRadius) var(--borderRadius) 0; }
.day-switch span.checked { background: var(--header-bg); border-color: var(--header-bg); color: #fff; }
.date-input { padding: 0.25rem 0.5rem; border: var(--border); border-radius: var(--borderRadius); color: var(--text-color2); font-family: inherit; }

.lottery-table { width: 100%; overflow-x: auto; }
.lottery-table table { width: 100%; border-collapse: collapse; }
.lottery-table th, .lottery-table td {
  padding: 0.5rem var(--padding);
  border-bottom: var(--lottery-table-border);
  text-align: left;
}
.lottery-table th { background: var(--lottery-table-head-bg); color: var(--text-color2); font-weight: normal; }
.lottery-table tbody tr:nth-child(even) { background: var(--lottery-table-stripe); }
.lottery-table tbody tr:hover { background: #f6edf8; }
.lottery-table .time, .lottery-table .issue { color: var(--text-color2); font-variant-numeric: tabular-nums; }
.lottery-table .codes { display: flex; align-items: center; gap: 0.25rem; }
.lottery-table .shape { display: flex; align-items: center; gap: 0.375rem; }
.lottery-table .sum { color: var(--style-color1); font-weight: bold; min-width: 1.5em; display: inline-block; }
.lottery-table .tag { color: var(--text-color2); }
.lottery-table .empty { text-align: center; color: var(--text-color3); padding: 2.5rem 0; }

/* ============================================================
   首頁 — 左側 Nav + 彩種卡片
   ============================================================ */
.home-layout { display: flex; align-items: flex-start; gap: var(--padding); }

/* ---------- 左側分類 Nav ---------- */
.side-col { flex: 0 0 var(--side-nav-width); }
.side-nav {
  background: var(--card-bg);
  border: var(--lottery-header-border);
  border-radius: var(--borderRadius);
  overflow: hidden;
}
.side-item { position: relative; border-bottom: var(--lottery-header-border); }
.side-item:last-child { border-bottom: 0; }
.side-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem var(--padding);
  background: none;
  border: 0;
  font-size: 0.875rem;
  color: var(--text-color2);
  letter-spacing: 1px;
  transition: var(--transition);
}
.side-link:hover { background: #f9f9f9; color: var(--header-bg); }
.side-item.active > .side-link { background: var(--header-bg); color: #fff; }
.side-arrow { transition: var(--transition); flex: 0 0 auto; }
.side-item.is-open .side-arrow { transform: rotate(90deg); }

/* 子清單：桌機用 hover 飛出，點擊也能鎖定 */
.side-sub {
  position: absolute;
  left: 100%; top: 0;
  z-index: 20;
  min-width: 460px;
  display: none;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 0.5rem;
  background: var(--navList-submenu-bg);
  border: var(--lottery-header-border);
  border-radius: var(--borderRadius);
  box-shadow: var(--navList-submenu-boxShadow);
}
.side-item:hover .side-sub,
.side-item.is-open .side-sub { display: flex; }
.side-sub li { flex: 0 0 33.333%; }
.side-sub li a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: var(--borderRadius);
  color: var(--text-color2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition);
}
.side-sub li a:hover { background: var(--navList-submenu-bg-hover); color: var(--header-bg); }

/* ---------- 卡片列表 ---------- */
.card-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--padding);
}
.game-card {
  background: var(--card-bg);
  border: var(--lottery-header-border);
  border-radius: var(--borderRadius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.game-card:hover { box-shadow: 0 2px 12px rgba(81, 64, 157, 0.12); }

.card-head { display: flex; align-items: center; gap: 0.75rem; padding: var(--padding); }
.card-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--lottery-header-number-bg2);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.card-title { min-width: 0; flex: 1; }
.card-title h2 { margin: 0; font-size: 0.9375rem; font-weight: bold; }
.card-title h2 a:hover { color: var(--header-bg); }
.card-title .issue { font-weight: normal; color: var(--text-color2); margin-left: 0.375rem; }
.card-title .issue b { color: var(--style-color1); margin: 0 0.15em; }
.card-time { display: flex; align-items: center; gap: 0.375rem; margin-top: 0.375rem; color: var(--text-color2); }
.card-time .gray { color: var(--text-color3); }
.card-time .bgtime {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px;
  background: var(--text-color);
  color: #fff;
  border-radius: var(--borderRadius);
  font-variant-numeric: tabular-nums;
}
.card-time .countdown.is-hurry .bgtime { background: var(--style-color1); }
.card-time .drawing-tip { display: none; color: var(--style-color1); }
.card-time.is-drawing .drawing-tip { display: block; }
.card-time.is-drawing .countdown,
.card-time.is-drawing .gray { display: none; }

.card-codes {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem;
  min-height: 44px;
  padding: 0 var(--padding) var(--padding);
  border-bottom: var(--lottery-table-border);
}
.card-codes .total.sm {
  min-width: 26px; height: 26px; font-size: 0.8125rem;
}

.card-stat { width: 100%; border-collapse: collapse; }
.card-stat th, .card-stat td {
  padding: 0.375rem 0.5rem;
  text-align: center;
  border-right: var(--lottery-table-border);
  border-bottom: var(--lottery-table-border);
}
.card-stat th:last-child, .card-stat td:last-child { border-right: 0; }
.card-stat th { background: var(--lottery-table-head-bg); color: var(--text-color2); font-weight: normal; }
.card-stat td { height: 40px; }
.card-stat td .badge { min-width: 24px; height: 24px; margin: 0 0.1rem; }
.card-stat td .hot { color: var(--style-color1); margin-right: 0.25rem; }

.card-links { display: flex; margin-top: auto; }
.card-links a {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0;
  color: var(--text-color2);
  border-right: var(--lottery-table-border);
  transition: var(--transition);
}
.card-links a:last-child { border-right: 0; }
.card-links a:hover { background: #f6edf8; color: var(--header-bg); }

@media all and (max-width: 960px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .side-sub { min-width: 320px; }
  .side-sub li { flex: 0 0 50%; }
}
@media all and (max-width: 768px) {
  .home-layout { flex-direction: column; }
  .side-col { flex: 1 1 auto; width: 100%; }
  .side-sub { position: static; min-width: 0; box-shadow: none; border: 0; border-top: var(--lottery-header-border); border-radius: 0; }
  .side-item:hover .side-sub { display: none; }
  .side-item.is-open .side-sub { display: flex; }
  .card-grid { width: 100%; }
}

/* ---------- 頁尾 ---------- */
.site-footer { background: #fff; border-top: var(--border); margin-top: 1.5rem; padding: 1.25rem 0; color: var(--text-color3); }
.site-footer .footer-nav { display: flex; gap: 1.25rem; margin-bottom: 0.5rem; }
.site-footer .footer-nav a:hover { color: var(--header-bg); }

/* ---------- RWD（沿用 igkjw_web 斷點） ---------- */
@media all and (max-width: 960px) {
  .lottery-header .current,
  .lottery-header .next { flex: 1 1 100%; border-right: 0; border-bottom: var(--lottery-header-border); }
  .lottery-header .next { flex-direction: row; gap: 0.75rem; }
  .lottery-header .next .linetit { margin-bottom: 0; }
  .lotteryNamebox .LineOne { flex-direction: column; }
  .lotteryNamebox .group-title { margin-bottom: 0.5rem; }
}
@media all and (max-width: 768px) {
  .mainNav { display: none; }
  .listhead { flex-direction: column; align-items: stretch; }
  .listheadr { justify-content: space-between; }
  .zoushimap { overflow-x: auto; }
  .zoushimap li a { white-space: nowrap; padding: 0.625rem 1rem; }
  .lottery-table th:nth-child(2), .lottery-table td:nth-child(2) { display: none; }
}
