/* Heftly – Gestaltung
   Idee: echte Schulhefte auf Karopapier. Die Startseite ist ein Stapel Hefte mit farbigem Umschlag und beschriftetem Etikett,
   die Fläche ist 5-mm-Karo, die Markenfarbe ist Königsblau wie Füllertinte, „nur auf diesem Gerät“ ist Textmarkergelb.
   Eine Schrift: Atkinson Hyperlegible Next (Braille Institute, SIL Open Font License) – gut lesbar, liegt auf dem eigenen Server. */

@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-Regular.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-Bold.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-Italic.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-BoldItalic.woff2") format("woff2"); }
/* Oberfläche: Atkinson zeichnet die Null mit Schrägstrich – für Namen wie „10b“ und Uhrzeiten wirkt das technisch, deshalb kommen 0–9 aus der Bricolage Grotesque (OFL) */
@font-face { font-family: "Heftly Text"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/bricolage-digits-Regular.woff2") format("woff2"); unicode-range: U+0030-0039; }
@font-face { font-family: "Heftly Text"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/bricolage-digits-Bold.woff2") format("woff2"); unicode-range: U+0030-0039; }
@font-face { font-family: "Heftly Text"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/bricolage-digits-Regular.woff2") format("woff2"); unicode-range: U+0030-0039; }
@font-face { font-family: "Heftly Text"; font-style: italic; font-weight: 700; font-display: swap; src: url("../fonts/bricolage-digits-Bold.woff2") format("woff2"); unicode-range: U+0030-0039; }
@font-face { font-family: "Heftly Text"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-Regular.woff2") format("woff2"); unicode-range: U+0000-002F, U+003A-FFFF; }
@font-face { font-family: "Heftly Text"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-Bold.woff2") format("woff2"); unicode-range: U+0000-002F, U+003A-FFFF; }
@font-face { font-family: "Heftly Text"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-Italic.woff2") format("woff2"); unicode-range: U+0000-002F, U+003A-FFFF; }
@font-face { font-family: "Heftly Text"; font-style: italic; font-weight: 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next-BoldItalic.woff2") format("woff2"); unicode-range: U+0000-002F, U+003A-FFFF; }

:root {
  --ground: #eef3f7;      /* Karopapier */
  --grid: #dbe5ee;
  --surface: #ffffff;
  --sunken: #f4f7fa;
  --ink: #1c2541;         /* Tinte */
  --muted: #5b6680;
  --line: #d5dde8;
  --line-strong: #b6c2d4;
  --brand: #2448c8;       /* Königsblau */
  --brand-deep: #142b7a;
  --brand-ink: #ffffff;
  --accent: #e2e8fb;
  --marker: #ffe14d;      /* Textmarker */
  --marker-ink: #3a3000;
  --ok: #1c7c52; --warn: #8f5b00; --bad: #c8352a;
  --head: "Heftly Text", "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Heftly Text", "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-md: 10px; --r-sm: 7px;
  --lift: 0 10px 24px -14px rgba(20, 43, 122, .45);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0f1420; --grid: #182031; --surface: #172033; --sunken: #131b2b; --ink: #e6ebf5; --muted: #9aa6bd; --line: #29344d; --line-strong: #3a4766;
    --brand: #8fa6ff; --brand-deep: #0b1638; --brand-ink: #0c1530; --accent: #22305a; --marker: #f2d44a; --marker-ink: #2b2300;
    --ok: #5fcf98; --warn: #e8b552; --bad: #ff8a7d; --lift: 0 12px 26px -14px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0f1420; --grid: #182031; --surface: #172033; --sunken: #131b2b; --ink: #e6ebf5; --muted: #9aa6bd; --line: #29344d; --line-strong: #3a4766;
  --brand: #8fa6ff; --brand-deep: #0b1638; --brand-ink: #0c1530; --accent: #22305a; --marker: #f2d44a; --marker-ink: #2b2300;
  --ok: #5fcf98; --warn: #e8b552; --bad: #ff8a7d; --lift: 0 12px 26px -14px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--body); background: var(--ground); color: var(--ink); }
a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Formulare und Knöpfe (auch im Editor) */
label { display: block; font-weight: 700; font-size: 14px; margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input:disabled { opacity: .55; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 17px; height: 17px; }
textarea { line-height: 1.45; }
.checks label, label.checks { font-weight: 400; display: flex; gap: 9px; align-items: center; margin: 8px 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); border-radius: 999px; padding: 10px 20px; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: color-mix(in srgb, var(--brand) 86%, #000); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--brand); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--brand); background: var(--accent); }
.btn.small { padding: 6px 13px; font-size: 14px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.linkbtn:hover { color: var(--brand); text-decoration: underline; }

/* ======================================================================= Startseite */
body.home {
  background-color: var(--ground);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 18px 18px; background-position: -1px -1px;
  min-height: 100vh;
}
.hf { min-height: 100vh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.hf-top { display: flex; align-items: center; gap: 10px; padding: 14px 28px; max-width: 1240px; width: 100%; margin: 0 auto; }
.hf-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand); }
.hf-mark { width: 26px; height: 33px; }
.hf-word { font: 700 27px/1 var(--head); letter-spacing: -.02em; color: var(--ink); }
.hf-spacer { flex: 1; }
.hf-select { margin: 0; }
.hf-select select { width: auto; padding: 6px 30px 6px 10px; font-size: 14px; border-radius: 999px; background-color: color-mix(in srgb, var(--surface) 85%, transparent); }

.hf-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 8px 28px 48px; }

/* LernSax: Leiste wie ein Anmeldezettel, Perforation unten */
.hf-lernsax { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px 32px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: 12px 12px 4px 4px;
  padding: 20px 24px 22px; position: relative; }
.hf-lernsax::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; border-bottom: 2px dashed var(--line-strong); }
.hf-ls-text h2 { margin: 0 0 6px; font-size: 19px; }
.hf-ls-text p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 56ch; }
.hf-ls-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0 10px; align-items: end; }
.hf-ls-form label { margin: 0; font-size: 13px; }
.hf-ls-form input { margin-top: 4px; padding: 9px 11px; }
.hf-ls-form .btn { padding: 9px 18px; }
.hf-ls-soon { grid-column: 1 / -1; margin: 8px 0 0; }

/* Regal */
.hf-shelf { margin-top: 34px; }
.hf-shelf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 14px; }
.hf-shelf-head h1 { font-size: 30px; margin: 0; letter-spacing: -.015em; }
.hf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hf-storage { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 0 0 22px; font-size: 13.5px; color: var(--muted); }
.hf-storage p { margin: 0; }
.hf-storage .ok { color: var(--ok); } .hf-storage .warn { color: var(--warn); }
.hf-storage .linkbtn { color: var(--brand); font-size: 13.5px; font-weight: 700; }

.hf-books { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 30px 26px; }
.hf-book { position: relative; min-width: 0; }
.hf-cover {
  --dark: color-mix(in srgb, var(--cover) 72%, #000);
  display: block; position: relative; aspect-ratio: 210 / 297; border-radius: 3px 9px 9px 3px; color: var(--ink); text-decoration: none; overflow: hidden;
  background-color: var(--cover);
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 5px), linear-gradient(90deg, var(--dark) 0 9%, rgba(0,0,0,.08) 9% 10%, transparent 10% 100%), linear-gradient(160deg, rgba(255,255,255,.16), rgba(0,0,0,.08));
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 3px 4px 0 -1px color-mix(in srgb, var(--surface) 88%, var(--cover)), 3px 4px 0 0 var(--line-strong), var(--lift);
  transition: transform .18s ease, box-shadow .18s ease;
}
.hf-cover::before { content: ""; position: absolute; left: 4.6%; top: 6%; bottom: 6%; border-left: 1.5px dashed rgba(255,255,255,.45); } /* Heftnaht */
@media (hover: hover) { .hf-cover:hover { transform: translateY(-3px) rotate(-.4deg); } }
.hf-cover:focus-visible { outline-offset: 4px; border-radius: 3px 9px 9px 3px; }
.hf-label { position: absolute; left: 20%; right: 9%; top: 15%; background: #fffdf7; border-radius: 4px; padding: 9px 30px 8px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.2); color: #1c2541;
  display: flex; flex-direction: column; gap: 3px; }
.hf-label-title { font-style: italic; font-weight: 700; font-size: 16.5px; line-height: 1.2; color: #182a7a; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hf-label-line { height: 0; border-bottom: 1px solid #c9d2e0; margin: 5px 0 0; }
.hf-label-meta { font-size: 12px; color: #5b6680; margin-top: 3px; }
.hf-lineatur { position: absolute; right: calc(9% + 7px); top: calc(15% + 8px); width: 17px; height: 17px; border-radius: 2px; background-color: #fffdf7; box-shadow: 0 0 0 1px #c9d2e0;
  background-image: linear-gradient(#9fb3cc 1px, transparent 1px), linear-gradient(90deg, #9fb3cc 1px, transparent 1px); background-size: 4px 4px; background-position: 1px 1px; }
.hf-stamp { position: absolute; right: 7%; bottom: 8%; max-width: 72%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--marker); color: var(--marker-ink); font-size: 11px; font-weight: 700; line-height: 1.15; padding: 3px 6px; border-radius: 2px; transform: rotate(-3deg); box-shadow: 0 1px 1px rgba(0,0,0,.15); }
.hf-book.light .hf-cover::before { border-left-color: rgba(0,0,0,.25); }
/* Tafel: Etikett wie eine kleine Kreidetafel */
.hf-book.is-tafel .hf-label { background: #24453a; color: #eef3e8; box-shadow: inset 0 0 0 3px #6b4b2a, 0 1px 2px rgba(0,0,0,.25); padding: 11px 30px 10px 12px; }
.hf-book.is-tafel .hf-label-title { color: #f6f8f0; font-style: normal; }
.hf-book.is-tafel .hf-label-line { border-bottom-color: rgba(255,255,255,.25); }
.hf-book.is-tafel .hf-label-meta { color: #c8d6c8; }
.hf-book.is-tafel .hf-lineatur { background: #3b6656; box-shadow: 0 0 0 1px rgba(255,255,255,.5); background-image: linear-gradient(transparent 9px, rgba(255,255,255,.7) 9px 10px, transparent 10px); background-size: 100% 100%; background-position: 0 0; }
.hf-book.fresh .hf-cover { animation: hf-arrive .7s ease-out; }
@keyframes hf-arrive { from { transform: translateY(-14px) rotate(-3deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .hf-cover { transition: none; } .hf-book.fresh .hf-cover { animation: none; } }
.hf-book-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 10px; padding-right: 2px; }
.hf-when { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-more { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 8px 6px; border-radius: 8px; cursor: pointer; }
.hf-more:hover { background: var(--surface); color: var(--ink); }
.hf-menu { position: absolute; right: 0; top: calc(100% + 2px); z-index: 30; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: 5px; display: flex; flex-direction: column; }
.hf-menu > button { text-align: left; border: 0; background: none; padding: 9px 11px; border-radius: 8px; font: inherit; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.hf-menu > button:hover, .hf-menu > button:focus-visible { background: var(--sunken); }
.hf-menu > button.bad { color: var(--bad); }
.hf-swatches { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 9px; }
.hf-swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.hf-swatches button.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.hf-empty { padding: 30px 0; color: var(--muted); max-width: 48ch; }

.hf-foot { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: center; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); color: var(--muted); }
.hf-toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; max-width: min(560px, 92vw); background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 10px; font-size: 14.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.hf-drop { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 18%, transparent); outline: 4px dashed var(--brand); outline-offset: -14px; pointer-events: none; }
.hf-drop span { background: var(--surface); padding: 14px 20px; border-radius: 12px; font-weight: 700; }

/* LernSax: angemeldet, Gruppen im Regal, Stempel und Hinweise */
.hf-ls-remember { grid-column: 1 / -1; margin: 10px 0 0 !important; font-size: 13.5px; }
.hf-ls-msg { grid-column: 1 / -1; margin: 8px 0 0; }
.hf-ls-msg.bad { color: var(--bad); font-weight: 700; } .hf-ls-msg.warn { color: var(--warn); }
.hf-ls-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; justify-content: flex-end; }
.hf-ls-in p { margin: 0; }
.hf-ls-who b { overflow-wrap: anywhere; }
.hf-group + .hf-group { margin-top: 34px; }
.hf-group-h { font-size: 17px; margin: 0 0 16px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.hf-group-h::after { content: ""; flex: 1; border-bottom: 1px dashed var(--line-strong); min-width: 20px; }
.hf-group-empty { margin: 0 0 10px; max-width: 60ch; }
.hf-stamp.ls { background: #e8efff; color: #142b7a; }
.hf-badge { font-size: 12px; font-weight: 700; color: var(--brand); }
.hf-badge.warn { color: var(--warn); } .hf-badge.bad { color: var(--bad); }
.hf-dialog-btns.hf-col { flex-direction: column; align-items: stretch; }
.hf-dialog-btns.hf-col .btn { justify-content: center; }
.hf-lo-text { color: var(--muted); }
.hf-where label { margin: 4px 0; }

/* Dialog „Neues Heft“ */
.hf-dialog { position: fixed; inset: 0; z-index: 80; background: rgba(10,14,24,.45); display: grid; place-items: center; padding: 16px; }
.hf-dialog-box { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 22px 24px; width: min(480px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,.3); max-height: calc(100vh - 32px); overflow: auto; }
.hf-dialog-box h2 { margin: 0 0 4px; font-size: 21px; }
.hf-field { margin-top: 14px; }
.hf-field span { display: block; margin-bottom: 5px; }
.hf-dialog-box fieldset { border: 0; padding: 0; margin: 16px 0 0; }
.hf-dialog-box legend { font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 6px; }
.hf-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hf-kinds legend { grid-column: 1 / -1; }
.hf-kind { display: flex; gap: 10px; align-items: center; margin: 0; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; }
.hf-kind:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.hf-kind input { position: absolute; opacity: 0; pointer-events: none; }
.hf-kind:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); }
.hf-kind b { display: block; font-size: 15px; }
.hf-kind small { display: block; color: var(--muted); line-height: 1.3; font-size: 12.5px; }
.hf-kind-pic { flex: none; border-radius: 2px; box-shadow: 0 0 0 1px var(--line-strong); background: #fff; }
.hf-kind-pic.heft { width: 26px; height: 36px; background-image: linear-gradient(#b8cbe0 1px, transparent 1px), linear-gradient(90deg, #b8cbe0 1px, transparent 1px); background-size: 4px 4px; }
.hf-kind-pic.tafel { width: 40px; height: 23px; background: #24453a; box-shadow: inset 0 0 0 2px #6b4b2a; }
.hf-colors .hf-swatches { padding: 0; }
.hf-dialog-btns { display: flex; gap: 14px; align-items: center; margin-top: 22px; }

@media (max-width: 860px) {
  .hf-lernsax { grid-template-columns: 1fr; }
  .hf-ls-form { grid-template-columns: 1fr 1fr; }
  .hf-ls-form .btn { grid-column: 1 / -1; justify-self: start; margin-top: 10px; }
}
@media (max-width: 560px) {
  .hf-top { padding: 12px 16px; flex-wrap: wrap; }
  .hf-main { padding: 4px 16px 40px; }
  .hf-ls-form { grid-template-columns: 1fr; gap: 8px; }
  .hf-books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
  .hf-label-title { font-size: 15px; }
  .hf-shelf-head h1 { font-size: 26px; }
  .hf-kinds { grid-template-columns: 1fr; }
}

/* ======================================================================= Editor: Rahmen (Leiste oben) */
body.office-window { height: 100vh; height: 100dvh; margin: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); }
.office-bar { display: flex; gap: 12px; align-items: center; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); border-top: 4px solid var(--app, var(--brand)); }
.office-bar .spacer { flex: 1; }
.office-name { font: 700 16px/1.2 var(--head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.office-status { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.office-status.ok { color: var(--ok); } .office-status.warn { color: var(--warn); } .office-status.bad { color: var(--bad); }

/* Setup-Seite */
body.plain-page { background: var(--ground); }
.setup { max-width: 760px; margin: 0 auto; padding: 40px 20px; }
.setup-steps { list-style: none; padding: 0; }
.setup-steps li { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.setup-steps li.ok span[aria-hidden] { color: var(--ok); } .setup-steps li.bad span[aria-hidden] { color: var(--bad); }
.setup-steps li.warn { color: inherit; } .setup-steps li.warn span[aria-hidden] { color: var(--warn); font-weight: 700; }

/* ---------------------------------------------------------------- Tafel koppeln (Seite für die digitale Tafel) */
.hf-board-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.hf-board-main h1 { font-size: clamp(28px, 3vw, 44px); margin: 8px 0 12px; }
.hf-board-lead { font-size: clamp(17px, 1.6vw, 24px); max-width: 60ch; line-height: 1.45; }
.hf-board-pair { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; margin: 28px 0; }
.hf-board-codebox { flex: 1 1 320px; display: grid; gap: 10px; justify-items: start; }
.hf-board-label { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 14px; color: var(--muted, #5b6474); }
.hf-board-code { font: 700 clamp(48px, 7vw, 104px)/1 'Heftly Text', system-ui, sans-serif; letter-spacing: .06em; font-variant-numeric: tabular-nums; color: var(--brand, #2448c8); }
.hf-board-state { font-size: 18px; font-weight: 600; }
.hf-board-state.bad { color: #b42318; }
.hf-board-qr { flex: 0 0 auto; width: min(360px, 80vw); background: #fff; padding: 14px; border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }
.hf-board-qr svg, .hf-board-qr img { display: block; width: 100%; height: auto; }
.hf-board-qr:empty { display: none; }
.hf-board-privacy { max-width: 70ch; color: var(--muted, #5b6474); }
.hf-live-banner { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: #e8efff; color: #142a6b; font-weight: 600; }
.hf-live-banner .btn { margin-left: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hf-live-banner { background: #1d2a4d; color: #dbe5ff; } }
:root[data-theme="dark"] .hf-live-banner { background: #1d2a4d; color: #dbe5ff; }

/* Online-Speicher: Reiter LernSax | Nextcloud/WebDAV (wie Karteireiter über dem Anmeldezettel) */
.hf-ls-tabs { grid-column: 1 / -1; display: flex; gap: 4px; margin: -8px 0 8px; border-bottom: 1px solid var(--line); }
.hf-ls-tabs button { appearance: none; border: 0; background: none; font: inherit; font-weight: 700; font-size: 14.5px; color: var(--muted); padding: 8px 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; border-radius: 6px 6px 0 0; }
.hf-ls-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.hf-ls-tabs button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.hf-cloud-form { grid-template-columns: 1fr; gap: 8px; }
.hf-cloud-form [data-cloud-pick] select { margin-top: 4px; }
.hf-cloud-nc { display: grid; gap: 6px; justify-items: start; }
.hf-cloud-nc p { margin: 0; }
.hf-cloud-pw { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0 10px; align-items: end; }
.hf-cloud-pw [data-cloud-back] { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
@media (max-width: 760px) { .hf-cloud-pw { grid-template-columns: 1fr; gap: 8px; } }

/* Anmelden mit dem Handy (QR-Code, ab 0.7) */
.hf-qr-row { grid-column: 1 / -1; margin: 6px 0 0; text-align: right; }
.hf-qr-panel { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; margin-top: 10px; padding: 16px; border-radius: 12px; background: var(--sunken, #f3f6fc); }
.hf-qr-code { background: #fff; padding: 12px; border-radius: 10px; line-height: 0; }
.hf-qr-code svg { width: min(240px, 60vw); height: auto; display: block; }
.hf-qr-info { flex: 1; min-width: 240px; }
.hf-qr-info h3 { margin: 0 0 6px; }
.hf-qr-info ol { margin: 0 0 8px; padding-left: 1.3em; }
.hf-qr-check { font-size: 15px; } .hf-qr-check b { font-size: 26px; letter-spacing: .12em; margin-left: 6px; }
.hf-qr-banner { flex-wrap: wrap; margin: 0 0 14px; }
.hf-qr-banner b.code { font-size: 20px; letter-spacing: .1em; }
.hf-qr-banner label { font-weight: 400; display: inline-flex; gap: 6px; align-items: center; margin: 0; }

/* Impressum und Datenschutz (ab 0.7) */
.hf-legal-main { max-width: 760px; margin: 0 auto; padding: 8px 20px 40px; line-height: 1.55; }
.hf-legal-main h1 { margin: 12px 0 6px; }
.hf-legal-main h2 { font-size: 1.1rem; margin: 26px 0 6px; }
.hf-legal-main ul { padding-left: 1.3em; } .hf-legal-main li { margin: 4px 0; }
.hf-legal-missing { color: #b42318; font-weight: 700; }
.hf-foot a { color: inherit; }

/* Geteilte Seite (ab 0.9) */
.hf-code-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0 0 14px; }
.hf-code-form label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.hf-code-form input { width: 9em; text-transform: uppercase; letter-spacing: .12em; padding: 6px 10px; }
.hf-share-main { max-width: 640px; margin: 0 auto; padding: 18px 20px 40px; }
.hf-share-main h1 { margin: 4px 0; }
.hf-share-kicker { margin: 0; color: var(--muted, #5b6474); font-weight: 600; letter-spacing: .04em; }
.hf-share-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.hf-share-pick { margin: 10px 0 18px; padding: 14px 16px; border: 1px solid var(--line, #d3d9e6); border-radius: 12px; background: var(--surface, #fff); }
.hf-share-pick h2 { font-size: 1.05rem; margin: 0 0 8px; }
.hf-share-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.hf-share-opt { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; margin: 0; }
.hf-share-opt:hover { background: rgba(36,72,200,.06); }
.hf-share-opt span { display: grid; } .hf-share-opt small { color: var(--muted, #5b6474); }
.hf-share-done { padding: 12px 14px; border-radius: 12px; background: #e3f5e9; color: #0f5a2c; font-weight: 600; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------------------------------------------------------------- Anleitung für Lehrkräfte (ab 0.13.6) */
.hf-guide .hf-top .btn { text-decoration: none; }
.hf-g-main { max-width: 980px; margin: 0 auto; padding: 8px 20px 48px; line-height: 1.55; }
.hf-g-main h2 { font-size: 1.45rem; margin: 44px 0 12px; scroll-margin-top: 16px; }
.hf-g-main section { scroll-margin-top: 16px; }
.hf-g-hero { padding: 26px 26px 22px; margin-top: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--lift);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 20px 20px; background-position: -1px -1px; }
.hf-g-kicker { margin: 0; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; font-size: .82rem; }
.hf-g-hero h1 { margin: 4px 0 8px; font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.15; }
.hf-g-lead { margin: 0; max-width: 62ch; font-size: 1.06rem; background: var(--surface); }
.hf-g-toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hf-g-toc a { padding: 6px 12px; border-radius: 999px; background: var(--accent); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .92rem; }
.hf-g-toc a:hover, .hf-g-toc a:focus-visible { background: var(--brand); color: var(--brand-ink); }
.hf-g-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.hf-g-card { padding: 16px 16px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.hf-g-card i { font-style: normal; font-size: 1.6rem; line-height: 1; }
.hf-g-card h3 { margin: 8px 0 4px; font-size: 1.04rem; }
.hf-g-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.hf-g-steps { padding-left: 1.4em; } .hf-g-steps li { margin: 8px 0; }
.hf-g-use { margin: 14px 0; padding: 16px 20px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); scroll-margin-top: 16px; }
.hf-g-use h3 { margin: 0 0 4px; font-size: 1.12rem; display: flex; gap: 8px; align-items: baseline; }
.hf-g-use h3 i { font-style: normal; }
.hf-g-why { margin: 0 0 6px; color: var(--muted); }
.hf-g-use ol, .hf-g-use ul { padding-left: 1.35em; margin: 6px 0 8px; } .hf-g-use li { margin: 5px 0; }
.hf-g-sub { list-style: lower-alpha; margin: 4px 0 !important; }
.hf-g-note { margin: 6px 0 8px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--sunken); font-size: .94rem; }
.hf-g-tips { margin: 18px 0; padding: 14px 20px 8px; border-radius: var(--r-md); background: color-mix(in srgb, var(--marker) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--marker) 60%, var(--line)); }
.hf-g-tips h3 { margin: 0 0 4px; font-size: 1.05rem; }
.hf-g-tips ul { padding-left: 1.3em; } .hf-g-tips li { margin: 5px 0; }
.hf-g-faq dt { font-weight: 700; margin-top: 14px; }
.hf-g-faq dd { margin: 4px 0 0; color: var(--ink); }
.hf-ui { display: inline-block; padding: 0 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--sunken); font-size: .9em; font-weight: 700; line-height: 1.45; white-space: nowrap; }
.hf-g-main code { padding: 0 4px; border-radius: 4px; background: var(--sunken); font-size: .9em; }
.hf-help-link { text-decoration: none; }
@media (max-width: 600px) { .hf-g-hero { padding: 18px 16px; } .hf-g-use { padding: 14px 14px 8px; } .hf-ui { white-space: normal; } }
@media print { .hf-top, .hf-g-toc, .hf-foot { display: none; } .hf-g-hero, .hf-g-use, .hf-g-card { box-shadow: none; break-inside: avoid; } body { background: #fff; } }
/* Anleitungsheft auf der Startseite (ab 0.13.7): Titel mit Silbentrennung statt mitten im Wort */
.hf-guide-book .hf-label-title { overflow-wrap: normal; hyphens: manual; -webkit-hyphens: manual; }
