/* Kalkino – Design */
:root {
  --bg: #f5f4ef; --surface: #ffffff; --ink: #15211d; --muted: #5a6863; --line: #e2e0d6;
  --brand: #0a7558; --brand-ink: #ffffff; --accent: #f2b134; --soft: #e9f3ee;
  --shadow: 0 1px 2px rgba(21, 33, 29, .05), 0 8px 24px -12px rgba(21, 33, 29, .18);
  --r: 18px; --mix: black; --tint: 11%;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1311; --surface: #151d1a; --ink: #e8eeeb; --muted: #98a7a1; --line: #25302c;
  --brand: #40cf9f; --brand-ink: #06261c; --soft: #14251e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .7);
  --mix: white; --tint: 16%; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1311; --surface: #151d1a; --ink: #e8eeeb; --muted: #98a7a1; --line: #25302c;
    --brand: #40cf9f; --brand-ink: #06261c; --soft: #14251e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .7);
    --mix: white; --tint: 16%; color-scheme: dark;
  }
}
[data-cat="finanzen"] { --c: #0a7558; }
[data-cat="mathe"] { --c: #4c44c9; }
[data-cat="zeit"] { --c: #bd540c; }
[data-cat="gesundheit"] { --c: #c0235a; }
[data-cat="alltag"] { --c: #0a6ca6; }
[data-cat="it"] { --c: #475569; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font);
  min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--brand); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 750; text-wrap: balance; overflow-wrap: anywhere; hyphens: auto; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
h2 { font-size: 1.35rem; }
/* Japanisch: keine engere Laufweite und Zeilenumbruch an Wortgrenzen statt mitten im Wort */
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { letter-spacing: 0; line-height: 1.35; }
:lang(ja) body { word-break: auto-phrase; line-break: strict; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* Kopfzeile */
.hdr { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.hdr-in { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.22rem; letter-spacing: -.03em; color: var(--ink); text-decoration: none; flex: none; }
.logo svg { width: 30px; height: 30px; border-radius: 9px; }
.nav { display: flex; gap: 2px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; padding: 7px 8px; border-radius: 99px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.ib { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.ib:hover { border-color: var(--muted); }
.ib svg { width: 19px; height: 19px; }
.ib .moon, [data-theme="dark"] .ib .sun { display: none; }
[data-theme="dark"] .ib .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ib .sun { display: none; }
  :root:not([data-theme="light"]) .ib .moon { display: block; }
}

/* Suche */
.search { position: relative; flex: 0 1 150px; }
.search input { width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .95rem; padding: 0 12px 0 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8782' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 11px center; background-size: 18px; }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.sr { position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 30; max-height: 70vh; overflow: auto; min-width: 260px; }
.sr a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.sr a:hover, .sr a:focus { background: var(--soft); outline: none; }
.sr small { color: var(--muted); display: block; font-size: .8rem; line-height: 1.3; }
.sr p { margin: 0; padding: 10px; color: var(--muted); font-size: .92rem; }
.sr .tile { width: 36px; height: 36px; font-size: .72rem; border-radius: 10px; }
/* Unter 1100 px (dann ist die Seite schmaler als ihre Höchstbreite) bekommt die Navigation eine eigene Zeile:
   Mit sechs Kategorien passen lange Sprachen (z. B. Französisch) sonst nicht mehr neben Logo und Suche. */
@media (max-width: 1099px) {
  .hdr-in { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 0; row-gap: 6px; }
  .search { flex: 1; max-width: 420px; margin-left: auto; }
  .nav { order: 5; flex: 0 0 100%; margin: 0 -16px; padding: 0 12px 8px; }
}
@media (max-width: 760px) {
  .search { max-width: none; margin-left: 0; }
  .home .hdr .search { visibility: hidden; }
}

/* Kacheln */
.tile { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: .88rem; letter-spacing: -.03em; line-height: 1; background: color-mix(in srgb, var(--c, var(--brand)) var(--tint), var(--surface)); color: color-mix(in srgb, var(--c, var(--brand)) 72%, var(--mix)); font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }
.card { display: flex; align-items: center; gap: 13px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; min-width: 0; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c, var(--brand)) 45%, var(--line)); }
.card b { display: block; font-weight: 700; line-height: 1.25; }
.card small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.35; margin-top: 2px; }
.card .ct { min-width: 0; }

/* Startseite */
.hero { padding: clamp(36px, 8vw, 84px) 0 clamp(28px, 5vw, 48px); text-align: center; background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 0) 0 0 / 22px 22px; -webkit-mask-image: none; position: relative; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 75% 85% at 50% 45%, var(--bg) 35%, transparent 100%); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.3rem, 7.2vw, 4.3rem); letter-spacing: -.045em; line-height: 1.02; margin-bottom: .35em; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.15rem); max-width: 560px; margin: 0 auto 26px; }
.hero .search { max-width: 560px; margin: 0 auto; flex: none; text-align: left; }
.hero .search input { height: 58px; border-radius: 18px; font-size: 1.05rem; padding-left: 50px; background-position: 18px center; background-size: 21px; box-shadow: var(--shadow); }
.sec { margin: 0 0 40px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-h h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.sec-h h2::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--accent)); flex: none; }
.sec-h a { font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.sec-h a:hover { text-decoration: underline; }

/* Rechnerseite */
.bc { font-size: .86rem; color: var(--muted); padding: 18px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.bc a { color: var(--muted); text-decoration: none; }
.bc a:hover { color: var(--ink); text-decoration: underline; }
.chead { display: flex; gap: 16px; align-items: flex-start; margin: 14px 0 22px; }
.chead .tile { width: 60px; height: 60px; border-radius: 18px; font-size: 1.02rem; margin-top: 2px; }
.chead h1 { margin-bottom: .25em; }
.lead { color: var(--muted); font-size: 1.06rem; margin: 0; max-width: 680px; }
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.cform { padding: 24px; display: grid; gap: 16px; align-content: start; }
.fld label { display: block; font-weight: 650; font-size: .93rem; margin-bottom: 6px; }
.fld small { display: block; color: var(--muted); font-size: .82rem; margin-top: 5px; line-height: 1.35; }
.inp { position: relative; display: flex; }
.inp input, .inp select, .inp textarea { width: 100%; min-height: 50px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 1.08rem; font-weight: 600; padding: 10px 14px; font-variant-numeric: tabular-nums; appearance: none; -webkit-appearance: none; }
.inp textarea { min-height: 110px; resize: vertical; font-weight: 500; line-height: 1.5; }
.inp select { font-weight: 600; font-size: 1rem; padding-right: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8782' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; background-size: 18px; text-overflow: ellipsis; }
.inp input:focus, .inp select:focus, .inp textarea:focus { outline: none; border-color: var(--c, var(--brand)); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--brand)) 16%, transparent); }
.inp.has-unit input { padding-right: 62px; }
.unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 650; font-size: .92rem; pointer-events: none; }
.cres { background: color-mix(in oklab, var(--c, var(--brand)) 80%, black); color: #fff; padding: 24px; display: flex; flex-direction: column; gap: 4px; min-height: 100%; }
:root[data-theme="dark"] .cres { background: color-mix(in oklab, var(--c, var(--brand)) 46%, #0d1311); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cres { background: color-mix(in oklab, var(--c, var(--brand)) 46%, #0d1311); } }
.out { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; }
.out:not([hidden]) ~ .out:not([hidden]) { border-top: 1px solid rgba(255, 255, 255, .16); }
.out .lbl { color: rgba(255, 255, 255, .8); font-size: .93rem; }
.out output { font-weight: 700; font-size: 1.06rem; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.out.big { flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 0 14px; }
.out.big ~ .out.big { padding-top: 14px; }
.out.big .lbl { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; }
.out.big output { font-size: clamp(2rem, 6vw, 2.9rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; text-align: left; }
.cmsg { margin: 8px 0 0; background: rgba(255, 255, 255, .14); border-radius: 10px; padding: 9px 12px; font-size: .92rem; }
.chart { margin-top: auto; padding-top: 18px; }
.chart svg { display: block; width: 100%; height: 110px; }
.chart .s0 { fill: rgba(255, 255, 255, .42); }
.chart .s1 { fill: var(--accent); }
.chart .only { fill: rgba(255, 255, 255, .7); }
/* Farbfeld vor Farbcodes (Ausgabeformat „color“) */
.out.color output::before { content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .3em; border-radius: .18em; background: var(--swatch, transparent); border: 2px solid rgba(255, 255, 255, .85); vertical-align: -.04em; }
/* Funktionsgraph (src/client/plot.js) */
.chart svg.plot { height: auto; overflow: visible; }
.plot .grid { stroke: rgba(255, 255, 255, .12); stroke-width: .6; }
.plot .axis { stroke: rgba(255, 255, 255, .55); stroke-width: .9; }
.plot text { fill: rgba(255, 255, 255, .75); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.plot path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot path.c0 { stroke: #fff; }
.plot path.c1 { stroke: var(--accent); }
.plot circle { fill: var(--accent); stroke: #fff; stroke-width: 1; }
.leg i.c0 { background: #fff; }
.leg i.c1 { background: var(--accent); }
.plot + .leg span { overflow-wrap: anywhere; white-space: normal; }
.inp input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: normal; }
.leg { display: flex; justify-content: space-between; gap: 12px; font-size: .78rem; color: rgba(255, 255, 255, .8); margin-top: 7px; flex-wrap: wrap; }
.leg i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.leg span { white-space: nowrap; }
.cact { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.pri { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-color: var(--accent); }
.btn[aria-pressed="true"] svg { fill: var(--accent); stroke: var(--accent); }
.btn.go { background: #fff; color: #15211d; border: 0; margin-top: 12px; align-self: flex-start; }
@media (max-width: 760px) {
  .calc { grid-template-columns: 1fr; border-radius: 20px; }
  .cform, .cres { padding: 18px; }
  .chead .tile { display: none; }
}
.ctable { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ctable summary, .faq summary { cursor: pointer; font-weight: 650; padding: 14px 18px; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ctable summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
.ctable summary::after, .faq summary::after { content: "+"; font-size: 1.3rem; font-weight: 500; color: var(--muted); line-height: 1; flex: none; }
details[open] > summary::after { content: "–"; }
.tw { overflow-x: auto; padding: 0 18px 16px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .93rem; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 650; font-size: .84rem; }
.note { margin: 14px 0 0; padding: 13px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); font-size: .93rem; }

/* Text */
.prose { max-width: 720px; margin: 38px 0; }
.prose h2 { margin-top: 1.7em; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
.kform { display: grid; gap: 16px; margin-top: 24px; max-width: 560px; }
.kform .inp input, .kform .inp textarea { font-weight: 500; font-variant-numeric: normal; }
.kform .btn { justify-self: start; height: 46px; padding: 0 22px; font-size: 1rem; }
.fnote { margin: 0; color: var(--muted); font-size: .88rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact .note { display: none; scroll-margin-top: 96px; }
.contact .note:target { display: block; }
.contact .note.err { background: color-mix(in srgb, #d64545 12%, var(--surface)); border-color: color-mix(in srgb, #d64545 45%, var(--line)); }
.contact .note.ok:target ~ .kform { display: none; }
.formula { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--brand)); border-radius: 10px; padding: 11px 15px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-x: auto; }
.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; }
.faq p { padding: 0 18px 15px; margin: 0; color: var(--muted); }
mark { background: #ffe08a; color: #3b2a00; padding: 1px 5px; border-radius: 4px; }
.page { max-width: 720px; padding-top: 30px; padding-bottom: 50px; }
.wrap.page { margin: 0 auto; }
.page > h1 { text-align: center; margin-bottom: .9em; }
.page.nf { text-align: center; }
.page.nf .lead { margin: 0 auto; }

/* Sprachwahl und Währung */
.lang { position: relative; flex: none; }
.lang summary { list-style: none; height: 40px; padding: 0 11px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: .85rem; cursor: pointer; text-transform: uppercase; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { border-color: var(--muted); }
.lang-m { grid-template-columns: repeat(2, minmax(120px, 1fr)); max-height: 70vh; overflow: auto; }
.lang-m { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 150px; z-index: 30; display: grid; }
.lang-m a { padding: 8px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .93rem; }
.lang-m a:hover { background: var(--soft); }
.lang-m a[aria-current] { color: var(--brand); }
.cur { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.cur select { height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; padding: 0 10px; cursor: pointer; }

/* Werbung */
.ad { margin: 26px 0; min-height: 280px; text-align: center; }
.ad > span { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }

/* Fußzeile */
.ftr { border-top: 1px solid var(--line); margin-top: 50px; padding: 34px 0 26px; font-size: .92rem; color: var(--muted); }
.ftr-g { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 28px; }
.ftr h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.ftr ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ftr a { color: var(--ink); text-decoration: none; }
.ftr a:hover { text-decoration: underline; }
.ftr .logo { margin-bottom: 10px; }
.ftr-b { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
@media (max-width: 640px) { .ftr-g { grid-template-columns: 1fr 1fr; } .ftr-g > :first-child { grid-column: 1 / -1; } }

/* Dialog, Toast */
dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); padding: 22px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
dialog::backdrop { background: rgba(8, 14, 12, .55); backdrop-filter: blur(3px); }
dialog h2 { font-size: 1.2rem; }
dialog textarea { width: 100%; height: 130px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: .82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 10px; resize: none; }
.drow { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; font-size: .92rem; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Einbettung */
body.embed { background: transparent; min-height: 0; padding: 4px; }
.embed .calc { box-shadow: none; }
.embed-by { text-align: right; font-size: .8rem; color: var(--muted); margin: 8px 4px 0; }
.embed h1 { font-size: 1.25rem; margin: 6px 4px 12px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .hdr, .ftr, .cact, .ad, .related { display: none; } .cres { color: #000; background: #fff !important; border-left: 1px solid #ccc; } .out .lbl { color: #333; } }

/* Umschalter, Schnellwahl, kleine Bausteine */
[data-cat="land"] { --c: #8a5a00; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 7%, transparent); gap: 2px; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 650; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.cact-r { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cact-r .cur { margin-left: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fld .chips { margin-top: 8px; }
.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none; cursor: pointer; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--c, var(--brand)); }
.chip[aria-current] { background: var(--c, var(--brand)); border-color: transparent; color: #fff; }
.badge { font-style: normal; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--muted); vertical-align: 2px; white-space: nowrap; }
.fine { color: var(--muted); font-size: .84rem; line-height: 1.5; margin-top: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.panel > :last-child { margin-bottom: 0; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; margin: 0 0 16px; }
.kv dt { color: var(--muted); font-size: .84rem; }
.kv dd { margin: 2px 0 0; font-weight: 700; font-size: 1.08rem; font-variant-numeric: tabular-nums; }

/* Länderseiten */
.shape { flex: none; width: 76px; height: 76px; border-radius: 20px; padding: 7px; background: color-mix(in srgb, var(--c) var(--tint), var(--surface)); }
.shape path { fill: color-mix(in srgb, var(--c) 72%, var(--mix)); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; margin-bottom: 40px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 13px 16px; min-width: 0; }
.fact > span { display: block; color: var(--muted); font-size: .82rem; }
.fact b { display: block; font-size: 1.05rem; line-height: 1.3; margin-top: 3px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stat-h span { color: var(--muted); font-size: .9rem; }
.stat-h b { font-size: 1.12rem; font-variant-numeric: tabular-nums; text-align: right; }
.bar { height: 7px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 8%, transparent); margin: 10px 0 7px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--brand)); }
:root[data-theme="dark"] .bar i, :root[data-theme="dark"] .chip[aria-current] { background: color-mix(in srgb, var(--c) 60%, white); color: #111; }
.stat small { color: var(--muted); font-size: .8rem; }
.tbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; padding: 4px 8px; }
.tbox th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tbox th button::after { content: "↕"; opacity: .35; font-size: .8em; }
.tbox th[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; }
.tbox th[aria-sort="descending"] button::after { content: "↓"; opacity: 1; }
.tbox th button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 4px; }
.tbox td a { font-weight: 650; text-decoration: none; }
.tbox td a:hover { text-decoration: underline; }
.tbox tr:last-child td { border-bottom: 0; }
.world .lead { margin-bottom: 14px; }
/* Dichtes Raster für lange Länderlisten: auf dem Handy zwei Spalten */
.grid-s { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.grid-s .card { padding: 10px 11px; gap: 10px; border-radius: 14px; }
.grid-s .tile { width: 36px; height: 36px; border-radius: 10px; font-size: .74rem; }
.grid-s .card b { font-size: .95rem; overflow-wrap: anywhere; }
.grid-s .card small { font-size: .78rem; }

/* Karte */
.map { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 40px; --c: var(--brand); }
.map-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 8px; }
.map-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.map-metrics button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .84rem; font-weight: 600; height: 30px; padding: 0 11px; border-radius: 99px; cursor: pointer; }
.map-metrics button:hover { border-color: var(--muted); }
.map-metrics button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }
.map-stage { position: relative; }
.map svg { display: block; width: 100%; height: auto; }
.map .land { fill: color-mix(in srgb, var(--ink) 8%, var(--surface)); }
.map a path, .map a .dot { fill: color-mix(in srgb, var(--c) 34%, var(--surface)); stroke: var(--surface); stroke-width: .7; stroke-linejoin: round; transition: fill .12s; }
.map a .dot { stroke-width: 1.2; }
.map a:hover path, .map a:focus path, .map a:hover .dot, .map a:focus .dot { fill: var(--accent); }
.map a:focus { outline: none; }
.map.colored a path, .map.colored a .dot { fill: color-mix(in srgb, var(--ink) 14%, var(--surface)); }
.map.colored a[data-level="0"] path, .map.colored a[data-level="0"] .dot, .map-leg i[data-level="0"] { fill: color-mix(in srgb, var(--c) 16%, var(--surface)); background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.map.colored a[data-level="1"] path, .map.colored a[data-level="1"] .dot, .map-leg i[data-level="1"] { fill: color-mix(in srgb, var(--c) 36%, var(--surface)); background: color-mix(in srgb, var(--c) 36%, var(--surface)); }
.map.colored a[data-level="2"] path, .map.colored a[data-level="2"] .dot, .map-leg i[data-level="2"] { fill: color-mix(in srgb, var(--c) 58%, var(--surface)); background: color-mix(in srgb, var(--c) 58%, var(--surface)); }
.map.colored a[data-level="3"] path, .map.colored a[data-level="3"] .dot, .map-leg i[data-level="3"] { fill: color-mix(in srgb, var(--c) 80%, var(--surface)); background: color-mix(in srgb, var(--c) 80%, var(--surface)); }
.map.colored a[data-level="4"] path, .map.colored a[data-level="4"] .dot, .map-leg i[data-level="4"] { fill: var(--c); background: var(--c); }
.map.colored a:hover path, .map.colored a:hover .dot { fill: var(--accent); }
.map-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 11px; border-radius: 10px; font-size: .86rem; line-height: 1.35; white-space: nowrap; z-index: 5; box-shadow: var(--shadow); }
.map-tip b { display: block; }
.map-tip span { opacity: .8; font-variant-numeric: tabular-nums; }
.map-leg { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 10px; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-leg i { width: 30px; height: 10px; border-radius: 3px; }
.map-leg span { margin: 0 6px; }
@media (max-width: 760px) { .shape { width: 56px; height: 56px; border-radius: 16px; } .map { padding: 10px; border-radius: 20px; } }
@media print { .map-bar, .map-leg { display: none; } }

/* iPhones vergrößern die Seite, sobald ein Feld mit weniger als 16 px Schrift angetippt wird */
@media (pointer: coarse) { .search input, .cur select, dialog textarea { font-size: 16px; } }
