/**
 * 25 Days of Christmas — a seasonal edition of Grounded.
 * Warm ivory, blush and dusty rose, champagne gold details, espresso serif
 * headings and small watercolour botanicals. Dark mode uses the app's evening
 * surfaces. Everything is scoped to .cx-* so no existing screen changes.
 */

#christmasChallengeCard,
.cx-backdrop {
  --cx-bg: #fdf8f3;
  --cx-surface: #fffcf9;
  --cx-blush: #f6e4de;
  --cx-blush-soft: #fbefea;
  --cx-line: #e8cbc2;
  --cx-line-strong: #cf9890;
  --cx-rose: #a2585a;
  --cx-rose-deep: #8b4849;
  --cx-rose-text: #944a4b;
  --cx-on-rose: #fffaf7;
  --cx-gold: #c39d62;
  --cx-gold-ink: #84632c;
  --cx-gold-track: rgba(195, 157, 98, 0.18);
  --cx-ink: #3b2a25;
  --cx-body: #4b3a34;
  --cx-muted: #755f57;
  --cx-locked-bg: #f5f0ea;
  --cx-locked-line: #e9ded5;
  --cx-locked-ink: #aa9a92;
  --cx-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --cx-sans: 'Inter', system-ui, sans-serif;
}

.cx-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

html.cx-modal-open,
html.cx-modal-open body {
  overflow: hidden;
}

/* ─── ornament ─── */
.cx-art {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
}
.cx-icon {
  flex: none;
  width: 18px;
  height: 18px;
}
.cx-dot {
  color: var(--cx-gold);
}

/* ─── Today card ─── */
.cx-card-section {
  padding: 0 clamp(14px, 3.5vw, 22px);
}
.cx-card-section[hidden] {
  display: none !important;
}
.cx-card {
  position: relative;
  overflow: hidden;
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 18px 6px;
  border: 1px solid var(--cx-line);
  border-radius: 20px;
  background: linear-gradient(165deg, var(--cx-surface) 0%, var(--cx-surface) 38%, var(--cx-blush-soft) 100%);
  box-shadow: 0 10px 26px rgba(139, 88, 78, 0.13);
  text-align: left;
}
.cx-art--card {
  top: -10px;
  right: -12px;
  width: 47%;
  max-width: 190px;
}
.cx-card-head {
  position: relative;
}
.cx-card-star {
  position: absolute;
  top: 7px;
  left: 0;
  width: 17px;
  height: 17px;
  color: var(--cx-gold);
}
.cx-card-brand {
  position: relative;
  margin: 0;
  font-family: var(--cx-serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0;
  color: var(--cx-rose-text);
  font-variant-numeric: lining-nums;
}
.cx-card-head .cx-card-brand span {
  display: block;
}
.cx-card-head .cx-card-brand span:first-child {
  padding-left: 27px;
  font-style: italic;
}
.cx-card-head .cx-card-brand span:last-child {
  padding-left: 8px;
  font-size: 1.14em;
}
.cx-card-tagline {
  position: relative;
  max-width: 62%;
  margin: 6px 0 0 8px;
  font-family: var(--cx-serif);
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.22;
  color: var(--cx-ink);
}
.cx-meta {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 14px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--cx-line);
  font-family: var(--cx-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--cx-rose-text);
}
.cx-streak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cx-flame {
  flex: none;
  width: 15px;
  height: 15px;
}
.cx-bar {
  height: 7px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--cx-gold-track);
  box-shadow: inset 0 0 0 1px rgba(195, 157, 98, 0.35);
}
.cx-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #dcbb82, #bc9055);
}
.cx-card-headline {
  margin: 12px 0;
  font-family: var(--cx-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.18;
  color: var(--cx-ink);
}

/* compact: nothing new to read */
.cx-card--compact {
  padding-top: 15px;
}
.cx-card--compact .cx-art--card {
  top: -14px;
  right: -12px;
  width: 104px;
}
.cx-card--compact .cx-card-brand {
  max-width: calc(100% - 78px);
  font-size: 23px;
  font-style: italic;
  line-height: 1.1;
}
.cx-status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 70px);
  margin: 5px 0 0;
  font-family: var(--cx-serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--cx-ink);
}
.cx-status-check {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--cx-gold-ink);
}
.cx-card--compact .cx-meta {
  margin-top: 11px;
}
.cx-card--compact .cx-bar {
  margin-bottom: 12px;
}

