/* Cards: PDF-Leser mit Markieren (cards-pdf.js). Alles unter .cp-…; Farben aus den App-Variablen, daher auch im Dunkelmodus stimmig. */
body.cp-offen { overflow: hidden; }
.cp { position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; background: var(--hg); color: var(--text); }
.cp-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; border-bottom: .5px solid var(--rand); background: var(--karte); }
.cp-kopf h2 { flex: 1; min-width: 0; margin: 0; text-align: center; font-size: calc(17px * var(--schrift)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-kopf > span { width: 70px; }
.cp-knopf { white-space: nowrap; min-width: 40px; min-height: 40px; padding: 0 10px; border: none; border-radius: 10px; background: var(--fuellung); color: var(--text); font-size: calc(16px * var(--schrift)); }
.cp-knopf.an { background: var(--haupt); color: var(--auf-haupt); }
.cp-knopf.haupt { background: var(--haupt); color: var(--auf-haupt); }
.cp-kopf .cp-knopf { background: none; color: var(--haupt); padding: 0 4px; white-space: nowrap; }
/* Liste */
.cp-liste { flex: 1; overflow-y: auto; padding: 14px 16px calc(env(safe-area-inset-bottom) + 24px); max-width: 640px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.cp-pdfs { margin-top: 14px; padding: 2px 0; }
.cp-pdf { display: flex; align-items: center; border-bottom: .5px solid var(--rand); }
.cp-pdf:last-child { border-bottom: none; }
.cp-pdf-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; padding: 12px; background: none; border: none; color: var(--text); font-size: calc(16px * var(--schrift)); overflow-wrap: anywhere; }
.cp-pdf-name .leise { font-size: calc(13px * var(--schrift)); }
.cp-pdf > .cp-knopf { background: none; color: var(--leise); }
.cp-leer { text-align: center; margin-top: 28px; }
/* Leser */
.cp-leiste { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: .5px solid var(--rand); background: var(--karte); overflow-x: auto; }
.cp-seite { min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; font-size: calc(15px * var(--schrift)); }
.cp-platz { flex: 1; }
.cp-haupt { flex: 1; display: flex; min-height: 0; position: relative; }
.cp-buehne { flex: 1; overflow: auto; padding: 8px; text-align: center; -webkit-overflow-scrolling: touch; }
.cp-formmodus { touch-action: none; }
.cp-blatt { position: relative; display: inline-block; text-align: left; background: #fff; box-shadow: var(--schatten-karte); margin: 0 auto; vertical-align: top; }
.cp-leinwand { position: absolute; inset: 0; }
.cp-hl { position: absolute; inset: 0; pointer-events: none; }
.cp-marke { position: absolute; background: var(--f); opacity: .38; border-radius: 2px; mix-blend-mode: multiply; }
.cp-marke.bild { background: none; border: 2px solid var(--f); opacity: .9; mix-blend-mode: normal; }
.cp-marke.blinkt { animation: cp-blink 1.2s ease-out 2; }
@keyframes cp-blink { 50% { opacity: .9; } }
.cp-text { position: absolute; inset: 0; overflow: hidden; line-height: 1; -webkit-user-select: text; user-select: text; }
.cp-text :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0 0; }
.cp-text ::selection { background: rgba(10, 132, 255, .35); }
.cp-ziehen { position: absolute; inset: 0; cursor: crosshair; touch-action: none; z-index: 3; }
.cp-rahmen { position: absolute; border: 2px dashed var(--haupt); background: rgba(10, 132, 255, .15); pointer-events: none; }
.cp-rahmen.verdeckt { border-color: #ff9f0a; background: rgba(255, 159, 10, .55); }
/* Seitenleiste: rechts am Computer, auf dem Handy über dem Blatt */
.cp-seitenleiste { display: none; width: 320px; flex: none; overflow-y: auto; padding: 12px; border-left: .5px solid var(--rand); background: var(--karte); }
.cp-seitenleiste h3 { margin: 0 0 8px; font-size: calc(15px * var(--schrift)); }
.cp-seitenleiste-an .cp-seitenleiste { display: block; }
.cp-s-seite { margin: 12px 0 4px; font-size: calc(12px * var(--schrift)); font-weight: 600; color: var(--leise); text-transform: uppercase; }
.cp-s-eintrag { display: flex; align-items: stretch; gap: 6px; margin-bottom: 6px; }
.cp-s-text { flex: 1; min-width: 0; text-align: left; padding: 8px 10px; border: none; border-left: 5px solid var(--f); border-radius: 8px; background: var(--karte-2); color: var(--text); font-size: calc(14px * var(--schrift)); overflow-wrap: anywhere; }
.cp-s-zahl { display: block; margin-top: 4px; font-size: calc(12px * var(--schrift)); color: var(--leise); }
@media (max-width: 760px) {
  .cp-seitenleiste { position: absolute; inset: 0; width: auto; border-left: none; z-index: 4; }
}
/* Auswahlleiste unten */
.cp-auswahl { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 16px); transform: translateX(-50%); z-index: 16; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 28px; background: var(--karte); box-shadow: var(--schatten-dialog); border: .5px solid var(--rand); }
.cp-farbe { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 2px solid transparent; background: var(--f); }
.cp-farbe.an { border-color: var(--text); }
.cp-karte-knopf { min-height: 36px; padding: 0 16px; border-radius: 18px; }
.cp-farben { display: flex; gap: 14px; margin: 12px 0; }
.cp-zitat { margin: 8px 0; padding-left: 10px; border-left: 3px solid var(--rand); color: var(--leise); }
/* Karten-Editor */
.cp-tabs { display: flex; gap: 6px; margin: 10px 0; }
.cp-tab { flex: 1; min-height: 40px; border: none; border-radius: 10px; background: var(--fuellung); color: var(--text); }
.cp-tab.an { background: var(--haupt); color: var(--auf-haupt); }
.cp-felder { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cp-felder label { font-size: calc(13px * var(--schrift)); color: var(--leise); margin-top: 4px; }
.cp-feld { width: 100%; box-sizing: border-box; padding: 10px 12px; border: .5px solid var(--rand); border-radius: 12px; background: var(--blatt-feld); color: var(--text); font: inherit; font-size: 16px; resize: vertical; }
.cp-bild-vorschau { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.cp-bild-vorschau img { max-width: 100%; max-height: 40vh; border-radius: 8px; background: #fff; }
.cp-vorschlaege { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.cp-vorschlag { padding: 10px 12px; border-radius: 12px; background: var(--karte-2); }
.cp-vorschlag p { margin: 0 0 8px; }
.cp-quelle { text-align: center; margin: 10px 0; }
.cp-quelle button { border: none; background: var(--haupt-zart); color: var(--haupt); border-radius: 16px; padding: 8px 14px; font-size: calc(14px * var(--schrift)); }
