.home-screen.bazi-open > .home-scroll,
.home-screen.bazi-open > .tab-panel,
.home-screen.bazi-open > .tabbar {
  display: none;
}

.bazi-page {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fffdfa;
  color: #111;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

.bazi-page[hidden] {
  display: none;
}

.bazi-page svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bazi-header {
  display: grid;
  grid-template-columns: 64px 1fr 94px;
  align-items: center;
  height: 54px;
  padding: 8px 18px 0;
}

.bazi-header h1 {
  margin: 0;
  color: #111;
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
}

.bazi-back {
  display: grid;
  place-items: center;
  width: 28px;
  height: 34px;
  color: #111;
}

.bazi-back svg {
  width: 27px;
  height: 27px;
  stroke-width: 2.4;
}

.bazi-record-link {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  color: #1f1f1f;
  font-size: 15px;
  font-weight: 550;
  white-space: nowrap;
}

.bazi-record-link svg {
  display: none;
}

.bazi-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 36px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.08);
}

.bazi-tabs button {
  position: relative;
  color: #5d5d5d;
  font-size: 14px;
  font-weight: 520;
}

.bazi-tabs button.is-active {
  color: #087f46;
  font-weight: 900;
}

.bazi-tabs button.is-active::after {
  position: absolute;
  right: 22px;
  bottom: 0;
  left: 22px;
  height: 3px;
  border-radius: 99px;
  background: #087f46;
  content: "";
}

.bazi-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #fffdfa 0%, #fffaf4 100%);
  scrollbar-width: none;
}

.bazi-scroll::-webkit-scrollbar {
  display: none;
}

.bazi-profile-card,
.bazi-location-grid,
.bazi-chart-card,
.bazi-summary-strip,
.bazi-fortune-card,
.bazi-action-card,
.bazi-detail-list article,
.bazi-year-panel,
.bazi-reading-panel {
  border: 1px solid rgba(31, 31, 31, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 9px 28px rgba(43, 31, 17, 0.06);
}

.bazi-profile-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 10px 15px;
}

.bazi-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.75), transparent 0 15%, transparent 34%),
    radial-gradient(circle at 70% 80%, rgba(15, 111, 71, 0.46), transparent 54%),
    linear-gradient(145deg, #71c68b 0%, #218b55 58%, #0e6f45 100%);
  box-shadow: inset 0 -8px 16px rgba(5, 92, 49, 0.28), 0 9px 18px rgba(16, 121, 72, 0.2);
}

.bazi-avatar::before {
  position: absolute;
  inset: 5px 8px auto;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0));
  content: "";
}

.bazi-avatar span {
  position: relative;
  width: 27px;
  height: 27px;
}

.bazi-avatar span::before {
  position: absolute;
  top: 1px;
  left: 7px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(14, 74, 43, 0.14);
  content: "";
}

.bazi-avatar span::after {
  position: absolute;
  right: 1px;
  bottom: 0;
  left: 1px;
  height: 13px;
  border-radius: 14px 14px 4px 4px;
  background: #fff;
  clip-path: ellipse(50% 78% at 50% 100%);
  content: "";
}

.bazi-profile-main {
  min-width: 0;
  padding-right: 96px;
}

.bazi-profile-main h2 {
  margin: 0 0 5px;
  font-family: inherit;
  color: #111;
  font-size: 17px;
  font-weight: 900;
}

.bazi-profile-main h2 span {
  margin-left: 12px;
}

.bazi-profile-main p {
  margin: 0;
  color: #5f6263;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.38;
  white-space: nowrap;
}

.bazi-edit {
  position: absolute;
  top: 12px;
  right: 9px;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 29px;
  padding: 0 8px;
  border: 1px solid rgba(13, 129, 69, 0.48);
  border-radius: 7px;
  color: #078246;
  font-size: 13px;
  font-weight: 800;
  transition: background 180ms ease, transform 180ms ease;
}

.bazi-edit:hover {
  background: rgba(13, 129, 69, 0.06);
  transform: translateY(-1px);
}

.bazi-edit svg {
  width: 17px;
  height: 17px;
}

.bazi-location-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 8px;
  overflow: hidden;
}

.bazi-location-grid div {
  display: grid;
  gap: 4px;
  min-height: 38px;
  padding: 6px 4px;
  text-align: center;
}

.bazi-location-grid div + div {
  border-left: 1px solid rgba(31, 31, 31, 0.07);
}

.bazi-location-grid span {
  color: #6b6c6d;
  font-size: 12px;
}

.bazi-location-grid strong {
  color: #111;
  font-size: 13px;
  font-weight: 650;
}
