/* =========================================================
   Scratch-Coaching – "gezeichneter" Look
   Papier, Tinte, Textmarker und ein bisschen Klebeband.
   ========================================================= */

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/caveat-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/caveat-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Patrick Hand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/patrickhand-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Patrick Hand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/patrickhand-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #fbf7ee;
  --paper-2: #f4eddd;
  --paper-3: #ebe1ca;
  --card: #fffdf8;
  --ink: #2d2a32;
  --ink-soft: #5f5a68;
  --ink-faint: #9a94a3;
  --grid: rgba(76, 151, 255, .10);
  --orange: #ff8c1a;
  --orange-soft: #ffe2c2;
  --blue: #4c97ff;
  --blue-soft: #dbe9ff;
  --green: #3fb46b;
  --green-soft: #d5f2df;
  --red: #e5484d;
  --red-soft: #fde0e0;
  --yellow: #ffd84a;
  --purple: #9966ff;
  --pink: #ff6fa0;
  --hand: 'Caveat', 'Comic Sans MS', cursive;
  --ui: 'Patrick Hand', 'Comic Sans MS', system-ui, sans-serif;
  --wobble-a: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble-b: 18px 225px 18px 255px / 255px 18px 225px 18px;
  --wobble-c: 30px 10px 25px 8px / 8px 25px 10px 30px;
  --shadow: 3px 4px 0 var(--ink);
  --shadow-soft: 0 10px 30px -12px rgba(45, 42, 50, .35);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--ui);
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .hand {
  font-family: var(--hand);
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
}
h1 { font-size: clamp(40px, 6vw, 64px); }
h2 { font-size: 36px; }
h3 { font-size: 28px; }

a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--orange); }

p { margin: 0 0 .8em; }

/* ---------- gezeichnete Kästen ---------- */

.sketch {
  position: relative;
  background: var(--card);
  border-radius: var(--wobble-c);
}
.sketch::before {
  content: '';
  position: absolute;
  inset: -1px;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble-a);
  pointer-events: none;
  filter: url(#wobble);
}
.sketch.alt::before { border-radius: var(--wobble-b); }
.sketch.shadow { box-shadow: 5px 6px 0 rgba(45, 42, 50, .85); }

.tape {
  position: absolute;
  width: 110px;
  height: 30px;
  background: rgba(255, 216, 74, .55);
  border-left: 2px dashed rgba(255,255,255,.6);
  border-right: 2px dashed rgba(255,255,255,.6);
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  z-index: 2;
}
.tape.blue { background: rgba(76, 151, 255, .35); }
.tape.pink { background: rgba(255, 111, 160, .35); }
.tape.left { left: 18px; transform: rotate(-8deg); }
.tape.right { left: auto; right: 18px; transform: rotate(7deg); }

.marker {
  background: linear-gradient(100deg, transparent 2%, rgba(255, 216, 74, .75) 4%, rgba(255, 216, 74, .6) 94%, transparent 97%);
  padding: 0 .2em;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.squiggle {
  display: block;
  height: 14px;
  width: 100%;
  max-width: 340px;
  margin-top: 4px;
}

/* ---------- Buttons ---------- */

.btn {
  --bg: var(--card);
  --fg: var(--ink);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 19px;
  color: var(--fg);
  background: var(--bg);
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble-a);
  padding: 7px 18px 6px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { transform: translate(-1px, -2px) rotate(-.6deg); box-shadow: 5px 6px 0 var(--ink); color: var(--fg); }
.btn:active { transform: translate(2px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible { outline: 3px dashed var(--blue); outline-offset: 4px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { --bg: var(--orange); --fg: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn.blue { --bg: var(--blue); --fg: #fff; }
.btn.green { --bg: var(--green); --fg: #fff; }
.btn.danger { --bg: var(--red-soft); --fg: #9b1c20; }
.btn.ghost { box-shadow: none; border-style: dashed; background: transparent; }
.btn.ghost:hover { box-shadow: none; background: rgba(255,255,255,.6); }
.btn.small { font-size: 16px; padding: 3px 12px 2px; box-shadow: 2px 3px 0 var(--ink); }
.btn.big { font-size: 24px; padding: 10px 26px 9px; }
.btn svg { width: 20px; height: 20px; flex: none; }

.icon-btn {
  appearance: none;
  border: 2px solid var(--ink);
  background: var(--card);
  width: 40px;
  height: 40px;
  border-radius: var(--wobble-b);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 2px 3px 0 var(--ink);
  transition: transform .1s, background .15s;
  padding: 0;
}
.icon-btn:hover { transform: translateY(-1px) rotate(-3deg); }
.icon-btn:active { transform: translate(1px, 2px); box-shadow: none; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.on { background: var(--yellow); }
.icon-btn.off { background: var(--red-soft); color: #9b1c20; }

/* ---------- Formulare ---------- */

label { display: block; font-size: 17px; color: var(--ink-soft); margin: 0 0 4px; }

.field { margin-bottom: 16px; }
.field .hint { font-size: 15px; color: var(--ink-faint); margin-top: 3px; }

input[type=text], input[type=email], input[type=url], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  font: inherit;
  font-size: 19px;
  color: var(--ink);
  width: 100%;
  padding: 8px 12px 7px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--wobble-b);
  outline: none;
  transition: box-shadow .15s, transform .15s;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.35; }
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 4px rgba(76, 151, 255, .25), 3px 3px 0 var(--blue);
}
input::placeholder, textarea::placeholder { color: #b8b2c0; }

.checkbox { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ink); }
.checkbox input { width: 22px; height: 22px; accent-color: var(--orange); }

/* ---------- Layout-Helfer ---------- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }
.hidden { display: none !important; }

.pill {
  display: inline-block;
  font-size: 15px;
  padding: 1px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 999px 900px 999px 950px;
  background: #fff;
}
.pill.orange { background: var(--orange-soft); }
.pill.blue { background: var(--blue-soft); }
.pill.green { background: var(--green-soft); }
.pill.red { background: var(--red-soft); }

/* ---------- Dialog ---------- */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 50, .35);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 100;
  animation: fade .18s ease;
}
.dialog {
  width: min(560px, 100%);
  padding: 34px 30px 26px;
  animation: pop .28s cubic-bezier(.2, 1.4, .4, 1);
}
.dialog .tape { top: -16px; }
.dialog > .dialog-scroll {
  max-height: calc(100vh - 110px);
  overflow: auto;
  margin: -6px -10px -6px;
  padding: 6px 10px 6px;
}
.dialog .close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: none;
  font-family: var(--hand);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}
.dialog .close:hover { color: var(--red); transform: rotate(8deg); }

@keyframes pop { from { transform: scale(.85) rotate(-2deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }

/* ---------- Toast ---------- */

.toast-zone {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 8px 18px 7px;
  border-radius: var(--wobble-a);
  font-size: 18px;
  box-shadow: 3px 4px 0 rgba(0,0,0,.2);
  animation: pop .25s ease;
  max-width: min(90vw, 560px);
  text-align: center;
}
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- Doodles ---------- */

.doodle { stroke: var(--ink); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.doodle .fill-o { fill: var(--orange-soft); }
.doodle .fill-b { fill: var(--blue-soft); }
.doodle .fill-y { fill: rgba(255, 216, 74, .6); }
.doodle .fill-w { fill: #fff; }
.doodle .thin { stroke-width: 1.8; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

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