:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #11151d;
  --surface-2: #171c26;
  --line: rgba(255, 255, 255, 0.075);
  --text: #f4f6f8;
  --muted: #818997;
  --faint: #555e6c;
  --lime: #c9f36a;
  --lime-deep: #8ec73a;
  --orange: #ff985f;
  --red: #ff6f66;
  --blue: #70a6ff;
  --radius: 22px;
}

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

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 80% -5%, rgba(201, 243, 106, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.97);
}

#app {
  position: relative;
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}

.ambient-one {
  width: 250px;
  height: 250px;
  top: -130px;
  right: calc(50% - 310px);
  background: rgba(201, 243, 106, 0.09);
}

.ambient-two {
  width: 220px;
  height: 220px;
  top: 450px;
  left: calc(50% - 330px);
  background: rgba(80, 112, 255, 0.07);
}

.view {
  position: relative;
  z-index: 1;
  animation: enter 0.34s ease both;
}

.eyebrow {
  color: var(--lime);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-block {
  margin-top: 25px;
}

.view > .section-block:first-child {
  margin-top: 10px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 13px;
}

.section-head h2 {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 720;
}

.subtle {
  color: var(--faint);
  font-size: 10px;
}

.hit-rate {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 6px 0 6px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.hit-rate b {
  margin-right: 2px;
  color: var(--text);
  font-size: 13px;
}

.prediction-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.prediction-item {
  position: relative;
  min-width: 0;
  min-height: 96px;
  padding: 10px 5px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
}

.prediction-period,
.prediction-item b,
.prediction-item small {
  display: block;
}

.prediction-period {
  color: var(--muted);
  font-size: 7px;
  font-weight: 650;
}

.prediction-item b {
  margin: 8px 0 3px;
  font-size: 23px;
  line-height: 1;
}

.prediction-item small {
  font-size: 8px;
  font-weight: 700;
}

.prediction-item i {
  width: 5px;
  height: 5px;
  display: block;
  margin: 9px auto 0;
  border-radius: 50%;
}

.prediction-item.hit {
  border-color: rgba(255, 111, 102, 0.32);
  background: linear-gradient(180deg, rgba(255, 111, 102, 0.1), var(--surface));
}

.prediction-item.hit b,
.prediction-item.hit small {
  color: #ff938b;
}

.prediction-item.hit i {
  background: #ff746b;
  box-shadow: 0 0 8px rgba(255, 116, 107, 0.55);
}

.prediction-item.miss {
  border-color: rgba(110, 210, 132, 0.27);
  background: linear-gradient(180deg, rgba(110, 210, 132, 0.08), var(--surface));
}

.prediction-item.miss b,
.prediction-item.miss small {
  color: #83d894;
}

.prediction-item.miss i {
  background: #6ed284;
  box-shadow: 0 0 8px rgba(110, 210, 132, 0.45);
}

.prediction-item.pending {
  border-color: rgba(152, 161, 175, 0.16);
  background: linear-gradient(180deg, rgba(152, 161, 175, 0.06), var(--surface));
}

.prediction-item.pending b {
  color: #a7afbb;
}

.prediction-item.pending small {
  color: #7f8793;
}

.prediction-item.pending i {
  background: #6e7682;
}

.modal-open {
  overflow: hidden;
}

.modal-open .tabbar {
  opacity: 0;
  pointer-events: none;
}

.history-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 12px 0;
  background: rgba(2, 4, 7, 0.72);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(7px);
  transition: opacity 0.24s ease;
}

.history-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.history-sheet {
  width: min(100%, 488px);
  max-height: min(82dvh, 720px);
  padding: 9px 16px calc(22px + env(safe-area-inset-bottom));
  overflow-y: auto;
  transform: translateY(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 0;
  border-radius: 25px 25px 0 0;
  background: #10141b;
  box-shadow: 0 -22px 70px rgba(0, 0, 0, 0.45);
  transition: transform 0.28s ease;
}

.history-overlay.show .history-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 34px;
  height: 4px;
  margin: 0 auto 13px;
  border-radius: 4px;
  background: #313844;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-head h2 {
  margin-top: 4px;
  font-size: 21px;
}

.history-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 16px 0 13px;
}

