@font-face {
  font-family: "Nunito";
  src: url("/Nunito.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --matte: #2b5d4f;           /* Schneidematte */
  --matte-linie: rgba(255, 255, 255, 0.06);
  --matte-linie-stark: rgba(255, 255, 255, 0.13);
  --tinte: #1a1a1a;           /* Schnittkontur */
  --text: #26303a;
  --text-leise: #4a5560;
  --papier: #ffffff;
  --fehler: #b42318;
  --fokus: #f7c531;

  --bullauge: #98e1ba;        /* werden per Skript gesetzt */
  --nummer: #23764a;
  --knopf: #2e9e62;
  --knopf-text: #ffffff;

  --schrift: "Nunito", "Nunito Sans", ui-rounded, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--schrift);
  color: var(--text);
  background-color: var(--matte);
  background-image:
    linear-gradient(var(--matte-linie-stark) 1px, transparent 1px),
    linear-gradient(90deg, var(--matte-linie-stark) 1px, transparent 1px),
    linear-gradient(var(--matte-linie) 1px, transparent 1px),
    linear-gradient(90deg, var(--matte-linie) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
}

.werkbank {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px;
}

/* ---------- Bedienzettel ---------- */
.zettel {
  background: var(--papier);
  border: 4px solid var(--tinte);
  border-radius: 20px;
  padding: 28px 26px 24px;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 1.2rem + 1.4vw, 2.2rem);
  hyphens: manual;
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--tinte);
}

.unterzeile {
  margin: 6px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-leise);
}

.intro {
  margin: 14px 0 16px;
  font-size: 1rem;
  line-height: 1.5;
}

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

.farben {
  margin: 0;
  padding: 0;
  border: 0;
}

.farbe {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
}

.farbe label,
.farbe p { margin: 0; cursor: pointer; }
.farbe.abgeleitet p { cursor: default; }

.name {
  display: block;
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.25;
}

.wo {
  display: block;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-leise);
}

.hex {
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-leise);
}

/* Farbwähler als runde Farbtupfer mit Schnittkontur */
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 4px solid var(--tinte);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }

input[type="color"]:focus-visible,
.chips button:focus-visible,
.laden:focus-visible {
  outline: 3px solid var(--fokus);
  outline-offset: 3px;
}

/* Fenster wie im Bogen: Bullauge mit dickem Rahmen */
.bullauge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 7px solid var(--tinte);
  background: var(--bullauge);
}

.nummer {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--nummer);
  color: #fff;
  font-weight: 900;
  font-size: 0.95rem;
}

/* ---------- Fertige Kombinationen ---------- */
.vorlagen { margin-top: 18px; }

.vorlagen-titel {
  margin: 0 0 10px;
  font-weight: 800;
  font-size: 1.02rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 6px;
  border: 2px solid var(--tinte);
  border-radius: 999px;
  background: var(--papier);
  color: var(--tinte);
  font: 700 0.95rem/1.2 var(--schrift);
  cursor: pointer;
}

.chips button[aria-pressed="true"] {
  background: var(--tinte);
  color: var(--papier);
}

.tupfen { display: inline-flex; }
.tupfen span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--tinte);
}
.tupfen span + span { margin-left: -5px; }
.chips button[aria-pressed="true"] .tupfen span { border-color: var(--papier); }

/* ---------- Download ---------- */
.laden {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  margin-top: 24px;
  padding: 0 18px;
  border: 4px solid var(--tinte);
  border-radius: 16px;
  background: var(--knopf);
  color: var(--knopf-text);
  font-weight: 900;
  font-size: 1.15rem;
  text-decoration: none;
  box-shadow: 0 5px 0 var(--tinte);
}

.laden:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--tinte); }
.laden[aria-busy="true"] { cursor: progress; opacity: 0.8; }

@media (prefers-reduced-motion: no-preference) {
  .laden { transition: transform 80ms ease-out, box-shadow 80ms ease-out; }
}

.status {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}
.status.fehler { color: var(--fehler); }

.tipp {
  margin: 4px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-leise);
}

/* ---------- Vorschau ---------- */
.vorschau {
  display: flex;
  justify-content: center;
}

.blatt {
  display: grid;
  place-items: center;
  width: min(100%, calc((100vh - 64px) * 210 / 297));
  aspect-ratio: 210 / 297;
  background: var(--papier);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 22px 44px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.blatt svg {
  display: block;
  width: 100%;
  height: 100%;
}

.laedt {
  margin: 0;
  padding: 24px;
  color: var(--text-leise);
  font-weight: 700;
  text-align: center;
}
.laedt.fehler { color: var(--fehler); }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 900px) {
  .werkbank {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 16px;
  }
  .zettel { padding: 22px 18px 20px; }
  .blatt { width: 100%; }
}
