.calendar-subtitle {
  font-size: 14px;
  color: var(--subtext);
  text-align: center;
  margin-bottom: 16px;
  opacity: 0.8;
}

#calendar-page .sub-page-back {
  color: #5a7a8a;
  border-color: rgba(90, 122, 138, 0.4);
}

#calendar-page .sub-page-back:hover {
  background: rgba(90, 122, 138, 0.12);
}

#calendar-page .sub-page-title {
  color: #5a7a8a;
}

/* --- 校历图片容器 --- */
.calendar-img-wrap {
  width: 100%;
  max-width: 480px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #5a7a8a;
  background: var(--glass);
  margin-bottom: 20px;
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.calendar-img-wrap:active {
  transform: scale(0.98);
}

#calendarImg {
  width: 100%;
  display: block;
  border-radius: 12px;
  pointer-events: none;
}

/* --- 日程列表 --- */
.calendar-event-list {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

/* 大卡片容器 */
.cal-section-card {
  width: 100%;
  background: var(--glass);
  border: 1.5px solid #5a7a8a;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* 已完成卡片 */
.cal-section-card.done {
  opacity: 0.9;
  border: 1.5px solid #78909c;
}

/* 区域标题 */
.cal-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #5a7a8a;
  margin: 0 0 4px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background: #5a7a8a;
  border-radius: 2px;
}

.cal-section-title.done {
  color: #78909c;
  opacity: 0.8;
}

.cal-section-title.done::before {
  background: #78909c;
}

/* 内容区 */
.cal-section-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}

/* --- 事件卡片 --- */
.cal-event-card {
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: default;
}

.cal-event-card.done {
  opacity: 0.5;
  filter: grayscale(0.6);
}

/* 左侧竖条 */
.cal-event-bar {
  width: 4px;
  flex-shrink: 0;
  background: var(--event-color);
}

/* 主内容区 */
.cal-event-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 10px;
}

.cal-event-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

/* 左侧文本颜色跟随右侧标签颜色 */
.cal-event-date {
  font-size: 12px;
  color: var(--subtext);
  opacity: 0.85;
  font-weight: 500;
}

.cal-event-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--event-color);
  line-height: 1.3;
}

.cal-event-card.done .cal-event-date,
.cal-event-card.done .cal-event-title {
  opacity: 0.6;
}

/* 标签 */
.cal-event-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 10px;
}

/* --- 图片缩放遮罩 --- */
.cal-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  touch-action: none;
}

.cal-zoom-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.cal-zoom-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cal-zoom-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-zoom-img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
  -webkit-user-drag: none;
  transform: translate(-50%, -50%) translate(0px, 0px) scale(1);
  will-change: transform;
}

.cal-zoom-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
  #calendar-page .sub-page-back {
    color: #8bb8d8;
    border-color: rgba(139, 184, 216, 0.4);
  }

  #calendar-page .sub-page-back:hover {
    background: rgba(139, 184, 216, 0.12);
  }

  #calendar-page .sub-page-title {
    color: #8bb8d8;
  }

  .cal-section-title,
  .cal-section-title::before {
    color: #8bb8d8;
  }

  .cal-section-title.done,
  .cal-section-title.done::before {
    color: #78909c;
  }

  .calendar-img-wrap {
    border-color: #5a7a8a;
  }

  .cal-section-card {
    border-color: #5a7a8a;
  }

  .cal-section-card.done {
    border-color: #78909c;
  }

  .cal-event-card {
    background: rgba(0, 0, 0, 0.2);
  }

  .cal-event-card.done {
    opacity: 0.35;
  }
}
