:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #1a2332;
  --muted: #7a8699;
  --line: #e6ebf2;
  --line-strong: #d7dee8;
  --primary: #1f6feb;
  --primary-dark: #1558c0;
  --primary-soft: #eaf2ff;
  --danger: #e11d48;
  --warn: #f59e0b;
  --ok: #12b981;
  --shadow: 0 8px 24px rgba(26, 35, 50, .06);
  --shadow-sm: 0 2px 8px rgba(26, 35, 50, .04);
  --radius: 14px;
  --radius-sm: 10px;
  --max: 1100px;
  --ball-red: linear-gradient(160deg, #ff7b7b 0%, #e11d2e 100%);
  --ball-blue: linear-gradient(160deg, #6bb0ff 0%, #1f6feb 100%);
  --ball-green: linear-gradient(160deg, #4fd39a 0%, #0f9f5b 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(1200px 420px at 50% -80px, rgba(31, 111, 235, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

/* ===== Header ===== */
.site-header {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(230, 235, 242, .9);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo-area {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.site-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: min(260px, 68vw);
  object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .4px;
  color: #123c8c;
  line-height: 1.1;
}
.banner-text { font-size: 12px; color: var(--muted); }
.header-action {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2b79f3, var(--primary-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(31, 111, 235, .25);
}

.nav-shell {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.main-nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  gap: 4px;
}
.main-nav a {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  text-decoration: none;
  color: #51607a;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.main-nav a:hover { color: var(--primary); }
.main-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== Carousel ===== */
.hero-carousel {
  position: relative;
  max-width: var(--max);
  margin: 12px auto 0;
  overflow: hidden;
  background: linear-gradient(135deg, #1a4fb5 0%, #2f7cf0 45%, #59a0ff 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.carousel-track {
  position: relative;
  width: 100%;
  aspect-ratio: 1100 / 300;
  min-height: 140px;
}
.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
}
.carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}
.carousel-slide img,
.carousel-slide a {
  display: block;
  width: 100%;
  height: 100%;
}
.carousel-slide img { object-fit: cover; }
.carousel-caption {
  position: absolute;
  left: 28px;
  bottom: 24px;
  z-index: 2;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.carousel-caption h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: .5px;
}
.carousel-caption p {
  margin: 0;
  font-size: 14px;
  opacity: .92;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.carousel-btn:hover { background: rgba(255,255,255,.34); }
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 7px;
}
.carousel-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(255,255,255,.4);
  cursor: pointer;
}
.carousel-dots .dot.active {
  width: 18px;
  border-radius: 999px;
  background: #fff;
}

/* ===== Lottery tabs ===== */
/* ===== Home ads ===== */
.home-ads {
  max-width: var(--max);
  margin: 12px auto 0;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ad-slot {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f5f7fa;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.ad-slot a { display: block; line-height: 0; }
.ad-slot img {
  display: block;
  width: 100%;
  /* 与推荐尺寸 1100×200 同比例 */
  height: auto;
  aspect-ratio: 1100 / 200;
  object-fit: contain;
  object-position: center;
  background: #f5f7fa;
}

.lottery-tabs-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 12px 0;
}
.lottery-tabs-shell .tabs-nav-btn { display: none !important; }
.lottery-tabs {
  max-width: var(--max);
  margin: 12px auto 0;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  overflow: visible;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.lottery-tabs-shell .lottery-tabs {
  max-width: none;
  margin: 0;
  padding: 0 0 4px;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}
.tab-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  text-decoration: none;
  text-align: center;
  color: #44546c;
  background: #f7f9fc;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: .15s ease;
}
.tab-item:hover {
  border-color: #b9cdf0;
  color: var(--primary);
  background: #eef5ff;
}
.tab-item.active {
  background: linear-gradient(180deg, #2b79f3, var(--primary-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px rgba(31, 111, 235, .22);
}
.tab-item.disabled { color: var(--muted); background: #f3f5f8; }

.page-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px;
}

/* ===== Result card ===== */
.result-card, .history-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(230, 235, 242, .95);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.result-card { margin-bottom: 12px; }
.empty-card { padding: 36px 20px; text-align: center; color: var(--muted); }

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  background: linear-gradient(90deg, #edf4ff, #f8fbff);
  border-bottom: 1px solid #e4edf8;
  flex-wrap: wrap;
}
.result-title {
  font-size: 17px;
  font-weight: 800;
  color: #1558c0;
}
.result-next { font-size: 12px; color: var(--muted); }

.result-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 18px;
  align-items: center;
}
.expect-line {
  margin-bottom: 12px;
  font-size: 14px;
  color: #51607a;
}
.expect-line strong {
  font-size: 20px;
  color: var(--text);
  margin: 0 2px;
}

.balls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.ball-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 38px;
}
.ball {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    0 4px 10px rgba(0,0,0,.14);
}
.ball.red { background: var(--ball-red); }
.ball.blue { background: var(--ball-blue); }
.ball.green { background: var(--ball-green); }
.zodiac { font-size: 12px; color: #8a96a8; line-height: 1; }
.plus {
  align-self: center;
  font-size: 20px;
  font-weight: 700;
  color: #b0bbc9;
  margin: 0 2px;
}
.balls.with-zodiac .plus { margin-top: -12px; }

.action-row {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: .15s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }
.btn-blue {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: #cfe0ff;
}
.btn-ghost {
  background: #f4f7fb;
  color: #51607a;
  border-color: var(--line);
}
.btn-orange {
  background: #fff7e8;
  color: #c47a00;
  border-color: #ffe2a8;
}
.btn-red {
  background: linear-gradient(180deg, #ff5a72, var(--danger));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(225, 29, 72, .22);
}
.history-link {
  margin-left: 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.countdown-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #f7faff, #eef5ff);
  border: 1px solid #d9e7fb;
  border-radius: 12px;
  min-width: 210px;
}
.countdown-label {
  font-size: 12px;
  color: #6d7f99;
  letter-spacing: .5px;
  font-weight: 600;
}
.countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.cd-unit {
  min-width: 52px;
  padding: 10px 8px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2a3a55, #17233a);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.cd-sep {
  font-size: 22px;
  font-weight: 800;
  color: #334155;
}
.countdown.is-zero .cd-unit {
  background: linear-gradient(180deg, #c24141, #7f1d1d);
}

/* ===== History ===== */
.history-card { margin-top: 0; }
.history-head {
  display: grid;
  grid-template-columns: 1.15fr 1.25fr minmax(220px, 2.6fr) 72px 64px 64px;
  gap: 10px;
  padding: 12px 16px;
  background: #f7f9fc;
  color: #7a8699;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.history-row {
  display: grid;
  grid-template-columns: 1.15fr 1.25fr minmax(220px, 2.6fr) 72px 64px 64px;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef2f7;
  align-items: center;
  font-size: 13px;
  transition: background .12s;
}
.history-row:hover { background: #f8fbff; }
.history-row:nth-child(even) { background: #fcfdff; }
.col-expect { font-weight: 700; color: #334155; }
.col-time { color: var(--muted); }
.col-balls { min-width: 0; }
.col-sum,
.col-size,
.col-oe {
  text-align: center;
  font-weight: 700;
}
.col-sum { color: #1e3a5f; font-variant-numeric: tabular-nums; }
.col-size.is-big,
.col-oe.is-odd { color: #e11d48; }
.col-size.is-small,
.col-oe.is-even { color: #1f6feb; }
.balls.mini .ball { width: 28px; height: 28px; font-size: 12px; }
.balls.mini .ball-wrap { min-width: 28px; gap: 3px; }
.history-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer {
  text-align: center;
  padding: 22px 12px 28px;
  color: #9aa6b8;
  font-size: 12px;
}
.site-footer a {
  color: #7d8ca3;
  text-decoration: none;
}
.site-footer a:hover { color: var(--primary); }

/* ===== Contact ===== */
.contact-page { padding-top: 14px; padding-bottom: 28px; }
.contact-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.contact-head {
  padding: 22px 22px 16px;
  background: linear-gradient(180deg, #f4f8ff 0%, #fff 100%);
  border-bottom: 1px solid var(--line);
}
.contact-head h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #123c8c;
}
.contact-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.contact-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 20px 22px;
  align-items: start;
}
.contact-list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.contact-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.contact-item .label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.contact-item .value {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}
.contact-item .value a { text-decoration: none; }
.contact-item .value a:hover { text-decoration: underline; }
.contact-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 18px 4px;
}
.contact-qr {
  text-align: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.contact-qr img {
  display: block;
  width: 148px;
  height: 148px;
  object-fit: contain;
  border-radius: 8px;
}
.contact-qr .qr-tip {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.contact-note {
  margin: 0 22px 22px;
  padding: 14px 16px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  color: #334155;
  font-size: 14px;
  line-height: 1.7;
}

@media (max-width: 768px) {
  .site-logo { height: 40px; max-width: 58vw; }
  .brand { font-size: 18px; }
  .header-action { padding: 8px 12px; font-size: 12px; }
  .main-nav a { font-size: 13px; padding: 11px 4px; }
  .home-ads { margin-top: 10px; padding: 0 12px; }
  .lottery-tabs {
    margin: 10px 12px 0;
    padding: 10px;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    border-radius: 12px;
  }
  .tab-item {
    min-height: 44px;
    padding: 6px 4px;
    font-size: 12px;
    border-radius: 8px;
    white-space: normal;
    word-break: break-all;
    line-height: 1.2;
  }
  .hero-carousel { margin: 10px 12px 0; border-radius: 12px; }
  .carousel-track { aspect-ratio: 16 / 7; min-height: 120px; }
  .carousel-caption { left: 16px; bottom: 16px; }
  .carousel-caption h2 { font-size: 20px; }
  .carousel-btn { width: 30px; height: 30px; font-size: 18px; }
  .result-body { grid-template-columns: 1fr; }
  .result-right { justify-self: stretch; }
  .countdown-wrap {
    align-items: flex-start;
    min-width: 0;
    width: 100%;
  }
  .cd-unit { min-width: 48px; font-size: 22px; padding: 9px 6px; }
  .ball { width: 36px; height: 36px; font-size: 14px; }
  .history-head { display: none; }
  .history-row {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "expect expect expect"
      "time time time"
      "balls balls balls"
      "sum size oe";
    row-gap: 8px;
  }
  .col-expect { grid-area: expect; }
  .col-time { grid-area: time; font-size: 12px; }
  .col-balls { grid-area: balls; }
  .col-sum { grid-area: sum; }
  .col-size { grid-area: size; }
  .col-oe { grid-area: oe; }
  .col-sum,
  .col-size,
  .col-oe {
    background: #f7f9fc;
    border-radius: 8px;
    padding: 6px 4px;
    font-size: 12px;
  }
  .col-sum::before { content: "总和 "; color: #94a3b8; font-weight: 600; }
  .col-size::before { content: "大小 "; color: #94a3b8; font-weight: 600; }
  .col-oe::before { content: "单双 "; color: #94a3b8; font-weight: 600; }
  .contact-head { padding: 18px 16px 14px; }
  .contact-head h1 { font-size: 20px; }
  .contact-body {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .contact-item { grid-template-columns: 72px 1fr; padding: 10px 12px; }
  .contact-qr { justify-self: center; }
  .contact-note { margin: 0 16px 16px; }
}
