:root {
  --bg: #fbfaf3; --banner: #eef3cf; --ink: #1f2a1c; --muted: #5c6657; --line: #e3e7da; --panel: #fff;
  --green: #3f7d2c; --red: #d9462b; --cat: #3f7d2c; --radius: 18px;
  --shadow: 0 1px 2px rgba(31, 42, 28, .05), 0 6px 22px -12px rgba(31, 42, 28, .18);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: #f1f3ea; padding: .05em .35em; border-radius: 5px; }
[hidden] { display: none !important; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 12px clamp(16px, 4vw, 40px); background: rgba(238, 243, 207, .9); backdrop-filter: blur(10px); border-bottom: 1px solid #dfe6bd; }
.logo img { height: 30px; display: block; }
.tagline { color: var(--muted); font-size: 14px; }
@media (max-width: 560px) { .tagline { display: none; } }

.view { max-width: 1240px; margin: 0 auto; padding: 0 clamp(14px, 3.5vw, 36px) 60px; min-height: 70vh; }

/* Startseite */
.hero { margin: 0 calc(50% - 50vw); padding: 54px clamp(14px, 3.5vw, 36px) 46px; background: linear-gradient(180deg, var(--banner), #f6f8e4 70%, var(--bg)); overflow: hidden; }
.hero-in { position: relative; max-width: 1168px; margin: 0 auto; }
.hero-text { position: relative; z-index: 1; max-width: 720px; }
.hero h1 { font-size: clamp(34px, 5.6vw, 62px); line-height: 1.04; margin: 0 0 16px; letter-spacing: -0.03em; font-weight: 850; }
.hero h1 em { font-style: normal; color: var(--red); position: relative; }
.hero h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: .04em; height: .12em; background: var(--red); opacity: .25; border-radius: 3px; }
.hero p { font-size: 18px; color: #3c4737; max-width: 620px; margin: 0 0 24px; }
.hero-leaves { position: absolute; right: 0; top: -54px; width: clamp(150px, 26vw, 300px); opacity: .95; pointer-events: none; }
.search { width: 100%; max-width: 560px; font: inherit; font-size: 17px; padding: 14px 18px 14px 46px; border-radius: 999px; border: 1.5px solid #d4dcb6; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%235c6657' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='8.5' cy='8.5' r='6'/%3E%3Cpath d='M13 13l5 5'/%3E%3C/svg%3E") 17px 50% no-repeat; box-shadow: var(--shadow); outline: none; }
.search:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(63, 125, 44, .15); }
.catnav { position: sticky; top: 55px; z-index: 10; display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; background: var(--bg); scrollbar-width: none; }
.catnav a { flex: none; text-decoration: none; font-weight: 700; font-size: 14px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); color: var(--cat); }
.catnav a:hover { border-color: var(--cat); }
.cat { margin-top: 26px; scroll-margin-top: 120px; }
.cat-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; border-bottom: 2px solid var(--cat); padding-bottom: 6px; margin-bottom: 16px; }
.cat-head h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; color: var(--cat); }
.cat-head span { color: var(--muted); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tcard-link { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto 1fr; column-gap: 12px; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s, box-shadow .15s; }
.tcard-link:hover { transform: translateY(-2px); border-color: var(--cat); box-shadow: 0 10px 28px -14px var(--cat); }
.tcard-link .sym { grid-row: 1 / 3; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: color-mix(in srgb, var(--cat) 12%, #fff); color: var(--cat); font: 700 20px/1 "Cambria Math", Georgia, serif; white-space: nowrap; overflow: hidden; letter-spacing: -.03em; }
.tcard-link .tt { font-weight: 750; line-height: 1.25; }
.tcard-link .td { font-size: 13.5px; color: var(--muted); line-height: 1.4; margin-top: 3px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* Rechner-Seite */
.tool-head { padding: 26px 0 8px; }
.back { display: inline-block; text-decoration: none; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.back:hover { color: var(--ink); }
.crumb { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--cat); }
.tool-head h1 { margin: 2px 0 6px; font-size: clamp(30px, 4.4vw, 44px); letter-spacing: -.025em; line-height: 1.1; }
.lead { margin: 0; max-width: 820px; color: #3c4737; font-size: 17px; }
.tool-grid { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); gap: 18px; margin-top: 18px; align-items: start; }
.col-left, .col-right { display: grid; gap: 18px; min-width: 0; }
.col-right { position: sticky; top: 72px; }
@media (max-width: 920px) { .tool-grid { grid-template-columns: 1fr; } .col-right { position: static; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; box-shadow: var(--shadow); min-width: 0; }
.view > .panel { margin-top: 18px; }
.panel > h2 { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--cat); }
.panel.res { border-color: color-mix(in srgb, var(--cat) 35%, var(--line)); }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }

/* Formulare */
.form { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; align-items: center; gap: 4px 12px; }
.row.wide { grid-template-columns: 1fr; }
.row-check { grid-template-columns: auto 1fr; }
.row-check .ctl { order: -1; }
.lbl { font-weight: 650; font-size: 15px; }
.ctl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hint { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.form-heading { font-weight: 800; font-size: 14px; margin-top: 6px; color: var(--ink); }
.form-note { font-size: 13.5px; color: var(--muted); }
input[type=text], select, textarea, .calc-in { width: 100%; min-width: 0; font: inherit; font-size: 16px; padding: 9px 12px; border: 1.5px solid #d9ded0; border-radius: 11px; background: #fdfdfb; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
input[type=text]:focus, select:focus, textarea:focus, .calc-in:focus { border-color: var(--cat); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--cat) 16%, transparent); background: #fff; }
input.bad { border-color: var(--red); background: #fff6f4; }
input[type=range] { flex: 1; accent-color: var(--cat); }
input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--cat); }
.range-val { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.unit { color: var(--muted); white-space: nowrap; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: #f0f2ea; border-radius: 12px; }
.seg button { font: inherit; font-size: 14px; font-weight: 650; border: 0; background: transparent; padding: 6px 11px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg button:hover:not(.on) { color: var(--ink); }
.btn { font: inherit; font-size: 14px; font-weight: 700; border: 1.5px solid #d9ded0; background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; color: var(--ink); margin-top: 10px; }
.btn:hover { border-color: var(--cat); color: var(--cat); }
.btn.primary { background: var(--cat); border-color: var(--cat); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }

/* Ausgabe */
.big { background: color-mix(in srgb, var(--cat) 7%, #fff); border-radius: 14px; padding: 6px 14px; margin-bottom: 10px; overflow-x: auto; }
.big-l { font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.big-v .katex-display { margin: .5em 0; }
.big-v .katex { font-size: 1.32em; }
.kv { display: grid; grid-template-columns: fit-content(42%) minmax(0, 1fr); gap: 6px 16px; margin: 6px 0 0; align-items: baseline; }
.kv dt { color: var(--muted); font-size: 14.5px; }
.kv dd { margin: 0; overflow-x: auto; }
.kv dd.hi { font-weight: 700; }
.note { background: #f5f7ef; border-radius: 12px; padding: 10px 14px; font-size: 15px; margin: 8px 0; }
.note.err { background: #fff1ee; color: #a2321d; border: 1px solid #f6cfc5; }
.note.ok { background: #eef7ea; color: #2c6a1d; }
.stepl { margin: 0; padding-left: 0; list-style: none; counter-reset: st; display: grid; gap: 10px; }
.stepl li { counter-increment: st; position: relative; padding: 10px 14px 10px 50px; background: #fafbf6; border-radius: 13px; border: 1px solid #eef0e7; }
.stepl li::before { content: counter(st); position: absolute; left: 13px; top: 11px; width: 25px; height: 25px; border-radius: 50%; background: var(--cat); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.st-t { font-size: 15px; }
.st-m { overflow-x: auto; overflow-y: hidden; }
.st-m .katex-display { margin: .45em 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tcard { background: #fafbf6; border: 1px solid #eef0e7; border-radius: 14px; padding: 12px 16px; min-width: 0; }
.tcard h3 { margin: 0 0 4px; font-size: 16px; }
.tcard p { margin: 4px 0; font-size: 14.5px; color: #3c4737; }
.tablewrap { overflow-x: auto; }
.tbl { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14.5px; width: 100%; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid #edf0e6; text-align: right; white-space: nowrap; }
.tbl th { background: #f5f7ef; font-weight: 750; position: sticky; top: 0; }
.tbl td:first-child, .tbl th:first-child { text-align: left; }
.tbl tr.hl td { background: color-mix(in srgb, var(--cat) 12%, #fff); font-weight: 700; }
.tbl.grid td, .tbl.grid th { border: 1px solid #e3e7da; text-align: center; }
.scrollbox { max-height: 380px; overflow: auto; border: 1px solid #eef0e7; border-radius: 12px; }

/* Plots */
.plot { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid #e6eadf; background: #fff; margin-bottom: 10px; }
.plot-canvas { display: block; width: 100%; touch-action: pan-y; cursor: move; }
.plot-canvas.v3d { cursor: grab; touch-action: none; }
.plot-canvas.grab { cursor: grabbing; }
.plot-bar { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.plot-bar button { width: 30px; height: 30px; border-radius: 9px; border: 1px solid #dfe3d6; background: rgba(255, 255, 255, .92); font: 700 16px/1 system-ui; cursor: pointer; color: var(--ink); }
.plot-bar button:hover { border-color: var(--cat); color: var(--cat); }
.plot-tip { position: absolute; left: 8px; bottom: 8px; font-size: 12.5px; background: rgba(255, 255, 255, .92); padding: 3px 8px; border-radius: 7px; border: 1px solid #e6eadf; pointer-events: none; font-variant-numeric: tabular-nums; white-space: pre; }
.v3d-hint { color: var(--muted); }
.svgwrap { overflow-x: auto; }
.svgviz { margin: 0 auto; width: 100%; height: auto; display: block; font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin: 6px 0; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* Taschenrechner */
.calc-in { font-size: 22px; padding: 12px 14px; font-family: ui-monospace, Menlo, monospace; }
.calc-row { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; gap: 10px; }
.calc-row .btn { margin: 0; }
.keypad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.keypad button { font: 650 16px var(--font); padding: 10px 0; border-radius: 10px; border: 1px solid #e1e5d8; background: #f7f8f2; cursor: pointer; color: var(--ink); }
.keypad button.k-num { background: #fff; font-size: 18px; }
.keypad button.k-clr { color: var(--red); }
.keypad button:hover { border-color: var(--cat); }
.keypad button:active { transform: scale(.96); }
.hist { display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.hist-i { text-align: left; border: 0; background: #fafbf6; border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; }
.hist-i:hover { background: #f0f3e6; }

/* Potenz-Plättchen */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; }
.chip-group { display: inline-flex; gap: 4px; flex-wrap: wrap; padding: 4px; border-radius: 10px; }
.chip-group.br { border: 2px dashed #c9cfc0; }
.chip { min-width: 34px; height: 34px; padding: 0 6px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; }
.chip.x { opacity: .3; text-decoration: line-through; }
.chip-op { font-size: 24px; font-weight: 800; color: var(--muted); }

/* Matrix-Eingabe */
.mat { display: inline-grid; gap: 5px; padding: 6px 10px; border-left: 2.5px solid var(--ink); border-right: 2.5px solid var(--ink); border-radius: 8px; }
.mat input { width: 62px; text-align: center; padding: 6px 4px; font-size: 15px; }
.mat .aug { border-left: 2px dashed #b9c0b0; margin-left: 4px; padding-left: 8px; }
.mat-wrap { overflow-x: auto; padding-bottom: 4px; }

/* Mehr */
.chiplinks { display: flex; flex-wrap: wrap; gap: 8px; }
.chiplinks a { text-decoration: none; font-size: 14px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fafbf6; }
.chiplinks a:hover { border-color: var(--cat); color: var(--cat); }

/* Datenschutz */
.prose { max-width: 800px; margin: 30px auto; background: #fff; padding: 28px 34px; border-radius: var(--radius); border: 1px solid var(--line); }
.prose h1 { letter-spacing: -.02em; }

/* Footer */
.site-footer { display: flex; justify-content: center; gap: clamp(20px, 8vw, 120px); flex-wrap: wrap; padding: 40px 20px 50px; background: #eef1e4; color: #3c4737; font-size: 15px; margin-top: 40px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.katex { font-size: 1.08em; }
.tex-d { display: block; }
.enum { display: flex; flex-wrap: wrap; gap: 5px; max-height: 260px; overflow: auto; }
.enum span { font: 600 13px ui-monospace, Menlo, monospace; background: #f0f6f4; color: #14857a; border-radius: 7px; padding: 3px 7px; letter-spacing: .08em; }
.objbox { margin-bottom: 8px; }
.stepl li, .cards > *, .panel-body, .tool-grid > * { min-width: 0; }
.panel { overflow: hidden; }
.big, .st-m, .kv dd { -webkit-overflow-scrolling: touch; }
@media (max-width: 700px) {
  .hero { padding-top: 34px; }
  .hero-leaves { width: 120px; top: -34px; right: -10px; opacity: .55; }
  .hero h1 { padding-right: 40px; }
  .panel { padding: 14px 14px 16px; }
  .row { grid-template-columns: minmax(90px, 40%) 1fr; }
  .keypad button { padding: 12px 0; }
  .catnav { top: 54px; }
}
