:root {
  --paper: #efede8;
  --panel: #f7f6f2;
  --sheet: #fffdf9;
  --ink: #17181a;
  --dim: #55585d;
  --line: rgba(23, 24, 26, .16);
  --accent: #7f95a8;
  --accent-ink: #3d5466;
  --hot: #b04a26;
  --hot-soft: rgba(176, 74, 38, .12);
  --hot-dark: #933c1d;
  --on-hot: #fffdf9;
  --ok: #2f6b4f;
  --ground: #e3e0d8;
  --font: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  --hairline: 0 1px 0 var(--line);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }   /* kein Doppeltipp-Zoom; Zoom-Gesten fängt nozoom.js ab */
body {
  background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ─── Rahmen: füllt genau den sichtbaren Bereich (auch bei offener Tastatur) ── */
#app { position: fixed; left: 0; top: 0; width: 100%; height: var(--vh, 100%); transform: translateY(var(--vy, 0)); }
.screen { position: relative; display: none; height: 100%; max-width: 560px; margin: 0 auto; flex-direction: column; background: var(--paper); }
.screen.active { display: flex; }

.topbar { flex: none; position: relative; z-index: 2; background: var(--paper); transition: box-shadow .2s; display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 6px; }
.topbar-start { justify-content: flex-end; }

.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--sheet); box-shadow: var(--hairline);
  display: grid; place-items: center; font-size: 20px; line-height: 1; color: var(--ink);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.progress { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.progress span { font-size: 14px; color: var(--dim); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.bars i { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: block; }
.bars i.on { background: var(--hot); }
.bars i b { display: block; height: 100%; background: var(--hot); transition: width .25s; }

.lang { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--sheet); box-shadow: var(--hairline); }
.lang button { min-height: 38px; min-width: 46px; border: 0; border-radius: 9px; background: transparent; color: var(--dim); font-size: 15px; }
.lang button[aria-checked="true"] { background: var(--ink); color: var(--paper); font-weight: 700; }
.topbar .lang button { min-height: 34px; min-width: 40px; font-size: 14px; }

.content { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.content h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.lead { margin: 0; font-size: 16px; color: var(--dim); }
/* Überschrift + Erklärung: auf jedem Schritt gleich groß und an gleicher Stelle */
.head { flex: none; display: flex; flex-direction: column; gap: 4px; min-height: 64px; }
.head h1 { font-size: 28px; }

/* Der Knopfbereich hat rundum denselben Abstand (16 px), auch unten */
.actions { flex: none; position: relative; z-index: 2; transition: box-shadow .2s; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
/* Schatten nur, wenn Inhalt unter Kopfleiste oder Knopfbereich liegt (Klassen setzt app.js) */
.screen.sh-top .topbar { box-shadow: 0 10px 18px -14px rgba(0, 0, 0, .45); }
.screen.sh-bottom .actions { box-shadow: 0 -10px 18px -14px rgba(0, 0, 0, .45); }
.actions .note { margin: 0; text-align: center; font-size: 14.5px; color: var(--dim); }
.primary {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 55px; border: 0; border-radius: 14px;
  background: var(--hot); color: var(--on-hot); font-size: 18px; font-weight: 700; text-decoration: none;
}
.primary:hover { background: var(--hot-dark); }
.primary:active { transform: scale(.99); background: var(--hot-dark); }
.ghost { border: 1.5px solid var(--line); background: transparent; min-height: 46px; padding: 8px 16px; border-radius: 14px; font-size: 16px; }
.ghost.wide { width: 100%; height: 55px; border-radius: 14px; font-weight: 600; }
.link { border: 0; background: none; padding: 0; color: var(--hot); font-weight: 600; text-decoration: underline; font-size: inherit; }

/* ─── Start ─────────────────────────────────────────────────────────────── */
.start { gap: 16px; padding-top: max(10px, env(safe-area-inset-top)); }
/* Startseite: Menüknopf schwebt rechts oben, das Logo beginnt auf seiner Höhe */
.screen[data-screen="start"] .topbar { position: absolute; top: 0; right: 0; background: none; }
.brand { font-size: clamp(50px, 16.4vw, 72px) !important; line-height: .96 !important; letter-spacing: -.035em !important; }
.brand em { font-style: italic; color: var(--hot); }
.sub { margin: -4px 0 0; font-size: 19px; color: var(--dim); line-height: 1.4; }
/* Die Figur füllt den Platz, der zwischen Text und Schritten frei bleibt */
.dog-hero { flex: 1 1 auto; min-height: 120px; display: grid; place-items: center; }
.dog-hero svg { width: 100%; height: 100%; max-height: 260px; display: block; }
/* Messen → Drucken → Nähen: eine Zeile, Pfeile in der Akzentfarbe */
.how { list-style: none; margin: 0; padding: 4px 0 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.how li + li::before { content: '→'; color: var(--hot); margin: 0 .4em; }
/* ─── Schnittwahl ───────────────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.card {
  position: relative; text-align: left; border: 2px solid transparent; background: var(--sheet); border-radius: 16px; padding: 12px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--hairline);
}
.card[aria-checked="true"] { border-color: var(--hot); box-shadow: none; }
.card[aria-checked="true"]::after {
  content: '✓'; position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--hot); color: var(--on-hot); display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.card svg { width: 100%; height: 46px; }
.card svg * { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.card svg .d { stroke-dasharray: 3 3; stroke: var(--dim); stroke-width: 1.1; }
.card b { font-size: 17px; line-height: 1.3; }
.card small { font-size: 14px; color: var(--dim); line-height: 1.35; }
.badge {
  align-self: flex-start; display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.5; background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line);
  vertical-align: middle; letter-spacing: 0;
}
.badge.free { background: #e1efe6; color: var(--ok); box-shadow: inset 0 0 0 1px rgba(47, 107, 79, .25); }
h1 .badge { font-size: 14px; margin: 0 0 0 4px; position: relative; top: -3px; }
.card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; }
.card.wide svg { flex: none; width: 96px; }
.card.wide > span { display: flex; flex-direction: column; gap: 2px; padding-right: 28px; }

/* ─── Passform ──────────────────────────────────────────────────────────── */
.options { display: flex; flex-direction: column; gap: 16px; }
.opt { display: flex; flex-direction: column; gap: 8px; }
.opt .help { font-size: 14.5px; color: var(--dim); }
.segs { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 6px; }
.seg { min-height: 50px; border: 0; border-radius: 12px; background: var(--sheet); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-size: 16px; font-weight: 600; padding: 4px 6px; line-height: 1.2; }
.seg[aria-checked="true"] { background: var(--hot); color: var(--on-hot); box-shadow: none; }
.numopt { display: flex; align-items: center; gap: 8px; }
.numopt input, .namefield input, .custom input {
  min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--sheet); padding: 0 14px; font-size: 17px; color: var(--ink);
}
.numopt input { width: 110px; text-align: right; font-weight: 600; }
.numopt em { font-style: normal; color: var(--dim); }
.namefield { display: flex; align-items: center; gap: 12px; }
.namefield .blocktitle { flex: none; }
.namefield input { flex: 1; min-width: 0; }
/* Passform: Name immer ganz unten */
.namefield small { font-size: 14.5px; color: var(--dim); }
input:focus { outline: 3px solid var(--ink); outline-offset: 0; border-color: transparent; }

/* Passform: gebaut wie die Preiswahl der Übersicht – kleiner Titel, darunter einzelne Knöpfe */
.opt .blocktitle, .namefield .blocktitle { display: block; line-height: 1.45; }

/* Die Erklärung zur Passform wechselt mit der Wahl; zwei Zeilen reserviert, damit nichts springt */

.singles p { margin: 8px 0 0; line-height: 1.6; }
.singles a { color: var(--hot); font-weight: 600; }

/* ─── Messen ────────────────────────────────────────────────────────────── */
.content.measure { overflow: hidden; gap: 12px; }
.dogbox { flex: 1 1 auto; min-height: 60px; display: grid; place-items: center; overflow: hidden; }
.dogbox svg { width: auto; height: 100%; max-width: 100%; max-height: 280px; }
.dogsvg .body { fill: #d9d5cc; stroke: #b3aea2; stroke-width: 1; }
.dogsvg .far path { fill: #c6c1b6; }
.dogsvg .ear { fill: #b7b1a4; }
.dogsvg .eye, .dogsvg .nose { fill: var(--ink); }
.ov { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; opacity: 0; transition: opacity .2s, stroke .2s; }
.ov.on { opacity: .5; }
.ov.active { opacity: 1; stroke: var(--hot); stroke-width: 3.6; }
.stepper { flex: none; display: grid; grid-template-columns: 58px minmax(0, 1fr) 58px; gap: 8px; align-items: center; }
.stepper button { height: 58px; border-radius: 14px; border: 0; background: var(--sheet); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 30px; color: var(--ink); }
.stepper button:active { background: var(--line); }
.stepper .in { position: relative; }
.stepper input {
  width: 100%; height: 58px; border-radius: 14px; border: 2px solid var(--hot); background: #fff; text-align: center;
  font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 0 46px 0 12px;
}
.stepper input:focus { outline: none; box-shadow: 0 0 0 4px var(--hot-soft); }
.stepper .in span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--dim); font-size: 18px; font-weight: 600; pointer-events: none; }
.err { margin: -4px 0 0; color: var(--hot); font-size: 15px; font-weight: 600; }
.err:empty { display: none; }
/* Messen: Überschrift + Erklärung (bis 3 Zeilen) und Fehlerzeile haben feste Höhen,
   damit der Hund bei jedem Maß an derselben Stelle steht */
.content.measure .head { height: 108px; overflow: hidden; }
.content.measure .head .lead { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.content.measure .err, .content.measure .err:empty { display: block; height: 20px; margin: -6px 0 -2px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breedrow { flex: none; display: flex; gap: 8px; align-items: stretch; }
.breed {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 4px 0 14px;
  border-radius: 12px; background: var(--sheet); box-shadow: var(--hairline); font-size: 15px;
}
.breed span { color: var(--dim); white-space: nowrap; }
.breed select { flex: 1; min-width: 0; min-height: 40px; border: 0; background: transparent; font-size: 16px; font-weight: 600; text-align: right; text-align-last: right; }
.unit { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--sheet); box-shadow: var(--hairline); }
.unit button { min-width: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--dim); font-size: 15px; }
.unit button[aria-checked="true"] { background: var(--ink); color: var(--paper); font-weight: 700; }
/* Wenig Platz (Tastatur offen): Erklärung kürzen, Rasse ausblenden, Figur behält den Rest */
.tight .content.measure { gap: 8px; }
.tight .content.measure .head { height: 78px; }
.tight .head .lead { font-size: 14.5px; -webkit-line-clamp: 2 !important; }
.tight .breedrow { display: none; }
.tiny .head .lead { display: none !important; }
.tiny .head h1 { font-size: 22px; }
.tiny .content.measure .head { height: 30px; }
.tiny .topbar { padding-top: 6px; padding-bottom: 2px; }
.tiny .stepper button, .tiny .stepper input { height: 48px; }
.tiny .stepper input { font-size: 24px; }

/* Übersicht: Reiter für die Vorschau, kompakte Zeilen */
.tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--sheet); box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 15px; font-weight: 600; white-space: nowrap; color: var(--ink);
}
.tab[aria-selected="true"] { background: var(--hot); color: var(--on-hot); box-shadow: none; }
.tab.locked { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.tab.locked svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.preview { position: relative; }
.pv-label { position: absolute; left: 10px; top: 8px; z-index: 1; padding: 3px 10px; border-radius: 999px; background: var(--sheet); font-size: 13px; font-weight: 700; box-shadow: var(--hairline); }
.pv-label em { font-style: normal; color: var(--ok); margin-left: 4px; }
.line { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.line b { font-weight: 700; margin-right: 2px; }
.line span { color: var(--dim); }

/* ─── Set ───────────────────────────────────────────────────────────────── */
.setcard { background: var(--sheet); border: 2px solid var(--hot); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.setcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.setcard-head b { font-size: 19px; }
.setcard .cards { gap: 5px; }
.setcard .card { background: var(--paper); box-shadow: none; cursor: default; border: 2px solid transparent; }
/* Mantel und Pullover: an- und abwählbar */
.setcard .card.pick { cursor: pointer; text-align: left; font: inherit; color: inherit; }
.setcard .card.pick[aria-checked="true"] { border-color: var(--hot); background: var(--sheet); }
.setcard .card.pick[aria-checked="true"]::after {
  content: '✓'; position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--hot); color: var(--on-hot); display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.setcard .card.pick[aria-checked="false"]::after {
  content: ''; position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--line); background: var(--sheet);
}
.setcard .card.pick[aria-checked="false"] svg, .setcard .card.pick[aria-checked="false"] b { opacity: .45; }
.badge.price.free { background: #e1efe6; color: var(--ok); box-shadow: inset 0 0 0 1px rgba(47, 107, 79, .25); }
.card .badge.free { margin-top: 4px; }
/* Die drei inklusiven Schnitte als schmale Reihe unter den wählbaren */
.setgroups { display: flex; flex-direction: column; gap: 5px; }
.cards.trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.trio .card { padding: 8px 10px; gap: 2px; }
.cards.trio .card svg { height: 30px; }
.cards.trio .card b { font-size: 15px; line-height: 1.25; }
.cards.trio .badge { font-size: 12px; padding: 1px 7px; margin-top: 2px; }
.setnote { margin: 0; font-size: 14px; line-height: 1.4; color: var(--dim); }
.badge.price { margin: 0; font-size: 15px; padding: 3px 12px; }

/* ─── Übersicht ─────────────────────────────────────────────────────────── */
.overview { gap: 9px; }
.preview { background: var(--ground); border-radius: 14px; padding: 8px; height: clamp(110px, 20vh, 220px); display: grid; place-items: center; overflow: hidden; }
:is(.preview, .zoom-stage) svg { width: 100%; height: 100%; display: block; }
.preview.busy svg { opacity: .5; }
:is(.preview, .zoom-stage) .g1 { stroke: rgba(17, 18, 20, .05); stroke-width: .02; }
:is(.preview, .zoom-stage) .g5 { stroke: rgba(17, 18, 20, .11); stroke-width: .03; }
:is(.preview, .zoom-stage) .tile { fill: rgba(255, 255, 255, .3); stroke: rgba(61, 84, 102, .4); stroke-width: .05; stroke-dasharray: .4 .25; }
:is(.preview, .zoom-stage) .tile.unused { fill: none; stroke: rgba(61, 84, 102, .12); }
:is(.preview, .zoom-stage) .tilelabel { fill: rgba(61, 84, 102, .7); font-size: .8px; font-weight: 700; }
:is(.preview, .zoom-stage) .wm { pointer-events: none; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fact { background: var(--sheet); border-radius: 12px; padding: 8px 12px; box-shadow: var(--hairline); display: flex; flex-direction: column; line-height: 1.3; }
.fact span { font-size: 13.5px; color: var(--dim); }
.fact b { font-size: 16px; }
.fact.wide { grid-column: 1 / -1; }
.block { display: flex; flex-direction: column; gap: 6px; }
.blocktitle { margin: 0; font-size: 14.5px; color: var(--dim); }
.blocktitle b { color: var(--ink); }
.formats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.formats > span { background: var(--sheet); border-radius: 10px; padding: 6px 4px; text-align: center; box-shadow: var(--hairline); display: flex; flex-direction: column; line-height: 1.2; }
.formats b { font-size: 15px; }
.formats small { font-size: 12.5px; color: var(--dim); }
.more { background: var(--sheet); border-radius: 12px; box-shadow: var(--hairline); }
.more summary { min-height: 46px; display: flex; align-items: center; padding: 0 14px; font-weight: 600; font-size: 15.5px; cursor: pointer; list-style: none; }
.more summary::after { content: '+'; margin-left: auto; font-size: 20px; color: var(--dim); }
.more[open] summary::after { content: '−'; }
.more summary::-webkit-details-marker { display: none; }
.advanced summary { gap: 10px; }
.advanced summary small { color: var(--dim); font-weight: 400; font-size: 14px; margin-left: auto; text-align: right; }
.advanced summary::after { margin-left: 8px; }
.advanced .options { padding: 4px 14px 14px; }
.guide { padding: 0 14px 12px; font-size: 15px; }
.guide h3 { margin: 10px 0 4px; font-size: 15px; }
.guide ul, .guide ol { margin: 0; padding-left: 20px; }
.guide li { margin-bottom: 4px; }
.guide small { color: var(--dim); }
.warnings:empty { display: none; }
.warnings p { margin: 0; padding: 10px 12px; background: var(--hot-soft); border-radius: 12px; font-size: 15px; }
.warnings p + p { margin-top: 6px; }
.amounts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.amounts button { min-height: 50px; border: 0; border-radius: 12px; background: var(--sheet); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 17px; font-weight: 700; }
.amounts button[aria-checked="true"] { background: var(--hot); color: var(--on-hot); box-shadow: none; }
.custom { grid-column: 1 / -1; position: relative; display: flex; }
.custom input { width: 100%; text-align: center; font-weight: 700; padding-right: 32px; }
.custom em { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--dim); }

.actions.pay { gap: 10px; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; cursor: pointer; border-radius: 12px; padding: 4px; margin: -4px; transition: background .2s, box-shadow .2s; }
.consent input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--hot); }
.consent.flash { background: var(--hot-soft); box-shadow: inset 0 0 0 2px var(--hot); animation: nudge .4s; }
@keyframes nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.paybox { min-height: 55px; display: grid; }
/* Stripe legt 4 px Rand um den Apple-Pay-Knopf; so steht er genau wie der Knopf auf den anderen Schritten */
.paybox:has(iframe) { position: relative; top: 4px; }
.paybox .wait { margin: 0; color: var(--dim); font-size: 15px; align-self: center; text-align: center; }
.noapple { padding: 12px 14px; border-radius: 14px; background: var(--sheet); box-shadow: var(--hairline); font-size: 14.5px; display: grid; gap: 8px; }
.msg { margin: 0; font-size: 15px; color: var(--hot); font-weight: 600; }
.msg:empty { display: none; }
.demo { margin: 0; font-size: 13.5px; color: var(--accent-ink); text-align: center; }

/* ─── Nach dem Kauf ─────────────────────────────────────────────────────── */
.done-head { background: var(--hot); color: var(--on-hot); border-radius: 20px; padding: 18px; display: grid; gap: 4px; }
.done-head h1 { color: var(--on-hot); font-size: 24px; }
.done-head p { margin: 0; color: var(--on-hot); opacity: .9; }
.dls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dl { display: grid; gap: 2px; padding: 14px; min-height: 72px; border-radius: 14px; background: var(--sheet); box-shadow: var(--hairline); text-decoration: none; }
.dl b { font-size: 18px; }
.dl small { color: var(--dim); font-size: 14px; }
.keep { margin: 0; font-size: 14.5px; color: var(--dim); overflow-wrap: anywhere; }
.svglink { font-size: 14.5px; }

.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-size: 15.5px; text-align: center;
  max-width: calc(100% - 32px); opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ─── Seitenleiste ──────────────────────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 80; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(23, 24, 26, .42); opacity: 0; transition: opacity .25s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 86vw); background: var(--paper);
  padding: max(12px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)) 20px;
  display: flex; flex-direction: column; gap: 24px; overflow-y: auto; box-shadow: -20px 0 40px -30px rgba(0, 0, 0, .5);
  transform: translateX(100%); transition: transform .25s ease;
}
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
@media (prefers-reduced-motion: reduce) { .drawer-backdrop, .drawer-panel { transition: none; } }
/* Gleiche Höhe wie die Kopfzeile: das ✕ steht genau dort, wo der Menü-Knopf war */
.drawer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 44px; padding-bottom: 10px; }
/* Logo zweizeilig wie auf der Startseite */
.drawer-brand { font-size: 38px; font-weight: 800; letter-spacing: -.035em; line-height: .96; padding-top: 4px; }
.drawer-brand em { font-style: italic; color: var(--hot); }
.drawer-sec { display: flex; flex-direction: column; gap: 10px; }
.drawer-sec h2 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.drawer-lang { display: grid; grid-template-columns: 1fr 1fr; }
.drawer-lang button { min-height: 44px; font-size: 16px; }
.mine-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.mine-list a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--sheet); box-shadow: var(--hairline); text-decoration: none; }
.mine-list small { color: var(--dim); white-space: nowrap; }
.insta { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--sheet); box-shadow: var(--hairline); text-decoration: none; }
.insta svg { flex: none; width: 30px; height: 30px; fill: none; stroke: var(--hot); stroke-width: 1.8; }
.insta svg .fill { fill: var(--hot); stroke: none; }
.insta span { display: flex; flex-direction: column; line-height: 1.3; }
.insta b { font-size: 16px; }
.insta small { font-size: 14px; color: var(--dim); }
.drawer-legal { margin-top: auto; display: flex; flex-direction: column; }
.drawer-legal a { min-height: 44px; display: flex; align-items: center; border-top: 1px solid var(--line); text-decoration: none; font-size: 16px; }
.drawer-legal a:last-child { border-bottom: 1px solid var(--line); }