/* ─── buttons ─── */
.cx-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--cx-rose);
  border-radius: 999px;
  background: var(--cx-rose);
  color: var(--cx-on-rose);
  font-family: var(--cx-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 5px 14px rgba(139, 72, 73, 0.22);
  cursor: pointer;
}
.cx-btn:active {
  background: var(--cx-rose-deep);
}
.cx-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.cx-btn--outline {
  border-color: var(--cx-line-strong);
  background: transparent;
  color: var(--cx-rose-text);
  box-shadow: none;
}
.cx-btn--outline:active {
  background: var(--cx-blush);
}
.cx-link {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-family: var(--cx-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--cx-rose-text);
  text-decoration: underline;
  text-decoration-color: var(--cx-gold);
  text-underline-offset: 3px;
  cursor: pointer;
}
.cx-btn:focus-visible,
.cx-link:focus-visible,
.cx-inline:focus-visible,
.cx-related:focus-visible,
.cx-door:focus-visible,
.cx-close:focus-visible {
  outline: 2px solid var(--cx-gold);
  outline-offset: 2px;
}

/* ─── full-screen page ─── */
.cx-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10260;
  display: flex;
  justify-content: center;
  background: rgba(70, 48, 42, 0.42);
}
.cx-backdrop[hidden] {
  display: none !important;
}
.cx-sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--cx-bg);
  animation: cx-rise 0.28s ease;
}
.cx-topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 6px 8px;
  background: var(--cx-bg);
}
.cx-close {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--cx-ink);
  cursor: pointer;
}
.cx-close .cx-icon {
  width: 22px;
  height: 22px;
}
.cx-topbar-title {
  visibility: hidden;
  font-family: var(--cx-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--cx-ink);
  font-variant-numeric: lining-nums;
}
.cx-sheet--discovery .cx-topbar {
  border-bottom: 1px solid var(--cx-line);
}
.cx-sheet--discovery .cx-topbar-title {
  visibility: visible;
}
.cx-sheet-body {
  overflow: hidden;
  padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px));
}
.cx-content {
  padding: 14px 20px 0;
}
.cx-title {
  position: relative;
  margin: 0;
  font-family: var(--cx-serif);
  font-size: 31px;
  font-weight: 600;
  line-height: 1.12;
  color: var(--cx-ink);
  font-variant-numeric: lining-nums;
}

