:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #27262d;
  background: #f5f6f8;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f5f6f8;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f5f6f8;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

.period-main {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 42px;
}

.period-flash {
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.period-flash-success {
  border-color: #9ecfc2;
  background: #f1faf7;
  color: #246e61;
}

.period-flash-error {
  border-color: #efacb8;
  background: #fff3f5;
  color: #a82c4b;
}

.calendar-panel {
  padding: 24px;
  border: 1px solid #dfe2e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(35, 39, 47, 0.07);
}

.calendar-toolbar {
  min-height: 42px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.calendar-toolbar h2 {
  margin: 0;
  color: #29272f;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
  white-space: nowrap;
}

.month-navigation {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-navigation a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #57545e;
  text-decoration: none;
}

.month-navigation a:hover {
  border-color: #d9dde3;
  background: #f7f8fa;
  color: #e34d68;
}

.month-navigation svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekdays {
  margin-bottom: 8px;
}

.calendar-weekdays span {
  min-height: 28px;
  display: grid;
  place-items: center;
  color: #72707a;
  font-size: 13px;
  font-weight: 700;
}

.calendar-blank,
.calendar-day {
  min-width: 0;
  min-height: 88px;
}

.calendar-day {
  padding: 9px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid #dfe2e7;
  border-radius: 6px;
  background: #fff;
  color: #34323a;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.calendar-day:hover {
  border-color: #aeb4bd;
  box-shadow: 0 3px 10px rgba(36, 40, 48, 0.08);
}

.calendar-day:focus-visible {
  outline: 3px solid rgba(66, 99, 235, 0.22);
  outline-offset: 1px;
}

.calendar-day:disabled {
  cursor: wait;
  opacity: 0.72;
}

.day-number {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.day-marker {
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.period-day {
  border-color: #ef9cad;
  background: #fff0f3;
  color: #a82c4b;
}

.range-start,
.range-end {
  border-color: #e34d68;
  background: #ffe4e9;
}

.pending-start {
  border-color: #d93757;
  background: #ffdbe3;
  color: #98223d;
  box-shadow: inset 0 0 0 1px #d93757;
}

.predicted-day {
  border-color: #dfb66f;
  border-style: dashed;
  background: #fff8eb;
  color: #87581a;
}

.ovulation-day {
  border-color: #7bbab0;
  background: #eef9f6;
  color: #247267;
}

.today {
  box-shadow: inset 0 0 0 2px #4263eb;
}

.cycle-trend-panel {
  margin-top: 16px;
  padding: 22px 24px 24px;
  border: 1px solid #dfe2e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(35, 39, 47, 0.07);
}

.cycle-trend-heading {
  min-height: 30px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cycle-trend-heading h2 {
  margin: 0;
  color: #29272f;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: 0;
}

.cycle-trend-heading span {
  color: #74717b;
  font-size: 12px;
  white-space: nowrap;
}

.cycle-trend-chart {
  position: relative;
  width: 100%;
  height: 280px;
}

@media (max-width: 720px) {
  .period-main {
    width: calc(100% - 28px);
    padding: 16px 0 30px;
  }

  .calendar-panel {
    padding: 16px;
  }

  .calendar-toolbar {
    margin-bottom: 14px;
  }

  .calendar-toolbar h2 {
    font-size: 21px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 5px;
  }

  .calendar-day,
  .calendar-blank {
    min-height: 64px;
  }

  .calendar-day {
    padding: 6px;
  }

  .day-number {
    font-size: 13px;
  }

  .day-marker {
    font-size: 10px;
  }

  .cycle-trend-panel {
    padding: 17px 14px 18px;
  }

  .cycle-trend-chart {
    height: 240px;
  }
}

@media (max-width: 380px) {
  .calendar-panel {
    padding: 12px;
  }

  .calendar-toolbar h2 {
    font-size: 19px;
  }

  .month-navigation {
    gap: 2px;
  }

  .month-navigation a {
    width: 34px;
    height: 34px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 4px;
  }

  .calendar-day,
  .calendar-blank {
    min-height: 57px;
  }

  .calendar-day {
    padding: 5px 4px;
  }

  .day-marker {
    font-size: 9px;
  }

  .cycle-trend-heading h2 {
    font-size: 17px;
  }

  .cycle-trend-chart {
    height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-day {
    transition: none;
  }
}
