/* ---------- Design-Tokens: Strichtafel-Look ---------- */
:root {
  --tafel-bg: #0f1210;
  --tafel-bg-2: #161a16;
  --kreide: #f5f1e2;
  --kreide-weich: rgba(245, 241, 226, 0.78);
  --kreide-schwach: rgba(245, 241, 226, 0.45);
  --kreide-linie: rgba(245, 241, 226, 0.18);
  --akzent: #ffd27a;
  --warn: #ff8a6b;
  --ok: #9bd89b;

  --rahmen: #3a2a17;
  --rahmen-hell: #6b4b28;

  --radius-m: 14px;
  --radius-l: 22px;

  --schrift-hand: "Bradley Hand", "Segoe Print", "Comic Sans MS", "Chalkduster", cursive;
  --schrift-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--schrift-ui);
  color: var(--kreide);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,0.04), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(255,255,255,0.03), transparent 60%),
    linear-gradient(160deg, var(--tafel-bg), var(--tafel-bg-2));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* feine Kreidestaub-Textur */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(245,241,226,0.035) 1px, transparent 1px),
    radial-gradient(rgba(245,241,226,0.025) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: screen;
  opacity: 0.6;
  z-index: 0;
}

/* ---------- Header ---------- */
.tafel-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  border-bottom: 2px solid var(--kreide-linie);
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0));
  flex-shrink: 0;
}

.logo {
  width: clamp(56px, 7vw, 84px);
  height: clamp(56px, 7vw, 84px);
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55));
  flex-shrink: 0;
}

.titel-block { flex: 1; min-width: 0; }

.titel-block h1 {
  font-family: var(--schrift-hand);
  font-weight: 700;
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0.5px;
  color: var(--kreide);
  text-shadow: 0 1px 0 rgba(0,0,0,0.4);
  line-height: 1.1;
}

.untertitel {
  margin: 1px 0 0;
  font-family: var(--schrift-hand);
  color: var(--kreide-schwach);
  font-size: clamp(12px, 1.3vw, 16px);
}

.hinzu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  color: var(--kreide);
  border: 2px dashed var(--kreide-weich);
  border-radius: var(--radius-l);
  font-family: var(--schrift-hand);
  font-size: clamp(15px, 1.6vw, 18px);
  cursor: pointer;
  transition: transform 120ms ease, background-color 180ms ease, border-color 180ms ease;
  min-height: 44px;
}

