:root {
  --bg: #0f1419;
  --card: #1a222c;
  --line: #2a3542;
  --text: #e8eef4;
  --muted: #8b9aab;
  --a: #3d9cf0;
  --b: #3ecf8e;
  --c: #f0a03d;
  --ball: #243040;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(900px 480px at 10% -20%, #1a2a3a 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}
.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 12px 40px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.top h1 { font-size: 1.25rem; font-weight: 700; }
.top nav { display: flex; gap: 8px; }
.top nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.88rem;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.top nav a.on, .top nav a:active { color: #fff; border-color: #4a90d9; background: #1e2d3d; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}
.card-hd a { color: var(--a); text-decoration: none; }
.cd b { color: #ffd166; font-variant-numeric: tabular-nums; min-width: 3.2em; display: inline-block; text-align: center; }
.cd.ending b { color: #ff6b6b; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0.4; } }
.period { color: var(--muted); margin-bottom: 12px; font-size: 0.92rem; }
.period b { color: #fff; font-size: 1.05rem; }
.m-br { display: none; }

.balls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
}
.balls i {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  background: var(--ball);
  border-radius: 50%;
  font-style: normal;
  font-weight: 700;
  border: 2px solid #3a4d63;
}
.balls .op { color: var(--muted); }
.balls strong { font-size: 1.45rem; color: #ffd166; }
.balls label {
  padding: 4px 10px;
  border-radius: 4px;
  background: #2a3a28;
  color: #9be89b;
  font-size: 0.9rem;
}

/* ABC：标题一行 + N个数单行 */
.abc-block {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.abc-block:first-of-type { border-top: none; padding-top: 0; }
.unique-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121820;
}
.unique-switch a {
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.unique-switch a.on {
  color: #fff;
  background: #2a6bb5;
}
.unique-tip {
  color: var(--muted);
  font-size: 0.8rem;
  margin: -4px 0 10px;
}
.miss-hist-link {
  margin-left: 8px;
  color: var(--a, #3b82f6);
  text-decoration: none;
  white-space: nowrap;
}
.miss-hist-link:hover {
  text-decoration: underline;
}
.miss-daily-hist th,
.miss-daily-hist td {
  text-align: center;
}
.miss-daily-hist th:first-child,
.miss-daily-hist td:first-child {
  text-align: left;
}
tr.miss-today-row {
  background: rgba(59, 130, 246, 0.08);
}
.abc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.abc-head em {
  font-style: normal;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.abc-block.a .abc-head em { color: var(--a); }
.abc-block.b .abc-head em { color: var(--b); }
.abc-block.c .abc-head em { color: var(--c); }
.abc-head .ball-rule {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.abc-head .ball-rule .rule-unseen4 {
  color: #ff2d2d !important;
  font-weight: 700;
}

.abc-row + .abc-row {
  margin-top: 8px;
}

.copy-btn {
  border: 1px solid var(--line);
  background: #121820;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  min-height: 32px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.copy-btn:active { opacity: 0.85; }
.copy-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.abc-block.a .copy-btn { border-color: #2a4a6a; color: var(--a); }
.abc-block.b .copy-btn { border-color: #2a5a45; color: var(--b); }
.abc-block.c .copy-btn { border-color: #6a4a2a; color: var(--c); }

.abc-line {
  width: 100%;
  padding: 10px 12px;
  background: #121820;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  word-break: break-word;
  line-height: 1.55;
  user-select: all;
  -webkit-user-select: all;
}
.abc-block.a .abc-line { color: var(--a); border-color: #2a4a6a; }
.abc-block.b .abc-line { color: var(--b); border-color: #2a5a45; }
.abc-block.c .abc-line { color: var(--c); border-color: #6a4a2a; }

.alert-lamp {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff2d2d;
  box-shadow: 0 0 6px rgba(255, 45, 45, 0.55);
  flex-shrink: 0;
}
.abc-block.alert-on .abc-line {
  border-color: #c23b3b;
  box-shadow: inset 0 0 0 1px rgba(255, 60, 60, 0.25);
}
.alert-tip {
  margin-top: 8px;
  color: #ff8a8a;
  font-size: 0.82rem;
  font-weight: 600;
}

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 420px; }
table.mini { min-width: 360px; }
table.abc-hist { min-width: 620px; }
table.abc-hist th.col-rule,
table.abc-hist td.col-rule {
  min-width: 9.5em;
  max-width: 16em;
  white-space: normal;
  line-height: 1.35;
  font-size: 0.82em;
}
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
table.abc-hist td.num .rule-unseen4,
#abcPickRule .rule-unseen4,
.rule-unseen4 {
  color: #ff2d2d !important;
  font-weight: 700;
}
td.tm { color: var(--muted); }
table.abc-hist td.ball-a { color: var(--a); font-weight: 600; }
table.abc-hist td.ball-b { color: var(--b); font-weight: 600; }
table.abc-hist td.ball-c { color: var(--c); font-weight: 600; }
table.abc-hist td.draw { color: #ffd166; font-weight: 600; white-space: nowrap; }
table.abc-hist td.draw .draw-tm {
  display: inline;
  margin-left: 10px;
  padding-top: 0;
  font-size: 0.78em;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}
/* 号源列红线：近80期去重最新10按后台取位，本期开奖不在号源内则标 */
table.abc-hist .bet-uline {
  display: inline-block;
  border-bottom: 2px solid #ff2d2d;
  padding-bottom: 1px;
  line-height: 1.25;
}
table.ball-attr-tbl { min-width: 520px; }
table.ball-attr-tbl td.ball-a b { color: var(--a); }
table.ball-attr-tbl td.ball-b b { color: var(--b); }
table.ball-attr-tbl td.ball-c b { color: var(--c); }
table.ball-attr-tbl .attr {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
}
table.ball-attr-tbl .attr.big { color: #ff8a65; background: rgba(255, 138, 101, 0.15); }
table.ball-attr-tbl .attr.small { color: #64b5f6; background: rgba(100, 181, 246, 0.15); }
table.ball-attr-tbl .attr.odd { color: #ce93d8; background: rgba(206, 147, 216, 0.15); }
table.ball-attr-tbl .attr.even { color: #81c784; background: rgba(129, 199, 132, 0.15); }
/* 大小单双竖线：红=恰好连2后已断；黄=连续≥3未断 */
table.ball-attr-tbl td.ball-a,
table.ball-attr-tbl td.ball-b,
table.ball-attr-tbl td.ball-c {
  position: relative;
  overflow: hidden;
}
table.ball-attr-tbl .attr.streak-r3,
table.ball-attr-tbl .attr.streak4 {
  position: relative;
  padding-right: 9px;
}
table.ball-attr-tbl .attr.streak-r3::after,
table.ball-attr-tbl .attr.streak4::after {
  content: '';
  position: absolute;
  right: 0;
  top: -100px;
  bottom: -100px;
  width: 2px;
  background: #ff2d2d;
  pointer-events: none;
}
table.ball-attr-tbl .attr.streak-y2,
table.ball-attr-tbl .attr.streak-long {
  position: relative;
  padding-right: 9px;
}
table.ball-attr-tbl .attr.streak-y2::after,
table.ball-attr-tbl .attr.streak-long::after {
  content: '';
  position: absolute;
  right: 0;
  top: -100px;
  bottom: -100px;
  width: 2px;
  background: #ffd166;
  pointer-events: none;
}
/* 连6语音提醒：属性右侧红灯同步闪烁 */
table.ball-attr-tbl .attr.lamp-on {
  position: relative;
  padding-right: 14px;
}
table.ball-attr-tbl .streak-lamp {
  position: absolute;
  right: 1px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #ff2d2d;
  box-shadow: 0 0 6px rgba(255, 45, 45, 0.95);
  animation: streak-lamp-blink 0.55s step-end infinite;
  pointer-events: none;
}
@keyframes streak-lamp-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.12; }
}
.empty { text-align: center; color: var(--muted); padding: 20px; }

.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.detail-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 12px;
  background: #121820;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.detail-label { color: var(--muted); font-size: 0.92rem; }
.detail-val { color: var(--text); font-size: 0.95rem; }
.detail-val b { color: #ffd166; font-size: 1.05rem; }
@media (min-width: 720px) {
  .detail-stats { grid-template-columns: 1fr 1fr 1fr; }
  .detail-item { flex-direction: column; align-items: flex-start; gap: 6px; }
}
.extreme-stats .card-hd .muted { color: var(--muted); font-weight: 400; }
.extreme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.extreme-block {
  background: #121820;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
}
.extreme-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 8px;
  font-size: 0.88rem;
}
.extreme-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.extreme-0 .extreme-num {
  color: #64b5f6;
  background: rgba(100, 181, 246, 0.18);
}
.extreme-27 .extreme-num {
  color: #ff8a65;
  background: rgba(255, 138, 101, 0.18);
}
.extreme-since { color: var(--muted); font-size: 0.82rem; }
.extreme-tbl { min-width: 0; width: 100%; }
.extreme-tbl th, .extreme-tbl td { padding: 7px 6px; font-size: 0.82rem; }
.extreme-tbl td:last-child { color: #ffd166; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .extreme-grid { grid-template-columns: 1fr; }
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}
.pager a {
  color: var(--a);
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}
.pager-jump input {
  width: 64px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: inherit;
  text-align: center;
}
.pager-jump button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--a);
  cursor: pointer;
}
footer { text-align: center; color: #5a6a7a; font-size: 0.75rem; margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(20, 28, 38, 0.96);
  color: #fff;
  border: 1px solid #3a4d63;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.86rem;
  z-index: 99;
  max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

.streak-copy .abc-line {
  word-break: break-all;
  line-height: 1.55;
  min-height: 1.4em;
}
.streak-copy .copy-btn {
  border-color: #6a2a2a;
  color: #ff8a8a;
}

.admin-wrap { max-width: 560px; }
.admin-form label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.admin-form input[type="password"],
.admin-form input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #121820;
  color: var(--text);
  font-size: 1rem;
  outline: none;
}
.admin-form input:focus { border-color: #4a90d9; }
.suffix-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.suffix-row .suffix-demo {
  color: var(--a);
  font-weight: 700;
  font-size: 1.2rem;
}
.suffix-row input {
  width: 96px !important;
  text-align: center;
  font-size: 1.3rem !important;
  font-weight: 700;
}
.btn-primary {
  margin-top: 14px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: #2a6bb5;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.btn-primary:active { opacity: 0.9; }
.btn-primary.btn-inline {
  margin-top: 0;
  width: auto;
  padding: 10px 16px;
  font-size: 0.92rem;
  white-space: nowrap;
}
.suffix-form .form-tip { margin-top: 4px; }
.form-tip { margin-top: 12px; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.form-tip code { color: #ffd166; }
.form-ok {
  background: #1a3328;
  color: #9be89b;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.form-err {
  background: #3a1e1e;
  color: #ff9b9b;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.voice-bar {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px 12px;
  border: 0;
  border-radius: 10px;
  background: #c62828;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(198, 40, 40, 0.35);
  position: sticky;
  top: 8px;
  z-index: 40;
  -webkit-tap-highlight-color: transparent;
  animation: voicePulse 1.2s ease-in-out infinite;
}
.voice-bar[hidden] { display: none !important; }
.voice-bar:active { transform: scale(0.98); opacity: 0.95; }
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(198, 40, 40, 0.35); }
  50% { box-shadow: 0 4px 22px rgba(255, 80, 80, 0.55); }
}

@media (max-width: 640px) {
  .wrap { padding: 12px 10px 36px; }
  .top h1 { font-size: 1.1rem; }
  .m-br { display: inline; }
  .balls { justify-content: center; gap: 6px; }
  .balls i { width: 42px; height: 42px; }
  .abc-line { font-size: 0.82rem; padding: 9px 10px; }
  .copy-btn { padding: 6px 8px; font-size: 0.74rem; }
  .card-hd { font-size: 0.8rem; flex-wrap: wrap; }
  .unique-switch a { padding: 5px 8px; font-size: 0.72rem; }
  .voice-bar { font-size: 0.95rem; padding: 16px 12px; }
}
