:root {
  --bg: #0f141b;
  --panel: #171d26;
  --panel-2: #1d2530;
  --fg: #eef2f7;
  --muted: #98a2b3;
  --line: rgba(255, 255, 255, .09);
  --accent: #1de9b6;
  --gold: #ffd166;
  --danger: #ff5a66;
  --blue: #5596ff;
  --green: #28d17c;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--fg);
  background: #0f141b;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(180deg, #0f141b 0%, #121923 48%, #0e1319 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

a {
  color: inherit;
}

button,
select,
input {
  font: inherit;
}

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 22px;
  background: rgba(15, 20, 27, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(29, 233, 182, .45);
  border-radius: var(--radius);
  color: #061f1a;
  background: var(--accent);
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 20px;
  letter-spacing: 0;
}

.brand span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.nav a {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #d6dde8;
  font-size: 14px;
  text-decoration: none;
}

.nav a:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, .05);
}

.menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--fg);
}

.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
}

main {
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
}

.toolbar {
  position: sticky;
  top: 72px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -2px;
  padding: 12px 0;
  background: rgba(15, 20, 27, .82);
  backdrop-filter: blur(12px);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-btn,
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--fg);
  background: var(--panel);
  cursor: pointer;
  text-decoration: none;
}

.tool-btn:hover,
.copy-btn:hover {
  border-color: rgba(29, 233, 182, .4);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: #dce3ee;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 20px;
  background: #657083;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left .18s ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  left: 17px;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  white-space: nowrap;
}

.lamp {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7c8798;
}

.lamp.ok {
  background: var(--green);
  box-shadow: 0 0 12px rgba(40, 209, 124, .55);
}

.lamp.warn {
  background: var(--gold);
  box-shadow: 0 0 12px rgba(255, 209, 102, .5);
}

.lamp.bad {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 90, 102, .5);
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 28px;
}

.lottery-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 29, 38, .9);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
  overflow: hidden;
}

.lottery-card.flash {
  animation: flash .8s ease;
}

@keyframes flash {
  0% { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(29, 233, 182, .4), 0 12px 28px rgba(0, 0, 0, .22); }
  100% { border-color: var(--line); }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
}

.card-top h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: 0;
}

.card-top p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.copy-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.issue-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 12px;
  color: var(--muted);
  font-size: 14px;
}

.source-pill,
.sum-pill,
.trait-pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #dce3ee;
  background: rgba(255, 255, 255, .05);
  white-space: nowrap;
}

.balls {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 64px;
  padding: 0 16px 14px;
  flex-wrap: wrap;
}

.ball {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  box-shadow: inset 0 -7px 12px rgba(0, 0, 0, .22), 0 4px 12px rgba(0, 0, 0, .2);
}

.ball.red {
  background: #f04455;
}

.ball.blue {
  background: #2e7cf6;
}

.ball.green {
  background: #10a56f;
}

.ball.pc {
  background: #ffb02e;
  color: #16120a;
}

.ball.empty {
  background: #343d4d;
  color: #8792a4;
}

.summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 14px;
}

.time-line {
  display: grid;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, .025);
  font-size: 14px;
}

.countdown.live {
  color: var(--gold);
}

.history {
  display: grid;
  max-height: 260px;
  overflow: auto;
}

.hist-item {
  display: grid;
  grid-template-columns: minmax(86px, 110px) 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .055);
}

.hist-issue {
  color: var(--muted);
  font-size: 13px;
}

.hist-balls {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.hist-balls .ball {
  width: 25px;
  height: 25px;
  font-size: 12px;
  box-shadow: none;
}

.hist-sum {
  color: #dce3ee;
  font-size: 13px;
}

.skeleton .balls::before {
  content: "";
  display: block;
  width: 100%;
  height: 44px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.12), rgba(255,255,255,.06));
  animation: pulse 1.2s linear infinite;
}

@keyframes pulse {
  0% { opacity: .4; }
  50% { opacity: 1; }
  100% { opacity: .4; }
}

.footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 14px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .menu-btn {
    display: block;
  }

  .site-head {
    align-items: center;
  }

  .nav {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 78px;
    display: none;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
  }

  .nav.show {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    top: 72px;
    align-items: stretch;
    flex-direction: column;
  }

  .hero {
    align-items: start;
    flex-direction: column;
  }

  .hero-meta {
    justify-items: start;
  }

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

@media (max-width: 560px) {
  main {
    width: min(100% - 18px, 1320px);
  }

  .site-head {
    padding: 0 12px;
  }

  .brand {
    min-width: 0;
  }

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

  .hero h1 {
    font-size: 32px;
  }

  .card-top h2 {
    font-size: 18px;
  }

  .ball {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .hist-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
