/* kartenwerkstatt.css · autisten.at, die kleine Kartenwerkstatt auf „Karten“ (de/karten/, en/cards/), nur mit --spielen
   geladen (nach huelle.css und rahmen.css). Agent für Falzbein, 04.12.2026. Eigener Code, nichts aus /cards/.
   Farben aus den Tokens der Hülle (Tag, Nacht, Leise); die Karten selbst bleiben weiß wie Papier. Kein Rot für Fokus oder
   Fehler, kein Braun. Druck: A4 hochkant, 3 × 3 Karten 54 × 85,6 mm (wie Mos Karte), Abstand 6 mm waagerecht und 8 mm
   senkrecht, Raster mittig wie im Basiskarten-PDF, Schnittmarken an den Ecken jeder Karte.
   Zweite Runde (Andy, 04.12. abends): genau ein Blatt. Die Vorschau zeigt es wie im Druck, 3 Spalten, jede Lage in Prozent
   der echten Millimeter (links 18/78/138 von 210, oben 12,1/105,7/199,3 von 297, Karte 54 × 85,6); am PC so klein, dass
   das ganze Blatt neben der Bibliothek auf einen Blick passt, am Handy über der Bibliothek. Blatt 2 trägt die Rückseiten
   (Spalten gespiegelt, das macht kartenwerkstatt.js). Die Wörter auf der Vorschau sind ihr Maßstab (13 % der Kartenbreite
   wie 20 pt auf 54 mm), sie sind ein Bild des Drucks; lesbar groß (ab 16 px) stehen sie in der Bibliothek. */

.kw [hidden] { display: none !important; }
.kw-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 24px; }
.kw-kopf h2 { margin: 0; }
.kw-mehr { margin: 0; font-size: 1.05rem; }
.kw-mehr a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.kw-ohne-js {
  max-width: 40em; background: var(--papier-hell); border: 2px dashed var(--rand); border-radius: 16px; padding: 12px 18px;
}
.kw-klein { color: var(--tinte-leise); font-size: 1rem; max-width: 34em; }