.history-summary article {
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.history-summary b,
.history-summary span {
  display: block;
}

.history-summary b {
  margin-bottom: 3px;
  font-size: 17px;
}

.history-summary span {
  color: var(--muted);
  font-size: 8px;
}

.history-list {
  display: grid;
  gap: 7px;
}

.history-record {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
}

.history-record-head,
.history-draw {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-record-head > span {
  color: var(--muted);
  font-size: 8px;
}

.history-record-head > span i {
  margin-left: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--faint);
  font-size: 6px;
  font-style: normal;
}

.history-record-head > em {
  font-size: 9px;
  font-style: normal;
  font-weight: 750;
}

.history-picks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 9px 0;
}

.history-picks > span {
  min-width: 0;
  padding: 6px 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 9px;
  color: #969eaa;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.history-picks > span > i,
.history-picks > span > small {
  display: block;
  font-style: normal;
}

.history-picks > span > i {
  margin-bottom: 2px;
  color: var(--faint);
  font-size: 6px;
}

.history-picks > span > small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 6px;
  font-weight: 600;
}

.history-picks > span.primary {
  border-color: rgba(255, 255, 255, 0.11);
  color: var(--text);
}

.history-draw {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
}

.history-draw > span {
  color: var(--faint);
  font-size: 7px;
}

.history-numbers {
  display: flex;
  gap: 3px;
}

.history-numbers i {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  color: #aeb5c0;
  font-size: 7px;
  font-style: normal;
  font-weight: 700;
}

.history-record.hit {
  border-color: rgba(255, 111, 102, 0.19);
}

.history-record.hit .history-record-head > em,
.history-record.hit .history-picks > span.primary {
  color: #ff8f87;
}

.history-record.miss {
  border-color: rgba(110, 210, 132, 0.17);
}

.history-record.miss .history-record-head > em,
.history-record.miss .history-picks > span.primary {
  color: #7bd58f;
}

.ranking-section {
  padding: 17px 15px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 21, 29, 0.78);
}

.zodiac-list {
  border-top: 1px solid var(--line);
}

.zodiac-row {
  height: 45px;
  display: grid;
  grid-template-columns: 26px 26px 1fr 50px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

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

.rank-index {
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
}

.zodiac-name {
  font-size: 13px;
  font-weight: 700;
}

.rank-track {
  height: 4px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
}

.rank-track i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #59616d;
}

