/* ZOK — gemeinsame Grundlage für alle Werkzeuge (Startseite, Glücksrad, Münze,
   Flasche, Karten). Stil: GLAS — zarter Farbnebel im Hintergrund (Rosa, Blau, Mint),
   Flächen und Knöpfe wie Milchglas, ein Violett-Pink-Verlauf als einziger Akzent.
   Alles, was zwei Seiten brauchen, gehört hierher. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../schrift/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 100%; /* A.15.1.0: Breite festgelegt (132 → 78 KB) — das Logo „ZOK“ ist jetzt ein SVG */
  font-display: swap;
}

:root {
  /* Flächen */
  --papier: #f6f4ff;                      /* Grund unter dem Farbnebel */
  --papier-2: rgba(255, 255, 255, .5);    /* eingelassene Felder */
  --flaeche: rgba(255, 255, 255, .62);    /* Milchglas */
  --flaeche-fest: #fff;
  --linie: rgba(255, 255, 255, .85);      /* Glaskante */
  --glas-blur: blur(16px) saturate(1.4);
  /* Tinte */
  --tusche: #1e1b3a;
  --tusche-weich: #5f5a7e;
  /* Akzent */
  --akzent: #8b5cf6;
  --akzent-2: #ec4899;
  --verlauf: linear-gradient(135deg, #8b5cf6, #ec4899);
  /* Alte Namen, auf die Glas-Palette gelegt */
  --messing: var(--akzent);
  --messing-hell: #ede9fe;
  --messing-tief: #7c3aed;
  --tomate: var(--akzent);
  --sonne: var(--akzent);
  --pflaume: var(--akzent);
  --rosa: var(--akzent-2);
  --minze: #10b981;
  --himmel: #6366f1;
  --elfenbein: #fff;
  --ochsenblut: var(--akzent-2);
  --salbei: #10b981;
  --nacht: #6366f1;
  /* Radgestell (liest rad/js/zeichnen.js) */
  --rad-ring-1: #ddd5fb; --rad-ring-2: #fff; --rad-ring-3: #f4f0ff; --rad-ring-4: #d6ccfa;
  --rad-trenner: rgba(255, 255, 255, .95); --rad-kante: rgba(255, 255, 255, .9);
  --rad-stift-1: #fff; --rad-stift-2: #f4f0ff; --rad-stift-3: #c4b5fd;
  --rad-nabe-rand-1: #fff; --rad-nabe-rand-2: #e9e3ff; --rad-nabe-1: #fff; --rad-nabe-2: #f4f0ff;
  --rad-nabe-schrift-1: #8b5cf6; --rad-nabe-schrift-2: #ec4899;
  --rad-leer: #ede9fe; --rad-glanz: .3; --rad-tiefe: .06;
  --zeiger-1: #a78bfa; --zeiger-2: #8b5cf6; --zeiger-3: #ec4899; --zeiger-punkt: #fff;
  /* Tiefe */
  --rand: 1px solid var(--linie);
  --schatten: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 10px 30px rgba(80, 60, 160, .12);
  --schatten-klein: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 4px 14px rgba(80, 60, 160, .1);
  --schatten-gross: inset 0 0 0 1px rgba(255, 255, 255, .85), 0 24px 60px rgba(80, 60, 160, .22);
  --rund: 20px;
  --schrift: "Bricolage Grotesque", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --schrift-titel: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--papier); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--schrift);
  font-weight: 450;
  font-optical-sizing: auto;
  color: var(--tusche);
  /* Durchsichtig: sonst deckte der Grund den Farbnebel (z-index −1) zu; die Grundfarbe trägt html */
  background: transparent;
  /* Ränder neben Notch und Kamera im Querformat freihalten */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* Farbnebel als eigene, feste Ebene statt background-attachment: fixed —
   das kann iOS nicht und ruckelt auf Android beim Scrollen. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(34rem 34rem at 0% 0%, #ffd1e8, transparent 65%),
    radial-gradient(38rem 38rem at 100% 12%, #c9d8ff, transparent 65%),
    radial-gradient(40rem 32rem at 35% 100%, #c8f5e6, transparent 65%),
    var(--papier);
}
/* Kein Doppeltipp-Zoom auf Bedienelementen, kein Lupen-Menü beim Festhalten */
button, a, summary, [role="button"], input[type="checkbox"] { touch-action: manipulation; }
canvas, svg, img { -webkit-touch-callout: none; }

h1, h2, h3 { font-family: var(--schrift-titel); font-weight: 700; letter-spacing: -.025em; }

a { color: inherit; }

button, input, select, textarea { font: inherit; color: inherit; }
/* Keine einzelnen Wörter in der letzten Zeile („…mit dem / Finger.“) */
p, h1, h2, h3, li { text-wrap: pretty; }

/* ---------- Knöpfe ---------- */
/* Milchglas-Knöpfe; der Hauptknopf trägt den Verlauf. Gedrückt: leicht kleiner. */
.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 44px;
  padding: .55em 1.15em;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: var(--glas-blur);
  backdrop-filter: var(--glas-blur);
  color: var(--tusche);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .85), 0 6px 18px rgba(80, 60, 160, .12);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
  user-select: none;
}
.knopf:not(:disabled):hover { background: rgba(255, 255, 255, .75); }
.knopf:not(:disabled):active { transform: scale(.97); }
.knopf:disabled { opacity: .45; cursor: not-allowed; }
.knopf:focus-visible, .ikon-knopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: 3px; }
.knopf.haupt {
  background: var(--verlauf);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 12px 30px rgba(139, 92, 246, .38);
}
.knopf.haupt:not(:disabled):hover { background: linear-gradient(135deg, #9a6cff, #f25aa6); }
.knopf.sonne { background: var(--verlauf); color: #fff; box-shadow: 0 6px 18px rgba(139, 92, 246, .3); }
/* „Dazu“-Knöpfe und Bestätigen: getöntes Violett. Bis A.6.0.1 fast schwarz — ein Rest aus dem
   dunklen Look A.3, im Glas der schwerste Fleck auf der Werkbank. */
.knopf.minze { background: rgba(139, 92, 246, .16); color: #5b21b6; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .28); }
.knopf.minze:not(:disabled):hover { background: rgba(139, 92, 246, .24); }
.knopf.leise { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(30, 27, 58, .3); }
.knopf.leise:not(:disabled):hover { background: transparent; text-decoration-color: currentColor; }
.knopf svg { width: 1.15em; height: 1.15em; flex: none; }

.ikon-knopf {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: var(--glas-blur);
  backdrop-filter: var(--glas-blur);
  color: var(--tusche);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .85), 0 6px 18px rgba(80, 60, 160, .12);
  cursor: pointer;
  padding: 0;
  transition: transform .1s ease, background .15s ease;
}
.ikon-knopf svg { width: 20px; height: 20px; }
.ikon-knopf:not(:disabled):hover { background: rgba(255, 255, 255, .75); }
.ikon-knopf:not(:disabled):active { transform: scale(.94); }
.ikon-knopf[aria-pressed="false"] { color: var(--tusche-weich); background: rgba(255, 255, 255, .3); }
.ikon-knopf.klein { width: 36px; height: 36px; }
.ikon-knopf.klein svg { width: 17px; height: 17px; }

/* ---------- Kopfleiste ---------- */
.kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
}
.kopf .logo-klein {
  font-family: var(--schrift-titel);
  font-weight: 800;
  font-size: 1.5rem;
  text-decoration: none;
  color: var(--tusche);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kopf .platz { flex: 1; }

/* ---------- Schriftzug ZOK ---------- */
.zok-schrift {
  font-family: var(--schrift-titel);
  font-weight: 800;
  letter-spacing: -.045em;
  background: var(--verlauf);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Meldung unten ---------- */
.meldung {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 160%);
  max-width: min(92vw, 460px);
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(30, 27, 58, .85);
  -webkit-backdrop-filter: var(--glas-blur);
  backdrop-filter: var(--glas-blur);
  color: #fff;
  font-weight: 550;
  box-shadow: var(--schatten-gross);
  transition: transform .3s cubic-bezier(.3, 1.3, .5, 1);
  z-index: 60;
  pointer-events: none;
}
.meldung.sichtbar { transform: translate(-50%, 0); }
/* mit „Rückgängig“ (A.14.9.0): klickbar, Text und Knopf nebeneinander */
.meldung.mit-knopf { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; justify-content: center; padding: 8px 10px 8px 20px; }
.meldung.sichtbar.mit-knopf { pointer-events: auto; }
.meldung-knopf {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.meldung-knopf:hover { background: rgba(255, 255, 255, .26); }
.meldung-knopf:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Fuß ---------- */
.fuss {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  font-size: .85rem;
  color: var(--tusche-weich);
}
.fuss a { display: inline-block; padding: 8px 4px; margin: -8px -4px; color: var(--tusche-weich); } /* größere Tippfläche */

.nur-vorleser {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Rückfragen ---------- */
.zok-dialog {
  width: min(92vw, 460px);
  padding: 24px;
  border: 0;
  border-radius: 26px;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: var(--glas-blur);
  backdrop-filter: var(--glas-blur);
  color: var(--tusche);
  box-shadow: var(--schatten-gross);
}
.zok-dialog::backdrop { background: rgba(30, 27, 58, .25); backdrop-filter: blur(6px); }
.zok-dialog h2 { margin: 0 0 8px; font-size: 1.4rem; }
.zok-dialog p { margin: 0 0 16px; line-height: 1.5; }
.dialog-feld {
  width: 100%;
  margin: 4px 0 18px;
  padding: 12px 14px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--papier-2);
  font-weight: 500;
  resize: vertical;
}
.dialog-feld:focus { outline: none; border-color: var(--akzent); background: #fff; }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---------- Neue Fassung (A.15.2.0, js/offline.js) ---------- */
.neue-fassung {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom)); /* unten: oben läge er über Zurück/Bearbeiten */
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 6px 10px;
  max-width: min(94vw, 480px);
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: #1e1b3a;
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  box-shadow: var(--schatten-gross);
  transform: translate(-50%, 180%);
  transition: transform .35s cubic-bezier(.3, 1.3, .5, 1);
}
.neue-fassung.sichtbar { transform: translate(-50%, 0); }
body:has(.neue-fassung.sichtbar) .meldung { bottom: calc(80px + env(safe-area-inset-bottom)); }
.neue-fassung button { min-height: 40px; border: 0; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; }
.nf-laden { padding: 0 16px; background: #fff; color: #5b21b6; white-space: nowrap; }
.nf-zu { width: 40px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.3rem !important; line-height: 1; }
.neue-fassung button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Werkzeugwahl (A.14.10.0, js/werkzeugwahl.js) ---------- */
.werkzeug-wahl { width: min(94vw, 560px); max-height: min(90dvh, 760px); padding: 18px 18px 20px; overflow: auto; }
.ww-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ww-kopf h2 { margin: 0 !important; }
.ww-start { width: 100%; justify-content: flex-start; margin-bottom: 12px; }
.ww-konto { display: block; margin: 14px 4px 0; color: var(--tusche-weich); font-weight: 600; font-size: .92rem; text-align: center; }
.ww-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.ww-liste a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px 8px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .7);
  box-shadow: var(--schatten-klein);
  color: var(--tusche);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background .15s ease, translate .15s ease;
}
.ww-liste a:hover { background: #fff; translate: 0 -1px; }
.ww-liste a:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ww-liste a[aria-current="page"] { background: #6d28d9; color: #fff; } /* dunkler als --sonne: Weiß braucht 4,5:1 */
.ww-symbol { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: #ede9fe; color: #6d28d9; }
.ww-liste a[aria-current="page"] .ww-symbol { background: rgba(255, 255, 255, .22); color: #fff; }
.ww-symbol svg { width: 22px; height: 22px; }
@media (max-width: 380px) { .ww-liste { grid-template-columns: 1fr 1fr; } .ww-liste a { font-size: .92rem; } }

/* ---------- Sprechen (A.9.1.0) ----------
   Ohne Spracherkennung im Browser (Firefox) gibt es keinen Sprech-Knopf. */
html:not(.kann-sprechen) .nur-sprechen { display: none !important; }
.sprech-zeile { display: flex; align-items: center; gap: 12px; margin: -8px 0 18px; }
.sprech-zeile .knopf { flex: none; }
.sprech-stand { flex: 1; min-width: 0; margin: 0 !important; font-size: .9rem; line-height: 1.35 !important; color: rgba(30, 27, 58, .62); }
.sprech-stand .zwischen { color: var(--tusche); font-style: italic; }
.sprech-stand .fehler { color: #be185d; }
.knopf.hoert, .ikon-knopf.hoert { background: var(--verlauf); color: #fff; animation: zok-hoert 1.4s ease-in-out infinite; }
@keyframes zok-hoert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, .45); }
  50% { box-shadow: 0 0 0 9px rgba(236, 72, 153, 0); }
}

/* ---------- Rechtsseiten ---------- */
.recht {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 48px;
  line-height: 1.6;
  font-weight: 400;
}
.recht h1 { font-size: 2.3rem; margin: 12px 0 18px; }
.recht h2 { font-size: 1.3rem; margin: 28px 0 6px; }
.recht h3 { font-size: 1.08rem; margin: 18px 0 4px; }
.recht strong { font-weight: 650; }
.recht .zurueck { font-weight: 600; }
.recht .weiter { margin-top: 2rem; }
.recht code { background: var(--papier-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- Am Rechner: die Leertaste steht am Hauptknopf ----------
   Jedes Werkzeug startet mit der Leertaste (aria-keyshortcuts="Space"); ohne
   diesen Hinweis wusste das niemand. Nur bei feinem Zeiger, am Handy gibt es keine. */
@media (hover: hover) and (pointer: fine) {
  .knopf.haupt[aria-keyshortcuts]::after {
    content: "Leertaste";
    margin-left: .2em;
    padding: .2em .55em;
    border-radius: 7px;
    background: rgba(255, 255, 255, .2);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
    font-size: .58em;
    font-weight: 650;
    letter-spacing: .02em;
  }
}