.hilfe-btn {
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 50%;
  border: 2px solid var(--kreide-weich);
  background: transparent;
  color: var(--kreide);
  font-family: var(--schrift-hand);
  font-size: 22px;
  cursor: pointer;
  transition: transform 120ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.hilfe-btn:active {
  transform: scale(0.9);
  background: rgba(255, 210, 122, 0.14);
  border-color: var(--akzent);
  color: var(--akzent);
}

/* Vollbild-Button (⛶ Toggle) */
.vollbild-btn {
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 50%;
  border: 2px solid var(--kreide-weich);
  background: transparent;
  color: var(--kreide);
  cursor: pointer;
  transition: transform 120ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
  flex-shrink: 0;
  padding: 0;
  display: grid;
  place-items: center;
}
.vollbild-btn .ico { display: none; }
.vollbild-btn .ico-enter { display: block; }
.vollbild-btn.vollbild-aktiv {
  border-color: var(--akzent);
  color: var(--akzent);
  background: rgba(255, 210, 122, 0.1);
}
.vollbild-btn.vollbild-aktiv .ico-enter { display: none; }
.vollbild-btn.vollbild-aktiv .ico-exit { display: block; }
.vollbild-btn:active {
  transform: scale(0.9);
  background: rgba(255, 210, 122, 0.14);
  border-color: var(--akzent);
  color: var(--akzent);
}

.hinzu-btn .plus {
  font-size: 1.4em;
  line-height: 1;
  transform: translateY(-1px);
}

.hinzu-btn:active {
  transform: scale(0.96);
  background: rgba(245,241,226,0.08);
  border-color: var(--akzent);
  color: var(--akzent);
}

/* ---------- Tafel / Listenbereich ---------- */
.tafel {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.tafel-rahmen {
  position: absolute;
  inset: 4px;
  border: 4px solid var(--rahmen);
  border-radius: var(--radius-l);
  box-shadow:
    inset 0 0 0 2px var(--rahmen-hell),
    inset 0 0 30px rgba(0,0,0,0.55),
    0 4px 16px rgba(0,0,0,0.45);
  pointer-events: none;
}

.freundes-liste {
  list-style: none;
  margin: 0;
  padding: 10px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
}

/* ---------- Freund-Karte ---------- */
.freund {
  position: relative;
  background: rgba(255,255,255,0.02);
  border: 1.5px solid var(--kreide-linie);
  border-radius: var(--radius-m);
  padding: 16px 16px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 10px 14px;
  align-items: center;
  backdrop-filter: blur(1px);
}

.freund.zahlt {
  border-color: rgba(255, 138, 107, 0.55);
  background: rgba(255, 138, 107, 0.06);
}

.freund.frei {
  border-color: rgba(155, 216, 155, 0.45);
}

.freund.kredit {
  border-color: rgba(255, 210, 122, 0.6);
  background: rgba(255, 210, 122, 0.05);
}

.freund .name {
  font-family: var(--schrift-hand);
  font-size: clamp(24px, 2.4vw, 32px);
  color: var(--kreide);
  line-height: 1.1;
  word-break: break-word;
  min-width: 0;
  padding-right: 96px;
}

.freund .status {
  grid-column: 1 / -1;
  font-family: var(--schrift-hand);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: 6px 8px 8px;
  color: var(--kreide-schwach);
  text-align: center;
  min-height: 50px;
}

.status .zahl {
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1;
  font-weight: 700;
  color: var(--kreide);
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
  letter-spacing: 0.5px;
}
.status .zahl-icon {
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1;
}
.status .zahl-label {
  font-size: clamp(16px, 1.6vw, 20px);
  color: var(--kreide-schwach);
  line-height: 1.1;
}
.status .frei-label {
  font-size: clamp(20px, 2.2vw, 28px);
  color: var(--ok);
  line-height: 1;
}

.freund.zahlt .status .zahl { color: var(--warn); text-shadow: 0 0 12px rgba(255,138,107,0.35); }
.freund.zahlt .status .zahl-label { color: var(--warn); opacity: 0.85; }
.freund.kredit .status .zahl { color: var(--akzent); text-shadow: 0 0 12px rgba(255,210,122,0.4); }
.freund.kredit .status .zahl-label { color: var(--akzent); opacity: 0.85; }

.freund .loesch {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--kreide-linie);
  color: var(--kreide-schwach);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 150ms ease, color 150ms ease, transform 100ms ease;
  padding: 0;
  line-height: 1;
}
.freund .loesch:active {
  background: rgba(255,138,107,0.15);
  color: var(--warn);
  transform: scale(0.92);
}

/* ---------- Striche (Tally) ---------- */
.striche {
  grid-column: 1 / -1;
  min-height: 56px;
  padding: 6px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  border-top: 1px dashed var(--kreide-linie);
  border-bottom: 1px dashed var(--kreide-linie);
}

.strich-gruppe {
  position: relative;
  display: inline-flex;
  gap: 5px;
  align-items: flex-end;
  height: 40px;
  padding: 0 3px;
}

.strich {
  width: 3px;
  height: 36px;
  background: var(--kreide);
  border-radius: 2px;
  box-shadow: 0 0 5px rgba(245,241,226,0.35);
  transform-origin: bottom center;
  animation: strich-zeichnen 260ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

/* Kredit-Striche: goldene Farbe */
.striche.kredit .strich {
  background: var(--akzent);
  box-shadow: 0 0 7px rgba(255, 210, 122, 0.55);
}
.striche.kredit .strich-gruppe.voll::after {
  background: var(--akzent);
  box-shadow: 0 0 9px rgba(255, 210, 122, 0.6);
}
.striche.kredit::before {
  content: "\20AC";
  font-family: var(--schrift-hand);
  font-size: 28px;
  color: var(--akzent);
  align-self: center;
  opacity: 0.8;
  margin-right: 4px;
}

.strich:nth-child(1) { transform: rotate(-4deg); }
.strich:nth-child(2) { transform: rotate(2deg); }
.strich:nth-child(3) { transform: rotate(-1deg); }
.strich:nth-child(4) { transform: rotate(3deg); }

/* 5er: Querstrich */
.strich-gruppe.voll::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: 50%;
  height: 5px;
  background: var(--kreide);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(245,241,226,0.5);
  transform: rotate(-18deg);
  animation: querstrich 300ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes strich-zeichnen {
  from { transform: scaleY(0) rotate(var(--r, 0deg)); opacity: 0; }
  to   { opacity: 1; }
}
@keyframes querstrich {
  from { transform: rotate(-18deg) scaleX(0); opacity: 0; }
  to   { transform: rotate(-18deg) scaleX(1); opacity: 1; }
}

/* ---------- + / − Buttons ---------- */
.aktionen {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

.kredit-leiste {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: 2px;
}
.kredit-btn {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: var(--akzent);
  border: 1.5px dashed rgba(255, 210, 122, 0.55);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--schrift-hand);
  font-size: clamp(15px, 1.5vw, 18px);
  min-height: 44px;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kredit-btn:active {
  background: rgba(255, 210, 122, 0.12);
  transform: scale(0.97);
}
.kredit-btn .euro { font-size: 1.3em; line-height: 1; }

.akt-btn {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  border: 2px solid var(--kreide-weich);
  background: transparent;
  color: var(--kreide);
  font-family: var(--schrift-hand);
  font-size: clamp(18px, 2vw, 22px);
  border-radius: var(--radius-m);
  min-height: 70px;
  cursor: pointer;
  transition: transform 80ms ease, background-color 180ms ease, border-color 180ms ease, color 180ms ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  line-height: 1.1;
}
.akt-btn .symbol {
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1;
}
.akt-btn .akt-label {
  font-size: clamp(14px, 1.5vw, 18px);
  color: var(--kreide-schwach);
}

/* "trinkt" = Haupt-Aktion, Bier holen */
.akt-btn.trinkt {
  border-color: rgba(245,241,226,0.65);
}
.akt-btn.trinkt:active {
  background: rgba(255,210,122,0.15);
  border-color: var(--akzent);
  color: var(--akzent);
  transform: scale(0.97);
}

/* "zahlt" = Bezahl-Aktion */
.akt-btn.zahlt {
  border-color: rgba(155,216,155,0.55);
}
.akt-btn.zahlt:active {
  background: rgba(155,216,155,0.15);
  border-color: var(--ok);
  color: var(--ok);
  transform: scale(0.97);
}

/* Alte Klassen noch unterstuetzen fuer evtl. Cache */
.akt-btn.plus:active { background: rgba(155,216,155,0.14); border-color: var(--ok); color: var(--ok); transform: scale(0.97); }
.akt-btn.minus:active { background: rgba(255,138,107,0.14); border-color: var(--warn); color: var(--warn); transform: scale(0.97); }
.akt-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Ripple-Feedback */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: currentColor;
  opacity: 0.25;
  pointer-events: none;
  animation: ripple 500ms ease-out forwards;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* Pop-Animation beim Zählerwechsel */
.zaehler-pop {
  animation: pop 240ms ease;
}
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ---------- Leer-Hinweis ---------- */
.leer-hinweis {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  font-family: var(--schrift-hand);
  color: var(--kreide-schwach);
  padding: 20px;
  pointer-events: none;
}
.leer-hinweis p { margin: 4px 0; font-size: clamp(18px, 2vw, 26px); }
.leer-hinweis .leer-sub { color: var(--kreide-schwach); }
.leer-hinweis.versteckt { display: none; }

/* ---------- Dialoge ---------- */
.kreide-dialog {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--kreide);
  max-width: min(92vw, 440px);
  width: 100%;
}
.kreide-dialog::backdrop {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
.kreide-dialog form {
  background: linear-gradient(180deg, #1a1e1a, #121512);
  border: 2px solid var(--kreide-linie);
  border-radius: var(--radius-l);
  padding: 22px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.kreide-dialog h2 {
  font-family: var(--schrift-hand);
  margin: 0 0 14px;
  font-size: 28px;
}
.kreide-dialog label {
  display: block;
  font-family: var(--schrift-hand);
  color: var(--kreide-schwach);
  margin-bottom: 6px;
  font-size: 18px;
}
.kreide-dialog input {
  width: 100%;
  padding: 14px 14px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--kreide-linie);
  border-radius: 12px;
  color: var(--kreide);
  font-family: var(--schrift-hand);
  font-size: 24px;
  outline: none;
}
.kreide-dialog input:focus {
  border-color: var(--akzent);
}
.dialog-hinweis {
  font-family: var(--schrift-hand);
  color: var(--kreide-schwach);
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.3;
}

.schnell-tasten {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.schnell-tasten button {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: var(--akzent);
  border: 1.5px solid rgba(255, 210, 122, 0.55);
  border-radius: 12px;
  font-family: var(--schrift-hand);
  font-size: 22px;
  min-height: 52px;
  cursor: pointer;
  transition: background 150ms ease, transform 80ms ease;
}
.schnell-tasten button:active {
  background: rgba(255, 210, 122, 0.14);
  transform: scale(0.96);
}

.dialog-aktionen {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  flex-wrap: wrap;
}
.btn-primaer, .btn-sekundaer, .btn-warn {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-family: var(--schrift-hand);
  font-size: 20px;
  min-height: 52px;
  cursor: pointer;
  border: 2px solid transparent;
}
.btn-primaer {
  background: var(--kreide);
  color: #111;
  border-color: var(--kreide);
}
.btn-primaer:active { transform: scale(0.97); }
.btn-sekundaer {
  background: transparent;
  color: var(--kreide);
  border-color: var(--kreide-linie);
}
.btn-warn {
  background: transparent;
  color: var(--warn);
  border-color: var(--warn);
}

/* ---------- Layout-Anpassungen Tablet / Querformat ---------- */
@media (orientation: landscape) and (min-width: 900px) {
  .freundes-liste {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
  .tafel { padding: 18px; }
}

@media (orientation: portrait) {
  .tafel-header { flex-wrap: wrap; }
  .hinzu-btn { flex-shrink: 0; }
}

/* kleine Phones */
@media (max-width: 480px) {
  .tafel-header { gap: 10px; padding: 8px 12px; }
  .titel-block h1 { font-size: 26px; }
  .freundes-liste { grid-template-columns: 1fr; gap: 12px; }
  .tafel { padding: 10px; }
  .tafel-rahmen { inset: 4px; border-width: 4px; }
  .freund { padding: 12px; }
  .aktionen { grid-template-columns: 1fr 1fr; gap: 10px; }
  .akt-btn { min-height: 64px; }
}

/* ---------- Footer mit LimmerNet-Branding ---------- */
.tafel-footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 4px 14px;
  border-top: 2px solid var(--kreide-linie);
  background: linear-gradient(0deg, rgba(0,0,0,0.5), rgba(0,0,0,0.15));
  font-family: var(--schrift-hand);
  color: var(--kreide-schwach);
  font-size: clamp(11px, 1.1vw, 14px);
  flex-shrink: 0;
  min-height: 44px;
}

.fuss-text {
  letter-spacing: 0.3px;
}

.fuss-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0;
  background: transparent;
  transition: transform 150ms ease, filter 200ms ease;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.fuss-link:hover {
  transform: translateY(-2px) scale(1.03);
  filter: drop-shadow(0 4px 14px rgba(255, 210, 122, 0.4));
}
.fuss-link:active {
  transform: translateY(0) scale(0.98);
}

.fuss-logo {
  display: block;
  height: clamp(32px, 4vw, 44px);
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.fuss-url {
  color: var(--akzent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 210, 122, 0.5);
  padding-bottom: 1px;
  font-size: clamp(14px, 1.5vw, 18px);
  transition: color 150ms ease, border-color 150ms ease;
}
.fuss-url:hover {
  color: var(--kreide);
  border-bottom-color: var(--kreide);
}

@media (max-width: 480px) {
  .tafel-footer { gap: 8px; padding: 4px 8px; min-height: 40px; }
  .fuss-logo { height: 28px; max-width: 120px; }
  .fuss-text { font-size: 11px; }
  .fuss-url { font-size: 12px; }
}

/* ---------- Partikel / Lustige Animationen ---------- */
.partikel-buehne {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999;
}

.partikel {
  position: absolute;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  will-change: transform, opacity;
  transform: translate(-50%, -50%);
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

/* Bier fliegt nach oben mit leichter Drehung */
.partikel.bier {
  animation: bier-flieg 900ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes bier-flieg {
  0%   { transform: translate(-50%, -50%) scale(0.4) rotate(0deg); opacity: 0; }
  15%  { transform: translate(calc(-50% + var(--dx, 0px) * 0.2), calc(-50% + var(--dy, -40px) * 0.2)) scale(1.2) rotate(var(--rot1, 12deg)); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -220px))) scale(0.8) rotate(var(--rot2, 30deg)); opacity: 0; }
}

/* Schaum-Blasen */
.partikel.schaum {
  width: 10px; height: 10px;
  background: radial-gradient(circle at 35% 30%, #fff, #e8dfba 70%, rgba(255,255,255,0) 72%);
  border-radius: 50%;
  animation: schaum-pop 700ms ease-out forwards;
}
@keyframes schaum-pop {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  20%  { opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -80px))) scale(1.2); opacity: 0; }
}

/* Münzen kippen/fallen */
.partikel.muenze {
  animation: muenze-fall 900ms cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
@keyframes muenze-fall {
  0%   { transform: translate(-50%, -50%) scale(0.3) rotate(0deg); opacity: 0; }
  20%  { transform: translate(-50%, -50%) scale(1.1) rotate(180deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 180px))) scale(0.7) rotate(540deg); opacity: 0; }
}

/* Geldscheine segeln */
.partikel.geld {
  animation: geld-segeln 1400ms cubic-bezier(0.35, 0.15, 0.45, 1) forwards;
}
@keyframes geld-segeln {
  0%   { transform: translate(-50%, -50%) scale(0.4) rotate(0deg); opacity: 0; }
  15%  { opacity: 1; }
  50%  { transform: translate(calc(-50% + var(--dx, 0px) * 0.5), calc(-50% + var(--dy, 100px) * 0.5)) rotate(var(--rot1, 45deg)) scale(1.1); }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 220px))) rotate(var(--rot2, 720deg)) scale(0.9); opacity: 0; }
}

