:root {
  --papier: #fcfbf6;
  --linie: #bcd4ee;
  --rand: #e9a1a1;
  --graphit: #2e2e2e;
  --graphit-hell: #6c6a66;
  --rotstift: #c2362b;
  --zettel: #fff27a;
  --zettel-schatten: rgba(80, 64, 0, .22);
  --zeile: 36px;
  --rand-x: 88px;
}
* { box-sizing: border-box; }
html { background: var(--papier); }
body {
  margin: 0; color: var(--graphit); min-height: 100vh;
  font-family: "Patrick Hand", "Comic Neue", cursive;
  font-size: 22px; line-height: var(--zeile);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--zettel); color: var(--graphit); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px dashed var(--graphit); outline-offset: 3px; border-radius: 3px; }

/* das Blatt: blaue Linien, roter Rand, ein Hauch Papierkorn */
.blatt {
  position: relative; min-height: 100vh;
  padding: calc(var(--zeile) * 1) 40px calc(var(--zeile) * 2) calc(var(--rand-x) + 30px);
  background:
    linear-gradient(90deg, transparent calc(var(--rand-x) - 1px), var(--rand) calc(var(--rand-x) - 1px), var(--rand) calc(var(--rand-x) + 1px), transparent calc(var(--rand-x) + 1px)),
    repeating-linear-gradient(180deg, transparent 0, transparent calc(var(--zeile) - 1px), var(--linie) calc(var(--zeile) - 1px), var(--linie) var(--zeile)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .42  0 0 0 0 .35  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    var(--papier);
  background-position: 0 0, 0 calc(var(--zeile) * 2), 0 0, 0 0;
}

.kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: var(--zeile); }
.kopf h1 { margin: 0; font-weight: 400; font-size: 44px; line-height: calc(var(--zeile) * 2); letter-spacing: .3px; }
.kopf h1 span { color: var(--rotstift); white-space: nowrap; }
.kopf-links { display: flex; gap: 22px; }
.stift-link {
  all: unset; cursor: pointer; color: var(--graphit-hell); font-size: 20px;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; text-decoration-color: rgba(46, 46, 46, .35);
}
.stift-link:hover { color: var(--graphit); text-decoration-color: var(--graphit); }
.stift-link:focus-visible { outline: 2px dashed var(--graphit); outline-offset: 3px; }

.buehne { display: grid; grid-template-columns: minmax(240px, 330px) minmax(0, 1fr); gap: 56px; align-items: start; max-width: 1080px; }
.galgen-ort { display: grid; justify-items: center; }
#galgen { width: 100%; height: auto; overflow: visible; }
#galgen path { fill: none; stroke: var(--graphit); stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; filter: url(#graphit); }
#galgen path.rot { stroke: var(--rotstift); stroke-width: 3; }
.fehler-zahl { margin: 0; color: var(--graphit-hell); font-size: 21px; }
.fehler-zahl.knapp { color: var(--rotstift); }

