:root {
  --bg: #07111b;
  --panel: #0a1219;
  --panel-2: #101b26;
  --ink: #ffffff;
  --muted: #94a3b8;
  --line: rgba(7, 89, 255, 0.32);
  --blue: #0759ff;
  --blue-2: #1287ff;
  --purple: #5b49c8;
  --cyan: #00f5d4;
  --red: #ff4d5d;
  --red-dark: #8f1f2f;
  --green: #27f99a;
  --green-dark: #0f7a4a;
  --shadow: rgba(0, 0, 0, 0.8) 0 18px 48px, rgba(255, 255, 255, 0.05) 0 2px 10px inset, rgba(7, 89, 255, 0.38) 0 0 26px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 16%, rgba(7, 89, 255, 0.16), transparent 30%),
    radial-gradient(circle at 86% 72%, rgba(91, 73, 200, 0.16), transparent 36%),
    linear-gradient(135deg, #06101a, #0a1219 54%, #0d1024);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background:
    linear-gradient(118deg, transparent 0 21%, rgba(7, 89, 255, 0.1) 21% 21.12%, transparent 21.12% 58%, rgba(91, 73, 200, 0.08) 58% 58.12%, transparent 58.12%),
    radial-gradient(circle at 18% 26%, rgba(7, 89, 255, 0.22) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 34%, rgba(91, 73, 200, 0.24) 0 1px, transparent 2px);
  background-size: 100% 100%, 190px 190px, 230px 230px;
  animation: bg-drift 14s ease-in-out infinite alternate;
}

.rechner-header {
  position: sticky;
  z-index: 20;
  top: 18px;
  width: min(1220px, calc(100% - 32px));
  min-height: 64px;
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 14px 8px 18px;
  border: 1px solid rgba(7, 89, 255, 0.72);
  border-radius: 8px;
  background: rgba(7, 17, 27, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(140%);
}

.brand img {
  display: block;
  width: clamp(158px, 15vw, 210px);
  height: 46px;
  object-fit: contain;
  object-position: left center;
}

.rechner-header nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rechner-header nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0;
  transition: color 160ms ease, background 160ms ease;
}

.rechner-header nav a:hover {
  color: #ffffff;
  background: rgba(7, 89, 255, 0.12);
}

