* { box-sizing: border-box; }

:root {
  --bg: #f5f5f2;
  --surface: rgba(255,255,255,0.78);
  --surface-strong: #ffffff;
  --surface-soft: #ecebe5;
  --text: #171715;
  --muted: #77766f;
  --muted-2: #99978f;
  --border: #d6d5ce;
  --border-strong: #c8c7c0;
  --accent: #1b1b18;
  --positive: #355f49;
  --warning: #8f6b28;
  --danger: #90463f;
  --radius: 16px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

button, input { font: inherit; }

.page {
  width: min(1040px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.topbar,
.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.lab-link,
.footer a {
  color: inherit;
  text-decoration: none;
}

.lab-link:hover,
.footer a:hover {
  color: var(--text);
}

.intro {
  max-width: 760px;
  padding: 84px 0 54px;
}

.kicker {
  margin: 0 0 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.052em;
  font-weight: 500;
}

.lede {
  max-width: 690px;
  margin: 22px 0 0;
  color: #65645e;
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.5;
  letter-spacing: -0.015em;
}

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

.panel,
.result-section,
.stress-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel { padding: 24px; }

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.section-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.028em;
  font-weight: 550;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.step {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

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

.field-full { grid-column: 1 / -1; }

.field > span {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  color: #5f5e58;
}

.money-input {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-strong);
}

.money-input:focus-within {
  border-color: #9f9d95;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.035);
}

.money-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 14px 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.money-input span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.loan-summary {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.loan-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.loan-summary strong {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.result-section,
.stress-section {
  margin-top: 12px;
  padding: 26px;
}

.result-heading { margin-bottom: 18px; }

.hero-result {
  padding: 34px 0 36px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.hero-result > span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.hero-result > strong {
  display: block;
  margin: 12px 0 10px;
  font-size: clamp(48px, 8vw, 84px);
  line-height: 1;
  letter-spacing: -0.055em;
  font-weight: 560;
}

.hero-result p {
  margin: 0;
  max-width: 700px;
  color: #65645e;
  font-size: 15px;
}

.comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 22px 0;
}

.comparison-card {
  background: var(--surface-soft);
  border-radius: 13px;
  padding: 18px;
}

.comparison-label,
.stress-kicker {
  display: block;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  font-size: 14px;
}

.metric-row:last-child { border-bottom: 0; }

.metric-row span { color: var(--muted); }

.metric-row strong {
  white-space: nowrap;
  font-weight: 600;
}

.metric-row.emphasis {
  margin-top: 4px;
  padding-top: 14px;
}

.metric-row.emphasis span,
.metric-row.emphasis strong {
  color: var(--text);
  font-size: 15px;
}

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

.metric-card {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 16px;
  background: rgba(255,255,255,0.42);
}

.metric-card > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric-card > strong {
  display: block;
  font-size: 24px;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.metric-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.stress-layout {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 26px;
  padding-top: 6px;
}

.slider-field {
  display: block;
  padding: 17px 0;
  border-bottom: 1px solid var(--border);
}

.slider-label {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: baseline;
  margin-bottom: 12px;
}

.slider-label span {
  color: #5f5e58;
  font-size: 14px;
}

.slider-label strong {
  font-size: 15px;
  font-weight: 600;
}

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

.range-ends,
.buffer-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 11px;
  margin-top: 5px;
}

.secondary-button {
  margin-top: 20px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
}

.secondary-button:hover { background: var(--surface-soft); }

.stress-result {
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 24px;
}

.stress-result > strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(46px, 7vw, 72px);
  line-height: 1;
  letter-spacing: -0.052em;
  font-weight: 560;
}

.stress-caption {
  color: var(--muted);
  font-size: 14px;
}

.buffer-bar-wrap { margin: 24px 0 16px; }

.buffer-bar {
  position: relative;
  height: 11px;
  background: #d4d2ca;
  border-radius: 999px;
  overflow: hidden;
}

.buffer-fill {
  height: 100%;
  width: 50%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 180ms ease;
}

.zero-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 20%;
  width: 1px;
  background: rgba(0,0,0,0.55);
}

.status-box {
  margin: 18px 0;
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  background: rgba(255,255,255,0.6);
  border-radius: 0 9px 9px 0;
  font-size: 14px;
}

.status-box.positive { border-left-color: var(--positive); }
.status-box.warning { border-left-color: var(--warning); }
.status-box.danger { border-left-color: var(--danger); }

.stress-details {
  margin: 0;
  font-size: 14px;
}

.stress-details div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}

.stress-details div:last-child { border-bottom: 0; }

.stress-details dt { color: var(--muted); }

.stress-details dd {
  margin: 0;
  font-weight: 600;
}

.trust-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-top: 12px;
}

.trust-row > div {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255,255,255,0.35);
}

.trust-title {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
}

.trust-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.footer {
  padding-top: 28px;
}

@media (max-width: 900px) {
  .grid-two,
  .stress-layout {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 620px) {
  .page {
    width: min(100% - 20px, 1040px);
    padding-top: 18px;
  }

  .context { display: none; }

  .intro {
    padding: 58px 2px 40px;
  }

  h1 {
    font-size: clamp(40px, 13vw, 58px);
  }

  .lede {
    font-size: 17px;
  }

  .panel,
  .result-section,
  .stress-section {
    padding: 20px;
    border-radius: 14px;
  }

  .field-grid,
  .comparison,
  .metric-grid,
  .loan-summary,
  .trust-row {
    grid-template-columns: 1fr;
  }

  .field-full { grid-column: auto; }

  .loan-summary { gap: 14px; }

  .loan-summary div {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  .loan-summary div:last-child { border-bottom: 0; }
}


.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.currency-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.52);
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.currency-switch:hover {
  border-color: var(--border-strong);
}

.currency-switch:focus-visible {
  outline: 2px solid #8d8b84;
  outline-offset: 3px;
}

.currency-option {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.055em;
  transition: color 160ms ease, opacity 160ms ease;
  user-select: none;
}

.currency-option-left {
  color: var(--text);
}

.currency-option-right {
  color: var(--muted-2);
}

.currency-track {
  position: relative;
  display: block;
  width: 34px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d3d1ca;
  transition: background 180ms ease;
}

.currency-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 180ms ease;
}

.currency-switch.is-eur .currency-knob {
  transform: translateX(16px);
}

.currency-switch.is-eur .currency-option-left {
  color: var(--muted-2);
}

.currency-switch.is-eur .currency-option-right {
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .currency-knob,
  .currency-option,
  .currency-track {
    transition: none;
  }
}

@media (max-width: 620px) {
  .topbar-right {
    gap: 8px;
  }

  .currency-switch {
    gap: 6px;
    min-height: 32px;
    padding: 3px 7px;
  }
}
