#turnover {
  position: relative;
  overflow: hidden;
}

#turnover .calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
  padding: 0 240px;
}
#turnover .calc-widget {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  border: 1px solid var(--card-border);
}
#turnover .slider-group { margin-bottom: 32px; }
#turnover .slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#turnover .slider-label span:first-child { font-size: 1rem; font-weight: 500; color: var(--text); }
#turnover .val-badge {
  background: var(--surface-muted);
  border-radius: 8px; padding: 3px 10px;
  font-size: 1.125rem; font-family: ui-monospace, 'SF Mono', 'Monaco', monospace; font-weight: 800; color: var(--text);
}
#turnover input[type="range"] {
  width: 100%; height: 8px; border-radius: 4px;
  appearance: none; -webkit-appearance: none;
  background: linear-gradient(to right, var(--blue) var(--pct, 10%), var(--card-border) var(--pct, 10%));
  outline: none; cursor: pointer;
  transition: background 0.2s ease;
}
#turnover input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 2px 6px rgba(42, 23, 212, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#turnover input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 2px 10px rgba(42, 23, 212, 0.55);
}
#turnover input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue);
  border: none;
  box-shadow: 0 2px 6px rgba(42, 23, 212, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#turnover input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.15);
}

#turnover .calc-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}
#turnover .calc-result-box {
  background: var(--surface-muted);
  border-radius: 12px; padding: 16px;
  text-align: center;
}
#turnover .r-label { font-size: .75rem; color: var(--text-sub); font-weight: 500 }
#turnover .r-val   { font-size: 1.25rem; font-family: ui-monospace, 'SF Mono', 'Monaco', monospace; font-weight: 800; color: var(--text);}
#turnover .calc-note {
  font-size: .875rem; color: var(--gray);
  text-align: center; margin-top: 24px; line-height: 1.5;
}

/* ── DARK MODE ──────────────────────────────────────── */
[data-theme="dark"] #turnover::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"] #turnover > .container {
  position: relative;
  z-index: 1;
}

[data-theme="dark"] #turnover .section-heading h2 {
  color: #ffffff;
}

[data-theme="dark"] #turnover .section-heading h2 .blue {
  color: var(--blue);
}

[data-theme="dark"] #turnover .calc-widget {
  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"] #turnover .val-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] #turnover input[type="range"]::-webkit-slider-thumb {
  box-shadow: 0 2px 8px rgba(26, 82, 219, 0.45);
}

[data-theme="dark"] #turnover input[type="range"]:active::-webkit-slider-thumb {
  box-shadow: 0 2px 12px rgba(26, 82, 219, 0.6);
}

[data-theme="dark"] #turnover input[type="range"]::-moz-range-thumb {
  box-shadow: 0 2px 8px rgba(26, 82, 219, 0.45);
}

[data-theme="dark"] #turnover .calc-result-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] #turnover .calc-note {
  color: #6b7280;
}

[data-theme="dark"] #turnover .calc-result-box.box-updated {
  animation: to-box-glow-dark 0.42s ease;
}

@keyframes to-box-glow-dark {
  0%   { box-shadow: 0 0 0 0 rgba(26, 82, 219, 0); }
  50%  { box-shadow: 0 0 0 5px rgba(26, 82, 219, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(26, 82, 219, 0); }
}

/* ── Scroll entrance ─────────────────────────────────── */
#turnover .section-heading,
#turnover .calc-widget,
#turnover .slider-group,
#turnover .calc-result-box,
#turnover .calc-note {
  opacity: 0;
}

#turnover.to-visible .section-heading {
  animation: to-fade-down 0.6s ease forwards;
}
#turnover.to-visible .calc-widget {
  animation: to-fade-up 0.65s ease 0.12s forwards;
}
#turnover.to-visible .slider-group:nth-child(1) {
  animation: to-fade-up 0.5s ease 0.28s forwards;
}
#turnover.to-visible .slider-group:nth-child(2) {
  animation: to-fade-up 0.5s ease 0.4s forwards;
}
#turnover.to-visible .calc-result-box:nth-child(1) {
  animation: to-fade-up 0.45s ease 0.52s forwards;
}
#turnover.to-visible .calc-result-box:nth-child(2) {
  animation: to-fade-up 0.45s ease 0.64s forwards;
}
#turnover.to-visible .calc-result-box:nth-child(2) .r-val {
  animation: to-result-pop 0.55s ease 0.82s forwards;
}
#turnover.to-visible .calc-note {
  animation: to-fade-up 0.5s ease 0.76s forwards;
}

@keyframes to-fade-down {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes to-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes to-result-pop {
  from { transform: scale(0.88); }
  to   { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #turnover .section-heading,
  #turnover .calc-widget,
  #turnover .slider-group,
  #turnover .calc-result-box,
  #turnover .calc-note {
    opacity: 1;
    animation: none !important;
    transform: none !important;
  }
  #turnover .val-badge.val-updated,
  #turnover .r-val.val-updated,
  #turnover .calc-result-box.box-updated {
    animation: none !important;
  }
}

@media (max-width: 1024px) {
  #turnover .calc-grid { grid-template-columns: 1fr; padding: 0; gap: 20px; }
}

@media (max-width: 768px) {
  #turnover .calc-widget { padding: 20px; }
  #turnover .slider-group { margin-bottom: 24px; }

  #turnover .calc-results {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
  }

  #turnover .calc-result-box {
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--surface-muted);
    min-height: 0;
  }

  #turnover .r-label {
    font-size: .6875rem;
    line-height: 1.35;
    margin-bottom: 4px;
  }

  #turnover .r-val {
    font-size: 1.0625rem;
  }

  #turnover .calc-note {
    margin-top: 20px;
    font-size: .8125rem;
  }
}

/* ── Slider value feedback ───────────────────────────── */
#turnover .val-badge.val-updated,
#turnover .r-val.val-updated {
  animation: to-val-pulse 0.38s ease;
}
#turnover .calc-result-box.box-updated {
  animation: to-box-glow 0.42s ease;
}
@keyframes to-val-pulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.07); color: var(--blue); }
  100% { transform: scale(1); }
}
@keyframes to-box-glow {
  0%   { box-shadow: 0 0 0 0 rgba(42, 23, 212, 0); }
  50%  { box-shadow: 0 0 0 5px rgba(42, 23, 212, 0.12); }
  100% { box-shadow: 0 0 0 0 rgba(42, 23, 212, 0); }
}