/* Konfetti-Schnipsel */
.partikel.konfetti {
  width: 10px; height: 14px;
  border-radius: 2px;
  background: var(--k, #ffd27a);
  animation: konfetti-burst 1100ms cubic-bezier(0.3, 0.9, 0.3, 1) forwards;
}
@keyframes konfetti-burst {
  0%   { transform: translate(-50%, -50%) scale(0.3) rotate(0deg); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 160px))) scale(1) rotate(var(--rot, 540deg)); opacity: 0; }
}

/* Kreide-Staubwolke beim Löschen */
.partikel.staub {
  width: 18px; height: 18px;
  background: radial-gradient(circle, rgba(245,241,226,0.9), rgba(245,241,226,0) 70%);
  border-radius: 50%;
  animation: staub-wolke 900ms ease-out forwards;
}
@keyframes staub-wolke {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  25%  { opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -20px))) scale(3.2); opacity: 0; }
}

/* Sterne-Burst beim 5er-Strich (wenn eine Fuenfergruppe voll wird) */
.partikel.stern {
  animation: stern-blitz 700ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes stern-blitz {
  0%   { transform: translate(-50%, -50%) scale(0.2) rotate(0deg); opacity: 0; }
  30%  { transform: translate(-50%, -50%) scale(1.4) rotate(180deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -60px))) scale(0.8) rotate(360deg); opacity: 0; }
}

