:root {
  --blue: #1989fa;
  --blue-deep: #1677e6;
  --green: #07c160;
  --ink: #222;
  --muted: #8d97a8;
  --line: #d7e3f3;
  --chip: #d5dbe6;
  --bg: #f4f6f9;
  --card: #f7f9fc;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }

.app {
  width: min(680px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 24px rgba(20, 40, 80, 0.06);
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
}

.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 48px;
  padding: 0 10px;
  border-bottom: 1px solid #f2f3f5;
}
.header h1 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.header-side { display: flex; }
.header-side.right { justify-content: flex-end; }
.home-link {
  color: #5b6b82;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.back-btn, .link-btn {
  border: 0;
  background: transparent;
  color: #5b6b82;
  font-size: 14px;
  padding: 6px 2px;
}
.link-btn {
  background: #e8f3ff;
  color: var(--blue);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}
.year-line {
  margin: 0;
  padding: 6px 12px 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.result-box {
  min-height: 148px;
  max-height: 210px;
  overflow: auto;
  margin: 12px 14px 0;
  padding: 8px 6px 10px;
  border: 1px dashed #c5d4ea;
  border-radius: 10px;
  background: var(--card);
}
.result-box.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa6b8;
  font-size: 14px;
}
.hit-label {
  margin: 4px 8px 2px;
  font-size: 14px;
  font-weight: 650;
}
.num-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 4px;
  padding: 2px 6px 8px;
}
.result-ball {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: #fff;
  line-height: 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 650;
}
.result-ball.red { color: #f04545; }
.result-ball.blue { color: #2f8df0; }
.result-ball.green { color: #22a85e; }

.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 12px;
}
.pill {
  border: 0;
  border-radius: 999px;
  height: 32px;
  padding: 0 16px;
  font-size: 14px;
  color: #fff;
}
.pill.blue { background: var(--blue); }
.pill.blue:active { background: var(--blue-deep); }
.pill.green { background: var(--green); }
.pill.green:disabled {
  background: #b7e7cb;
  color: #fff;
  cursor: default;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #e6e8ee;
  background: #fff;
  color: #606266;
  font-size: 14px;
}

.filter-wrap {
  margin: 0 12px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.filter-row { border-top: 1px solid var(--line); }
.filter-row:first-child { border-top: 0; }
.chip-grid {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 10px 4px;
  padding: 12px 6px;
}
.chip-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.chip-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.chip {
  width: min(52px, 100%);
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--chip);
  background: #fff;
  color: #303133;
  font-size: 15px;
}
.chip.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.wave-row { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.wave-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-left: 1px solid #edf2f8;
}
.wave-cell:first-child { border-left: 0; }
.wave-cell.red { background: #c1c1c1; }
.wave-cell.blue { background: #c1c1c1; }
.wave-cell.green { background: #c1c1c1; }

.panel { padding: 8px 14px 32px; }
.panel h2 {
  margin: 16px 0 12px;
  font-size: 16px;
  font-weight: 700;
}
.field { margin-bottom: 12px; }
.field label {
  display: block;
  margin-bottom: 6px;
  color: #606266;
  font-size: 13px;
}
.field input, .field select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
}
.block-btn {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
}
.block-btn:active { background: var(--blue-deep); }
.calc-result {
  margin: 12px 0 4px;
  text-align: center;
  color: #606266;
  font-size: 15px;
}
.calc-result strong {
  margin: 0 4px;
  color: #ee5a24;
  font-size: 20px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.tabs button {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #606266;
  font-size: 14px;
}
.tabs button.on {
  background: #e8f3ff;
  border-color: #b7d7ff;
  color: var(--blue);
  font-weight: 650;
}

.ball-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px 4px;
}
.zodiac-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px 6px;
}
.ball, .zodiac-ball {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin: 0 auto;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 650;
}
.ball {
  background: #fff;
  border: 2px solid currentColor;
}
.ball.red { color: #f04545; }
.ball.blue { color: #2f8df0; }
.ball.green { color: #22a85e; }
.zodiac-ball.ball {
  border: 0;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #8fe0b8, #1f9f68 62%, #14784c);
  box-shadow: inset 0 -6px 8px rgba(0, 0, 0, 0.12), inset 0 6px 8px rgba(255, 255, 255, 0.35);
}
.ball.on {
  color: #fff;
  outline: none;
  box-shadow: none;
}
.ball.red.on { background: #f04545; border-color: #f04545; }
.ball.blue.on { background: #2f8df0; border-color: #2f8df0; }
.ball.green.on { background: #22a85e; border-color: #22a85e; }
.zodiac-ball.on {
  outline: 3px solid #ff9f0a;
  outline-offset: 2px;
}
.pick-meta {
  margin: 14px 0 10px;
  color: #606266;
  font-size: 14px;
  text-align: center;
}
.pick-meta strong { color: var(--blue); }
.row-btns { display: flex; gap: 10px; }
.row-btns .block-btn { flex: 1; }
.row-btns .ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--blue);
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  max-height: 72vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px;
}
.sheet-head strong { font-size: 16px; }
.sheet-head button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 14px;
}
.sheet-tip {
  margin: 0 14px 8px;
  color: #606266;
  font-size: 13px;
}
.sheet-tip b { color: #ee5a24; }
.sheet-list {
  overflow: auto;
  padding: 0 14px 18px;
}
.combo-line {
  padding: 8px 0;
  border-bottom: 1px solid #f2f3f5;
  font-size: 14px;
  letter-spacing: 0.3px;
}
.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 25;
}

.toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -8px);
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
