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

:root {
  --parchment: #f0e6d6;
  --parchment-light: #f5ede0;
  --parchment-dark: #e4d6c1;
  --ink: #2c1e10;
  --ink-medium: #4a3828;
  --ink-light: #6e5a47;
  --ink-faint: #96866f;
  --ink-ghost: #b8a890;
  --rust: #8b4c2a;
  --rust-light: #a86840;
  --rubric: #8a2e1e;
  --border-line: rgba(110, 90, 71, 0.18);
  --border-strong: rgba(110, 90, 71, 0.3);
}

html,
body {
  height: 100%;
  font-family: 'Crimson Pro', 'EB Garamond', Georgia, serif;
  background: var(--parchment);
  color: var(--ink-medium);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 0 1.25rem;
  position: relative;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 0 2rem;
  animation: fadeUp 0.9s ease-out;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.ornament {
  margin: 0 auto 1rem;
  color: var(--rust);
  opacity: 0.5;
}

.header h1 {
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 1.55rem;
  color: var(--ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.date-display {
  font-family: 'Crimson Pro', serif;
  font-size: 0.85rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* Feast day banner */
.feast-banner {
  width: 100%;
  text-align: center;
  margin-bottom: 1.2rem;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--border-line);
  background: var(--parchment-light);
  box-shadow: inset 0 0 20px rgba(200, 180, 150, 0.1);
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.4s ease;
  display: none;
}

.feast-banner.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.feast-title {
  font-family: 'EB Garamond', serif;
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.feast-rank {
  font-family: 'Crimson Pro', serif;
  font-size: 0.68rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.feast-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.lit-green {
  background: #5a7a4a;
}

.lit-violet {
  background: #6b4c7a;
}

.lit-white {
  background: var(--ink-ghost);
  border: 1px solid var(--border-line);
}

.lit-red {
  background: var(--rubric);
}

.lit-rose {
  background: #c07a8a;
}

.verse-card {
  width: 100%;
  background: var(--parchment-light);
  border: 1px solid var(--border-line);
  border-radius: 4px;
  padding: 2.5rem 2.2rem;
  margin-bottom: 1.5rem;
  position: relative;
  box-shadow: 1px 2px 6px rgba(80, 60, 40, 0.06),
    inset 0 0 40px rgba(200, 180, 150, 0.15);
  animation: cardIn 0.8s ease-out 0.15s both;
  min-height: 200px;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.verse-card::before {
  content: '';
  position: absolute;
  top: 1.5rem;
  bottom: 1.5rem;
  left: 1.2rem;
  width: 1px;
  background: var(--rubric);
  opacity: 0.2;
}

.verse-card::after {
  content: '';
  position: absolute;
  top: 0.8rem;
  left: 1.5rem;
  right: 1.5rem;
  height: 0;
  border-top: 1px solid var(--border-line);
  border-bottom: 1px solid var(--border-line);
  padding-top: 2px;
}

.lang-section {
  margin-bottom: 1.8rem;
  padding-left: 0.8rem;
}

.lang-section:last-child {
  margin-bottom: 0;
}

.verse-text {
  font-family: 'EB Garamond', Georgia, serif;
  font-weight: 400;
  font-style: italic;
  font-size: 1.28rem;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 0.9rem;
  text-indent: 1em;
}

.verse-ref {
  font-family: 'Crimson Pro', serif;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--rust-light);
  text-align: right;
  letter-spacing: 0.03em;
  font-style: italic;
}

.card-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 1.2rem 0 1.6rem;
  padding-left: 0.8rem;
}

.card-divider::before,
.card-divider::after {
  content: '';
  flex: 1;
  height: 0;
  border-top: 1px solid var(--border-line);
}

.divider-sym {
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  color: var(--rust);
  opacity: 0.35;
  line-height: 1;
}

.second-lang .verse-text {
  color: var(--ink-medium);
}

/* Loading skeleton */
.skeleton-line {
  height: 1.1em;
  background: linear-gradient(
    90deg,
    var(--parchment-dark) 25%,
    var(--parchment) 50%,
    var(--parchment-dark) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 3px;
  margin-bottom: 0.6em;
}

.skeleton-line:nth-child(2) {
  width: 90%;
}

.skeleton-line:nth-child(3) {
  width: 60%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.nav-row {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.3rem;
  animation: cardIn 0.8s ease-out 0.35s both;
}

.nav-btn {
  background: transparent;
  border: 1px solid var(--border-line);
  color: var(--ink-faint);
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover,
.nav-btn:active {
  background: var(--parchment-dark);
  color: var(--ink-medium);
  border-color: var(--border-strong);
}

.nav-btn svg {
  width: 15px;
  height: 15px;
}

.today-btn {
  opacity: 0.35;
  transition: all 0.2s ease;
}

.today-btn.away {
  opacity: 1;
  color: var(--rust-light);
  border-color: var(--border-strong);
}

.day-counter {
  font-family: 'Crimson Pro', serif;
  font-size: 0.78rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-ghost);
  min-width: 70px;
  text-align: center;
}

.actions {
  display: flex;
  gap: 0.5rem;
  animation: cardIn 0.8s ease-out 0.5s both;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border-line);
  color: var(--ink-faint);
  font-family: 'Crimson Pro', serif;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 0.5rem 1.1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.action-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-medium);
  background: var(--parchment-dark);
}

.action-btn svg {
  width: 13px;
  height: 13px;
}

.action-btn.fav-active {
  color: var(--rubric);
  border-color: rgba(138, 46, 30, 0.25);
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: var(--parchment-light);
  border: 1px solid var(--border-strong);
  color: var(--ink-medium);
  font-family: 'Crimson Pro', serif;
  font-size: 0.8rem;
  font-style: italic;
  padding: 0.5rem 1.1rem;
  border-radius: 4px;
  box-shadow: 0 3px 12px rgba(80, 60, 40, 0.1);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.verse-card.changing {
  animation: vOut 0.25s ease-in forwards;
}

@keyframes vOut {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.verse-card.entering {
  animation: vIn 0.35s ease-out forwards;
}

@keyframes vIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.footer-note {
  margin-top: auto;
  padding: 2.5rem 0 1rem;
  text-align: center;
  font-family: 'Crimson Pro', serif;
  font-size: 0.6rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-ghost);
  letter-spacing: 0.06em;
}

@media (max-width: 480px) {
  .verse-card {
    padding: 2rem 1.6rem;
  }
  .verse-text {
    font-size: 1.18rem;
  }
  .header h1 {
    font-size: 1.3rem;
  }
  .lang-section {
    padding-left: 0.6rem;
  }
}

/* Tablet and larger screens */
@media (min-width: 481px) and (max-width: 768px) {
  .container {
    max-width: 600px;
  }
  .verse-text {
    font-size: 1.35rem;
  }
  .nav-row {
    gap: 1rem;
  }
  .nav-btn {
    width: 44px;
    height: 44px;
  }
}

/* Desktop - wider layout */
@media (min-width: 769px) {
  body {
    padding: 0 2rem;
  }
  .container {
    max-width: 700px;
  }
  .verse-card {
    padding: 3rem 2.8rem;
    min-height: 220px;
  }
  .verse-text {
    font-size: 1.4rem;
    line-height: 1.8;
  }
  .header h1 {
    font-size: 1.7rem;
  }
  .date-display {
    font-size: 0.9rem;
  }
  .nav-btn {
    width: 44px;
    height: 44px;
  }
  .action-btn {
    padding: 0.6rem 1.3rem;
    font-size: 0.85rem;
  }
  .feast-banner {
    margin-bottom: 1.5rem;
    padding: 0.7rem 1.2rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-line: rgba(110, 90, 71, 0.3);
    --border-strong: rgba(110, 90, 71, 0.5);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
  }
  .nav-row,
  .actions,
  .today-btn.away {
    display: none;
  }
  .verse-card {
    border: 1px solid #ccc;
    box-shadow: none;
  }
  .verse-text {
    color: black;
  }
}

/* Offline indicator */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--rubric);
  color: white;
  text-align: center;
  padding: 0.5rem 1rem;
  font-family: 'Crimson Pro', serif;
  font-size: 0.8rem;
  font-weight: 400;
  z-index: 100;
  display: none;
}

.offline-banner.visible {
  display: block;
}
