body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: #f5f5f5;
}

.app {
  max-width: 700px;
  margin: 20px auto;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

.header-center {
  flex: 1;
  text-align: center;
}

.calendar-header h1 {
  font-size: 28px;
  margin: 0 0 10px 0;
}

.calendar-header button {
  background: #eee;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 20px;
  cursor: pointer;
}

.calendar-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-controls select,
.today-btn {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  font-size: 14px;
}

.today-btn {
  cursor: pointer;
  background: #f3f4f6;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.weekdays {
  margin-bottom: 10px;
}

.weekday {
  text-align: center;
  font-weight: bold;
  font-size: 18px;
}

.sunday-label {
  color: red;
}

.empty {
  min-height: 108px;
  background: transparent !important;
}

.day-cell {
  min-height: 108px;
  background: #fafafa;
  border-radius: 8px;
  padding: 6px;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: 20px 20px 34px 20px;
  align-items: center;
  justify-items: center;
}

.hk-holiday,
.cn-holiday,
.day-number,
.lunar-text {
  width: 100%;
  text-align: center;
}

.hk-holiday {
  font-size: 11px;
  color: red;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cn-holiday {
  font-size: 11px;
  color: #16a34a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-number {
  font-size: 28px;
  line-height: 1;
  color: #222;
}

.lunar-text {
  font-size: 11px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sunday .day-number {
  color: red;
  font-weight: bold;
}

.holiday .day-number {
  color: red;
  font-weight: bold;
}

.today {
  background: #dbeafe !important;
  border: 2px solid #60a5fa;
}

.holiday {
  background: #fff1f2 !important;
  border: 1px solid #fecdd3;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #555;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.hk-dot {
  background: red;
}

.cn-dot {
  background: #16a34a;
}

/* Modal */
.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.modal-content {
  position: relative;
  width: min(90%, 420px);
  margin: 12vh auto 0;
  background: #ffffff;
  border-radius: 20px;
  padding: 24px 22px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 14px;
  background: #f2f2f2;
  color: #007aff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.modal-title {
  margin: 0 56px 20px 0;
  font-size: 22px;
  font-weight: 700;
  color: #111;
}

.modal-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.modal-row:last-child {
  border-bottom: none;
}

.modal-label {
  font-size: 13px;
  font-weight: 600;
  color: #888;
}

.modal-value {
  font-size: 19px;
  font-weight: 600;
  color: #222;
}

.hk-row .modal-value {
  color: #e53935;
}

.cn-row .modal-value {
  color: #2e9f42;
}

.lunar-row .modal-value {
  color: #666;
}

/* Mobile */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .app {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 14px;
    border-radius: 16px;
    box-sizing: border-box;
  }

  .calendar-header {
    gap: 8px;
    align-items: flex-start;
  }

  .calendar-header h1 {
    font-size: 28px;
    line-height: 1.2;
    text-align: center;
    width: 100%;
    margin-bottom: 10px;
  }

  .header-center {
    flex: 1;
  }

  .calendar-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .calendar-controls select,
  .today-btn {
    font-size: 16px;
    padding: 8px 10px;
  }

  .legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 14px;
  }

  .weekdays,
  .calendar-grid {
    gap: 6px;
  }

  .weekday,
  .sunday-label {
    font-size: 16px;
    text-align: center;
  }

  .day-cell {
    min-height: 88px;
    padding: 6px 4px;
    border-radius: 12px;
  }

  .day-number {
    font-size: 22px;
    line-height: 1;
    text-align: center;
    width: 100%;
  }

  .lunar-text {
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
    width: 100%;
  }

  .calendar-header button {
    padding: 8px 12px;
    font-size: 22px;
    border-radius: 10px;
  }

  .modal-content {
    width: calc(100% - 32px);
    margin: 16vh auto 0;
    padding: 22px 20px 18px;
    border-radius: 22px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-value {
    font-size: 17px;
  }

  .modal-close {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }
}

  .month-title-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  #monthTitle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-align: center;

    font-size: 24px;
    font-weight: 800;
    color: #ffffff;

    background: linear-gradient(180deg, #e25353 0%, #d94242 100%);
    border-radius: 18px;
    padding: 10px 24px;
    line-height: 1.1;
    white-space: nowrap;

    border: none;
    box-shadow: 0 6px 14px rgba(217, 66, 66, 0.22);
  }

  button,
  select,
  .today-btn,
  #prevMonth,
  #nextMonth,
  .day-cell {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .build-version {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: #999;
    letter-spacing: 0.2px;
  }

  @media (max-width: 768px) {
    .build-version {
      margin-top: 14px;
      font-size: 11px;
    }
  }