/* Button-Wackeln auf Klick */
.wackel {
  animation: wackel 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes wackel {
  10%, 90% { transform: translate3d(-1px, 0, 0) rotate(-1deg); }
  20%, 80% { transform: translate3d(2px, 0, 0) rotate(1.5deg); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0) rotate(-2deg); }
  40%, 60% { transform: translate3d(3px, 0, 0) rotate(2deg); }
}

/* Karten-Huepfer beim Kredit */
.kredit-huepfer {
  animation: kredit-huepf 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes kredit-huepf {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-8px) scale(1.02); }
  60%  { transform: translateY(2px) scale(0.99); }
  100% { transform: translateY(0) scale(1); }
}

/* Karten-Shake beim Minus */
.minus-shake {
  animation: minus-shake 350ms ease;
}
@keyframes minus-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* Glitzer-Aura um Karte bei 5er */
.freund.glitzert::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius-m) + 4px);
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(255, 210, 122, 0.6);
  animation: glitzer-ring 700ms ease-out forwards;
}
@keyframes glitzer-ring {
  0%   { box-shadow: 0 0 0 0 rgba(255, 210, 122, 0.7); }
  100% { box-shadow: 0 0 0 22px rgba(255, 210, 122, 0); }
}

/* ---------- Hilfe-Dialog ---------- */
.hilfe-intro {
  font-family: var(--schrift-hand);
  color: var(--kreide-schwach);
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.3;
}
.hilfe-liste, .hilfe-farben {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hilfe-liste li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--kreide-linie);
  border-radius: 12px;
}
.hilfe-symbol {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}
.hilfe-text {
  font-family: var(--schrift-hand);
  font-size: 17px;
  color: var(--kreide);
  line-height: 1.3;
}
.hilfe-text strong { color: var(--kreide); font-weight: 700; }

