:root {
  --bg: #f5f4ef;
  --card: #ffffff;
  --surface: #f1efe8;
  --info-bg: #e6f1fb;
  --info-text: #0c447c;
  --border: rgba(0,0,0,0.12);
  --text: #1a1a18;
  --text-secondary: #5f5e5a;
  --text-tertiary: #888780;
  --warning: #854f0b;
  --success: #3b6d11;
  --danger: #a32d2d;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.6;
}
h1 { font-size: 20px; font-weight: 500; margin: 0 0 0.25rem; }
.sub { font-size: 13px; color: var(--text-secondary); margin: 0 0 1.5rem; }
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 1.5rem;
  max-width: 540px;
  width: 100%;
}
.row { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; }
label { font-size: 14px; color: var(--text-secondary); min-width: 180px; }
input[type="number"] {
  flex: 1;
  height: 36px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 10px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--card);
  color: var(--text);
}
input[type="number"]:focus { outline: none; box-shadow: 0 0 0 2px var(--info-bg); border-color: var(--info-text); }
input[type="range"] { flex: 1; accent-color: var(--info-text); height: 4px; }
.pct { font-size: 14px; color: var(--text-tertiary); }
.out { font-size: 14px; font-weight: 500; min-width: 44px; text-align: right; }
.divider { border-top: 0.5px solid var(--border); padding-top: 1.25rem; }
.slider-wrap { background: var(--surface); border-radius: var(--radius-md); padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.slider-wrap .row { margin-bottom: 0; }
.earn-box {
  background: var(--info-bg); border-radius: var(--radius-md);
  padding: 1rem 1.25rem; margin-bottom: 1rem;
  display: flex; justify-content: space-between; align-items: baseline;
}
.earn-box .label { font-size: 13px; color: var(--info-text); }
.earn-box .val { font-size: 24px; font-weight: 500; color: var(--info-text); }
.note { font-size: 12px; color: var(--text-tertiary); margin: 0 0 1rem; }
.results { display: flex; flex-direction: column; gap: 10px; }
.result {
  background: var(--surface); border-radius: var(--radius-md);
  padding: 0.85rem 1rem; display: flex; justify-content: space-between; align-items: center;
}
.result .label { font-size: 13px; color: var(--text-secondary); }
.result .val { font-size: 16px; font-weight: 500; }
.warn-c { color: var(--warning); }
.sec-c { color: var(--text-secondary); }

/* AdSense slot spacing */
.ad-slot { max-width: 540px; width: 100%; margin: 0 auto 1.25rem; text-align: center; }

/* Footer */
.site-footer { max-width: 540px; width: 100%; margin: 1.25rem auto 0; text-align: center; }
.site-footer a { font-size: 13px; color: var(--text-tertiary); text-decoration: none; }
.site-footer a:hover { color: var(--info-text); text-decoration: underline; }
.site-footer .sep { color: var(--text-tertiary); margin: 0 6px; font-size: 13px; }

/* ---- Mobile responsiveness ---- */
@media (max-width: 560px) {
  body { padding: 1rem 0.75rem; }
  .card { padding: 1.25rem; }

  /* Stack label above the field instead of side-by-side */
  .row { flex-wrap: wrap; gap: 6px 8px; }
  .row label { min-width: 100%; margin-bottom: 2px; }

  /* Number inputs take the full row width */
  .row input[type="number"] { flex: 1 1 auto; width: auto; min-width: 0; }

  /* Keep the % sign on the same line as its input, not pushed off-screen */
  .row .pct { flex: 0 0 auto; }

  /* Slider row: label on its own line, slider + value below */
  .slider-wrap .row label { min-width: 100% !important; }
  .slider-wrap .row input[type="range"] { flex: 1 1 auto; min-width: 0; }
  .slider-wrap .row .out { flex: 0 0 auto; }

  /* Prevent any element from forcing horizontal overflow */
  .card, .earn-box, .result, .slider-wrap { max-width: 100%; }
  input[type="range"] { max-width: 100%; }
}

/* Belt-and-suspenders: never allow horizontal scroll */
html, body { overflow-x: hidden; }
* { box-sizing: border-box; }

/* ---- German personalisation ---- */
/* German flag accent in the title */
.flag {
  display: inline-block;
  width: 22px; height: 15px;
  vertical-align: -1px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #000 0 33.3%, #DD0000 33.3% 66.6%, #FFCE00 66.6% 100%);
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.15);
}
/* English sub-text shown smaller/lighter under German */
.sub-en { color: var(--text-tertiary); font-size: 12px; }
.lbl-en { color: var(--text-tertiary); font-weight: 400; }
/* VAT preset buttons */
.vat-presets { display: flex; gap: 8px; }
.vat-btn {
  flex: 1;
  border: 0.5px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
}
.vat-btn .vat-note { font-size: 11px; color: var(--text-tertiary); }
.vat-btn.active {
  border-color: var(--info-text);
  background: var(--info-bg);
  color: var(--info-text);
}
.vat-btn.active .vat-note { color: var(--info-text); }
.vat-btn:hover { border-color: var(--info-text); }

/* Language toggle (top of page) */
.lang-toggle { max-width: 540px; width: 100%; margin: 0 auto 1rem; display: flex; gap: 6px; }
.lang-toggle a {
  flex: 1; text-align: center; text-decoration: none;
  font-size: 13px; font-weight: 500; padding: 8px 0;
  border: 0.5px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-secondary); background: var(--card);
}
.lang-toggle a.active { background: var(--info-text); color: #fff; border-color: var(--info-text); }
.lang-toggle a:not(.active):hover { border-color: var(--info-text); color: var(--info-text); }


/* Flags inside language toggle (flag sits AFTER the text, with spacing) */
.lang-toggle a { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lang-toggle .flag { order: 2; display: inline-flex; width: 22px; height: 15px; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 0.5px rgba(0,0,0,0.15); flex: 0 0 auto; }
.lang-toggle .flag svg { width: 100%; height: 100%; display: block; }
