* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #f3f5f8;
  color: #2b2b2b;
}
.app {
  max-width: 620px; margin: 0 auto;
  padding: 10px;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}
/* 与图3一致：四列均分整栏宽度，选中为绿字+底边线（属性页同款） */
.top-tabs {
  position: sticky;
  top: 0;
  z-index: 120;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  align-items: stretch;
  background: #fff;
  border-bottom: 1px solid #eef1f5;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}
.top-tab {
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 14px 4px;
  background: transparent;
  color: #6b7280;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.35;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.top-tab.active {
  color: #06c755;
  border-bottom-color: #06c755;
  background: transparent;
}
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 0;
  max-width: 620px;
  margin: 0 auto;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}
.bottom-nav .bottom-nav-btn {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  padding: 8px 2px;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.25;
}
.bottom-nav .bottom-nav-btn.active {
  color: #06c755;
  background: rgba(6, 199, 85, 0.12);
}
.view { display: none; }
.view.active { display: block; }
.card {
  background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}
.row-between, .section-title-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.title { margin: 0; font-size: 22px; font-weight: 500; }
.title-sm { margin: 0; font-size: 18px; font-weight: 500; }
.muted { color: #969aa3; font-size: 14px; }
.latest-line { margin-top: 10px; }
.draw-title,
.draw-date,
.latest-card .draw-title {
  color: #6b7280;
  font-weight: 500;
}
.latest-top-row {
  margin: -4px 0 10px;
  padding-bottom: 8px;
  border-bottom: 3px solid #06c755;
  align-items: flex-start;
  gap: 10px;
}
.latest-countdown {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 15px;
  font-weight: 600;
  color: #e53935;
  line-height: 1.4;
}
.latest-next-date {
  flex-shrink: 0;
  text-align: right;
  max-width: 48%;
}
.latest-countdown-digits {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.latest-countdown.latest-countdown-drawing {
  color: #06c755;
}
.draw-result-box {
  margin-top: 8px;
  padding: 12px 10px 14px;
  border: 1px solid #14c95f;
  border-radius: 8px;
  background: #fff;
  max-width: 100%;
  min-width: 0;
}
.balls-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  justify-content: space-between;
}
.plus {
  color: #6d7681;
  font-size: 24px;
  font-weight: 600;
  flex: 0 0 1em;
  align-self: center;
  margin-bottom: 1.35em;
}
.ball-wrap {
  width: 52px;
  text-align: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 56px;
  overflow: hidden;
}
.ball {
  position: relative;
  width: 52px;
  min-width: 0;
  max-width: 100%;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 5px solid #22c55e;
}
.ball-num {
  font-size: 36px;
  line-height: 1;
  font-weight: 700;
  color: #111;
}
.ball.red { border-color: #ff3b30; }
.ball.blue { border-color: #3897ff; }
.ball.green { border-color: #22c55e; }
.ball.pending {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
}
.ball.pending::after {
  display: none;
}
.ball::after {
  content: "";
  position: absolute;
  bottom: 4px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
.ball-cap {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.2;
  color: #111;
  white-space: nowrap;
}

.history-list { display: grid; gap: 10px; margin-top: 10px; }
.history-item {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  min-width: 0;
  overflow: hidden;
}
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.history-issue {
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  flex: 1;
  min-width: 0;
}
.history-date { color: #8f96a0; font-size: 14px; flex-shrink: 0; }

@media (max-width: 768px) {
  .history-item .draw-result-box {
    padding: 12px 6px 14px;
    max-width: 100%;
    overflow: hidden;
  }
  .history-item .balls-row {
    gap: 2px;
    overflow: hidden;
  }
  .history-item .ball-wrap {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }
  .history-item .ball {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    aspect-ratio: 1;
    border-width: 2px;
  }
  .history-item .ball-num {
    font-size: clamp(11px, 2.8vw, 16px);
  }
  .history-item .ball-cap {
    font-size: clamp(9px, 2.2vw, 11px);
  }
  .history-item .plus {
    font-size: 14px;
    flex: 0 0 0.6em;
  }
}
.history-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.history-year-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #86efac;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  color: #047857;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.history-year-btn .query-caret {
  color: #059669;
}

.attr-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 8px -12px 0;
  padding: 0 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid #eef1f5;
}
.attr-tabs::-webkit-scrollbar { display: none; }
.attr-btn {
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #6b7280;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.attr-btn.active {
  color: #06c755;
  border-bottom-color: #06c755;
}

.attr-list { margin-top: 4px; }
.attr-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #eef1f5;
}
.attr-row:last-child { border-bottom: none; }
.attr-row-label {
  flex: 0 0 auto;
  min-width: 2em;
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  line-height: 34px;
}
.attr-row-balls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.attr-badge {
  position: relative;
  box-sizing: border-box;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.attr-badge::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 3px;
  width: 10px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 65%);
  pointer-events: none;
  opacity: 0.9;
}
.attr-badge--outline.attr-badge--red {
  background: #fff;
  border: 2px solid #ff3b30;
  color: #ff3b30;
}
.attr-badge--outline.attr-badge--blue {
  background: #fff;
  border: 2px solid #3897ff;
  color: #3897ff;
}
.attr-badge--outline.attr-badge--green {
  background: #fff;
  border: 2px solid #22c55e;
  color: #22c55e;
}
.attr-badge--fill.attr-badge--red {
  background: #ff3b30;
  border: 2px solid #ff3b30;
  color: #fff;
}
.attr-badge--fill.attr-badge--blue {
  background: #3897ff;
  border: 2px solid #3897ff;
  color: #fff;
}
.attr-badge--fill.attr-badge--green {
  background: #22c55e;
  border: 2px solid #22c55e;
  color: #fff;
}
.attr-badge--fill::after {
  opacity: 0.75;
}

.fenxiao-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.fenxiao-card {
  border: 1px solid #eef1f5;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.fenxiao-card-title {
  margin: 0;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  border-bottom: 1px solid #eef1f5;
  background: #fafbfc;
}
.fenxiao-card-body { padding: 0; }
.fenxiao-row {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef1f5;
  align-items: flex-start;
  font-size: 15px;
  line-height: 1.5;
}
.fenxiao-row:last-child { border-bottom: none; }
.fenxiao-row-label {
  flex: 0 0 auto;
  min-width: 3em;
  font-weight: 600;
  color: #374151;
}
.fenxiao-row-text {
  flex: 1;
  min-width: 0;
  color: #1f2937;
}

.query-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.query-toolbar-btn {
  background: #fff;
  color: #3f3f46;
  border: 0;
  border-bottom: 1px solid #d6d7dc;
  border-radius: 0;
  padding: 10px 4px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px;
  line-height: 1;
}
.query-caret {
  font-size: 14px;
  color: #52525b;
}
.query-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 8px;
}
.query-only-hit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #3f3f46;
  font-size: 15px;
}
.query-only-hit input {
  width: 18px;
  height: 18px;
}
.query-tip-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #a1a1aa;
  background: #fff;
  color: #52525b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}