/* #881: zwischen 860 und ~1150 px Fensterbreite brach ein 7- oder 8-Buchstaben-Wort in zwei Zeilen um; jetzt schrumpfen die Felder */
.wort { display: flex; flex-wrap: nowrap; gap: 14px clamp(8px, 1.4vw, 18px); margin: calc(var(--zeile) * 2) 0 var(--zeile); min-height: calc(var(--zeile) * 2); }
.feld {
  position: relative; width: clamp(34px, 4.6vw, 52px); height: calc(var(--zeile) * 2);
  display: grid; place-items: end center; font-size: clamp(44px, 5.6vw, 62px); line-height: 1; padding-bottom: 8px;
  text-transform: uppercase;
}
.feld svg { position: absolute; left: -2px; right: -2px; bottom: 0; width: calc(100% + 4px); height: 8px; overflow: visible; }
.feld svg path { fill: none; stroke: var(--graphit); stroke-width: 3.6; stroke-linecap: round; filter: url(#graphit); }
.feld .b { display: inline-block; transform-origin: 50% 90%; }
.feld .b.neu { animation: schreiben .38s cubic-bezier(.2, .9, .3, 1.2) both; }
.feld .b.verpasst { color: var(--rotstift); }
@keyframes schreiben { from { opacity: 0; transform: translateY(-6px) rotate(-6deg) scale(.7); } to { opacity: 1; transform: none; } }

.hinweis { margin: 0 0 var(--zeile); color: var(--graphit-hell); font-size: 23px; min-height: var(--zeile); }

.alphabet { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px 4px; max-width: 640px; }
.taste {
  all: unset; position: relative; height: 54px; display: grid; place-items: center; cursor: pointer;
  font-size: 36px; text-transform: uppercase; border-radius: 6px; transition: transform .12s ease-out, color .2s;
  transform: rotate(var(--r, 0deg));
}
.taste:hover:not([disabled]) { transform: translateY(-2px) rotate(calc(var(--r, 0deg) - 3deg)); }
.taste:focus-visible { outline: 2px dashed var(--graphit); outline-offset: 0; }
.taste[disabled] { cursor: default; color: rgba(46, 46, 46, .38); }
.taste svg { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); overflow: visible; pointer-events: none; }
.taste svg path { fill: none; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; filter: url(#graphit); }
.taste.treffer { color: var(--graphit); }
.taste.treffer svg path { stroke: var(--graphit); }
.taste.daneben svg path { stroke: var(--rotstift); }

.zeichnen { stroke-dasharray: var(--l); stroke-dashoffset: var(--l); animation: zeichnen var(--d, .45s) ease-out forwards; }
@keyframes zeichnen { to { stroke-dashoffset: 0; } }

.ende { margin-top: var(--zeile); max-width: 640px; }
.ende-titel { margin: 0; font-size: 34px; line-height: calc(var(--zeile) * 1.5); }
.ende-titel b { color: var(--rotstift); font-weight: 400; text-transform: uppercase; letter-spacing: 2px; }
.ende-wechsel { margin: 6px 0 var(--zeile); color: var(--graphit-hell); font-size: 23px; }
.ende-wechsel s { text-decoration-color: var(--rotstift); text-decoration-thickness: 2px; }
.stift-knopf {
  all: unset; cursor: pointer; font-size: 28px; padding: 2px 14px; border: 2.5px solid var(--graphit);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; transition: transform .12s, background .2s;
}
.stift-knopf:hover { transform: rotate(-1.5deg); background: rgba(255, 242, 122, .55); }
.stift-knopf:focus-visible { outline: 2px dashed var(--graphit); outline-offset: 4px; }

/* der Haftzettel: das Hirn des Computers */
.zettel {
  position: absolute; top: calc(var(--zeile) * 4); right: 36px; width: 268px;
  background: var(--zettel); padding: 14px 18px 18px; transform: rotate(2.2deg);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .06), 0 10px 18px -8px var(--zettel-schatten), 0 22px 30px -22px var(--zettel-schatten);
  line-height: 28px; font-size: 20px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 30%);
}
.zettel::before {
  content: ""; position: absolute; top: -12px; left: 50%; width: 92px; height: 26px; transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 255, 255, .55); box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.zettel-griff { all: unset; cursor: pointer; font-size: 21px; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.zettel-griff:focus-visible { outline: 2px dashed var(--graphit); outline-offset: 3px; }
.zettel-titel { margin: 10px 0 2px; color: #5e4f10; }
.gedanken { list-style: none; margin: 0 0 8px; padding: 0; font-size: 26px; text-transform: lowercase; }
.gedanken li { line-height: 32px; }
.gedanken li.alt { color: #6e5d16; text-decoration: line-through; text-decoration-color: var(--rotstift); text-decoration-thickness: 2.5px; font-size: 22px; }
.gedanken li.jetzt { animation: schreiben .4s ease-out both; }
.moeglich { margin: 0; }
.moeglich b { font-weight: 400; font-size: 26px; font-variant-numeric: tabular-nums; }
.beispiele { margin: 4px 0 0; color: #5e4f10; font-size: 18px; line-height: 24px; word-spacing: 4px; }

@media (min-width: 1241px) {
  .blatt { padding-right: 340px; }
}
@media (max-width: 1240px) {
  .zettel { position: relative; top: auto; right: auto; margin: calc(var(--zeile) * 1.5) 0 0 auto; transform: rotate(1.4deg); }
}
@media (max-width: 860px) {
  :root { --rand-x: 26px; }
  .blatt { padding: 12px 16px calc(var(--zeile) * 2) calc(var(--rand-x) + 14px); }
  .kopf { margin-bottom: 10px; gap: 4px 18px; }
  .kopf h1 { font-size: 34px; line-height: 40px; }
  .kopf h1 span { display: block; }
  .kopf-links { gap: 16px; }
  .stift-link { font-size: 18px; }
  .buehne { grid-template-columns: 1fr; gap: 6px; }
  .galgen-ort { max-width: 210px; margin: 0 auto; }
  .wort { margin: 8px 0 12px; gap: 10px 10px; justify-content: center; }
  .feld { width: 34px; font-size: 44px; height: 60px; }
  .hinweis { text-align: center; font-size: 21px; margin-bottom: 10px; }
  .alphabet { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px 2px; max-width: none; }
  .taste { height: 48px; font-size: 32px; }
  .ende { text-align: center; }
  .zettel { margin: 28px auto 0; width: min(300px, 100%); }
}
@media (prefers-reduced-motion: reduce) {
  .zeichnen { animation: none; stroke-dashoffset: 0; }
  .feld .b.neu, .gedanken li.jetzt { animation: none; }
  .taste:hover:not([disabled]) { transform: rotate(var(--r, 0deg)); }
}
