:root {
  --ink: #15171c;
  --muted: #68707e;
  --line: #e1e4e9;
  --soft: #f5f6f8;
  --paper: #ffffff;
  --red: #9f1725;
  --red-dark: #79101b;
  --gold: #b88a31;
  --cyan: #0d9bb2;
  --blue: #276bc5;
  --green: #13865f;
  --shadow: 0 14px 35px rgba(27, 31, 39, 0.09);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--soft);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #191b20;
  color: #fff;
}

.header-inner,
.intro-inner,
.section-inner,
.footer-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 70px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 176px;
}

.brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand span {
  display: grid;
  gap: 1px;
}

.brand strong {
  color: #fff;
  font-size: 20px;
  line-height: 1.2;
}

.brand small {
  color: #c9cbd1;
  font-size: 13px;
}

.live-status {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  color: #d8d9dd;
  font-size: 13px;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8d939e;
}

.live-status.online .status-dot {
  background: #2dcc86;
  box-shadow: 0 0 0 4px rgba(45, 204, 134, 0.12);
}

.live-status.error .status-dot {
  background: #f0b33c;
}

.intro-band {
  background: var(--red);
  color: #fff;
}

.intro-inner {
  min-height: 152px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 26px 0;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.intro-band .eyebrow {
  color: #e8ca86;
}

.intro-band h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.16;
  font-weight: 800;
}

.intro-band p:last-child {
  margin: 10px 0 0;
  color: #f2dfe2;
  font-size: 15px;
}

.clock-block {
  min-width: 195px;
  padding-left: 30px;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  display: grid;
  justify-items: end;
}

.clock-block span,
.clock-block small {
  color: #f0d9dc;
  font-size: 13px;
}

.clock-block strong {
  margin: 4px 0;
  font-family: Consolas, monospace;
  font-size: 31px;
}

.ad-band {
  padding: 14px 0;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.ad-slot {
  width: 100%;
  border: 1px solid #e2e4e8;
  background: #fff;
}

.ad-slot-primary {
  height: 136px;
}

.ad-slot-secondary {
  height: 112px;
  margin-top: 16px;
}

.latest-section,
.content-section,
.trend-section {
  scroll-margin-top: 82px;
}

.latest-section {
  padding: 30px 0 34px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refresh-button,
.mi-mode-button,
.primary-button,
.secondary-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.refresh-button,
.secondary-button {
  border-color: #cfd3da;
  background: #fff;
  color: #343943;
}

.mi-mode-button {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
  font-weight: 700;
}

.mi-mode-button:hover {
  border-color: #9c7327;
  background: #9c7327;
}

.refresh-button:hover,
.secondary-button:hover {
  border-color: #9ba2ad;
  background: #f6f7f9;
}

.primary-button {
  background: var(--red);
  color: #fff;
}

.primary-button:hover {
  background: var(--red-dark);
}

.live-board {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  min-height: 184px;
  border: 1px solid #d9dce2;
  border-top: 3px solid var(--red);
  background: #fff;
  box-shadow: var(--shadow);
}

.issue-meta,
.countdown-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 25px 28px;
}

.issue-meta {
  border-right: 1px solid var(--line);
}

.countdown-panel {
  align-items: flex-end;
  border-left: 1px solid var(--line);
  text-align: right;
}

.issue-meta span,
.countdown-panel span {
  color: var(--muted);
  font-size: 13px;
}

.issue-meta strong {
  margin: 8px 0 6px;
  font-family: Consolas, monospace;
  font-size: 26px;
}

.issue-meta small,
.countdown-panel small {
  color: #777e89;
  font-size: 12px;
}

.countdown-panel strong {
  margin: 4px 0 8px;
  color: var(--red);
  font-family: Consolas, monospace;
  font-size: 38px;
}

.result-display {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 22px 28px;
}

.result-balls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.result-balls i {
  color: #343943;
  font-size: 19px;
  font-style: normal;
  font-weight: 700;
}

.number-ball,
.sum-ball {
  width: 52px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--cyan);
  font-family: Consolas, monospace;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 6px 15px rgba(13, 155, 178, 0.23);
}

