* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
body {
  padding: 30px 20px;
  background: #f1f5f9;
}
.widget {
  max-width: 420px;
  margin: 0 auto;
}
.heading {
  margin-bottom: 12px;
}
.heading-title {
  font-size: 17px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}
.heading-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.short-line {
  width: 20px;
  height: 3px;
  background: #3b82f6;
  border-radius: 3px;
}
.long-line {
  width: 40px;
  height: 3px;
  background: #3b82f6;
  border-radius: 3px;
}

/* ===================================== */
/* 🔥 旗舰版万年历 - 农历+黄历+节气+干支+五行  */
/* ===================================== */
.w-calendar-pro {
  background: #fff;
  border-radius: 20px;
  overflow: visible; /* 关键修复：去掉 hidden，让 tooltip 可以完整显示 */
  box-shadow: 0 12px 48px rgba(0,0,0,0.09);
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  margin-top: 20px;
  position: relative;
  z-index: 1;
}
.w-calendar-pro:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.13);
}

/* 顶部渐变栏 */
.cal-header {
  position: relative;
  padding: 30px 26px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cal-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 25% 30%, rgba(255,255,255,0.18) 0%, transparent 45%),
    radial-gradient(circle at 75% 70%, rgba(255,255,255,0.12) 0%, transparent 50%);
  pointer-events: none;
}
.cal-title {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cal-title .year {
  font-size: 16px;
  opacity: 0.92;
}
.cal-title .zodiac {
  font-size: 13px;
  opacity: 0.9;
  background: rgba(255,255,255,0.22);
  padding: 3px 9px;
  border-radius: 12px;
  white-space: nowrap;
}
.cal-nav {
  display: flex;
  gap: 10px;
}
.cal-btn {
  width: 38px;
  height: 45px;
  border-radius: 45px;
  background: rgba(255,255,255,0.22);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}
.cal-btn:hover {
  background: rgba(255,255,255,0.38);
  transform: scale(1.1);
}
.cal-btn svg {
  width: 18px;
  height: 18px;
}

/* 星期栏 */
.cal-week {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.week-day {
  flex: 1;
  text-align: center;
  padding: 13px 0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

/* 日期网格 */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 14px;
  gap: 3px;
}
.cal-day {
  aspect-ratio: 1/1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.22s ease;
}
/* 农历日期 */
.cal-day .lunar {
  font-size: 9px;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
}
.cal-day.other {
  color: #cbd5e1;
}
.cal-day.other .lunar {
  color: #e2e8f0;
}
.cal-day.weekend {
  color: #ef4444;
  font-weight: 600;
}
.cal-day:hover {
  background: #eff6ff;
  transform: scale(1.08);
  z-index: 10;
}

/* 今日高亮 */
.cal-day.today {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 5px 15px rgba(59,130,246,0.35);
}
.cal-day.today .lunar {
  color: rgba(255,255,255,0.92);
}

/* 节气/节日标记 */
.cal-day .solar-term {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 7px;
  color: #3b82f6;
  background: rgba(59,130,246,0.12);
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
}
.cal-day.today .solar-term {
  color: #fff;
  background: rgba(255,255,255,0.25);
}

/* 旗舰级悬浮卡片 - 修复版 */
.cal-day .tip {
  position: absolute;
  bottom: calc(100% + 8px); /* 调整位置，避免被裁剪 */
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 12px;
  background: #1e293b;
  color: #fff;
  font-size: 11px;
  border-radius: 10px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 9999;
  min-width: 180px;
  pointer-events: none;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}
/* 关键修复：给 tooltip 加上智能边界判断，避免左右超出 */
.cal-day:hover .tip {
  opacity: 1;
  visibility: visible;
}
/* 给靠近左右边缘的日期单独处理 tooltip 位置 */
.cal-day:nth-child(7n+1):hover .tip {
  left: 0;
  transform: translateX(0);
}
.cal-day:nth-child(7n):hover .tip {
  left: auto;
  right: 0;
  transform: translateX(0);
}

.cal-day .tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #1e293b;
}
/* 边缘日期的箭头位置修正 */
.cal-day:nth-child(7n+1) .tip::after {
  left: 15px;
  transform: none;
}
.cal-day:nth-child(7n) .tip::after {
  left: auto;
  right: 15px;
  transform: none;
}

.tip .festival {
  color: #38bdf8;
  font-weight: 600;
  margin-bottom: 3px;
  font-size: 12px;
}
.tip .lunar-info {
  margin-bottom: 4px;
  line-height: 1.4;
}
.tip .yellow {
  font-size: 10px;
  line-height: 1.4;
}
.tip .yellow .yi {
  color: #10b981;
}
.tip .yellow .ji {
  color: #ef4444;
}

/* 响应式 */
@media (max-width:768px) {
  .cal-day { font-size:13px; }
  .cal-day .lunar { font-size:8px; }
  .cal-header { padding:18px; }
  .tip { min-width: 150px; font-size:10px; padding:8px 10px; }
}