/* ─── discovery ─── */
.cx-page-head {
  position: relative;
  min-height: 80px;
  padding: 16px 20px 0;
}
.cx-art--page {
  top: -4px;
  right: -14px;
  width: 132px;
}
.cx-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  max-width: calc(100% - 96px);
  margin: 0 0 6px;
  font-family: var(--cx-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cx-rose-text);
}
.cx-page-head .cx-title {
  padding-right: 88px;
}
.cx-scripture {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 15px;
  padding: 14px 14px 3px 12px;
  border: 1px solid var(--cx-line);
  border-radius: 14px;
  background: var(--cx-blush);
}
.cx-scripture-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--cx-surface);
  color: var(--cx-gold-ink);
}
.cx-scripture-text {
  flex: 1;
  min-width: 0;
}
.cx-scripture blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--cx-serif);
  font-size: 18px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.32;
  color: var(--cx-ink);
}
.cx-scripture figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 10px;
  font-family: var(--cx-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cx-muted);
}
.cx-inline {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--cx-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--cx-rose-text);
  text-decoration: underline;
  text-decoration-color: var(--cx-gold);
  text-underline-offset: 3px;
  cursor: pointer;
}
.cx-body {
  margin: 0 0 15px;
  font-family: var(--cx-sans);
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--cx-body);
}
.cx-worth {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 17px;
  padding: 12px 14px 13px;
  border: 1px solid var(--cx-line);
  border-radius: 14px;
  background: var(--cx-blush-soft);
}
.cx-worth-star {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 4px;
  color: var(--cx-gold);
}
.cx-worth-label {
  display: block;
  font-family: var(--cx-serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--cx-ink);
}
.cx-worth p {
  margin: 3px 0 0;
  font-family: var(--cx-sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--cx-body);
}
.cx-done {
  text-align: center;
}
.cx-done-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 0 8px;
  font-family: var(--cx-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--cx-rose-text);
}
.cx-done-line svg {
  width: 14px;
  height: 14px;
  color: var(--cx-gold);
}
.cx-done--new .cx-done-line svg {
  animation: cx-twinkle 1.1s ease 2;
}
.cx-done .cx-pips {
  margin-bottom: 14px;
}
.cx-related {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--cx-line);
  border-radius: 14px;
  background: var(--cx-surface);
  text-align: left;
  cursor: pointer;
}
.cx-related-kicker {
  display: block;
  font-family: var(--cx-sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cx-muted);
}
.cx-related-title {
  display: block;
  margin-top: 2px;
  font-family: var(--cx-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--cx-ink);
}
.cx-tag {
  flex: none;
  padding: 3px 9px;
  border: 1px solid var(--cx-line-strong);
  border-radius: 999px;
  font-family: var(--cx-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cx-rose-text);
}
.cx-tag--premium {
  border-color: var(--cx-gold);
  background: var(--cx-gold-track);
  color: var(--cx-gold-ink);
}