/* ─── Desktop: der Ablauf als Karte in der Mitte ───────────────────────── */
@media (min-width: 700px) and (min-height: 640px) {
  body { background: var(--ground); }
  .screen { height: calc(100% - 48px); margin-top: 24px; border-radius: 28px; overflow: hidden; box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .45); }
  .content { padding-left: 24px; padding-right: 24px; }
  .actions { padding: 24px; }
  .topbar { padding-left: 24px; padding-right: 24px; padding-top: 18px; }
  .start { padding-top: 16px; }   /* Logo auf Höhe des Menüknopfs */
  .breedrow { padding-left: 24px; padding-right: 24px; }
  .preview { height: clamp(160px, 28vh, 280px); }
}

/* ─── Rechtstexte (eigene Seiten, normales Scrollen) ──────────────────── */
body.legalpage { overflow: auto; }
.legal { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }
.legal h1 { font-size: 32px; letter-spacing: -.02em; margin: 14px 0 16px; line-height: 1.15; }
.legal h2 { font-size: 20px; margin: 28px 0 8px; }
.legal p, .legal li { font-size: 17px; }
.legal .back { color: var(--dim); text-decoration: none; font-weight: 600; display: inline-flex; min-height: 44px; align-items: center; }
.legal mark { background: #f3d9cf; padding: 0 3px; border-radius: 3px; }
.legal .box { background: var(--panel); border-radius: 12px; padding: 14px 16px; }
.legal .switch { float: right; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }
.legalfoot { max-width: 760px; margin: 0 auto; padding: 0 20px 40px; color: var(--dim); font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ─── Niedrige Bildschirme (z. B. iPhone SE): kompakter, damit nichts scrollt ── */
@media (max-height: 720px) {
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); }
  .content { gap: 10px; padding-top: 6px; }
  .content h1, .head h1 { font-size: 24px; }
  .head { min-height: 56px; }
  .content.measure .head { height: 100px; }
  .lead { font-size: 15px; margin-top: -6px; }
  .start { gap: 10px; }
  .brand { font-size: clamp(46px, 14vw, 56px) !important; }
  .sub { font-size: 16.5px; }
  .dog-hero { min-height: 90px; }
  .how { font-size: 20px; }
  .primary { min-height: 52px; }
  .cards { gap: 6px; }
  .card { padding: 10px; gap: 2px; }
  .card svg { height: 38px; }
  .card small { font-size: 13px; }
  .options { gap: 12px; }
  .opt { gap: 6px; }
  .opt .help { font-size: 13.5px; }
  .namefield input { min-height: 46px; }
  .overview { gap: 9px; }
  .preview { height: clamp(100px, 19vh, 160px); }
  .fact { padding: 8px 10px; }
  .formats > span { padding: 5px 4px; }
  .amounts button { min-height: 46px; }
  .setcard { padding: 10px; gap: 8px; }
  .setcard .card small { display: none; }
  .tab { min-height: 36px; padding: 0 12px; font-size: 14px; }
  .preview { height: clamp(90px, 15vh, 120px); }
  .fact { padding: 6px 10px; }
  .fact b { font-size: 15px; }
  .formats > span { padding: 4px; }
  .more summary { min-height: 40px; }
  .seg { min-height: 46px; }
  .namefield input { min-height: 44px; }
}