.hilfe-farben-titel {
  font-family: var(--schrift-hand);
  color: var(--kreide-schwach);
  font-size: 16px;
  margin: 14px 0 8px;
}
.hilfe-farben li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--schrift-hand);
  font-size: 16px;
  color: var(--kreide);
  padding: 6px 8px;
}
.farb-punkt {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}
.farb-punkt.rot   { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.farb-punkt.gruen { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.farb-punkt.gold  { background: var(--akzent); box-shadow: 0 0 10px var(--akzent); }

/* ---------- Edit-Button (Name aendern) ---------- */
.freund .edit-btn {
  position: absolute;
  top: 8px;
  right: 56px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--kreide-linie);
  color: var(--kreide-schwach);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 150ms ease, color 150ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.freund .edit-btn:hover {
  background: rgba(255, 210, 122, 0.12);
  color: var(--akzent);
}
.freund .edit-btn:active {
  transform: scale(0.92);
}

/* ---------- Drag & Drop (SortableJS) ---------- */
.freund {
  touch-action: manipulation;
}
body.sortieren {
  cursor: grabbing;
}
body.sortieren .freund {
  cursor: grabbing;
}
.freund.freund-ghost {
  opacity: 0.35;
  filter: blur(0.5px);
}
.freund.freund-chosen {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65), 0 0 0 2px var(--akzent);
  transform: scale(1.03) rotate(-0.5deg);
  z-index: 100;
  transition: box-shadow 180ms ease, transform 180ms ease;
}
.freund.freund-drag,
.freund-drag-fallback {
  opacity: 0.94;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.7);
  cursor: grabbing;
}