.sum-ball {
  background: var(--blue);
  box-shadow: 0 6px 15px rgba(39, 107, 197, 0.24);
}

.sum-ball.low {
  background: var(--green);
}

.sum-ball.high {
  background: var(--red);
}

.result-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.result-tags span {
  min-width: 48px;
  padding: 5px 12px;
  border: 1px solid #d9dce2;
  border-radius: 999px;
  background: #f7f8fa;
  color: #343943;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.result-tags span:first-child {
  border-color: #e9c8cd;
  background: #fbf0f2;
  color: var(--red);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quick-stats > div {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 18px;
  border-right: 1px solid var(--line);
}

.quick-stats > div:last-child {
  border-right: 0;
}

.quick-stats span {
  color: var(--muted);
  font-size: 13px;
}

.quick-stats strong {
  font-size: 17px;
}

.quick-stats b {
  font-weight: 800;
}

.section-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
  border: 1px solid #d9dce2;
  background: #fff;
}

.section-nav a {
  position: relative;
  min-height: 50px;
  display: grid;
  place-items: center;
  border-right: 1px solid #e1e4e9;
  color: #444a54;
  font-size: 14px;
  font-weight: 700;
}

.section-nav a:last-child {
  border-right: 0;
}

.section-nav a:hover {
  background: #f7f8fa;
  color: var(--red);
}

.section-nav a.active {
  background: #24272d;
  color: #fff;
}

.section-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--gold);
}

.content-section,
.trend-section {
  padding: 38px 0;
}

.content-section {
  background: var(--soft);
}

.history-heading {
  margin-bottom: 16px;
}

.update-time,
.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.query-bar {
  display: grid;
  grid-template-columns: 1fr 230px auto auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.query-bar label {
  display: grid;
  gap: 6px;
}

.query-bar label span {
  color: #555c68;
  font-size: 12px;
}

.query-bar input {
  width: 100%;
  height: 40px;
  border: 1px solid #cfd3da;
  border-radius: 4px;
  padding: 0 12px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

.query-bar input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(159, 23, 37, 0.08);
}

.draw-list {
  overflow: hidden;
  border: 1px solid #d8dbe1;
  background: #fff;
  box-shadow: 0 8px 22px rgba(27, 31, 39, 0.05);
}

.draw-row {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1.8fr 1.1fr 0.9fr 0.8fr;
  min-height: 54px;
  border-bottom: 1px solid #e6e8ec;
}

.draw-row:last-child {
  border-bottom: 0;
}

.draw-row:not(.draw-head):hover {
  background: #fff9f2;
}

.draw-row > span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-right: 1px solid #eceef1;
  font-size: 14px;
  text-align: center;
}

.draw-row > span:last-child {
  border-right: 0;
}

.draw-head {
  min-height: 46px;
  background: #24272d;
  color: #fff;
}

.draw-head > span {
  border-color: #3a3e46;
  font-size: 13px;
  font-weight: 700;
}

.issue-cell {
  font-family: Consolas, monospace;
  font-weight: 700;
}

.numbers-inline {
  gap: 5px;
  font-family: Consolas, monospace;
  font-weight: 700;
}

.mini-ball {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--cyan);
  color: #fff;
}

.mini-ball.sum {
  background: var(--blue);
}

.type-pair {
  gap: 5px;
}

.type-badge {
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 3px;
  background: #f1f2f5;
  color: #444a54;
  font-size: 12px;
  font-weight: 700;
}

.type-badge.hot {
  background: #f8e7e9;
  color: var(--red);
}

.loading-row,
.empty-row {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 62px;
}

.pagination button {
  width: 38px;
  height: 36px;
  border: 1px solid #cfd3da;
  border-radius: 4px;
  background: #fff;
  color: #3e444f;
  cursor: pointer;
}