/* 查询页：仅表格区域滚动，整页不滚动（由 body.view-query-active 控制） */
body.view-query-active {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.view-query-active .top-tabs {
  flex-shrink: 0;
}
body.view-query-active .app {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.view-query-active #view-query.view.active,
body.view-query-active #view-trend.view.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
body.view-query-active #view-query .card,
body.view-query-active #view-trend .card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 0;
}
body.view-query-active .query-toolbar,
body.view-query-active .query-tools-row {
  flex-shrink: 0;
}
body.view-query-active .query-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  max-height: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
body.view-query-active .query-table-wrap::-webkit-scrollbar {
  display: none;
}

.trend-mode-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}
.trend-mode-chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #6b7280;
}
.trend-mode-chip.active {
  border-color: #06c755;
  color: #06c755;
  background: rgba(6, 199, 85, 0.1);
}
.trend-segment-panel {
  margin-bottom: 12px;
}
.trend-segment-tip {
  font-size: 12px;
  line-height: 1.45;
  margin: 0 0 8px;
}
.trend-segment-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.trend-seg-btn {
  min-width: 56px;
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
}
.trend-seg-btn.active {
  border-color: #06c755;
  color: #06c755;
  background: rgba(6, 199, 85, 0.12);
}
.trend-segment-count {
  margin: 8px 0 0;
  font-size: 12px;
}
.query-table .ball.ball-trend {
  width: 34px;
  height: 34px;
  min-width: 34px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.query-table .ball.ball-trend::after {
  display: none;
}
.query-table .ball.ball-trend .ball-num {
  font-size: 13px;
}
.trend-sp-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px !important;
  min-width: 40px;
}
.trend-sp-sub {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.1;
}
.trend-seg-hit {
  background: rgba(34, 197, 94, 0.22) !important;
  border: 2px solid #16a34a !important;
  color: #166534 !important;
}
.trend-seg-miss {
  background: rgba(239, 68, 68, 0.12) !important;
  border: 2px solid #ef4444 !important;
  color: #b91c1c !important;
}
.trend-seg-hit-purple {
  background: #e9d5ff !important;
  border: 2px solid #a855f7 !important;
  color: #6b21a8 !important;
}
.trend-node-pill {
  background: #8b5cf6 !important;
}
.trend-cell-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
}
.query-table.trend-table--wide {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}
.query-table.trend-table--wide th,
.query-table.trend-table--wide td {
  min-width: 42px;
  font-size: 13px;
  padding: 6px 2px;
}
.query-table.trend-table--wide th:first-child,
.query-table.trend-table--wide td:first-child {
  min-width: 92px;
}

