#retention {
  position: relative;
  overflow: hidden;
}

.ltv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}
.ltv-chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chart-legend { display: flex; gap: 24px; margin-bottom: 16px; font-size: .8rem; }
.legend-item-1 { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--blue); }
.retention-chart {
  width: 100%;
  height: auto;
  display: block;
  flex-shrink: 0;
  color: var(--text-sub);
}
.retention-chart__label { fill: var(--text-sub); }
.legend-item-2 { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.legend-dot { width: 32px; height: 3px; }

.ltv-cards { display: flex; flex-direction: column; gap: 16px; }
.ltv-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--card-border);
}
.ltv-card h3 {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.125rem; font-weight: 600;
  color: var(--text); margin-bottom: 12px;
}
.ltv-card p {
  font-size: .875rem; font-weight: 400;
  color: var(--text-sub); margin-bottom: 12px;
}
.dot-gray { width: 12px; height: 3px; background: var(--footer-badge-border); flex-shrink: 0; }
.ltv-h3-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--blue); }
.dot-blue { width: 12px; height: 3px; background: var(--blue); flex-shrink: 0; }
.ltv-list { list-style: none; }
.ltv-list li {
  font-size: .875rem; color: var(--text-sub);
  padding: 4px 0;
  display: flex; align-items: flex-start; gap: 12px;
}
.ltv-list li::before { content: "•"; color: var(--gold); font-size: .9rem; flex-shrink: 0; }
.ltv-list--no li::before { content: none; }
.ltv-list .cell-no { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.ltv-list--no .cell-no circle { fill: #dc2626; }
.ltv-list .cell-yes { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.ltv-list-other li {
  font-size: .75rem; color: var(--text);
  display: flex; align-items: center; gap: 12px;
}
.ltv-list-other li::before { content: "•"; color: var(--blue); font-size: .9rem; flex-shrink: 0; }

#retention .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:first-child {
  border: 1px solid var(--blue);
  box-shadow: 0 4px 24px rgba(26, 58, 143, 0.12);
}

/* ── DARK MODE ──────────────────────────────────────── */
[data-theme="dark"] #retention::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 75%;
  height: 70%;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  background: radial-gradient(circle, rgba(26, 82, 219, 0.06) 0%, transparent 72%);
}

[data-theme="dark"] #retention > .container {
  position: relative;
  z-index: 1;
}

[data-theme="dark"] #retention .section-heading h2 {
  color: #ffffff;
}

[data-theme="dark"] #retention .section-heading h2 .blue {
  color: var(--blue);
}

[data-theme="dark"] #retention .section-heading p {
  color: var(--text-sub);
}

[data-theme="dark"] #retention .ltv-chart-card {
  background: rgba(24, 24, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] #retention .legend-item-1 {
  color: var(--blue);
}

[data-theme="dark"] #retention .legend-item-2 {
  color: #94a3b8;
}

[data-theme="dark"] #retention .retention-chart__label {
  fill: #6b7280;
}

[data-theme="dark"] #retention .ltv-card {
  background: rgba(24, 24, 28, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-card {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-card h3 {
  color: #6b7280;
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-card .ltv-list li {
  color: #6b7280;
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:first-child {
  background: rgba(26, 82, 219, 0.1);
  border: 1px solid var(--blue);
  box-shadow:
    0 4px 28px rgba(0, 51, 160, 0.22),
    inset 0 1px 0 rgba(120, 175, 255, 0.06);
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:first-child h3 {
  color: #f1f5f9;
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:first-child .ltv-list li {
  color: #cbd5e1;
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:last-child h3 {
  color: #f1f5f9;
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:last-child p {
  color: var(--text-sub);
}

[data-theme="dark"] #retention .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:last-child .ltv-list-other li {
  color: #cbd5e1;
}

[data-theme="dark"] #retention .ltv-list--no .cell-no circle {
  fill: #ef4444;
}

[data-theme="dark"] #retention .ltv-list .cell-yes circle {
  fill: #22c55e;
}

[data-theme="dark"] #retention .ltv-h3-icon {
  color: var(--blue);
}

[data-theme="dark"] #retention .dot-blue {
  background: var(--blue);
  box-shadow: 0 0 8px rgba(26, 82, 219, 0.45);
}

/* ── ANIMATIONS ─────────────────────────────────────── */
#retention .section-heading,
#retention .ltv-chart-card,
#retention .ltv-card,
#retention .ltv-list li,
#retention .ltv-list-other li {
  opacity: 0;
}

#retention .ret-chart-legacy-fill,
#retention .ret-chart-main-fill,
#retention .ret-chart-marker,
#retention .ret-chart-badge,
#retention .ret-chart-gap {
  opacity: 0;
}

#retention .ret-chart-marker {
  visibility: hidden;
}

#retention.ret-visible .section-heading {
  animation: ret-fade-down 0.6s ease forwards;
}

#retention.ret-visible .ltv-chart-card {
  animation: ret-slide-left 0.65s ease 0.12s forwards;
}

#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-card {
  animation: ret-slide-right 0.65s ease 0.22s forwards;
}

#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(1) {
  animation: ret-slide-right 0.65s ease 0.32s forwards;
}

#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(2) {
  animation: ret-slide-right 0.65s ease 0.44s forwards;
}