.pagination button:hover,
.pagination button.active {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.trend-section {
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.trend-chart {
  min-height: 270px;
  display: grid;
  grid-template-columns: repeat(28, minmax(18px, 1fr));
  align-items: end;
  gap: 4px;
  padding: 24px 18px 12px;
  border: 1px solid var(--line);
  background: #fafbfc;
  overflow-x: auto;
}

.bar-item {
  min-width: 18px;
  height: 220px;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 8px;
}

.bar-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: end;
  background: #edf0f3;
}

.bar-fill {
  position: relative;
  width: 100%;
  min-height: 4px;
  background: var(--cyan);
  transition: height 240ms ease;
}

.bar-fill em {
  position: absolute;
  left: 50%;
  top: -20px;
  transform: translateX(-50%);
  color: #555c68;
  font-size: 10px;
  font-style: normal;
}

.bar-item > span {
  color: #59606b;
  font-family: Consolas, monospace;
  font-size: 11px;
  text-align: center;
}

.sequence-strip {
  margin-top: 16px;
  padding: 15px 18px;
  border-left: 3px solid var(--gold);
  background: #f7f8fa;
}

.sequence-strip > div {
  display: grid;
  grid-template-columns: 145px 1fr;
  align-items: center;
  gap: 18px;
}

.sequence-strip span {
  color: #555c68;
  font-size: 13px;
}

.sequence-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sequence-item {
  min-width: 44px;
  padding: 5px 7px;
  border-radius: 3px;
  background: #e7eaee;
  color: #353b45;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.sequence-item.big {
  background: #f6e3e6;
  color: var(--red);
}

footer {
  background: #17191d;
  color: #aeb2ba;
}

.footer-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}

.footer-inner strong {
  color: #fff;
}

.footer-inner small {
  margin-left: auto;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 16px;
  border-radius: 5px;
  background: #24272d;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.mi-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 14, 17, 0.76);
}

.mi-dialog {
  width: min(470px, 100%);
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 7px;
  background: #1d1f24;
  color: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.mi-dialog-head {
  min-height: 82px;
  display: grid;
  grid-template-columns: 58px 1fr 38px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #44474f;
}

.mi-dialog-head img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.mi-dialog-head > div {
  display: grid;
  gap: 4px;
}

.mi-dialog-head span {
  color: #e1bd6e;
  font-size: 12px;
  font-weight: 700;
}

.mi-dialog-head strong {
  font-size: 18px;
}

.mi-dialog-head b {
  color: #f0c86f;
  font-family: Consolas, monospace;
}

.mi-close-icon {
  width: 36px;
  height: 36px;
  border: 1px solid #555963;
  border-radius: 50%;
  background: #2c2f36;
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.mi-close-icon:hover {
  border-color: #8b909b;
  background: #3a3e46;
}

.mi-reveal {
  position: relative;
  height: 210px;
  margin: 16px;
  overflow: hidden;
  border: 1px solid #bfc3ca;
  border-radius: 5px;
  background: #fff;
}

.mi-result {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  padding: 20px;
  color: var(--ink);
}

.mi-result-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mi-result-numbers i {
  color: #3d424c;
  font-style: normal;
  font-weight: 700;
}

.mi-result-numbers b {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: #fff;
  font-family: Consolas, monospace;
  font-size: 21px;
}

.mi-result-numbers b:last-child {
  background: var(--blue);
}

.mi-result-tags {
  display: flex;
  gap: 8px;
}

.mi-result-tags span {
  min-width: 58px;
  padding: 5px 10px;
  border: 1px solid #d8dbe1;
  border-radius: 999px;
  background: #f5f6f8;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.mi-result-tags span:first-child {
  border-color: #e8c6cb;
  background: #fbf0f2;
  color: var(--red);
}

#miCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  transition: opacity 220ms ease;
}

#miCanvas.revealed {
  opacity: 0;
  pointer-events: none;
}

.mi-hint {
  margin: 0 16px;
  color: #c9cbd1;
  font-size: 13px;
  text-align: center;
}

.mi-sync {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 16px 0;
  border-top: 1px solid #3c4048;
  border-bottom: 1px solid #3c4048;
  color: #c9cbd1;
  font-size: 13px;
}

.mi-sync strong {
  color: #f0c86f;
  font-family: Consolas, monospace;
  font-size: 20px;
}

.mi-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px 16px;
}

.mi-actions button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
}

