@font-face { font-family: Andika; font-weight: 400; src: url(vendor/fonts/andika-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Andika; font-weight: 700; src: url(vendor/fonts/andika-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Playwrite DE Grund"; font-weight: 400; src: url(vendor/fonts/playwrite-de-grund-latin-400-normal.woff2) format("woff2"); }

:root {
  --blue: #2f80ed; --green: #27ae60; --orange: #f2994a; --purple: #9b51e0; --red: #eb5757;
  --bg: #f4f7fb; --ink: #1f2937; --soft: #e6ecf5;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Andika, "Comic Sans MS", system-ui, sans-serif; color: var(--ink); background: var(--bg);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

/* Start */
#start { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 24px; gap: 24px; }
#start h1 { font-size: 44px; margin: 0; }
#start h1 .digi { color: var(--blue); } /* the name as in the logo: «Digi» blue */
#start h1 .ideen { color: #27ae60; } /* (the Ideennetz: «Ideen» green, as its logo) */
.bigbuttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; width: min(760px, 100%); }
.big {
  border: 0; border-radius: 28px; padding: 26px 18px; color: #fff; font-size: 28px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 6px 0 rgba(0,0,0,.15);
}
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.15); }
.big span { background: #fff; border-radius: 50%; padding: 10px; display: grid; }
.big svg { width: 60px; height: 60px; }
.big small { font-size: 17px; font-weight: 400; opacity: .9; }
.blue { background: var(--blue); } .green { background: var(--green); } .orange { background: var(--orange); } .purple { background: var(--purple); }
.teacherlink { color: #6b7280; font-size: 16px; }
/* Footer of the start screen and the teacher page (the same links on klasse.schule and the privacy page) */
.sitefoot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 48px; width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; padding: 16px 12px 4px; border-top: 1px solid #e2e8f0; font-size: 15px; color: #6b7280; }
.sitefoot a { color: inherit; white-space: nowrap; text-decoration: none; }
.sitefoot a:hover, .sitefoot a:focus-visible { color: #1f2937; text-decoration: underline; }
.sitefoot .brand { font-weight: 700; color: #1f2937; }
.sitefoot .grp { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 14px; }
.sitefoot { margin-top: 24px; margin-bottom: 8px; }

/* Editor */
#editor { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top));
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08); z-index: 2;
}
.topbar .title { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.topbar .title svg { width: 20px; height: 20px; margin-left: 6px; vertical-align: -3px; }
.pinbadge { flex: none; background: #f1e6fc; color: #6b2fa8; font-weight: 700; font-size: 16px; border-radius: 12px; padding: 6px 10px; }
.tb, .tool {
  border: 0; background: transparent; border-radius: 16px; min-width: 70px; padding: 4px 6px;
  display: flex; flex-direction: column; align-items: center; font-size: 13px; line-height: 1.1;
}
.tb svg { width: 34px; height: 34px; margin-bottom: 2px; }
.tb:active, .tool:active { background: var(--soft); }
.tb:disabled { opacity: .3; }
.tb.accent { background: #e3f6ea; color: #1e7a45; font-weight: 700; }
.tb.accent3 { background: #f1e6fc; color: #6b2fa8; font-weight: 700; }
.tb.accent2 { background: #fdeedd; color: #b45f12; font-weight: 700; }

#pages { flex: 1; overflow: auto; touch-action: none; background: #cfd8e3; padding: 16px 0; }
/* Round buttons over the sheet (the page scrolls below them; at the end there is room, see .pageacts) */
.stage { flex: 1; min-height: 0; position: relative; display: flex; overflow: hidden; } /* (very low screens: the round buttons stay on the sheet's area) */
.stage.busy .floatbar { pointer-events: none; } /* (something happens on the sheet: a touch there belongs to it, see app.js) */
.floatbar { position: absolute; bottom: 12px; z-index: 3; display: flex; gap: 4px; padding: 4px; border-radius: 32px;
  background: rgba(255, 255, 255, .94); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
.floatbar.left { left: 12px; }
.floatbar.right { right: 12px; }
.fb { width: 50px; height: 50px; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; }
.fb svg { width: 32px; height: 32px; }
.fb:active { background: var(--soft); }
.fb:disabled { opacity: .3; }
.page { position: relative; margin: 0 auto 16px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.page img, .page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.page img { pointer-events: none; }
.page img:not([src]) { visibility: hidden; }
.addpage { display: flex; align-items: center; gap: 10px; margin: 0 auto 24px; border: 3px dashed #94a3b8; border-radius: 20px; background: #eef2f7; padding: 14px 24px; font-size: 20px; }
.addpage svg, .sortpages svg { width: 40px; height: 40px; }
.pageacts { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 16px; padding-bottom: 56px; } /* (room for the round buttons) */
.pageacts .addpage { margin: 0 0 24px; }
.sortpages { display: flex; align-items: center; gap: 10px; margin: 0 0 24px; border: 3px solid #94a3b8; border-radius: 20px; background: #eef2f7; padding: 14px 24px; font-size: 20px; }
/* «Seiten ordnen» */
#dlgPages { width: 96vw; max-width: 1100px; height: 92vh; max-height: none; padding: 20px; }
#dlgPages[open] { display: flex; flex-direction: column; }
.pagesgrid { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; align-content: start; padding: 6px; }
.pagecard { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 4px solid transparent; border-radius: 16px; background: var(--soft); font-size: 18px; }
.pagecard.on { border-color: var(--blue); background: #e8f1fd; }
.pagecard img { width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.pagesbar { justify-content: center; margin-top: 12px; }
.pagesbar .opt:disabled { opacity: .35; }
.pagesbar [data-icon] svg { width: 28px; height: 28px; }

.toolbar { background: #fff; box-shadow: 0 -2px 6px rgba(0,0,0,.08); padding-bottom: env(safe-area-inset-bottom); z-index: 2; }
.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 2px 4px; }
.tool { min-width: 70px; font-size: 12.5px; padding: 3px 4px; border: 2px solid transparent; }
.tool svg { width: 32px; height: 32px; margin-bottom: 1px; }
.tool.on { border-color: var(--blue); background: #e8f1fd; }
/* Options in one row, always the same height (the sheet does not jump when the tool changes); what does not fit
   scrolls sideways. The margins centre the row and still let it scroll from its start. */
.options { display: flex; align-items: center; gap: 4px; padding: 4px 8px; min-height: 52px; overflow-x: auto; -webkit-overflow-scrolling: touch; border-bottom: 1px solid var(--soft); }
.options > * { flex: none; }
/* (wide screens: a long row of options wraps into a second row, so nothing is out of reach; phones swipe, below) */
.options { flex-wrap: wrap; justify-content: center; row-gap: 4px; }
.options .hint { font-size: 18px; color: #6b7280; }
.options .opt { min-height: 42px; padding: 4px 10px; font-size: 16px; border-radius: 12px; }
.options .opt svg { width: 24px; height: 24px; }
.options .opt.sticker { padding: 2px 8px; }

.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #cbd5e1; }
.swatch.on { box-shadow: 0 0 0 4px var(--ink); }
.dot { width: 42px; height: 42px; border-radius: 12px; border: 3px solid transparent; background: var(--soft); display: grid; place-items: center; }
.dot i { display: block; border-radius: 50%; background: var(--ink); }
.dot.on, .opt.on { border-color: var(--blue); background: #e8f1fd; }
.sep { width: 2px; height: 30px; background: var(--soft); margin: 0 4px; }
.stamp { padding: 4px; width: 42px; height: 42px; border-radius: 12px; border: 3px solid transparent; background: var(--soft); }
.stamp.on { border-color: var(--blue); background: #e8f1fd; }
.opt { border: 3px solid transparent; background: var(--soft); border-radius: 14px; padding: 10px 16px; font-size: 18px; min-height: 52px; }
.opt.schule, textarea.schule, .tedit.schule { font-family: "Playwrite DE Grund", cursive; }
.opt.red { background: #fde2e2; color: #b42318; }
.opt { display: inline-flex; align-items: center; gap: 8px; }
.opt svg { width: 30px; height: 30px; }
.opt.sticker { padding: 6px 10px; }
.stamp svg { width: 100%; height: 100%; }
h1 svg, h2 svg { width: 1.3em; height: 1.3em; vertical-align: -0.3em; }
.btn svg, .sbtn svg { width: 1.2em; height: 1.2em; vertical-align: -0.25em; }
.sheetlist button svg { width: 34px; height: 34px; vertical-align: middle; }
.msgicon { text-align: center; }
.msgicon svg { width: 84px; height: 84px; }

/* Dialoge */
dialog { border: 0; border-radius: 28px; padding: 28px; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,23,42,.45); }
dialog h2 { margin: 0 0 14px; font-size: 30px; padding-right: 48px; overflow-wrap: anywhere; } /* (a file name without spaces as title) */
.close { position: absolute; top: 14px; right: 14px; width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--soft); font-size: 30px; line-height: 1; }
dialog p { font-size: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; align-items: center; margin-top: 16px; }
.row.papers { justify-content: center; align-items: stretch; } /* (all as high as the highest: a label on two lines moves nothing) */
.row.wrap { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
.btn { border: 0; border-radius: 18px; padding: 14px 24px; font-size: 22px; background: var(--soft); min-height: 60px; }
.btn.primary { background: var(--green); color: #fff; font-weight: 700; }
.choice2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; } /* two main choices side by side */
.choice2 .btn { padding: 12px 10px; }
@media (max-width: 640px) { .choice2 { grid-template-columns: 1fr; } } /* (one below the other on a phone) */
@media (max-width: 640px) { /* «Seiten ordnen» on a phone: the four buttons 2 × 2, the pages keep the room */
  .pagesgrid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; } /* (two side by side on the smallest) */
  .pagesbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .pagesbar .opt { justify-content: center; padding: 8px 6px; font-size: 16px; }
  .pagesbar [data-icon] svg { width: 22px; height: 22px; }
}
.bigInput, textarea, .tedit {
  width: 100%; font: inherit; font-size: 30px; padding: 14px 18px; border: 3px solid #cbd5e1; border-radius: 18px;
  -webkit-user-select: text; user-select: text;
}
.bigInput { text-transform: uppercase; text-align: center; letter-spacing: 2px; }
#saveName { text-transform: none; letter-spacing: 0; }
.pin { font-size: 64px; font-weight: 700; letter-spacing: 12px; text-align: center; margin: 10px 0; color: #6b2fa8; }
textarea { font-size: 26px; resize: none; }
.bigInput:focus, textarea:focus, .tedit:focus { outline: none; border-color: var(--blue); }
.error { color: var(--red); min-height: 1em; margin: 8px 0 0; }
.msg { font-size: 24px; text-align: center; }
.sheetlist { display: grid; gap: 10px; margin-top: 10px; max-height: 50vh; overflow: auto; }
.sheetlist button { border: 0; border-radius: 18px; padding: 18px; font-size: 22px; text-align: left; background: #e8f1fd; }
.paper { flex: 1 1 110px; max-width: 200px; border: 3px solid var(--soft); background: #fff; border-radius: 20px; padding: 12px; font-size: 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.paper svg { width: 80px; height: 80px; }
.pv { width: 90px; height: 120px; border: 1px solid #cbd5e1; background: #fff; }
.pv.lines { background: repeating-linear-gradient(#fff 0 11px, #94a3b8 11px 12px); }
.pv.lines1 { background: repeating-linear-gradient(#fff 0 8px, #b8c2cf 8px 9px, #fff 9px 13px, #b8c2cf 13px 14px, #eaf2fd 14px 18px, #64748b 18px 19px, #fff 19px 23px, #b8c2cf 23px 24px, #fff 24px 26px); }
.pv.boxes { background: repeating-linear-gradient(#fff 0 9px, #a3adb9 9px 10px), repeating-linear-gradient(90deg, #fff 0 9px, #a3adb9 9px 10px); background-blend-mode: multiply; }
.pv.staff { background: repeating-linear-gradient(#fff 0 10px, #7b8594 10px 11px, #fff 11px 13px, #7b8594 13px 14px, #fff 14px 16px, #7b8594 16px 17px, #fff 17px 19px, #7b8594 19px 20px, #fff 20px 22px, #7b8594 22px 23px, #fff 23px 30px); }
.pv.mindmap { width: 120px; height: 85px; margin: 17px 0 18px; background: radial-gradient(circle, #a3adb9 0 1px, transparent 1.5px) 0 0 / 7px 7px #fff; } /* (A4 across) */
.pv.grid { background: repeating-linear-gradient(#fff 0 5px, #cbd5e1 5px 6px), repeating-linear-gradient(90deg, #fff 0 5px, #cbd5e1 5px 6px); background-blend-mode: multiply; }

#busy { position: fixed; inset: 0; background: rgba(255,255,255,.6); display: grid; place-items: center; z-index: 10; }
.spinner { width: 70px; height: 70px; border: 8px solid var(--soft); border-top-color: var(--blue); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Phones (and Split View): Start, title and PIN in the first row; «Heft», «Sichern», «Später», «Abgeben» in a second
   one that shares its width, so it never wraps. (Phones held across: one row of icons, below.) */
@media (max-width: 640px) and (orientation: portrait), (max-width: 640px) and (min-height: 501px) {
  .topbar { flex-wrap: wrap; justify-content: center; }
  .topbar :is(#btnHome, .title, .pinbadge) { order: -2; }
  .topbar::before { content: ''; order: -1; flex-basis: 100%; } /* the line break after them */
  .topbar #btnHome { font-size: 0; min-width: 0; padding: 4px 8px; } /* (its word stays for screen readers) */
  .topbar .tb:not(#btnHome) { flex: 1 1 0; min-width: 0; max-width: 110px; font-size: 12px; }
  .topbar .tb svg { width: 28px; height: 28px; }
  .topbar #btnHome svg { margin: 0; }
}
/* Low screens (phones held across) too: the top buttons as icons, the options and the tools each in one row to swipe
   through, smaller round buttons and dialogs, so the sheet keeps room. */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar .tb { font-size: 0; min-width: 0; padding: 4px 8px; }
  .topbar .tb svg { width: 28px; height: 28px; margin: 0; }
  .tools .tool { font-size: 0; min-width: 52px; } /* (.tools: after the phone rules below too) */
  .tools .tool svg { margin: 0; }
}
@media (max-width: 640px), (max-height: 500px) {
  #start { gap: 16px; padding: 16px; }
  #start h1 { font-size: 34px; }
  .bigbuttons { gap: 14px; }
  .big { font-size: 22px; padding: 16px 14px; border-radius: 22px; }
  .big span { padding: 8px; }
  .big svg { width: 44px; height: 44px; }
  .big small { font-size: 15px; }
  .floatbar { bottom: 8px; }
  .floatbar.left { left: 8px; }
  .floatbar.right { right: 8px; }
  .fb { width: 42px; height: 42px; }
  .fb svg { width: 27px; height: 27px; }
  dialog { padding: 18px; }
  dialog h2 { font-size: 21px; }
  dialog p { font-size: 17px; }
  .msg { font-size: 19px; }
  .btn { font-size: 18px; min-height: 48px; padding: 10px 18px; }
  .bigInput { font-size: 20px; padding: 10px 12px; letter-spacing: 1px; }
  .paper { font-size: 17px; padding: 10px; }
  .paper svg { width: 56px; height: 56px; }
  .sheetlist button { font-size: 18px; padding: 14px; }
  .close { top: 10px; right: 10px; width: 44px; height: 44px; font-size: 26px; }
  .pin { font-size: 48px; letter-spacing: 8px; }
  #textInput { font-size: 20px; }
  .pv { width: 60px; height: 80px; }
  .pv.mindmap { width: 80px; height: 57px; margin: 11px 0 12px; }
  .tools { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tools > * { flex: none; }
  .options { flex-wrap: nowrap; justify-content: flex-start; }
  .options > :first-child { margin-left: auto; } .options > :last-child { margin-right: auto; } /* (centred while it fits) */
  .options > .hint { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.25; text-align: center; } /* (alone in its row: it wraps) */
  .tool { min-width: 62px; font-size: 12px; }
  .topbar .title { font-size: 18px; }
  .addpage, .sortpages { font-size: 14px; padding: 6px 12px; gap: 6px; border-width: 2px; border-radius: 14px; } /* (small, side by side under the sheet) */
  .addpage svg, .sortpages svg { width: 24px; height: 24px; }
  .pageacts { gap: 0 10px; }
  .pageacts .addpage, .sortpages { margin-bottom: 16px; }
  .pagecard, .opt { font-size: 16px; }
}

/* A short note at the bottom that goes away by itself (toast in app.js) */
#toast { position: fixed; left: 50%; bottom: calc(120px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  width: max-content; max-width: min(92vw, 560px); padding: 12px 18px; border-radius: 16px; background: #1f2937; color: #fff;
  font-size: 18px; line-height: 1.35; text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); pointer-events: none; }
/* A page whose picture could not be made: it is tried again when it comes back */
.page.broken::before { content: 'Diese Seite lädt gerade nicht. Einen Moment, ich versuche es nochmals …'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: #b42318; font-size: 20px; }
/* Start page: saves still waiting for internet; the note shown only if the app has not started after 15 seconds */
.waiting { background: #fff7e6; border-radius: 14px; padding: 10px 16px; font-size: 18px; }
@media (max-width: 640px), (max-height: 500px) { #toast, .waiting { font-size: 16px; } .page.broken::before { font-size: 17px; } }
.noJs { background: #fde2e2; color: #b42318; border-radius: 14px; padding: 12px 16px; max-width: 640px; animation: noJs 0s 15s both; }
@keyframes noJs { from { visibility: hidden; } to { visibility: visible; } }
.locknote { background: #fff7e6; border-radius: 12px; padding: 10px 14px; }
/* «Zuschneiden»: the photo with a frame; outside the frame darker (only over the photo), the handles may stick out */
.cropbox { position: relative; width: fit-content; margin: 8px auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.cropbox img { display: block; }
.cropclip { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#cropShade { position: absolute; box-shadow: 0 0 0 9999px rgba(15,23,42,.55); }
#cropFrame { position: absolute; border: 3px solid #fff; outline: 1px solid #2f80ed; cursor: move; }
#cropFrame i { position: absolute; width: 48px; height: 48px; margin: -24px; background: radial-gradient(circle, #2f80ed 0 14px, #fff 14.5px 17px, transparent 17.5px); } /* a dot of 34 px, touched in 48 px */
#cropFrame i[data-c=nw] { left: 0; top: 0; cursor: nwse-resize; }
#cropFrame i[data-c=ne] { right: 0; top: 0; cursor: nesw-resize; }
#cropFrame i[data-c=sw] { left: 0; bottom: 0; cursor: nesw-resize; }
#cropFrame i[data-c=se] { right: 0; bottom: 0; cursor: nwse-resize; }
/* «Als Heft»: double page with the fold; the shadow at the fold shows the middle of the booklet */
#dlgHeft { width: 96vw; max-width: 1400px; height: 92vh; max-height: none; padding: 20px; }
#dlgHeft[open] { display: flex; flex-direction: column; }
#heftStage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
#heftBook { position: relative; perspective: 2600px; }
#heftBook .hp, #heftBook .face { position: absolute; top: 0; background: #fff; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 3px 12px rgba(0,0,0,.18); cursor: pointer; }
#heftBook img { display: block; width: 100%; height: 100%; object-fit: contain; }
#heftBook .hp::after, #heftBook .face::after { content: ''; position: absolute; top: 0; bottom: 0; width: 9%; pointer-events: none; }
#heftBook .l::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.14), rgba(0,0,0,0)); }
#heftBook .r::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.14), rgba(0,0,0,0)); }
#heftBook .blank { background: #f6f7f9; }
#heftBook .leer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; color: #9ca3af; font-size: 16px; }
#heftBook .leaf { position: absolute; top: 0; z-index: 3; transform-style: preserve-3d; transition: transform .65s cubic-bezier(.4,.1,.3,1); pointer-events: none; }
#heftBook .face { left: 0; width: 100%; height: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
#heftBook .face.back { transform: rotateY(180deg); }
.heftnav { justify-content: center; margin-top: 10px; }
.heftnav .opt { font-size: 22px; min-width: 70px; justify-content: center; }
.heftnav .opt:disabled { opacity: .35; }
#heftWhere { font-size: 18px; min-width: 200px; text-align: center; }
@media (max-width: 640px), (max-height: 500px) { #heftInfo { font-size: 14px; margin: 0 0 6px; } } /* (the book keeps the room) */
@media (max-width: 640px) { /* phones: «◀ Seiten 6 und 7 von 36 ▶» in one row */
  .heftnav { flex-wrap: nowrap; gap: 8px; }
  .heftnav .opt { min-width: 56px; font-size: 18px; }
  #heftWhere { min-width: 0; flex: 1; font-size: 16px; }
}
/* Phones held across: windows tighter, so «OK» and the title fit without scrolling where possible */
@media (max-height: 500px) {
  dialog { padding: 12px 16px; }
  dialog h2 { font-size: 19px; margin: 0 0 6px; }
  dialog p { margin: 6px 0; }
  .pin { font-size: 36px; margin: 2px 0; }
  .paper { padding: 6px; gap: 4px; }
  .paper svg { width: 40px; height: 40px; }
  .btn { min-height: 44px; padding: 8px 16px; }
}
/* «Gefüllt»: a small filled square in the colour of the text */
.fillmark { display: inline-block; width: 16px; height: 16px; border-radius: 3px; background: currentColor; border: 2px solid currentColor; }
/* Text window: a slim bar above the field (size, bold and underline, font, colour) */
.tbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 52px 10px 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--soft); }
.seg button { min-width: 40px; height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: none; font-size: 16px; line-height: 1; }
.seg button.on { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.seg .schule { font-family: "Playwrite DE Grund", cursive; }
.tcolors { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tcolors .swatch { width: 28px; height: 28px; border-width: 2px; }
/* The text field of the text window: what is written shows in its sizes and styles (a span per part, see app.js) */
.tedit { display: block; box-sizing: border-box; min-height: 4.4em; max-height: 40vh; overflow-y: auto; margin-top: 0;
  font-size: 26px; line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; cursor: text; }
.tedit:empty::before { content: attr(data-placeholder); color: #94a3b8; pointer-events: none; }
