:root {
  --bg: #ffffff;
  --fg: #111111;
  --line: #111111;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.15em;
  font-weight: 500;
  background-color: var(--bg);
  color: var(--fg);
  transition: background-color 1.2s ease, color 1.2s ease;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.affirmation-container {
  text-align: left;
  max-width: 90vw;
  width: 100%;
  position: relative;
}

.line {
  height: 1px;
  background-color: var(--line);
  width: 0;
  margin-bottom: 1.5rem;
  opacity: 0;
  transition: opacity 2s ease, width 2s ease-out;
}

.line.active {
  width: 100%;
  opacity: 1;
}

.line.fade-out {
  opacity: 0;
}

.phrase {
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 1.2;
  font-weight: 500;
}

.phrase .label,
.phrase .rest {
  display: inline;
  opacity: 0;
}

.phrase.fade-in .label {
  animation: fadeIn 2s ease forwards;
}

.phrase.fade-in .rest {
  animation: fadeIn 2s ease forwards;
  animation-delay: 1s;
}

.phrase.fade-out .label,
.phrase.fade-out .rest {
  animation: fadeOut 2.4s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  .line.active {
    animation: none;
    width: 100%;
  }
  .phrase.fade-in .label,
  .phrase.fade-in .rest {
    animation: none;
    opacity: 1;
  }
  .phrase.fade-out .label,
  .phrase.fade-out .rest {
    animation: none;
  }
  html, body {
    transition: none;
  }
  body {
    animation: none !important;
  }
}