.query-table-wrap {
  position: relative;
  overflow-y: auto;
  overflow-x: auto;
  max-height: calc(100vh - 220px - env(safe-area-inset-bottom, 0px));
  border: 1px solid #d6d7dc;
  width: 100%;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.query-table-wrap::-webkit-scrollbar {
  display: none;
}
.query-table-inner {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
}
.query-trend-svg {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.trend-card {
  position: relative;
}
.trend-seg-stats-btn {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 20;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid #86efac;
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  color: #047857;
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}
.trend-seg-stats-btn.hidden {
  display: none;
}
.trend-seg-stats-panel {
  padding: 12px;
}
.trend-seg-stats-content {
  max-height: 55vh;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.trend-seg-stats-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.trend-seg-stats-table th,
.trend-seg-stats-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 6px;
  font-size: 13px;
  text-align: left;
  color: #374151;
  vertical-align: top;
  word-break: break-word;
}
.trend-seg-stats-table th {
  background: #f9fafb;
  font-weight: 600;
}
.trend-seg-num-list {
  line-height: 1.5;
}
.query-table {
  position: relative;
  z-index: 1;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.query-table th,
.query-table td {
  border: 1px solid #d6d7dc;
  text-align: center;
  vertical-align: middle;
  color: #52525b;
  padding: 8px 4px;
  font-size: 15px;
  line-height: 1.35;
  box-sizing: border-box;
}
.query-table thead th {
  background: #9a6026;
  color: #fff;
  font-weight: 600;
  padding: 7px 2px;
}
.query-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}
.query-table tbody tr:nth-child(even) td {
  background: #f3f4f6;
}
.query-table tbody td {
  min-height: 46px;
  height: auto;
}
.query-table th:first-child,
.query-table td:first-child {
  width: 92px;
}
#trendTableWrap .query-table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
}
#trendTableWrap .query-table th:first-child,
#trendTableWrap .query-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 7;
}
#trendTableWrap .query-table thead th:first-child {
  z-index: 8;
  background: #9a6026;
}
#trendTableWrap .query-table tbody tr:nth-child(odd) td:first-child {
  background: #ffffff;
}
#trendTableWrap .query-table tbody tr:nth-child(even) td:first-child {
  background: #f3f4f6;
}
#queryTableWrap .query-table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
}
.query-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
}
.query-pill--c1 { background: #ef4444; }
.query-pill--c2 { background: #2563eb; }
.query-pill--c3 { background: #16a34a; }
.query-pill--red { background: #ef4444; }
.query-pill--blue { background: #2563eb; }
.query-pill--green { background: #16a34a; }
.query-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.query-modal.hidden { display: none; }
.query-help-modal {
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.query-help-panel {
  width: min(620px, 100%);
  max-height: min(85vh, calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.query-help-header {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px solid #eef1f5;
}
.query-help-modal .query-help-back {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #18181b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.query-help-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  color: #18181b;
}
.query-help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 20px;
}
.query-help-section {
  margin-bottom: 18px;
}
.query-help-section:last-child {
  margin-bottom: 0;
}
.query-help-h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #18181b;
}
.query-help-p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: #3f3f46;
}
.query-modal-panel {
  width: min(620px, 100%);
  background: #fff;
  border-radius: 12px 12px 0 0;
}
.query-year-panel { padding: 12px; }
.query-modal-title {
  margin: 0 0 10px;
  font-size: 16px;
  color: #18181b;
}
.query-year-list {
  max-height: 40vh;
  overflow: auto;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
}
.query-year-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #f1f2f5;
  background: #fff;
  color: #3f3f46;
  padding: 10px 12px;
  text-align: left;
}
.query-year-item.active { color: #16a34a; font-weight: 700; }
.query-cond-panel {
  max-height: 85vh;
  min-height: 52vh;
  display: flex;
  flex-direction: column;
}
.query-cond-main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 132px 1fr;
  align-items: stretch;
  overflow: hidden;
}
.query-cond-cats {
  border-right: 1px solid #e4e4e7;
  background: #fafbfc;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  align-self: stretch;
}
.query-cond-cat {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #f1f2f5;
  background: #fff;
  padding: 12px 10px;
  text-align: left;
  color: #18181b;
}
.query-cond-cat.active { color: #16a34a; }
.query-cond-items {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
  align-self: stretch;
}
.query-cond-items--grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  align-content: start;
}
.query-cond-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #f1f2f5;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #3f3f46;
  font-size: 15px;
}
.query-cond-item.active { color: #16a34a; }
.query-cond-items--grid .query-cond-item {
  border-bottom: none;
}
.query-cond-item--tile {
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  margin: 0;
  min-height: 36px;
  padding: 6px 4px;
  font-size: 14px;
}
.query-cond-item--tile .query-check {
  font-size: 12px;
}
.query-check { font-weight: 700; }
.query-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #e4e4e7;
}
.query-modal-btn {
  border: 0;
  background: #fff;
  font-size: 18px;
  padding: 12px 0;
  border-radius: 0;
}
.query-modal-btn.ok { color: #16a34a; font-weight: 700; }
.query-modal-btn.cancel { color: #52525b; }
input, button, select {
  padding: 9px 10px; border-radius: 8px; border: 1px solid #d1d5db; font-size: 14px;
}
input { flex: 1; }
button { background: #06c755; color: #fff; border-color: #06c755; cursor: pointer; }
.query-toolbar-btn,
.query-tip-btn,
.query-year-item,
.query-cond-cat,
.query-cond-item,
.query-modal-btn {
  background: #fff;
  color: inherit;
  border-color: inherit;
}

/* —— 视图 · 统计图 —— */
.stat-view-title { margin-bottom: 4px; }
.stat-field-label {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}
.stat-field-label:first-of-type { margin-top: 4px; }
.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stat-view-card .stat-chip {
  border: 1px solid #d9dee4;
  background: #fff;
  color: #374151;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.stat-view-card .stat-chip.active {
  border-color: #06c755;
  color: #06c755;
  background: rgba(6, 199, 85, 0.1);
}
.stat-code-tabs {
  display: flex;
  margin-top: 12px;
  border-bottom: 1px solid #eef1f5;
}
.stat-code-tabs--hidden { display: none; }
.stat-code-tabs button.stat-code-tab {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #6b7280;
  padding: 10px 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.stat-code-tabs button.stat-code-tab.active {
  color: #06c755;
  border-bottom-color: #06c755;
  background: #fff;
}
.stat-period-bar {
  margin-top: 12px;
  padding: 10px 12px;
  background: #eef1f5;
  border-radius: 8px;
  text-align: center;
  color: #06c755;
  font-weight: 600;
  font-size: 14px;
}
.stat-chart-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin: 14px 0 8px;
}
.stat-chart-sub {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
  margin: -4px 0 10px;
}
.stat-digit-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  padding: 6px 4px 2px;
  flex-wrap: wrap;
}
.stat-digit-scroll-arrow {
  color: #06c755;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.stat-digit-scroll-hint-text {
  font-size: 13px;
  color: #4b5563;
  text-align: center;
}
.stat-vchart {
  display: flex;
  gap: 4px;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
}
.stat-y-panel {
  flex: 0 0 34px;
  position: relative;
  min-height: 248px;
}
.stat-y-unit {
  font-size: 11px;
  color: #9ca3af;
  display: block;
  margin-bottom: 2px;
}
.stat-y-ticks {
  position: absolute;
  left: 0;
  right: 0;
  top: 18px;
  bottom: 32px;
  border-right: 1px solid #e5e7eb;
}
.stat-y-tick {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid #f0f1f3;
  pointer-events: none;
}
.stat-y-tick span {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10px;
  color: #9ca3af;
  transform: translate(-2px, -7px);
}
.stat-vcols {
  flex: 1;
  display: flex;
  gap: 3px;
  align-items: flex-end;
  min-width: 0;
  padding-bottom: 2px;
}
.stat-vcol {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-vval {
  font-size: 11px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
  min-height: 14px;
  line-height: 1;
}
.stat-vtrack {
  width: 100%;
  max-width: 36px;
  margin: 0 auto;
  align-self: stretch;
  background: #eceff3;
  border-radius: 6px 6px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.stat-vfill {
  width: 100%;
  min-height: 0;
  background: linear-gradient(180deg, #d8c5ff, #b08df4);
  border-radius: 6px 6px 0 0;
}
.stat-vfill--red {
  background: linear-gradient(180deg, #ff6b6b, #e54d4d);
}
.stat-vfill--blue {
  background: linear-gradient(180deg, #5eb0ff, #3897ff);
}
.stat-vfill--green {
  background: linear-gradient(180deg, #4ade80, #22c55e);
}
.stat-vchart--digits .stat-y-panel {
  flex: 0 0 34px;
}
.stat-digit-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.stat-vcols--digits {
  justify-content: flex-start;
  gap: 2px;
  min-width: min-content;
  padding-right: 8px;
}
.stat-vcols--digits .stat-vcol {
  flex: 0 0 22px;
  min-width: 22px;
  max-width: 22px;
}
.stat-vcols--digits .stat-vtrack {
  max-width: 100%;
}
.stat-vcols--digits .stat-vlabel {
  font-size: 8px;
}
.stat-vcols--digits .stat-vval {
  font-size: 9px;
}
.stat-vlabel {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.15;
  color: #374151;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 移动端：紧凑排版，单条记录内号码/生肖不换行（与参考图一致） */
@media (max-width: 520px) {
  .app {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    max-width: 100%;
  }
  .top-tab { padding: 12px 2px; font-size: 14px; border-radius: 0; }
  .card {
    padding: 8px 10px;
    margin-bottom: 8px;
    min-width: 0;
    max-width: 100%;
  }
  .row-between { gap: 6px; }
  .row-between .title { min-width: 0; flex: 1; }
  .row-between .muted { flex-shrink: 0; white-space: nowrap; font-size: 11px; }
  .title { font-size: 15px; font-weight: 600; line-height: 1.3; }
  .title-sm { font-size: 14px; font-weight: 600; }
  .muted { font-size: 12px; }
  .latest-line { margin-top: 6px; }
  .draw-result-box {
    margin-top: 8px;
    padding: 14px 6px 18px;
    min-height: 0;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .history-head { margin-bottom: 6px; align-items: flex-start; gap: 6px; }
  .history-issue {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .history-date {
    font-size: 11px;
    color: #8f96a0;
    flex-shrink: 1;
    min-width: 0;
    max-width: 42%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
  }
  .latest-card .draw-date {
    flex-shrink: 1;
    min-width: 0;
    max-width: 38%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
  }
  .balls-row {
    flex-wrap: nowrap;
    gap: 2px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    justify-content: space-between;
    align-items: flex-end;
    overflow: hidden;
  }
  .ball-wrap {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
  }
  .ball {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    aspect-ratio: 1;
    height: auto;
    border-width: 2px;
  }
  .ball-num {
    font-size: clamp(11px, 3.2vw, 16px);
    font-weight: 700;
  }
  .ball::after {
    width: 5px;
    height: 5px;
    bottom: 3px;
    right: 4px;
  }
  .ball-cap {
    margin-top: 5px;
    font-size: clamp(9px, 2.6vw, 11px);
    line-height: 1.2;
    color: #111;
    white-space: nowrap;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .plus {
    font-size: 14px;
    font-weight: 600;
    flex: 0 0 0.65em;
    min-width: 0;
    align-self: center;
    padding: 0;
    margin-bottom: 1.35em;
  }
  .fenxiao-row { font-size: 14px; padding: 8px 10px; }
  .fenxiao-card-title { font-size: 15px; padding: 8px 10px; }
  input, button, select, .query-result, .attr-btn { font-size: 15px; }
  .query-toolbar-btn { font-size: 15px; }
  .query-only-hit { font-size: 15px; }
  .query-table th,
  .query-table td { font-size: 15px; }
  .query-table th:first-child,
  .query-table td:first-child { width: 84px; }
  #trendTableWrap .query-table.trend-table--wide {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
  }
  #trendTableWrap .query-table.trend-table--wide th,
  #trendTableWrap .query-table.trend-table--wide td {
    min-width: 24px;
    font-size: 11px;
    padding: 4px 1px;
  }
  #trendTableWrap .query-table.trend-table--wide th:first-child,
  #trendTableWrap .query-table.trend-table--wide td:first-child {
    width: 58px;
    min-width: 58px;
    font-size: 10px;
    padding: 4px 1px;
  }
  #trendTableWrap .query-table.trend-table--wide .query-pill {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
  .query-cond-item { font-size: 15px; }
  .bottom-nav-btn { font-size: 11px; padding: 6px 2px; }
  .attr-row-label { font-size: 15px; line-height: 32px; }
  .attr-badge { width: 30px; height: 30px; font-size: 12px; }
  .attr-badge::after { width: 9px; height: 7px; top: 1px; right: 2px; }
  .stat-view-card .stat-chip { padding: 7px 10px; font-size: 13px; }
  .stat-vlabel { font-size: 9px; }
  .stat-vval { font-size: 10px; }
  .stat-vtrack { max-width: 100%; }
  .stat-vcols--digits .stat-vcol {
    flex-basis: 20px;
    min-width: 20px;
    max-width: 20px;
  }
}