.mi-reset-button {
  background: var(--gold);
  color: #fff;
}

.mi-close-button {
  border-color: #555963 !important;
  background: #2c2f36;
  color: #fff;
}

@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: auto 1fr;
    gap: 14px;
  }

  .live-status {
    justify-self: end;
  }

  .live-board {
    grid-template-columns: 1fr 180px;
  }

  .issue-meta {
    grid-column: 1 / -1;
    min-height: 72px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 13px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .issue-meta strong {
    margin: 0;
    font-size: 21px;
  }

  .result-display {
    min-height: 150px;
  }

  .quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-stats > div:nth-child(2) {
    border-right: 0;
  }

  .quick-stats > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .query-bar {
    grid-template-columns: 1fr 1fr auto auto;
  }
}

@media (max-width: 680px) {
  .header-inner,
  .intro-inner,
  .section-inner,
  .footer-inner {
    width: min(100% - 20px, 1180px);
  }

  .header-inner {
    min-height: 62px;
  }

  .brand img {
    width: 46px;
    height: 46px;
  }

  .brand strong {
    font-size: 18px;
  }

  .live-status span:last-child {
    display: none;
  }

  .intro-inner {
    min-height: 126px;
    padding: 20px 0;
  }

  .intro-band h1 {
    font-size: 27px;
  }

  .intro-band p:last-child {
    font-size: 13px;
  }

  .clock-block {
    min-width: 104px;
    padding-left: 14px;
  }

  .clock-block strong {
    font-size: 21px;
  }

  .latest-section,
  .content-section,
  .trend-section {
    padding: 26px 0;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .heading-actions {
    gap: 6px;
  }

  .heading-actions button {
    min-height: 38px;
    padding: 0 11px;
    font-size: 13px;
  }

  .ad-slot-primary {
    height: 92px;
  }

  .ad-slot-secondary {
    height: 82px;
  }

  .section-nav a {
    min-height: 46px;
    font-size: 13px;
  }

  .mi-modal {
    padding: 12px;
  }

  .mi-dialog-head {
    grid-template-columns: 48px 1fr 34px;
    gap: 9px;
  }

  .mi-dialog-head img {
    width: 48px;
    height: 48px;
  }

  .mi-dialog-head strong {
    font-size: 16px;
  }

  .mi-reveal {
    height: 190px;
    margin: 12px;
  }

  .mi-result-numbers b {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .mi-hint {
    margin: 0 12px;
  }

  .live-board {
    grid-template-columns: 1fr;
  }

  .result-display {
    padding: 22px 10px;
  }

  .number-ball,
  .sum-ball {
    width: 46px;
    font-size: 21px;
  }

  .result-balls {
    gap: 7px;
  }

  .countdown-panel {
    min-height: 92px;
    align-items: center;
    padding: 15px 18px;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: center;
  }

  .countdown-panel strong {
    margin: 2px 0 4px;
    font-size: 31px;
  }

  .quick-stats > div {
    min-height: 68px;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
  }

  .quick-stats strong {
    font-size: 15px;
  }

  .history-heading {
    align-items: start;
  }

  .update-time {
    padding-top: 22px;
  }

  .query-bar {
    grid-template-columns: 1fr 1fr;
  }

  .query-bar label {
    grid-column: 1 / -1;
  }

  .draw-list {
    overflow-x: hidden;
  }

  .draw-row {
    min-width: 0;
    grid-template-columns: 1.08fr 0.88fr 1.78fr 0.86fr 0.78fr 0.52fr;
  }

  .draw-row > span {
    padding: 7px 3px;
    font-size: 11px;
  }

  .draw-head > span {
    font-size: 10px;
  }

  .numbers-inline {
    gap: 2px;
    font-size: 10px;
  }

  .mini-ball {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }

  .type-pair {
    gap: 2px;
  }

  .type-badge {
    min-width: 20px;
    padding: 2px 3px;
    font-size: 10px;
  }

  .trend-chart {
    grid-template-columns: repeat(28, 24px);
  }

  .sequence-strip > div {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .footer-inner {
    min-height: 96px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    text-align: center;
  }

  .footer-inner small {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