#retention.ret-visible .ret-chart-legacy-fill {
  animation: ret-fade-in 0.5s ease 0.35s forwards;
}

#retention.ret-visible .ret-chart-legacy-line {
  animation: ret-draw-line 1.1s ease 0.45s forwards;
}

#retention.ret-visible .ret-chart-main-fill {
  animation: ret-fade-in 0.55s ease 0.55s forwards;
}

#retention.ret-visible .ret-chart-main-line {
  animation: ret-draw-line 1.1s ease 0.65s forwards;
}

#retention .ret-chart-legacy-line,
#retention .ret-chart-main-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

#retention.ret-visible .ret-chart-marker--gray {
  animation: ret-marker-show 0.01s ease 1.55s forwards;
}

#retention.ret-visible .ret-chart-marker--gray .ret-chart-dot-group {
  animation: ret-dot-in 0.35s ease 1.55s forwards;
}

#retention.ret-visible .ret-chart-marker--gray .ret-chart-ripple {
  animation: ret-ripple 2.4s ease-out 2s infinite;
}

#retention.ret-visible .ret-chart-badge--gray {
  animation: ret-fade-up 0.4s ease 1.65s forwards;
}

#retention.ret-visible .ret-chart-marker--blue {
  animation: ret-marker-show 0.01s ease 1.75s forwards;
}

#retention.ret-visible .ret-chart-marker--blue .ret-chart-dot-group {
  animation: ret-dot-in 0.35s ease 1.75s forwards;
}

#retention.ret-visible .ret-chart-marker--blue .ret-chart-ripple {
  animation: ret-ripple 2.4s ease-out 2.2s infinite;
}

#retention.ret-visible .ret-chart-badge--blue {
  animation: ret-fade-up 0.4s ease 1.85s forwards;
}

#retention.ret-visible .ret-chart-gap {
  animation: ret-gap-in 0.5s ease 1.95s forwards;
}

#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-card .ltv-list li {
  animation: ret-fade-up 0.4s ease forwards;
}
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-card .ltv-list li:nth-child(1) { animation-delay: 0.42s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-card .ltv-list li:nth-child(2) { animation-delay: 0.52s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-card .ltv-list li:nth-child(3) { animation-delay: 0.62s; }

#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(1) .ltv-list li {
  animation: ret-fade-up 0.4s ease forwards;
}
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(1) .ltv-list li:nth-child(1) { animation-delay: 0.52s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(1) .ltv-list li:nth-child(2) { animation-delay: 0.62s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(1) .ltv-list li:nth-child(3) { animation-delay: 0.72s; }

#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(2) .ltv-list-other li {
  animation: ret-fade-up 0.4s ease forwards;
}
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(2) .ltv-list-other li:nth-child(1) { animation-delay: 0.64s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(2) .ltv-list-other li:nth-child(2) { animation-delay: 0.72s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(2) .ltv-list-other li:nth-child(3) { animation-delay: 0.80s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(2) .ltv-list-other li:nth-child(4) { animation-delay: 0.88s; }
#retention.ret-visible .ltv-grid > .ltv-cards > .ltv-cards > .ltv-card:nth-child(2) .ltv-list-other li:nth-child(5) { animation-delay: 0.96s; }

@keyframes ret-fade-down {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ret-slide-left {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes ret-slide-right {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes ret-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ret-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ret-draw-line {
  to { stroke-dashoffset: 0; }
}
@keyframes ret-marker-show {
  to { opacity: 1; visibility: visible; }
}
@keyframes ret-dot-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes ret-ripple {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  15% {
    opacity: 0.3;
  }
  100% {
    transform: scale(3.5);
    opacity: 0;
  }
}
@keyframes ret-gap-in {
  from { opacity: 0; transform: scaleY(0.6); }
  to   { opacity: 1; transform: scaleY(1); }
}

.ret-chart-marker,
.ret-chart-gap,
.ret-chart-ripple,
.ret-chart-dot-group {
  transform-box: fill-box;
  transform-origin: center;
}

#retention .ret-chart-ripple,
#retention .ret-chart-dot-group {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  #retention .section-heading,
  #retention .ltv-chart-card,
  #retention .ltv-card,
  #retention .ltv-list li,
  #retention .ltv-list-other li,
  #retention .ret-chart-legacy-fill,
  #retention .ret-chart-main-fill,
  #retention .ret-chart-legacy-line,
  #retention .ret-chart-marker,
  #retention .ret-chart-badge,
  #retention .ret-chart-gap {
    opacity: 1;
    visibility: visible;
    animation: none !important;
    transform: none !important;
  }
  #retention .ret-chart-legacy-line,
  #retention .ret-chart-main-line {
    stroke-dashoffset: 0;
  }
  #retention .ret-chart-ripple {
    opacity: 0 !important;
  }
}

@media (max-width: 1024px) {
  .ltv-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 768px) {
  .ltv-chart-card { padding: 18px; }
  .chart-legend { flex-wrap: wrap; gap: 12px 20px; font-size: .75rem; }
  .ltv-card { padding: 16px; }
  .ltv-card h3 { font-size: 1rem; }
  .ltv-card p { font-size: .8125rem; }
  .ltv-list li { font-size: .8125rem; }
}
