:root {
  --bg: #0f1419;
  --card: #1a2332;
  --border: #2d3a4f;
  --accent: #f0b429;
  --text: #e8ecf1;
  --muted: #8b9cb3;
  --win: #3dd68c;
  --dice-red: #e85d4c;
  --dice-green: #3dd68c;
  --dice-blue: #6cb6ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(240, 180, 41, 0.1), transparent);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo { font-size: 2rem; }
.brand h1 { font-size: 1.35rem; font-weight: 700; }
.tagline { font-size: 0.8rem; color: var(--muted); }

.header-links {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
}
.header-links .dot { opacity: 0.5; }

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}
.tab.active {
  background: var(--accent);
  color: #1a1200;
  border-color: var(--accent);
  font-weight: 600;
}

.countdown-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  background: rgba(26, 35, 50, 0.85);
  border-bottom: 1px solid var(--border);
}

.countdown-wrap { display: flex; align-items: baseline; gap: 0.65rem; flex-wrap: wrap; }
.countdown-label { font-size: 0.85rem; color: var(--muted); }
.countdown {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.next-period { font-size: 0.85rem; color: var(--muted); }
.interval-hint { font-size: 0.8rem; color: var(--muted); }

.main {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}

.card h2 {
  font-size: 1rem;
  margin-bottom: 0.85rem;
  font-weight: 600;
}

.latest-result { min-height: 4rem; }

.dice-guide-card h2 {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.dice-guide-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
}

.dice-guide-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 0.55rem 0.25rem 0.65rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  min-height: 7.5rem;
}

.dice-guide-鱼,
.dice-guide-鸡 { border-color: var(--dice-red); }
.dice-guide-虾,
.dice-guide-蟹 { border-color: var(--dice-green); }
.dice-guide-葫芦,
.dice-guide-虎 { border-color: var(--dice-blue); }

.dice-guide-img img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  display: block;
}

.dice-guide-name {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 600;
}

.dice-guide-point {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffd54f;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  font-variant-numeric: tabular-nums;
}

.dice-latest {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.dice-period { font-size: 0.9rem; color: var(--muted); }
.dice-symbols {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.dice-sym {
  text-align: center;
}
.dice-sym img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  margin: 0 auto 0.35rem;
  /* 固定占位，避免重绘/解码时闪一下 */
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}
.dice-sym .num {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}
.dice-summary {
  text-align: center;
  font-size: 1.05rem;
  margin-top: 0.25rem;
}

.zodiac-latest { text-align: center; }
.zodiac-big {
  font-size: 3rem;
  line-height: 1.2;
  margin: 0.5rem 0;
}
.zodiac-ages { color: var(--muted); font-size: 0.95rem; }

.lotto-latest { text-align: center; }
.lotto-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin: 0.75rem 0;
}
.ball {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  background: #243044;
}
.ball.special {
  background: var(--accent);
  color: #1a1200;
}
.lotto-special-meta { color: var(--muted); font-size: 0.9rem; }

.pass3-latest { text-align: center; }
.pass3-gates {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 0.75rem 0;
}
.pass3-gate {
  min-width: 8.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}
.pass3-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.pass3-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}
.pass3-sum {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent, #e8b84a);
}
.pass3-ball {
  width: 2.15rem;
  height: 2.15rem;
  font-size: 0.8rem;
}
.pass3-gate-pending {
  opacity: 0.72;
  border-style: dashed;
}
.pass3-pending {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.35rem 0;
}
.pass3-status {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.pass3-summary {
  font-size: 1.05rem;
  color: var(--muted);
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.muted { color: var(--muted); font-size: 0.85rem; }

.draw-history { list-style: none; }
.draw-history li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9rem;
}
.draw-history li:last-child { border-bottom: none; }
.dh-time { color: var(--muted); min-width: 4.5rem; }
.dh-period { min-width: 8rem; }
.dh-result { flex: 1; }

.dice-row-syms { display: inline-flex; gap: 0.25rem; align-items: center; }
.dice-row-syms img { width: 28px; height: 28px; object-fit: contain; }

.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}
.footer code {
  background: rgba(0,0,0,0.25);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

@media (max-width: 600px) {
  .countdown { font-size: 1.45rem; }
  .dice-sym img { width: 56px; height: 56px; }
  .dice-guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dice-guide-img img { width: 50px; height: 50px; }
}