.kw-werk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; margin-block-start: 20px; }
.kw-bib { min-width: 0; }
.kw-auswahl {
  min-width: 0; background: var(--papier-hell); border: 2px solid var(--linie); border-radius: 18px; padding: 16px 18px;
}
.kw-auswahl h3 { margin-block-end: .3em; }
.kw-auswahl h3:focus { outline: none; }
.kw-auswahl h3:focus-visible { outline: 3px solid var(--fokus); outline-offset: 3px; }
.kw-zahl { font-weight: 700; margin-block-end: .5em; }
@media (min-width: 1000px) {
  .kw-werk { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .kw-bib { grid-column: 1; grid-row: 1; }
  .kw-auswahl {
    grid-column: 2; grid-row: 1; position: sticky; inset-block-start: calc(var(--kopf-h) + 16px);
    max-height: calc(100vh - var(--kopf-h) - 32px); overflow-y: auto; overscroll-behavior: contain;
  }
  .kw-leiste { display: none !important; }
}

/* ---------- Sprache und Text ---------- */
.kw-einstellen { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-block-end: 8px; }
.kw-sprache { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-weight: 700; }
.kw-sprache select {
  min-height: 48px; min-width: 11em; padding: 6px 12px; font: inherit; font-weight: 400;
  color: var(--tinte); background: var(--papier-hell); border: 2px solid var(--rand); border-radius: 12px;
}
.kw-schalter { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; font-weight: 700; cursor: pointer; }
.kw-schalter input { width: 26px; height: 26px; margin: 0; accent-color: var(--akzent); cursor: pointer; }
.kw-sprache select:focus-visible, .kw-schalter input:focus-visible { outline: 3px solid var(--fokus); outline-offset: 3px; }

/* ---------- Gruppen und Karten ---------- */
.kw-gruppe h3 { margin-block: 28px 14px; }
.kw-liste {
  list-style: none; margin: 0; padding: 4px; display: grid; gap: 18px 14px;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}
@media (min-width: 700px) { .kw-liste { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 20px 16px; } }
.kw-liste > li { min-width: 0; }

.kw-karte, .kw-gewaehlt-karte {
  position: relative; display: block; width: 100%; margin: 0; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: center; cursor: pointer; border-radius: 9px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
/* Schlüsselbund-Karten: das fertige Bild (Text eingebaut) */
.kw-bild img { display: block; width: 100%; height: auto; aspect-ratio: 1276 / 2022; border-radius: 6% / 3.8%;
  box-shadow: 0 8px 14px -10px var(--schatten); }
/* Wortkarten: Bild oben, das Wort darunter, auf weißer Karte im Maß 54 × 85,6 */
.kw-wortkarte {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; width: 100%;
  aspect-ratio: 54 / 85.6; padding: 12% 8% 8%; overflow: hidden; text-align: center;
  background: #FFFFFF; color: #1F2730; border: 2px solid #3C4A5A; border-radius: 6% / 3.8%;
  box-shadow: 0 8px 14px -10px var(--schatten); container-type: inline-size;
}
.kw-flaeche { display: block; width: 100%; aspect-ratio: 1 / 1; flex: 0 0 auto; }
.kw-flaeche img { display: block; width: 100%; height: 100%; object-fit: contain; }
.kw-wortkarte .kw-wort:not(.vh) {
  display: block; margin-block: auto; padding-block-start: 4px; font-weight: 700; line-height: 1.15;
  font-size: max(16px, 14cqi); color: #1F2730; overflow-wrap: anywhere; hyphens: auto;
}
.kw-wortkarte:has(.kw-wort.vh) { justify-content: center; }
html[data-leise="an"] .kw-bild img, html[data-leise="an"] .kw-wortkarte { box-shadow: none; }

/* gewählt: Ring in der Akzentfarbe und die Stelle in der Auswahl als Zahl */
.kw-karte[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--papier), 0 0 0 8px var(--akzent); }
.kw-nr {
  position: absolute; inset-block-start: -8px; inset-inline-end: -8px; z-index: 1;
  display: flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 6px;
  border-radius: 17px; border: 3px solid var(--papier); background: var(--akzent); color: var(--akzent-text);
  font-weight: 700; font-size: 1rem; line-height: 1;
}
.kw-nr:empty { display: none; }
/* die Seite ist voll: Karten, die nicht darauf sind, treten zurück (bleiben antippbar, dann sagt der Satz, warum nichts geschieht) */
.kw-karte[aria-disabled="true"] { opacity: .5; cursor: default; }
.kw-karte:focus, .kw-gewaehlt-karte:focus { outline: none; }
.kw-karte:focus-visible, .kw-gewaehlt-karte:focus-visible { outline: 3px dashed var(--tinte); outline-offset: 11px; }
@media (hover: hover) {
  .kw-karte:hover .kw-flaeche img, .kw-karte:hover img { filter: brightness(1.03); }
}

/* ---------- die Seite: ein A4-Blatt wie im Druck ---------- */
.kw-seite-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kw-seite-kopf h3 { margin-block: 0 .15em; }
.kw-seite-kopf .kw-zahl { margin-block-end: 0; }
.kw-wende {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  margin: 0; padding: 0; cursor: pointer; color: var(--tinte); background: var(--papier); border: 2px solid var(--rand);
  border-radius: 12px; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.kw-wende[aria-pressed="true"] { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.kw-wende:focus { outline: none; }
.kw-wende:focus-visible { outline: 3px solid var(--fokus); outline-offset: 3px; }
.kw-vorschau {
  position: relative; width: 100%; max-width: 340px; aspect-ratio: 210 / 297; margin: 12px auto 14px;
  background: #FFFFFF; border: 1px solid var(--rand); border-radius: 3px; box-shadow: 0 10px 20px -14px var(--schatten);
}
@media (min-width: 1000px) {  /* das ganze Blatt auf einen Blick: Breite aus der Fensterhöhe (Kopf, Knöpfe, Rand abgezogen) */
  .kw-vorschau { width: min(100%, calc((100vh - var(--kopf-h) - 250px) * 210 / 297)); min-width: 180px; }
}
html[data-leise="an"] .kw-vorschau { box-shadow: none; }
.kw-plaetze { position: absolute; inset: 0; }
.kw-gewaehlt { list-style: none; position: absolute; inset: 0; margin: 0; padding: 0; }
.kw-platz, .kw-gewaehlt > li { position: absolute; width: 25.7143%; height: 28.8215%; }
.kw-platz { border: 1.5px dashed #B4BEC8; border-radius: 6% / 3.8%; }
.kw-vorschau .kw-s0 { left: 8.5714%; } .kw-vorschau .kw-s1 { left: 37.1429%; } .kw-vorschau .kw-s2 { left: 65.7143%; }
.kw-vorschau .kw-r0 { top: 4.0741%; } .kw-vorschau .kw-r1 { top: 35.5892%; } .kw-vorschau .kw-r2 { top: 67.1044%; }
.kw-gewaehlt-karte { width: 100%; height: 100%; border-radius: 6% / 3.8%; }
.kw-gewaehlt .kw-ansicht { display: block; width: 100%; height: 100%; }
.kw-gewaehlt .kw-bild img { width: 100%; height: 100%; aspect-ratio: auto; box-shadow: none; }
.kw-gewaehlt .kw-wortkarte { height: 100%; aspect-ratio: auto; padding: 12.96% 7.4% 7.4%; border-width: 1px; box-shadow: none; }
.kw-gewaehlt .kw-wortkarte .kw-wort:not(.vh) { font-size: 13cqi; padding-block-start: 2px; }
.kw-gewaehlt .kw-gewaehlt-karte:focus-visible { outline: 3px dashed var(--tinte); outline-offset: 2px; }
.kw-voll {
  margin-block: 4px 10px; padding: 8px 12px; border-inline-start: 5px solid var(--akzent); border-radius: 6px;
  background: var(--papier);
}
.kw-ansicht.kw-bild { display: block; width: 100%; }
.kw-knoepfe { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 4px 12px; }
.kw-haupt { background: var(--mo-gelb); color: var(--gelb-text); border-color: var(--gelb-kante); }
.kw-haupt[aria-disabled="true"] { background: var(--papier-hell); color: var(--tinte-leise); border-color: var(--rand); }
.knopf[aria-disabled="true"] { cursor: default; }

/* am Handy: eine Leiste, die beim Blättern durch die Karten unten mitgeht */
.kw-leiste {
  position: sticky; inset-block-end: 8px; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-block-start: 24px; padding: 4px 6px 4px 16px;
  background: var(--tisch); color: var(--tinte); border: 2px solid var(--linie); border-radius: 14px;
  box-shadow: 0 6px 16px -8px var(--schatten); font-weight: 700;
}
.kw-leiste a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 12px; white-space: nowrap; }
.kw-leiste-voll { display: block; font-weight: 400; }
.kw-leiste-voll[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { .kw-karte, .kw-karte img { transition: none !important; } }

/* ---------- Druckbogen ---------- */
@page { size: A4 portrait; margin: 0; }
@media screen { .kw-druck { display: none !important; } }
@media print {
  html.kw-druckbar, html.kw-druckbar body { background: #FFFFFF !important; margin: 0 !important; padding: 0 !important; }
  html.kw-druckbar body > :not(.kw-druck) { display: none !important; }
  html:not(.kw-druckbar) .kw-druck { display: none !important; }
  .kw-druck { display: block; color: #1F2730; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .kw-blatt { position: relative; width: 210mm; height: 296mm; overflow: hidden; break-after: page; page-break-after: always; }
  .kw-blatt:last-child { break-after: auto; page-break-after: auto; }
  .kw-zelle { position: absolute; width: 54mm; height: 85.6mm; }
  .kw-s0 { left: 18mm; } .kw-s1 { left: 78mm; } .kw-s2 { left: 138mm; }
  .kw-r0 { top: 12.1mm; } .kw-r1 { top: 105.7mm; } .kw-r2 { top: 199.3mm; }
  .kw-zelle .kw-ansicht { width: 54mm; height: 85.6mm; }
  .kw-zelle .kw-bild img { width: 54mm; height: 85.6mm; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
  .kw-zelle .kw-wortkarte { width: 54mm; height: 85.6mm; aspect-ratio: auto; padding: 7mm 4mm 4mm;
    border: .3mm solid #3C4A5A; border-radius: 3.2mm; box-shadow: none; }
  .kw-zelle .kw-wortkarte .kw-wort:not(.vh) { font-size: 20pt; line-height: 1.15; }
  .kw-marke { position: absolute; width: 0; height: 0; }
  .kw-marke::before, .kw-marke::after { content: ""; position: absolute; background: #000000; }
  .kw-marke::before { width: 2.2mm; height: .15mm; top: -.075mm; }
  .kw-marke::after { width: .15mm; height: 2.2mm; left: -.075mm; }
  .kw-m-lo { left: 0; top: 0; } .kw-m-ro { left: 100%; top: 0; } .kw-m-lu { left: 0; top: 100%; } .kw-m-ru { left: 100%; top: 100%; }
  .kw-m-lo::before, .kw-m-lu::before { right: .6mm; }
  .kw-m-ro::before, .kw-m-ru::before { left: .6mm; }
  .kw-m-lo::after, .kw-m-ro::after { bottom: .6mm; }
  .kw-m-lu::after, .kw-m-ru::after { top: .6mm; }
}
