.he-daily-phrase {
  white-space: pre-wrap;
}

.he-phrase-calendar {
  --he-calendar-bg: #ffffff;
  --he-calendar-text: #2d3732;
  --he-calendar-muted: #7f8c8d;
  --he-calendar-red: #ff4d4f;
  --he-calendar-red-hover: #ff7875;
  --he-calendar-blue: #1890ff;
  --he-calendar-orange: #d97736;
  --he-calendar-border: #e0e4e0;
  width: 100%;
  color: var(--he-calendar-text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.he-phrase-calendar,
.he-phrase-calendar * {
  box-sizing: border-box;
}

.he-phrase-calendar button {
  font-family: inherit;
}

.he-phrase-calendar__stack {
  display: grid;
  width: min(100%, 380px);
  margin: 0 auto 42px;
  perspective: 1000px;
  isolation: isolate;
}

.he-phrase-calendar__sheet {
  grid-area: 1 / 1;
  align-self: stretch;
  min-width: 0;
  border: 1px solid var(--he-calendar-border);
  border-top: 8px solid var(--he-calendar-red);
  border-radius: 12px;
  background: var(--he-calendar-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  transform-origin: top center;
  backface-visibility: hidden;
}

.he-phrase-calendar__sheet--current {
  position: relative;
  z-index: 2;
}

.he-phrase-calendar__sheet--behind {
  z-index: 1;
  opacity: 0;
  transform: none;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.he-phrase-calendar__stack.is-transitioning .he-phrase-calendar__sheet--behind {
  opacity: 1;
  transform: none;
}

.he-phrase-calendar__sheet--current.is-tearing {
  animation: hePhraseCalendarTearOff 1.2s forwards ease-in;
  pointer-events: none;
}

.he-phrase-calendar__sheet--current.is-resetting {
  animation: none;
  opacity: 0;
  transform: none;
}

@keyframes hePhraseCalendarTearOff {
  0% {
    opacity: 1;
    transform: rotate(0deg) translateY(0) scale(1);
  }
  20% {
    opacity: 1;
    transform: rotate(-3deg) translateY(10px) scale(0.99);
  }
  100% {
    opacity: 0;
    transform: rotate(-15deg) translateY(600px) scale(0.85);
  }
}

.he-phrase-calendar__sheet-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 62px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--he-calendar-border);
}

.he-phrase-calendar__yesterday {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 0;
  border-radius: 20px;
  background: var(--he-calendar-orange);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: normal;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

button.he-phrase-calendar__yesterday {
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

button.he-phrase-calendar__yesterday:hover,
button.he-phrase-calendar__yesterday:focus-visible {
  filter: brightness(0.92);
  outline: 2px solid rgba(217, 119, 54, 0.3);
  outline-offset: 2px;
}

button.he-phrase-calendar__yesterday:active {
  transform: scale(0.97);
}

.he-phrase-calendar__numeric-date {
  margin-bottom: 8px;
  color: var(--he-calendar-muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  text-align: center;
}

.he-phrase-calendar__sheet-body {
  padding: 23px 24px 26px;
  text-align: center;
}

.he-phrase-calendar__month {
  margin: 4px 0;
  color: #262626;
  font-size: 22px;
  font-weight: 500;
}

.he-phrase-calendar__day-number {
  margin: 12px 0;
  color: var(--he-calendar-red);
  font-size: clamp(64px, 16vw, 76px);
  font-weight: 700;
  line-height: 1;
}

.he-phrase-calendar__weekday {
  margin-bottom: 22px;
  color: #595959;
  font-size: 17px;
  font-weight: 500;
}

.he-phrase-calendar__divider {
  height: 1px;
  margin: 16px 0;
  background: #f0f0f0;
}

.he-phrase-calendar__phrases {
  display: grid;
  gap: 11px;
  margin-top: 18px;
  padding: 14px;
  border-left: 4px solid var(--he-calendar-blue);
  border-radius: 0 8px 8px 0;
  background: #fafafa;
  text-align: left;
}

.he-phrase-calendar__phrase-title {
  color: #8c8c8c;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.55px;
  text-transform: uppercase;
}

.he-phrase-calendar__phrase-row {
  min-width: 0;
}

.he-phrase-calendar__prompt {
  display: inline;
  margin-right: 4px;
  color: #262626;
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
}

.he-phrase-calendar__phrase {
  min-width: 0;
  color: #000;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.he-phrase-calendar__phrase--question {
  color: #262626;
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
}

.he-phrase-calendar__phrase--answer {
  color: #000;
  font-size: 14px;
  font-style: italic;
  font-weight: 600;
}

.he-phrase-calendar__sheet-footer {
  padding: 0 24px 24px;
}

.he-phrase-calendar__tear-button {
  width: 100%;
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: 6px;
  background: var(--he-calendar-red);
  box-shadow: 0 4px 10px rgba(255, 77, 79, 0.22);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease;
}

.he-phrase-calendar__tear-button:hover,
.he-phrase-calendar__tear-button:focus-visible {
  background: var(--he-calendar-red-hover);
  outline: 2px solid rgba(255, 77, 79, 0.28);
  outline-offset: 2px;
}

.he-phrase-calendar__tear-button:active {
  transform: scale(0.98);
}

.he-phrase-calendar__sheet--behind .he-phrase-calendar__tear-button {
  pointer-events: none;
}

.he-phrase-calendar__year {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.he-phrase-calendar__months {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.he-phrase-calendar__month-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--he-calendar-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.045);
}

.he-phrase-calendar__month-title {
  margin: 0 0 12px;
  color: #262626;
  font-size: 15px;
  font-weight: 650;
  text-align: center;
}

.he-phrase-calendar__month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.he-phrase-calendar__week-label,
.he-phrase-calendar__day-spacer {
  display: grid;
  min-width: 0;
  min-height: 28px;
  place-items: center;
}

.he-phrase-calendar__week-label {
  color: #8c8c8c;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.he-phrase-calendar__date-button {
  display: grid;
  min-width: 0;
  min-height: 31px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #3f3f3f;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease;
}

.he-phrase-calendar__date-button:hover,
.he-phrase-calendar__date-button:focus-visible {
  border-color: var(--he-calendar-red-hover);
  background: #fff7f7;
  color: var(--he-calendar-red);
  outline: none;
}

.he-phrase-calendar__date-button.is-today {
  border-color: var(--he-calendar-blue);
  color: var(--he-calendar-blue);
  font-weight: 700;
}

.he-phrase-calendar__date-button.is-active {
  border-color: var(--he-calendar-red);
  background: var(--he-calendar-red);
  color: #fff;
  font-weight: 700;
}

@media (max-width: 900px) {
  .he-phrase-calendar__months {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .he-phrase-calendar__stack {
    width: min(100%, 360px);
  }

  .he-phrase-calendar__sheet-header {
    padding-inline: 14px;
  }

  .he-phrase-calendar__sheet-body {
    padding-inline: 18px;
  }

  .he-phrase-calendar__sheet-footer {
    padding-inline: 18px;
  }

  .he-phrase-calendar__months {
    grid-template-columns: 1fr;
  }

  .he-phrase-calendar__month-card {
    padding: 14px;
  }

  .he-phrase-calendar__date-button,
  .he-phrase-calendar__week-label,
  .he-phrase-calendar__day-spacer {
    min-height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .he-phrase-calendar__sheet--behind,
  .he-phrase-calendar__sheet--current,
  .he-phrase-calendar__yesterday,
  .he-phrase-calendar__tear-button,
  .he-phrase-calendar__date-button {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