/* ─── streak + segmented progress ─── */
.cx-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 11px;
  border-bottom: 1px solid var(--cx-line);
}
.cx-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 4px 4px 8px;
  font-family: var(--cx-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  color: var(--cx-rose-text);
}
.cx-stat + .cx-stat {
  border-left: 1px solid var(--cx-line);
}
.cx-stat b {
  font-family: var(--cx-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  color: var(--cx-ink);
  font-variant-numeric: lining-nums;
}
.cx-pips {
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  gap: 2px;
  margin: 0;
}
.cx-pips i {
  height: 6px;
  border-radius: 3px;
  background: var(--cx-blush);
  box-shadow: inset 0 0 0 1px var(--cx-line);
}
.cx-pips i.is-on {
  background: linear-gradient(180deg, #dcbb82, #b78c52);
  box-shadow: none;
}

/* ─── Advent calendar + badge headings ─── */
.cx-center-head {
  position: relative;
  padding: 0 20px 2px;
  text-align: center;
}
.cx-center-head .cx-title {
  font-size: 27px;
}
.cx-head-star {
  display: block;
  width: 17px;
  height: 17px;
  margin: 0 auto 4px;
  color: var(--cx-gold);
}
.cx-subtitle {
  margin: 3px 0 0;
  font-family: var(--cx-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--cx-muted);
}
.cx-art--side {
  top: 2px;
  width: 64px;
}
/* A tighter top bar on the calendar so all five rows stay in view. */
.cx-sheet--calendar .cx-topbar {
  padding-bottom: 0;
}
.cx-art--left {
  left: -8px;
}
.cx-art--right {
  right: -8px;
  transform: scaleX(-1);
}

/* ─── Advent calendar doors ─── */
.cx-doors {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 15px;
}
.cx-door {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1 / 1;
  min-width: 0;
  padding: 2px;
  border: 1.5px solid var(--cx-line-strong);
  border-radius: 12px;
  background: var(--cx-surface);
  color: var(--cx-ink);
  font-family: var(--cx-serif);
  cursor: pointer;
}
.cx-door-num {
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: lining-nums;
}
.cx-door small {
  font-family: var(--cx-sans);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cx-door--complete {
  border-color: var(--cx-line);
  background: var(--cx-blush);
}
.cx-door--complete .cx-door-num {
  font-size: 15px;
  color: var(--cx-body);
}
.cx-door-check {
  width: 22px;
  height: 22px;
  color: var(--cx-gold-ink);
}
.cx-door-check path {
  stroke-width: 2.6;
}
.cx-door--today {
  border-color: var(--cx-rose);
  background: var(--cx-rose);
  color: var(--cx-on-rose);
  box-shadow: 0 5px 14px rgba(139, 72, 73, 0.3);
}
.cx-door--locked,
.cx-door--soon {
  border: 1px solid var(--cx-locked-line);
  background: var(--cx-locked-bg);
  color: var(--cx-locked-ink);
  cursor: default;
}
.cx-door--soon small {
  color: var(--cx-muted);
}
.cx-door-lock {
  width: 11px;
  height: 11px;
}
.cx-door-star {
  position: absolute;
  top: -7px;
  left: 50%;
  width: 15px;
  height: 15px;
  margin-left: -7.5px;
  color: var(--cx-gold);
}
.cx-door--christmas {
  border-color: var(--cx-gold);
}
.cx-note {
  margin: 15px 0 12px;
  font-family: var(--cx-serif);
  font-size: 16px;
  font-style: italic;
  text-align: center;
  color: var(--cx-muted);
}

/* ─── badge ─── */
.cx-badge-image {
  display: block;
  width: 100%;
  max-width: min(400px, calc((100vh - 235px) * 0.8));
  max-width: min(400px, calc((100dvh - 235px) * 0.8));
  height: auto;
  aspect-ratio: 4 / 5;
  margin: 0 auto 16px;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(139, 88, 78, 0.18);
}
.cx-badge-image[hidden] {
  display: none;
}

/* ─── dark and evening themes: the app's own surfaces ─── */
html:is(.dark-theme, [data-theme='dark'], [data-theme='evening']) #christmasChallengeCard,
html:is(.dark-theme, [data-theme='dark'], [data-theme='evening']) .cx-backdrop {
  --cx-bg: var(--bg, #24201f);
  --cx-surface: var(--card, #332d2b);
  --cx-blush: #463633;
  --cx-blush-soft: #3b302e;
  --cx-line: rgba(213, 175, 168, 0.26);
  --cx-line-strong: rgba(213, 175, 168, 0.58);
  --cx-rose-text: #ecc2b9;
  --cx-gold: #cfae74;
  --cx-gold-ink: #e2c791;
  --cx-gold-track: rgba(207, 174, 116, 0.2);
  --cx-ink: var(--text, #f5ede7);
  --cx-body: #ecdfd8;
  --cx-muted: var(--text-light, #c9b9b1);
  --cx-locked-bg: #2a2524;
  --cx-locked-line: rgba(213, 175, 168, 0.12);
  --cx-locked-ink: #93807a;
}
html:is(.dark-theme, [data-theme='dark'], [data-theme='evening']) .cx-backdrop {
  background: rgba(12, 9, 8, 0.62);
}

@keyframes cx-rise {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes cx-twinkle {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  50% {
    transform: scale(1.55) rotate(45deg);
  }
}

@media (max-width: 360px) {
  .cx-card {
    padding-left: 15px;
    padding-right: 15px;
  }
  .cx-card-brand {
    font-size: 28px;
  }
  .cx-title {
    font-size: 27px;
  }
  .cx-content {
    padding-left: 16px;
    padding-right: 16px;
  }
  .cx-page-head {
    padding-left: 16px;
    padding-right: 16px;
  }
  .cx-art--page {
    width: 112px;
  }
  .cx-page-head .cx-title {
    padding-right: 70px;
  }
  .cx-scripture-icon {
    display: none;
  }
  .cx-center-head .cx-title {
    font-size: 23px;
  }
  .cx-art--side {
    width: 44px;
  }
  .cx-doors {
    gap: 7px;
  }
  .cx-door-num {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cx-sheet,
  .cx-done--new .cx-done-line svg {
    animation: none;
  }
}

/* Level figures, so "December 1" never reads as "December I". */
.cx-subtitle,
.cx-note {
  font-variant-numeric: lining-nums;
}
