/* Baukasten-Gestalter (/gestalter/). Alle Maße auf dem Blatt in cqw (Blattbreite),
   damit Bildschirm, Druck und Export gleich umbrechen. */
.fb-page { padding-bottom: 2rem; }
.fb-app {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
  padding-top: 0;
}
.fb-tools {
  position: sticky;
  top: calc(var(--header-h, 4.25rem) + 0.8rem);
  background: #fffdf8;
  box-shadow: 0 0 0 2px var(--ink), 6px 6px 0 var(--fir);
  padding: 1rem 1rem 1.1rem;
  max-height: calc(100vh - var(--header-h, 4.25rem) - 1.6rem);
  overflow: auto;
}
.fb-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; margin: 0 0 0.9rem; }
.fb-tab {
  appearance: none; border: 2px solid var(--ink); background: #fffdf8; color: var(--ink);
  font: 700 0.95rem/1 var(--font, inherit); padding: 0.7rem 0.4rem; min-height: 44px; cursor: pointer;
}
.fb-tab[aria-selected="true"] { background: var(--fir); border-color: var(--fir); color: #F1E4C3; }
.fb-group { margin: 0 0 0.85rem; }
.fb-group-label { margin: 0 0 0.35rem; font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.fb-hint { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.9rem; }
.fb-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.6rem; }
.fb-chip { min-height: 40px; display: inline-flex; align-items: center; gap: 0.35rem; }
.fb-swatch { width: 1rem; height: 1rem; display: inline-block; box-shadow: 0 0 0 1.5px rgba(0,0,0,.35); }
.fb-adds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.45rem; }
.fb-add {
  appearance: none; display: flex; align-items: center; gap: 0.5rem; text-align: left;
  border: 2px solid var(--ink); background: #fffdf8; color: var(--ink); padding: 0.5rem 0.6rem;
  min-height: 48px; font: 600 0.95rem/1.15 var(--font, inherit); cursor: pointer;
}
.fb-add:hover, .fb-add:focus-visible { background: #f6edd6; box-shadow: 3px 3px 0 var(--ochre); }
.fb-add .fb-ico { flex: none; color: var(--fir); }
.fb-opts-title { font-family: var(--display); font-size: 1.15rem; margin: 0 0 0.6rem; }
.fb-input { width: 100%; min-height: 44px; border: 2px solid var(--ink); padding: 0.4rem 0.6rem; font: inherit; background: #fff; }
.fb-actions { border-top: 2px dashed var(--line); margin-top: 0.8rem; padding-top: 0.9rem; display: grid; gap: 0.5rem; }
.fb-actions .btn { width: 100%; justify-content: center; }
.fb-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.fb-small { font-size: 0.9rem; padding: 0.55rem 0.5rem; min-height: 44px; }
.fb-status { margin: 0; min-height: 1.2em; font-size: 0.9rem; color: var(--muted); }
.fb-stage { position: relative; min-width: 0; }
.fb-meter { margin: 0 0 0.5rem; font-weight: 700; color: var(--fir); font-size: 0.95rem; }
.fb-meter.is-full { color: var(--red); }
.fb-meter.is-over { color: #fff; background: var(--red); display: inline-block; padding: 0.1rem 0.5rem; }
.fb-toast {
  position: sticky; bottom: 1rem; margin: 0.8rem auto 0; max-width: 34rem; background: var(--ink); color: #F1E4C3;
  padding: 0.7rem 0.9rem; font-weight: 600; box-shadow: 4px 4px 0 var(--red); z-index: 5;
}
.fb-toast[hidden] { display: none; }
.fb-bar { display: none; }

/* ---------- Das Blatt ---------- */
:is(.fb-sheet, .fb-msheet) {
  --paper-c: #f3e6c8;
  --ink-c: #2a241c;
  --accent: #8B2E28;
  --fs: 2.2cqw;
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 210 / 297;
  background: var(--paper-c);
  color: var(--ink-c);
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 14px 34px rgba(20,25,22,.22);
  overflow: hidden;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
:is(.fb-sheet, .fb-msheet)[data-paper="weiss"] { --paper-c: #fffdf8; }
:is(.fb-sheet, .fb-msheet)[data-paper="tanne"] { --paper-c: #e3ecdf; }
:is(.fb-sheet, .fb-msheet)[data-paper="rose"] { --paper-c: #f6e3df; }
:is(.fb-sheet, .fb-msheet)[data-paper="himmel"] { --paper-c: #e2ebf2; }
:is(.fb-sheet, .fb-msheet)[data-ink="tanne"] { --ink-c: #143d28; --accent: #2C4A34; }
:is(.fb-sheet, .fb-msheet)[data-ink="wein"] { --ink-c: #6b1c22; --accent: #8B2E28; }
:is(.fb-sheet, .fb-msheet)[data-ink="nacht"] { --ink-c: #1a2a4a; --accent: #2f4f7a; }
:is(.fb-sheet, .fb-msheet)[data-font="hand"] { font-family: "Patrick Hand", "Segoe Print", cursive; --fs: 2.85cqw; }
:is(.fb-sheet, .fb-msheet)[data-font="serif"] { font-family: "Fraunces", Georgia, serif; --fs: 2.45cqw; }
:is(.fb-sheet, .fb-msheet)[data-font="sans"] { font-family: "Source Sans 3", "Segoe UI", sans-serif; --fs: 2.6cqw; }
.fb-art { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.fb-frame-svg { position: absolute; inset: 2.2cqw; }
.fb-frame-svg svg { width: 100%; height: 100%; display: block; }
/* Rahmenlinien als echte Ränder (nicht inset box-shadow): html2canvas zeichnet die im Export nicht */
:is(.fb-sheet, .fb-msheet)[data-frame="schlicht"] .fb-art::before { content: ""; position: absolute; inset: 4.2cqw; border: 0.3cqw solid var(--ink-c); }
:is(.fb-sheet, .fb-msheet)[data-frame="sterne"] .fb-art::before { content: ""; position: absolute; inset: 4cqw; border: 0.35cqw solid #C6A04A; }
.fb-corner { position: absolute; width: 9cqw; height: 9cqw; }
.fb-corner svg { width: 100%; height: 100%; display: block; }
.fb-corner-tl { left: 3.5cqw; top: 3.5cqw; }
.fb-corner-tr { right: 3.5cqw; top: 3.5cqw; }
.fb-corner-bl { left: 3.5cqw; bottom: 3.5cqw; }
.fb-corner-br { right: 3.5cqw; bottom: 3.5cqw; }
.fb-corner-star { width: 5.5cqw; height: 5.5cqw; }
.fb-corner-star.fb-corner-tl, .fb-corner-star.fb-corner-tr { top: 2cqw; }
.fb-corner-star.fb-corner-bl, .fb-corner-star.fb-corner-br { bottom: 2cqw; }
.fb-corner-star.fb-corner-tl, .fb-corner-star.fb-corner-bl { left: 2cqw; }
.fb-corner-star.fb-corner-tr, .fb-corner-star.fb-corner-br { right: 2cqw; }
.fb-motif { position: absolute; left: 50%; top: 4.4cqw; width: 5cqw; height: 5cqw; transform: translateX(-50%); color: #8aa6bf; }
.fb-motif svg { width: 100%; height: 100%; display: block; }
.fb-motif-seal { top: auto; transform: none; bottom: 8cqw; left: 9cqw; width: 9cqw; height: 9cqw; }
.fb-flow {
  position: absolute;
  left: 10.5cqw; right: 10.5cqw; top: 10cqw; bottom: 19cqw;
  overflow: hidden;
  z-index: 1;
  font-size: var(--fs);
  line-height: 1.45;
}
.fb-end { clear: both; height: 0; }
.fb-foot {
  position: absolute; left: 0; right: 0; bottom: 9.5cqw; margin: 0; text-align: center;
  font: 1.45cqw/1 "Source Sans 3", sans-serif; letter-spacing: 0.08em; color: var(--ink-c); opacity: 0.6; z-index: 1;
}
:is(.fb-sheet, .fb-msheet)[data-motif="siegel"] .fb-foot { left: 18cqw; right: 0; }

/* Bausteine */
.fb-block { position: relative; margin: 0 0 1.4cqw; }
.fb-block [contenteditable="true"] { outline: none; border-radius: 1px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-block [contenteditable="true"]:focus { background: rgba(198,160,74,.16); box-shadow: 0 0 0 0.35cqw rgba(198,160,74,.35); }
.fb-h { margin: 0; font-family: inherit; font-weight: 700; line-height: 1.15; color: var(--ink-c); font-size: 1.85em; }
:is(.fb-sheet, .fb-msheet)[data-font="serif"] .fb-h { font-weight: 600; }
.fb-t-heading[data-size="s"] .fb-h { font-size: 1.4em; }
.fb-t-heading[data-size="l"] .fb-h { font-size: 2.4em; }
.fb-p { margin: 0; }
.fb-t-text[data-size="s"] { font-size: 0.88em; }
.fb-t-text[data-size="l"] { font-size: 1.2em; }
.fb-list { margin: 0; padding-left: 0.2em; list-style: none; }
.fb-li { margin: 0 0 0.35em; display: flex; align-items: baseline; gap: 0.5em; }
.fb-mk { flex: 0 0 auto; min-width: 1.2em; text-align: right; }
.fb-mk-box { min-width: 0; width: 0.85em; height: 0.85em; border: 0.14em solid var(--ink-c); box-sizing: border-box; align-self: flex-start; margin-top: 0.28em; }
.fb-li-t { display: inline-block; min-width: 4em; }
.fb-line { display: block; height: 2.1em; border-bottom: 0.1cqw solid var(--ink-c); opacity: 0.55; }
.fb-t-figure { margin-bottom: 1cqw; }
.fb-fig { display: block; height: auto; width: 20cqw; }
.fb-t-figure[data-size="s"] .fb-fig { width: 13cqw; }
.fb-t-figure[data-size="l"] .fb-fig { width: 30cqw; }
.fb-t-figure[data-align="right"] { float: right; margin: 0 0 1cqw 2cqw; }
.fb-t-figure[data-align="left"] { float: left; margin: 0 2cqw 1cqw 0; }
.fb-t-figure[data-align="center"] .fb-fig { margin: 0 auto; }
.fb-t-figure[data-align="right"].is-sel, .fb-t-figure[data-align="left"].is-sel { z-index: 3; }
.fb-pz-title { margin: 0 0 0.6em; font-weight: 700; font-size: 1.1em; }
.fb-grid { display: grid; gap: 0; max-width: 42cqw; margin: 0 auto 0.5em; border: 0.25cqw solid var(--ink-c); }
.fb-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font: 700 2.5cqw/1 "Source Sans 3", sans-serif; border: 0.08cqw solid rgba(0,0,0,.28); color: var(--ink-c);
}
.fb-pz-words { text-align: center; margin: 0; font-size: 0.95em; letter-spacing: 0.04em; }
.fb-scramble { margin: 0; padding-left: 0.2em; list-style: none; }
.fb-scramble li { margin: 0 0 0.4em; display: flex; align-items: baseline; gap: 0.5em; }
.fb-scr { font-family: "Source Sans 3", sans-serif; font-weight: 700; letter-spacing: 0.32em; }
.fb-blank { display: inline-block; flex: 0 0 30cqw; width: 30cqw; height: 0.9em; margin-left: 1.5cqw; border-bottom: 0.12cqw solid var(--ink-c); vertical-align: baseline; }
.fb-solution { margin: 0.3em 0 0; font-size: 0.7em; opacity: 0.75; transform: rotate(180deg); text-align: right; }
.fb-doors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.2cqw; }
.fb-door {
  aspect-ratio: 1 / 1.08; border: 0.3cqw solid var(--ink-c); display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 0.6cqw 0.9cqw; font: 700 2.4cqw/1 "Fraunces", Georgia, serif; color: var(--accent); background: rgba(255,255,255,.35);
}
.fb-week-row { display: flex; align-items: flex-end; gap: 1.6cqw; height: 2.2em; }
.fb-week-day { width: 9em; font-weight: 700; }
.fb-week-line { flex: 1; border-bottom: 0.12cqw solid var(--ink-c); opacity: 0.6; }
.fb-seal {
  --sc: #8B2E28;
  width: 19cqw; height: 19cqw; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 0.55cqw solid var(--sc); position: relative;
  color: var(--sc); transform: rotate(-9deg); text-align: center; padding: 1.5cqw;
}
.fb-seal::before { content: ""; position: absolute; inset: 0.9cqw; border: 0.25cqw solid var(--sc); border-radius: 50%; pointer-events: none; }
.fb-seal-green { --sc: #2C4A34; }
.fb-seal-gold { --sc: #a8822e; }
.fb-stamp-t { font: 700 1.8cqw/1.1 "Source Sans 3", sans-serif; text-transform: uppercase; letter-spacing: 0.04em; overflow-wrap: break-word; hyphens: none; max-width: 100%; }
.fb-stamp-star { font-size: 2cqw; line-height: 1; }
.fb-stamp-star:first-child { margin-bottom: 0.4cqw; }
.fb-stamp-star:last-child { margin-top: 0.4cqw; }
.fb-t-stamp[data-align="right"] .fb-seal { margin-left: auto; }
.fb-t-stamp[data-align="center"] .fb-seal { margin: 0 auto; }
.fb-t-sign { margin-top: 1.6cqw; }
.fb-sign-g { margin: 0; }
.fb-sign-n { margin: 0; font-family: "Patrick Hand", "Segoe Print", cursive; font-size: 1.6em; color: var(--accent); }
.fb-t-divider { display: flex; align-items: center; justify-content: center; gap: 1.5cqw; min-height: 5cqw; }
.fb-rule { flex: 1; border-top: 0.2cqw solid var(--ink-c); opacity: 0.5; }
.fb-rule-short { flex: 0 0 26cqw; }
.fb-stars { color: #C6A04A; letter-spacing: 0.6em; font-size: 1.4em; }
.fb-div-sprig { width: 7cqw; height: 7cqw; }
.fb-div-sprig svg { width: 100%; height: 100%; }

/* Auswahl und Werkzeugleiste (nie im Druck/Export) */
.fb-block.is-sel { box-shadow: 0 0 0 0.3cqw var(--paper-c), 0 0 0 0.6cqw #C6A04A; }
.fb-block.is-drag { opacity: 0.45; }
.fb-dropmark { height: 0; border-top: 3px solid var(--red); margin: -2px 0 2px; }
.fb-tb {
  position: absolute; right: 0; top: 0; transform: translateY(calc(-100% - 6px)); display: flex; gap: 2px; z-index: 4;
  background: var(--ink); padding: 2px; box-shadow: 2px 2px 0 #C6A04A; font-size: 16px;
}
.fb-tb.tb-below { top: auto; bottom: 0; transform: translateY(calc(100% + 6px)); }
.fb-tb.tb-inside { top: 0; transform: none; }
.fb-tb-btn {
  appearance: none; border: 0; background: transparent; color: #F1E4C3; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.fb-tb-btn:hover, .fb-tb-btn:focus-visible { background: #3b4a3f; }
.fb-drag { cursor: grab; touch-action: none; }

/* Paket-Band */
.fb-after { margin-top: 2.2rem; }
.fb-paket {
  display: grid; grid-template-columns: 1fr auto; gap: 1.2rem; align-items: center;
  background: var(--fir); color: #F1E4C3; padding: 1.4rem 1.6rem; box-shadow: 6px 6px 0 var(--ochre);
}
body.page-frei .fb-paket h2, .fb-paket h2 { color: #F6EDD6; margin: 0.2rem 0 0.5rem; }
body.page-frei .fb-paket .kicker, .fb-paket .kicker { color: #E2C377; margin: 0; font-size: 0.85rem; letter-spacing: 0.12em; }
body.page-frei .fb-paket p { color: #F1E4C3; }
.fb-paket p { margin: 0; }

/* ---------- Mobil ---------- */
@media (max-width: 959px) {
  .fb-app { grid-template-columns: 1fr; gap: 1rem; }
  .fb-stage { order: 1; }
  .fb-tools { order: 2; position: static; max-height: none; scroll-margin-top: calc(var(--header-h, 4.25rem) + 0.5rem); }
  .fb-sheet { max-width: 560px; }
  .fb-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--ink); padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom));
  }
  .fb-bar button {
    appearance: none; border: 0; background: transparent; color: #F1E4C3; min-height: 56px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 0.15rem; font: 600 0.8rem/1 var(--font, inherit); cursor: pointer;
  }
  .fb-bar .fb-ico { width: 24px; height: 24px; }
  .fb-page { padding-bottom: 5.5rem; }
  .fb-paket { grid-template-columns: 1fr; }
  .fb-adds { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
  .fb-tb-btn { width: 36px; height: 40px; }
}

/* ---------- Druck: nur das Blatt, genau 1 Seite A4 ---------- */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.page-frei > *:not(main),
  body.page-frei main > *:not(.fb-page),
  body.page-frei .fb-page > *:not(.fb-app),
  body.page-frei .fb-app > *:not(.fb-stage),
  body.page-frei .fb-stage > *:not(.fb-sheet),
  .fb-tb, .fb-dropmark { display: none !important; }
  body.page-frei main, body.page-frei .fb-page, body.page-frei .fb-app, body.page-frei .fb-stage {
    display: block !important; margin: 0 !important; padding: 0 !important; width: auto !important; max-width: none !important;
  }
  .fb-sheet { width: 210mm !important; max-width: none !important; height: 297mm !important; aspect-ratio: auto !important; margin: 0 !important; transform: none !important; box-shadow: none !important; break-inside: avoid; page-break-after: avoid; }
  .fb-block.is-sel { box-shadow: none !important; }
  .fb-block [contenteditable="true"]:focus { background: none !important; box-shadow: none !important; }
}
/* Export-Klon (sheetPdf) */
.letter-capture-host .fb-sheet { box-shadow: none !important; max-width: none !important; }
.letter-capture-host .fb-tb { display: none !important; }

/* Mobil: Mini-Vorschau im Stil-Fach (Klon des Blatts, ohne IDs, nicht bearbeitbar) */
.fb-mini { display: none; }
@media (max-width: 959px) {
  .fb-mini {
    display: flex; align-items: center; gap: 0.8rem; width: 100%; position: sticky; z-index: 5;
    top: calc(var(--header-h, 4.25rem) + 0.4rem); margin: 0 0 0.9rem; padding: 0.5rem 0.6rem;
    background: #FFFDF6; border: 2px solid var(--ink); box-shadow: 3px 3px 0 #C6A04A; text-align: left; cursor: pointer;
    font: inherit; color: var(--ink);
  }
  .fb-mini-frame { flex: 0 0 auto; width: 92px; display: block; pointer-events: none; }
  .fb-mini-frame .fb-msheet { width: 92px; max-width: none; margin: 0; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
  .fb-mini-txt { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; line-height: 1.35; }
  .fb-mini-txt strong { font-size: 1rem; }
  .fb-mini-note.is-warn { color: var(--red, #8B2E28); font-weight: 600; }
}
@media print { .fb-mini { display: none !important; } }

/* Blatt löschen */
.fb-clear-row { margin: 0.6rem 0 0; font-size: 0.88rem; color: #5b5346; display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; }
.fb-clear { appearance: none; background: none; border: 0; padding: 0.35rem 0; min-height: 32px; font: 600 0.92rem/1.2 inherit; color: var(--red, #8B2E28); text-decoration: underline; cursor: pointer; }

/* Mobil: Werkzeugleiste schwebt über der unteren Leiste statt über dem nächsten Baustein */
@media (max-width: 959px) {
  .fb-tb, .fb-tb.tb-below, .fb-tb.tb-inside {
    position: fixed; top: auto; right: auto; left: 50%; bottom: calc(68px + env(safe-area-inset-bottom));
    transform: translateX(-50%); z-index: 32;
  }
}

/* Voller Footer auf der Baukasten-Seite: Tap-Ziele mindestens 24 px */
body.page-frei .footer li a { display: inline-block; min-height: 24px; padding-block: 0.2rem; }
/* Mobil: Hinweise oben unter dem Kopf, immer sichtbar und nie über der Werkzeugleiste */
@media (max-width: 959px) {
  .fb-toast { position: fixed; top: calc(var(--header-h, 4.25rem) + 0.5rem); bottom: auto; left: 0.75rem; right: 0.75rem; margin: 0; max-width: none; z-index: 33; }
}

/* B3: Mobil Mini-Vorschau klebt am Bildschirm (overflow:auto auf #fb-tools brach sticky) */
@media (max-width: 959px) {
  .fb-tools { overflow: visible; }
  .fb-mini-frame, .fb-mini-frame .fb-msheet { width: 112px; }
  .fb-app.tb-off .fb-tb { display: none !important; }
}
/* Blatt groß (Antippen der Vorschau) */
.fb-big {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 25, 22, 0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem; padding: 0.8rem;
}
.fb-big-box { width: min(94vw, calc((100dvh - 6rem) / 1.4142)); }
.fb-big-box .fb-msheet { width: 100%; max-width: none; margin: 0; box-shadow: 0 4px 18px rgba(0,0,0,.45); }
.fb-big-bar { display: flex; gap: 0.6rem; }
.fb-big-bar .btn { min-width: 8.5rem; justify-content: center; }
html.fb-big-open { overflow: hidden; }
@media print { .fb-big { display: none !important; } }
/* Erster Blick: Versprechen im Kopf; mobil kompakter Kopf, Blatt früher sichtbar */
.fb-claim { margin: 0.7rem 0 0; font-weight: 600; color: var(--fir); }
@media (max-width: 959px) {
  body.page-frei .room-hero { gap: 0.4rem; padding-top: 0.4rem; padding-bottom: 0.2rem; }
  body.page-frei .room-hero-art { display: none; }
  body.page-frei .room-hero-copy .crumb { display: none; }
  body.page-frei .room-hero-copy .kicker { display: none; }
  body.page-frei .room-hero-copy h1 { font-size: clamp(1.5rem, 6.4vw, 1.9rem); margin-bottom: 0.3rem; }
  body.page-frei .room-hero-copy .lede { font-size: 0.95rem; line-height: 1.4; }
  body.page-frei .fb-claim { margin-top: 0.4rem; }
}
/* Buchstabensalat: alle Lösungslinien gleich lang und mit gleicher Endkante
   (Liste ist ein eigener Block, auch neben dem Wichtel gleich breit) */
.fb-scramble { display: flow-root; }
.fb-scramble li .fb-scr { flex: 1 1 auto; }
.fb-scramble li .fb-blank { flex: 0 0 30cqw; margin-left: 1.5cqw; }
.fb-big-bar .btn-ghost { background: #FFFDF6; color: var(--ink); border-color: #FFFDF6; }

/* B4: Laptop – Ausgabe-Knöpfe immer sichtbar: feste Leiste unten in der Seitenleiste */
@media (min-width: 960px) {
  /* Seitenleiste scrollt mit der Seite (kein innerer Scrollbereich ohne sichtbaren Balken);
     die Ausgabe-Knöpfe kleben am unteren Bildschirmrand, solange die Leiste im Bild ist. */
  .fb-tools { position: relative; top: auto; max-height: none; overflow: visible; padding-bottom: 0; }
  .fb-actions {
    position: sticky; bottom: 0; z-index: 4; background: #fffdf8;
    margin: 0.8rem -1rem 0; padding: 0.7rem 1rem 0.8rem; gap: 0.4rem;
    box-shadow: 0 -6px 10px -6px rgba(0,0,0,.18);
  }
  .fb-actions .fb-small { min-height: 40px; padding-block: 0.45rem; }
  .fb-actions .fb-clear-row { margin-top: 0.2rem; }
  .fb-actions .fb-status:empty { display: none; }
}

/* B4 P3 */
.fb-foot { white-space: nowrap; }
.fb-mini-sent { display: block; height: 0; }
@media (max-width: 959px) {
  .fb-mini.is-compact { padding: 0.3rem 0.6rem; gap: 0.6rem; }
  .fb-mini.is-compact .fb-mini-frame, .fb-mini.is-compact .fb-mini-frame .fb-msheet { width: 34px; }
  .fb-mini.is-compact .fb-mini-note { display: none; }
  .fb-mini.is-compact .fb-mini-txt strong::after { content: " · antippen zeigt das Blatt groß"; font-weight: 400; font-size: 0.85rem; }
}
@media (min-width: 960px) {
  body.page-frei .crumb a { display: inline-block; min-height: 24px; padding-block: 0.15rem; }
}

/* B5 (Rex B4 P3 + Nachtrag 07:09) */
/* Echte Kopfhöhe statt 4,25rem = 68 px (der Kopf ist 71–74 px hoch); JS setzt den gemessenen Wert */
body.page-frei .fb-app { --header-h: 74px; }
.fb-meter { min-height: 1.45em; }
@media (min-width: 960px) {
  html:has(body.page-frei) { scroll-padding-top: 160px; }
  /* Fach-Knöpfe kleben unter der Kopfleiste, solange die Seitenleiste im Bild ist */
  .fb-tabs {
    position: sticky; top: var(--header-h, 71px); z-index: 5; background: #fffdf8;
    margin: -1rem -1rem 0.9rem; padding: 0.9rem 1rem 0.5rem;
  }
}
/* Blatt in A4-Breite und verkleinert (alle Breiten): die Baustein-Leiste bleibt in Bildschirmgröße */
.fb-sheet[data-scale] .fb-tb { transform-origin: 100% 100%; transform: translateY(calc(-100% - 6px)) scale(var(--fb-ik, 1)); }
.fb-sheet[data-scale] .fb-tb.tb-below { transform-origin: 100% 0; transform: translateY(calc(100% + 6px)) scale(var(--fb-ik, 1)); }
.fb-sheet[data-scale] .fb-tb.tb-inside { transform-origin: 100% 0; transform: scale(var(--fb-ik, 1)); }
.fb-sheet[data-scale] .fb-dropmark { border-top-width: calc(3px * var(--fb-ik, 1)); }
/* Mini kompakt: zwei Farbpunkte (Papier, Tinte) neben dem Daumen */
.fb-mini-dots { display: none; }
@media (max-width: 959px) {
  .fb-mini.is-compact .fb-mini-dots { display: inline-flex; gap: 4px; flex: none; }
  .fb-mini-dots i { width: 16px; height: 16px; border-radius: 50%; display: block; box-shadow: 0 0 0 1.5px var(--ink); }
}
/* Groß-Ansicht: Näher ran (2×, verschiebbar) */
.fb-big-box { outline: none; }
.fb-big-box.is-zoom { aspect-ratio: 210 / 297; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.fb-big-box.is-zoom .fb-msheet { width: 200%; }
.fb-big-bar { flex-wrap: wrap; justify-content: center; }
@media (max-width: 420px) { .fb-big-bar .btn { min-width: 0; flex: 1 1 auto; padding-inline: 0.7rem; } }
/* B5 P3-7: Deko nicht mehr auf der Rahmenlinie – Motiv und Eckzweige unterbrechen die Linie (Papierfarbe dahinter) */
.fb-motif:not(.fb-motif-seal) { top: 3.2cqw; width: 7.4cqw; height: 7.4cqw; padding: 1.2cqw; border-radius: 50%; background: var(--paper-c); box-sizing: border-box; }
.fb-corner:not(.fb-corner-star) > svg { position: relative; z-index: 1; }
.fb-corner:not(.fb-corner-star)::before { content: ""; position: absolute; left: 12%; top: 12%; width: 76%; height: 76%; border-radius: 50%; background: var(--paper-c); }
/* B5 P3-7: große Kalender-/Rätsel-Variante (Start-Blätter füllen die Seite) */
.fb-t-calendar[data-size="l"] .fb-door { aspect-ratio: 1 / 1.62; }
.fb-t-calendar[data-size="l"] .fb-week-row { height: 3.4em; }
.fb-t-puzzle[data-size="l"] .fb-grid { max-width: 46cqw; }
.fb-t-puzzle[data-size="l"] .fb-cell { font-size: 2.7cqw; }
.fb-t-puzzle[data-size="l"] .fb-scramble li { margin-bottom: 0.85em; }

/* B6 (Rex B5-Nachtrag): Desktop-Kopf kürzer, damit das Werkzeug im Startzustand weit oben beginnt */
@media (min-width: 960px) {
  body.page-frei .tool-page.fb-page { padding-top: 0; }
  body.page-frei .room-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 15rem);
    gap: 0.4rem 2rem; margin: 0 0 1rem; padding: 0.7rem 0 0.8rem; border-bottom-width: 2px;
  }
  body.page-frei .room-hero-copy .crumb { margin: 0 0 0.15rem; font-size: 0.85rem; }
  body.page-frei .room-hero-copy .kicker { display: none; }
  body.page-frei .room-hero-copy h1 { font-size: 1.85rem; line-height: 1.15; margin: 0 0 0.3rem; }
  body.page-frei .room-hero-copy .lede { font-size: 0.98rem; line-height: 1.45; max-width: 44rem; }
  body.page-frei .fb-claim { margin-top: 0.35rem; }
  body.page-frei .room-hero-art .room-art { max-height: 6.5rem; width: 100%; object-fit: cover; }
}
@media (min-width: 960px) and (max-width: 1099px) {
  body.page-frei .room-hero { grid-template-columns: minmax(0, 1fr); }
  body.page-frei .room-hero-art { display: none; }
}
@media (min-width: 960px) {
  /* Ausgabe-Leiste: frei im Fluss, solange der Fach-Anfang sonst verdeckt würde (JS setzt is-free) */
  .fb-actions.is-free { position: relative; box-shadow: none; }
  /* klebt sie, deckt sie angeschnittene Knopfreihen ganz ab.
     B7: Abdeckung über clip-path, Kante über transform (kein Layout-Sprung, CLS 0); Zuklappen weich */
  .fb-actions { box-shadow: none; border-top-color: transparent; }
  .fb-actions::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 420px;
    background: #fffdf8; pointer-events: auto;
    clip-path: inset(calc(420px - var(--fb-act-ext, 0px)) 0 0 0);
  }
  .fb-actions::after {
    content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 0;
    border-top: 2px dashed var(--line); pointer-events: none;
    transform: translateY(calc(-1 * var(--fb-act-ext, 0px)));
    box-shadow: 0 -6px 10px -6px rgba(0,0,0,.18);
  }
  .fb-actions.is-free::after { box-shadow: none; }
  .fb-actions.is-shrink::before { transition: clip-path .12s ease-out; }
  .fb-actions.is-shrink::after, .fb-actions.is-shrink .fb-more { transition: transform .12s ease-out; }
  /* B7 P3: Knopf in der Abdeckung – scrollt die verdeckten Bausteine ins Bild */
  .fb-more {
    position: absolute; z-index: 1; left: 1rem; right: 1rem; bottom: calc(100% + 0.6rem);
    display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 0.6rem;
    text-align: left; min-height: 44px; padding: 0.45rem 0.8rem; cursor: pointer;
    background: #F6EBD3; color: var(--ink); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--fir);
    font: inherit;
  }
  .fb-more[hidden] { display: none; }
  .fb-more:hover { background: #F1E4C3; }
  .fb-more:focus-visible { outline: 3px solid var(--fir); outline-offset: 2px; }
  .fb-more-t { font-weight: 700; font-size: 0.95rem; grid-column: 1; grid-row: 1; }
  .fb-more-s { font-size: 0.82rem; color: var(--muted); grid-column: 1; grid-row: 2; }
  .fb-more-i { grid-column: 2; grid-row: 1 / span 2; color: var(--fir); }
  /* B7 P2-1: klebende Fach-Tabs mit deckendem Polster und feiner Kante; Polster wächst über angeschnittene Reihen */
  .fb-tabs.is-stuck::after {
    content: ""; position: absolute; left: 0; right: 0; top: 100%;
    height: calc(9px + var(--fb-tab-ext, 0px)); background: #fffdf8; pointer-events: auto;
    border-bottom: 1px solid var(--line); box-shadow: 0 6px 8px -6px rgba(0,0,0,.18);
  }
}
@media (max-width: 959px) { .fb-more { display: none !important; } }
@media (min-width: 960px) { html:has(body.page-frei) { scroll-padding-bottom: var(--fb-spb, 0px); } }