/* ─── Passform: Liste wie die Set-Karte, Auswahl im Fenster von unten ────── */
.fitbody { display: flex; flex-direction: column; gap: 14px; }

.fitlist { background: var(--sheet); border-radius: 16px; box-shadow: var(--hairline); overflow: hidden; }
.fitrow {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 8px 12px; margin: 0;
  border: 0; border-radius: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.fitrow + .fitrow { border-top: 1px solid var(--line); }
button.fitrow:active { background: var(--panel); }
.fr-ic { flex: none; width: 46px; display: grid; place-items: center; }
.fr-ic svg { width: 46px; height: 24px; }
.fr-ic svg * { fill: none; stroke: var(--ink); stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; }
.fr-ic svg .d { stroke-dasharray: 5 5; stroke: var(--dim); stroke-width: 2.2; }
.fr-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.fr-t b { font-size: 16px; }
.fr-t small { font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fitrow .badge { flex: none; align-self: center; margin: 0; font-size: 12px; padding: 1px 8px; }
.stdtag { flex: none; font-size: 13px; color: var(--dim); }
.badge.custom { background: var(--hot-soft); color: var(--hot-dark); box-shadow: none; }
.chev { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; margin-left: -4px; }
/* Rüde/Hündin: kleine Knöpfe rechts in der Zeile */
.sexrow .fr-t { flex: none; }
.segs.mini { flex: 1; min-width: 0; max-width: 220px; margin-left: auto; gap: 4px; }
.segs.mini .seg { min-height: 38px; font-size: 15px; border-radius: 10px; padding: 2px 4px; }
/* Name: groß und mittig oben in der Karte „Dein Hund“ */
.namebig { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 14px 8px; cursor: text; }
.nb-label { font-size: 13px; font-weight: 600; color: var(--dim); }
.namebig input {
  width: 100%; min-height: 42px; border: 0; background: transparent; padding: 0; text-align: center;
  font-size: 26px; font-weight: 800; letter-spacing: -.01em; color: var(--ink);
}
.namebig input::placeholder { color: var(--dim); opacity: .45; font-weight: 700; }
.namebig input:focus { outline: none; }
.namebig:focus-within { background: var(--panel); box-shadow: inset 0 -2px 0 var(--hot); }
.namebig + .fitrow { border-top: 1px solid var(--line); }
/* Überschrift mit Namen bleibt einzeilig, damit nichts springt */
#fit-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-wrap: nowrap; }
#fit-next, #mnext { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 16px; padding-right: 16px; }

.sheet { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(23, 24, 26, .32); animation: fade .2s ease-out; }
.sheet-panel {
  position: relative; max-height: 88%; overflow-y: auto; background: var(--paper); border-radius: 22px 22px 0 0;
  padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 -12px 30px -12px rgba(0, 0, 0, .35);
  animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet-panel::before { content: ''; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: -6px; }
.sheet-top h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.sheet-top .link { font-size: 15px; }
.sheet-body { display: flex; flex-direction: column; gap: 16px; }
.sheet-body .opt { gap: 6px; }
.sheet-body .opt .help { font-size: 14px; min-height: calc(2 * 1.4em); line-height: 1.4; }
.seg small { display: block; font-size: 11.5px; font-weight: 600; opacity: .7; line-height: 1.2; }
.sheet-body .numopt input { min-height: 50px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet-panel, .sheet-backdrop { animation: none; } }
@media (max-height: 720px) {
  .fitbody { gap: 8px; }
  .fitrow { min-height: 44px; padding: 4px 12px; }
  .fr-t { line-height: 1.25; }
  .fr-t small { font-size: 13px; }
  .namebig { padding: 6px 14px 4px; }
  .fitbody > .block:first-child > .blocktitle { display: none; }   /* die Karte beschriftet sich selbst */
  .namebig input { min-height: 34px; font-size: 22px; }
  .fitbody .blocktitle .note { display: none; }
  .sheet-body, .sheet-panel { gap: 12px; }
}

/* ─── Vorschau vergrößern ───────────────────────────────────────────────── */
.preview[role="button"] { cursor: zoom-in; }
.preview:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pv-zoom { position: absolute; right: 10px; bottom: 8px; z-index: 1; width: 32px; height: 32px; border-radius: 50%; background: var(--sheet); box-shadow: var(--hairline); display: grid; place-items: center; pointer-events: none; }
.pv-zoom svg { width: 17px; height: 17px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.zoom { position: absolute; inset: 0; z-index: 25; background: var(--paper); display: flex; flex-direction: column; animation: fade .18s ease-out; }
.zoom[hidden] { display: none; }
.zoom-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 8px; }
.zoom-top h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.zoom-stage { flex: 1; min-height: 0; margin: 0 16px; border-radius: 14px; background: var(--ground); overflow: hidden; cursor: zoom-in; touch-action: pan-x pan-y; }
.zoom-stage svg { width: 100%; height: 100%; display: block; }
.zoom-stage.zoomed { overflow: auto; cursor: zoom-out; display: flex; }
/* Gezoomt: margin:auto zentriert, ohne links abzuschneiden */
.zoom-stage.zoomed svg { flex: none; margin: auto; }   /* Größe setzt app.js: 2,5-fach der eingepassten Größe */
.zoom-hint { flex: none; margin: 0; padding: 10px 16px max(16px, env(safe-area-inset-bottom)); text-align: center; font-size: 14px; color: var(--dim); }
