:root {
  --bg: #120507;
  --bg-soft: #1d0a0c;
  --text: #fcf2f4;
  --muted: #b39a9e;
  --glass: rgba(26, 10, 13, 0.58);
  --glass-strong: rgba(29, 10, 12, 0.78);
  --border: rgba(255, 225, 230, 0.12);
  --border-bright: rgba(255, 225, 230, 0.22);
  --primary: #ff3b5c;
  --secondary: #fb7185;
  --tertiary: #ff7675;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg: #faf0f1;
  --bg-soft: #ebd2d6;
  --text: #351218;
  --muted: #7c595d;
  --glass: rgba(255, 241, 243, 0.62);
  --glass-strong: rgba(255, 243, 245, 0.82);
  --border: rgba(255, 255, 255, 0.7);
  --border-bright: rgba(255, 255, 255, 0.9);
  --shadow: 0 24px 70px rgba(73, 28, 35, 0.15);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-family: "DM Sans", sans-serif; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
#liquid-scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.noise { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .055; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"); }

.app-shell, footer { position: relative; z-index: 2; }
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(18, 5, 7, 0.15);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              backdrop-filter 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.topbar.scrolled {
  background: var(--glass-strong);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.topbar-inner {
  max-width: 1180px;
  width: calc(100% - 40px);
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.topbar.scrolled .topbar-inner {
  padding: 14px 0;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: Manrope, sans-serif; font-weight: 800; font-size: 18px; }
.brand > span:last-child > span { color: var(--primary); }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border-bright); border-radius: 8px; background: var(--glass); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease; }
.brand:hover .brand-mark { transform: scale(1.08) rotate(4deg); border-color: var(--primary); }
.brand-mark svg { width: 20px; }
.top-actions { display: flex; gap: 8px; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--glass); backdrop-filter: blur(18px) saturate(150%); cursor: pointer; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease; }
.icon-button:hover { transform: translateY(-2px); border-color: var(--border-bright); }
.icon-button:active { transform: scale(0.95); }
.icon-button svg { width: 18px; }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 110px 0 28px; }
.header-tagline { margin: 0; font-family: Manrope, sans-serif; font-size: 15px; font-weight: 700; color: var(--text); opacity: 0.95; }
.header-tagline span { color: var(--primary); }
.intro { max-width: 670px; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--primary); text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: 1.7px; }
.intro-desc { margin: 12px 0 0; max-width: 510px; color: var(--muted); font-size: 17px; line-height: 1.6; }

.calculator-tabs { width: fit-content; display: flex; gap: 6px; margin: 34px 0 18px; padding: 5px; border: 1px solid var(--border); border-radius: 8px; background: rgba(26, 10, 13, .48); backdrop-filter: blur(18px); }
.tab { min-width: 102px; height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; transition: background 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease; }
.tab svg { width: 17px; }
.tab:hover { color: var(--text); transform: translateY(-1px); }
.tab:active { transform: scale(0.96) translateY(0); }
.tab.active { color: #ffffff; background: var(--primary); box-shadow: 0 8px 24px rgba(255, 59, 92, 0.25); }
.tab.active:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(255, 59, 92, 0.35); }

