/* Shared design system. Feature styles live in poll.css / book.css / admin.css. */

@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url(../fonts/nunito-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url(../fonts/nunito-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url(../fonts/nunito-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url(../fonts/fredoka-latin-600-normal.woff2) format("woff2"); }

:root {
  --leaf-50: #f5f9ee;
  --leaf-100: #e6efd6;
  --leaf-200: #cbdfb0;
  --leaf-300: #a3c97f;
  --leaf-500: #4f8f45;
  --leaf-700: #2c5c33;
  --ink: #1e3322;
  --ink-soft: #566b58;
  --green: #d8eea0;
  --green-deep: #8db43a;
  --orange: #ffd59a;
  --orange-deep: #e48a2a;
  --berry: #ffc9b5;
  --berry-deep: #d65a3c;
  --red-soft: #fde0d6;
  --red: #c8442f;
  --white: #fff;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 6px 0 rgba(44, 92, 51, .14), 0 12px 30px rgba(44, 92, 51, .12);
  --font: "Nunito", ui-rounded, system-ui, -apple-system, sans-serif;
  --font-head: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--font); font-size: 17px; line-height: 1.5; color: var(--ink);
  background-color: var(--leaf-100);
  background-image: radial-gradient(circle at 20% 0%, rgba(163, 201, 127, .45), transparent 45%), radial-gradient(var(--leaf-200) 1.4px, transparent 1.6px);
  background-size: 100% 100%, 22px 22px;
}
[x-cloak] { display: none !important; }
img, video { max-width: 100%; }
a { color: var(--leaf-700); font-weight: 700; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .9em; }

/* layout */
.page { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; position: relative; }
.page.wide { max-width: 1100px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.hidden { display: none; }

/* card */
.card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px; position: relative;
}
.card.tint-green { background: #f1fbf3; }
.card.tint-orange { background: #fff6ec; }
.card.tint-pink { background: #fff1f6; }

/* buttons */
.btn {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  min-height: 50px; padding: 12px 22px; border-radius: 999px; color: var(--ink);
  background: var(--leaf-300); box-shadow: 0 4px 0 var(--leaf-500);
  transition: transform .08s ease, box-shadow .08s ease, opacity .2s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--leaf-500); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { display: flex; width: 100%; }
.btn-primary { background: var(--leaf-500); color: #fff; box-shadow: 0 4px 0 var(--leaf-700); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--leaf-700); }
.btn-green { background: var(--green); box-shadow: 0 4px 0 var(--green-deep); }
.btn-orange { background: var(--orange); box-shadow: 0 4px 0 var(--orange-deep); }
.btn-pink { background: var(--berry); box-shadow: 0 4px 0 var(--berry-deep); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--leaf-700); min-height: 44px; padding: 8px 14px; }
.btn-ghost:active:not(:disabled) { transform: none; box-shadow: none; background: var(--leaf-50); }
.btn-small { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--leaf-700); text-decoration: underline; cursor: pointer; }

/* forms */
.field { display: block; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--leaf-50);
  border: 2px solid var(--leaf-200); border-radius: var(--radius-sm); padding: 12px 14px; outline: none;
  transition: border-color .15s, background .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--leaf-500); background: #fff; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-weight: 700; }
.check input { width: 24px; height: 24px; accent-color: var(--leaf-500); flex: none; margin-top: 1px; }

/* toggle switch (used for "Persönlich") */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 48px; height: 28px; border-radius: 999px; background: var(--leaf-200); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.15); transition: transform .2s; }
.switch input:checked + .track { background: var(--red); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--leaf-300); outline-offset: 2px; }

/* chips & badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--leaf-200); background: #fff;
  border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
}
.chip.on { background: var(--green); border-color: var(--green-deep); }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 800; background: var(--leaf-100); color: var(--leaf-700); }
.badge.green { background: var(--green); color: #2e6b3f; }
.badge.orange { background: var(--orange); color: #8a4b12; }
.badge.pink { background: var(--berry); color: #8c2f50; }
.badge.red { background: var(--red-soft); color: var(--red); }

/* progress */
.progress { height: 12px; background: var(--leaf-200); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--green-deep), var(--leaf-500)); border-radius: 999px; transition: width .3s ease; }

/* messages */
.error-box { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 100; max-width: calc(100% - 32px); text-align: center;
}

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 51, 34, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); padding: 26px 22px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }

/* header with logo */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.logo { font-family: var(--font-head); font-size: 1.15rem; color: var(--leaf-700); display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo .dot { width: 30px; height: 30px; border-radius: 50%; background: var(--green); display: grid; place-items: center; font-size: 16px; }

/* jungle decoration: vines on top, monstera leaves in the corners, dangling spiders */
.page { z-index: 1; }
.jungle-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.jungle-deco .vines { position: absolute; top: -6px; left: 0; right: 0; height: 80px; background: url(../img/vine.svg) repeat-x 0 0 / 240px 80px; opacity: .9; }
.jungle-deco .leaf { position: absolute; width: 190px; opacity: .35; }
.jungle-deco .leaf-bl { left: -50px; bottom: -40px; transform: rotate(25deg); }
.jungle-deco .leaf-br { right: -60px; bottom: 60px; transform: rotate(-120deg) scaleX(-1); }
.jungle-deco .spider { position: absolute; top: 0; width: 58px; transform-origin: 50% 0; animation: dangle 8s ease-in-out infinite; }
.jungle-deco .spider::before { content: ""; display: block; width: 2px; height: var(--len, 120px); margin: 0 auto; background: rgba(30, 51, 34, .55); }
.jungle-deco .spider img { display: block; width: 100%; margin-top: -11%; } /* spinnerets sit ~10% below the image top */
.jungle-deco .spider.small { width: 44px; }
.jungle-deco .spider.tiny { width: 32px; }
@keyframes dangle {
  0%, 100% { transform: translateY(-30px) rotate(3deg); }
  40% { transform: translateY(12px) rotate(-4deg); }
  60% { transform: translateY(6px) rotate(2deg); }
}

/* screen transition */
.screen { animation: pop .28s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 640px) {
  .page { padding-top: 36px; }
  .card { padding: 28px; }
}