.zodiac-row b {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.zodiac-row.winner .rank-index,
.zodiac-row.winner .zodiac-name,
.zodiac-row.winner b {
  color: var(--lime);
}

.zodiac-row.winner .rank-track i {
  background: linear-gradient(90deg, var(--lime-deep), var(--lime));
  box-shadow: 0 0 10px rgba(201, 243, 106, 0.25);
}

.notice-card {
  margin-top: 14px;
  padding: 14px 15px;
  border: 1px solid rgba(112, 166, 255, 0.13);
  border-radius: 17px;
  background: rgba(112, 166, 255, 0.055);
}

.notice-card span {
  color: #9ebfff;
  font-size: 10px;
  font-weight: 750;
}

.notice-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.notice-card.warning {
  border-color: rgba(255, 152, 95, 0.14);
  background: rgba(255, 152, 95, 0.05);
}

.notice-card.warning span {
  color: var(--orange);
}

.page-intro {
  padding: 25px 2px 20px;
}

.page-intro h1 {
  margin: 7px 0 9px;
  font-size: 31px;
  letter-spacing: -0.05em;
}

.page-intro > p:last-child {
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.control-card {
  margin-bottom: 13px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: #0b0e13;
}

.segmented button,
.filter-row button {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.segmented button {
  height: 32px;
  border-radius: 9px;
  font-size: 11px;
}

.segmented button.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.filter-row {
  display: flex;
  gap: 7px;
  margin-top: 9px;
}

.filter-row button {
  height: 27px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 9px;
}

.filter-row button.active {
  border-color: rgba(201, 243, 106, 0.22);
  background: rgba(201, 243, 106, 0.09);
  color: var(--lime);
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.number-card {
  min-width: 0;
  padding: 7px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  text-align: center;
}

.number-ball {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  margin: 0 auto 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  font-size: 11px;
  font-weight: 800;
}

.number-card b,
.number-card small,
.number-card em {
  display: block;
  white-space: nowrap;
}

.number-card b {
  font-size: 9px;
}

.number-card small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 7px;
}

.number-card em {
  margin-top: 5px;
  color: var(--faint);
  font-size: 6px;
  font-style: normal;
}

.number-card.hot {
  border-color: rgba(255, 111, 102, 0.22);
  background: linear-gradient(180deg, rgba(255, 111, 102, 0.11), var(--surface));
}

.number-card.hot .number-ball {
  background: rgba(255, 111, 102, 0.16);
  color: #ffaaa4;
}

.number-card.warm .number-ball {
  background: rgba(255, 152, 95, 0.13);
  color: #ffb18a;
}

.number-card.neutral .number-ball {
  color: #dbe1e8;
}

.number-card.cool .number-ball {
  background: rgba(112, 166, 255, 0.08);
  color: #9abfff;
}

.number-card.cold {
  opacity: 0.68;
}

.number-card.cold .number-ball {
  color: #6e7888;
}

.empty-state {
  padding: 60px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.formula-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  margin-bottom: 9px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
}

.formula-card.accent {
  border-color: rgba(201, 243, 106, 0.15);
  background: linear-gradient(135deg, rgba(201, 243, 106, 0.07), var(--surface) 56%);
}

.step {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--lime);
  font-size: 9px;
  font-weight: 800;
}

.formula-card h2 {
  margin-bottom: 6px;
  font-size: 14px;
}

.formula-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.data-card {
  margin-top: 22px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--lime);
  font-size: 9px;
}

.status-dot::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.data-card dl {
  border-top: 1px solid var(--line);
}

.data-card dl div {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.data-card dl div:last-child {
  border-bottom: 0;
}

.data-card dt {
  color: var(--muted);
  font-size: 10px;
}

.data-card dd {
  font-size: 10px;
  font-weight: 650;
}

.tabbar {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(488px, calc(100% - 24px));
  height: 66px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.095);
  border-radius: 21px;
  background: rgba(17, 21, 29, 0.88);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(22px);
  transition: opacity 0.2s ease;
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: none;
  color: #606977;
  font-size: 8px;
  cursor: pointer;
}

.tab svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.active {
  color: var(--lime);
}

.tab.active::after {
  content: "";
  position: absolute;
  bottom: 6px;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.boot,
.fatal {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
}

.boot-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border-radius: 18px;
  background: var(--lime);
  color: #152008;
  font-size: 16px;
  font-weight: 850;
  animation: breathe 1.4s ease-in-out infinite;
}

.fatal b {
  color: var(--text);
  font-size: 16px;
}

.fatal p {
  margin: 8px 0 16px;
}

.fatal button {
  padding: 9px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--lime);
  color: #152008;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes breathe {
  50% { transform: scale(1.04); box-shadow: 0 0 30px rgba(201, 243, 106, 0.16); }
}

@media (min-width: 700px) {
  body::before,
  body::after {
    content: "";
    position: fixed;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.035);
  }

  body::before { left: calc(50% - 270px); }
  body::after { right: calc(50% - 270px); }
}

@media (max-width: 370px) {
  #app { padding-inline: 12px; }
  .number-grid { gap: 4px; }
  .number-card { border-radius: 11px; }
  .number-ball { width: 27px; height: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