.glass { border: 1px solid var(--border); background: linear-gradient(140deg, rgba(255,255,255,.08), transparent 35%), var(--glass); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.13); backdrop-filter: blur(24px) saturate(150%); }
.workspace { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 16px; }
.control-panel, .results-panel { min-height: 510px; padding: 28px; border-radius: 8px; }
.panel-heading, .result-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.panel-heading h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 24px; letter-spacing: 0; }
.icon-button.subtle { background: rgba(255,255,255,.04); }
.fields { margin-top: 30px; display: grid; gap: 25px; }
.field-label { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.field-label label { color: var(--text); font-weight: 600; }
.value-input { height: 47px; margin: 9px 0 10px; display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border-bright); transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.value-input:focus-within { border-bottom-color: var(--primary); box-shadow: 0 1px 0 var(--primary); }
.value-input .prefix, .value-input > span { color: var(--primary); font-family: Manrope, sans-serif; font-size: 21px; font-weight: 700; }
.value-input input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-family: Manrope, sans-serif; font-size: 26px; font-weight: 700; }
.value-input input:focus { outline: none; }
.suffix-input input { text-align: right; }
input[type="number"]::-webkit-inner-spin-button { appearance: none; }
input[type="range"] { --value: 30%; width: 100%; height: 4px; display: block; appearance: none; border-radius: 3px; outline: 0; background: linear-gradient(90deg, var(--primary) var(--value), rgba(255,255,255,.14) var(--value)); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; appearance: none; border: 3px solid var(--bg-soft); border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 3px 12px rgba(0,0,0,.25); transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 3px solid var(--bg-soft); border-radius: 50%; background: var(--primary); transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
input[type="range"]::-moz-range-thumb:hover { transform: scale(1.15); }
input[type="range"]:active::-moz-range-thumb { transform: scale(1.25); }
.range-limits { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 10px; }
.quick-presets { display: flex; gap: 8px; margin-top: 23px; padding: 6px 4px; margin-left: -4px; margin-right: -4px; }
.quick-presets button { flex: 1; height: 36px; border: 1px solid var(--border); border-radius: 6px; background: rgba(255,255,255,.035); color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.quick-presets button:hover { color: var(--text); border-color: var(--primary); transform: translateY(-1px); background: rgba(255, 59, 92, 0.05); }
.quick-presets button.active { color: var(--text); border-color: var(--primary); background: rgba(255, 59, 92, 0.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.quick-presets button:active { transform: scale(0.97); }

.results-panel { display: flex; flex-direction: column; background: linear-gradient(145deg, rgba(255, 59, 92, .1), transparent 38%), var(--glass-strong); }
.hero-value { font-family: Manrope, sans-serif; font-size: clamp(36px, 5vw, 55px); font-weight: 800; line-height: 1.05; letter-spacing: 0; }
.result-caption { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.growth-badge { display: flex; align-items: center; gap: 5px; padding: 7px 10px; border: 1px solid rgba(255, 59, 92, .25); border-radius: 6px; color: var(--primary); background: rgba(255, 59, 92, .08); font-size: 12px; font-weight: 700; }
.growth-badge svg { width: 15px; }
.chart-wrap { position: relative; height: 220px; margin: 22px -8px 6px; }
#projection-chart { width: 100%; height: 100%; }
.chart-tooltip { position: absolute; z-index: 3; padding: 7px 9px; border: 1px solid var(--border-bright); border-radius: 5px; background: var(--glass-strong); color: var(--text); pointer-events: none; font-size: 11px; backdrop-filter: blur(12px); transform: translate(-50%, -115%); white-space: nowrap; }
.breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.breakdown > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.breakdown p { margin: 0; display: grid; gap: 3px; min-width: 0; }
.breakdown small { color: var(--muted); font-size: 11px; }
.breakdown strong { overflow: hidden; text-overflow: ellipsis; font-family: Manrope, sans-serif; font-size: 17px; }
.dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; }
.dot.principal { background: var(--secondary); }
.dot.returns { background: var(--primary); box-shadow: 0 0 12px rgba(255, 59, 92, .6); }
.result-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }
.result-actions button { height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; cursor: pointer; font-weight: 700; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease, box-shadow 0.2s ease; }
.result-actions svg { width: 16px; }
.secondary-button { flex: 1; border: 1px solid var(--border); background: transparent; }
.primary-button { flex: 1; border: 0; background: var(--primary); color: #ffffff; }
.result-actions button:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
.primary-button:hover { box-shadow: 0 4px 12px rgba(255, 59, 92, 0.2); }
.result-actions button:active { transform: scale(0.97) translateY(0); }

.insight-strip { margin-top: 16px; min-height: 70px; display: flex; align-items: center; gap: 15px; padding: 15px 20px; border-radius: 8px; }
.insight-strip p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
.insight-strip strong { color: var(--text); }
.insight-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: var(--tertiary); background: rgba(255, 118, 117, .12); }
.insight-icon svg { width: 18px; }
footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 18px 0 30px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }

@media (max-width: 820px) {
  .app-shell { padding-top: 100px; }
  .workspace { grid-template-columns: 1fr; }
  .control-panel, .results-panel { min-height: auto; }
  .result-actions { margin-top: 20px; }
}

@media (max-width: 520px) {
  .topbar-inner { padding: 14px 0; }
  .topbar.scrolled .topbar-inner { padding: 10px 0; }
  .header-tagline { display: none; }
  .app-shell { width: min(100% - 24px, 1180px); padding-top: 85px; }
  .intro-desc { font-size: 15px; }
  .calculator-tabs { width: 100%; }
  .tab { min-width: 0; flex: 1; }
  .control-panel, .results-panel { padding: 21px 18px; }
  .hero-value { font-size: 38px; }
  .chart-wrap { height: 190px; }
  .quick-presets { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .quick-presets button { min-width: 88px; }
  .result-actions { flex-direction: column; }
  .result-actions button { flex: none; }
  footer { width: calc(100% - 24px); gap: 16px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