.calculator-shell {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.intro {
  width: min(760px, 100%);
  margin-bottom: 24px;
}

.eyebrow,
.step-label {
  margin: 0 0 14px;
  color: var(--blue-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 16px;
  font-size: clamp(2rem, 3vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro > p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1rem, 1.25vw, 1.16rem);
  line-height: 1.55;
}

.calculator {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(420px, 0.86fr);
  gap: 24px;
  align-items: stretch;
}

.questionnaire,
.visual-card {
  border: 1px solid transparent;
  border-radius: 8px;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(7, 89, 255, 0.86), rgba(91, 73, 200, 0.62), rgba(7, 89, 255, 0.42)) border-box;
  box-shadow: var(--shadow);
}

.questionnaire {
  position: relative;
  min-height: 600px;
  padding: 26px;
  overflow: hidden;
}

.progress-rail {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(148, 163, 184, 0.12);
}

.progress-fill {
  display: block;
  width: 25%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--purple), var(--cyan));
  box-shadow: 0 0 18px rgba(7, 89, 255, 0.74);
  transition: width 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.steps {
  display: flex;
  gap: 10px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.step-dot {
  display: grid;
  place-items: center;
  width: 42px;
  height: 34px;
  border: 1px solid rgba(7, 89, 255, 0.24);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(16, 27, 38, 0.8);
  font-size: 0.78rem;
  font-weight: 900;
  transition: transform 180ms ease, color 180ms ease, border-color 180ms ease;
}

.step-dot.active {
  color: #ffffff;
  border-color: rgba(7, 89, 255, 0.86);
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(7, 89, 255, 0.42);
}

.question-card {
  display: none;
}

.question-card.active {
  display: block;
}

.question-card h2 {
  margin-bottom: 20px;
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  line-height: 1.12;
}

.question-card > p:not(.step-label),
.hint {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.process-tile {
  min-height: 112px;
  padding: 18px;
  border: 1px solid rgba(7, 89, 255, 0.22);
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(145deg, rgba(16, 27, 38, 0.95), rgba(7, 17, 27, 0.95));
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.process-tile span {
  display: block;
  margin-bottom: 10px;
  font-weight: 900;
}

.process-tile small {
  color: var(--muted);
  line-height: 1.45;
}

.process-tile:hover,
.process-tile.active {
  transform: translateY(-3px);
  border-color: rgba(7, 89, 255, 0.86);
  box-shadow: 0 0 24px rgba(7, 89, 255, 0.38);
}

.control-group {
  padding: 22px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.13);
}

.control-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.control-head label,
.number-field span {
  color: rgba(237, 245, 252, 0.9);
  font-weight: 800;
  line-height: 1.35;
}

.control-head strong {
  flex: 0 0 auto;
  color: #ffffff;
  font-size: 1.04rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.number-field {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.number-field input {
  width: min(260px, 100%);
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(7, 89, 255, 0.42);
  border-radius: 8px;
  color: #ffffff;
  background: #101b26;
  font-size: 1.4rem;
  font-weight: 900;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.number-field input:focus {
  border-color: rgba(7, 89, 255, 0.95);
  box-shadow: 0 0 0 3px rgba(7, 89, 255, 0.24);
}

.next-button,
.ghost-button,
.analyze-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  padding: 0 20px;
  border-radius: 8px;
  font-weight: 900;
  line-height: 1;
}

.next-button,
.analyze-button {
  border: 1px solid rgba(7, 89, 255, 0.8);
  color: #ffffff;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 0 24px rgba(7, 89, 255, 0.4);
}

.next-button {
  margin-top: 20px;
}

.ghost-button {
  border: 1px solid rgba(7, 89, 255, 0.32);
  color: var(--muted);
  background: rgba(16, 27, 38, 0.72);
}

.step-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.step-actions .next-button {
  margin-top: 0;
}

.analyze-button {
  position: relative;
  gap: 12px;
  margin-top: 10px;
  overflow: hidden;
}

.analyze-button i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 18px rgba(39, 249, 154, 0.8);
}

.analyze-button:hover {
  transform: translateY(-2px);
}

.visualization {
  position: sticky;
  top: 112px;
  height: 100%;
}

.visual-card {
  position: relative;
  height: 100%;
  min-height: 600px;
  padding: 26px;
  overflow: hidden;
}

.visual-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.38;
  background:
    radial-gradient(circle at 80% 18%, rgba(7, 89, 255, 0.18), transparent 28%),
    linear-gradient(145deg, transparent 0 54%, rgba(91, 73, 200, 0.11) 54% 54.2%, transparent 54.2%);
  pointer-events: none;
}

.visual-card > * {
  position: relative;
  z-index: 1;
}

.visual-topline,
.bar-label,
.result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.visual-topline {
  margin-bottom: 22px;
}

.visual-topline p {
  margin: 0;
  color: var(--blue-2);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.visual-topline span {
  padding: 8px 10px;
  border: 1px solid rgba(7, 89, 255, 0.24);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(16, 27, 38, 0.72);
  font-size: 0.76rem;
  font-weight: 900;
}

.process-plate {
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid rgba(7, 89, 255, 0.28);
  border-radius: 8px;
  background: rgba(16, 27, 38, 0.72);
  animation: plate-in 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.process-plate span,
.cost-panel span,
.result-panel span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.process-plate strong {
  display: block;
  font-size: clamp(1.45rem, 2.35vw, 2rem);
  line-height: 1.05;
}

.chart-area {
  display: grid;
  gap: 24px;
  margin-bottom: 28px;
}

.bar-row {
  display: grid;
  gap: 12px;
}

.bar-label strong {
  color: #ffffff;
}

.bar-label span {
  color: var(--muted);
  font-weight: 800;
}

.bar-track {
  height: 72px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 8px;
  background: rgba(2, 9, 16, 0.58);
  overflow: hidden;
}

.bar {
  display: block;
  height: 100%;
  width: 20%;
  border-radius: 6px;
  transition:
    width 640ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 640ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 320ms ease;
}

.manual-bar {
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  box-shadow: 0 0 20px rgba(255, 77, 93, 0.48);
}

.savings-row {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.savings-bar {
  width: 0;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  box-shadow: 0 0 26px rgba(39, 249, 154, 0.56);
}

.cost-panel {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid rgba(7, 89, 255, 0.28);
  border-radius: 8px;
  background: rgba(16, 27, 38, 0.72);
}

.cost-panel strong {
  display: block;
  font-size: clamp(1.65rem, 3.1vw, 2.38rem);
  line-height: 1;
}

.result-panel {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  padding: 20px;
  border: 1px solid rgba(39, 249, 154, 0.45);
  border-radius: 8px;
  background:
    radial-gradient(circle at 82% 18%, rgba(39, 249, 154, 0.13), transparent 32%),
    rgba(8, 24, 20, 0.78);
  box-shadow: 0 0 32px rgba(39, 249, 154, 0.2);
  transition: opacity 520ms ease, transform 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.result-panel strong {
  display: block;
  color: #ffffff;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.visual-card.analyzed {
  animation: success-pulse 900ms cubic-bezier(0.16, 1, 0.3, 1);
}

.visual-card.analyzed .savings-row,
.visual-card.analyzed .result-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.visual-card.analyzed .manual-bar {
  filter: saturate(0.9);
}

@media (max-width: 1020px) {
  .rechner-header {
    align-items: flex-start;
  }

  .rechner-header nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .calculator {
    grid-template-columns: 1fr;
  }

  .visualization {
    position: static;
    order: 2;
  }
}

@media (max-width: 700px) {
  .calculator-shell {
    width: min(100% - 24px, 560px);
    padding-top: 42px;
  }

  .rechner-header {
    width: calc(100% - 24px);
    min-height: 86px;
    padding: 10px 12px;
  }

  .brand img {
    width: 156px;
  }

  .rechner-header nav {
    display: none;
  }

  h1 {
    font-size: clamp(2.05rem, 10vw, 3.2rem);
  }

  .questionnaire,
  .visual-card {
    padding: 20px;
  }

  .process-grid,
  .result-panel {
    grid-template-columns: 1fr;
    display: grid;
  }

  .control-head,
  .bar-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .visual-card {
    min-height: auto;
  }
}

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

@keyframes question-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes plate-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes success-pulse {
  0% {
    box-shadow: var(--shadow);
  }
  52% {
    box-shadow:
      rgba(0, 0, 0, 0.8) 0 18px 48px,
      rgba(39, 249, 154, 0.08) 0 2px 12px inset,
      rgba(39, 249, 154, 0.7) 0 0 42px;
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@keyframes bg-drift {
  from {
    opacity: 0.28;
    transform: scale(1);
  }
  to {
    opacity: 0.48;
    transform: scale(1.012);
  }
}