/* ---------- Sync-Status-Indikator ---------- */
.sync-status {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--kreide-schwach);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
  transition: background 300ms ease, box-shadow 300ms ease;
  pointer-events: none;
  opacity: 0.65;
}
.sync-status.online  { background: var(--ok);    box-shadow: 0 0 10px var(--ok); }
.sync-status.lade    { background: var(--akzent); box-shadow: 0 0 10px var(--akzent); animation: sync-puls 1s ease-in-out infinite; }
.sync-status.offline { background: var(--warn);   box-shadow: 0 0 10px var(--warn); }
@keyframes sync-puls {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1;   }
}

/* ---------- PIN-Dialog ---------- */
.pin-dialog input[type="password"] {
  font-family: var(--schrift-hand);
  font-size: 44px;
  text-align: center;
  letter-spacing: 16px;
  padding: 12px 16px;
  background: transparent;
  color: var(--kreide);
  border: none;
  border-bottom: 2px dashed var(--kreide-linie);
  width: 100%;
  outline: none;
  caret-color: var(--akzent);
}
.pin-dialog input[type="password"]:focus {
  border-bottom-color: var(--akzent);
}
.pin-fehler {
  color: var(--warn);
  font-family: var(--schrift-hand);
  font-size: 18px;
  margin: 8px 0 0;
  text-align: center;
}
.pin-dialog.schuettel {
  animation: pin-schuettel 380ms ease;
}
@keyframes pin-schuettel {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-10px); }
  30%      { transform: translateX(10px); }
  45%      { transform: translateX(-8px); }
  60%      { transform: translateX(8px); }
  75%      { transform: translateX(-4px); }
}

/* ---------- Mini-Hinweis (Toast) fuer sichtbare Fehler ---------- */
.mini-hinweis {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 20px);
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: var(--radius-m);
  background: rgba(22, 26, 22, 0.96);
  color: var(--kreide);
  border: 1px solid var(--warn);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 12px rgba(255, 138, 107, 0.25);
  font-family: var(--schrift-ui);
  font-size: 0.95rem;
  text-align: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur, 220ms) ease, transform var(--dur, 220ms) ease;
}
.mini-hinweis.sichtbar {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* reduzierte Motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .partikel-buehne { display: none; }
}
