/* Hold-to-delete + Undo-Toast — Maße/Timings exakt nach Spec (09.10.2026).
 * Farben über Tokens: Dunkelmodus = Spec-Werte, Hellmodus dieselbe Hue,
 * aber lesbar auf Weiß (Ziffer/Icon ≥ 4,5:1, Karte auf --surface/--line). */
:root {
  --hd-rot: #ef4444;
  --hd-hell: #f87171;
  --hd-zart: #fca5a5;
  --hd-balken: rgba(255, 255, 255, .28);
  --hd-karte: var(--surface-3, #10131c);
  --hd-rand: var(--line-strong, #262b3a);
  --hd-text: var(--ink, #e5e7eb);
  --hd-text2: var(--ink-muted, #8b93a7);
}
:root[data-theme="hell"] {
  --hd-hell: #dc2626;
  --hd-zart: #b91c1c;
  /* Weiß auf Weiß wäre unsichtbar: .btn--danger ist hier transparent auf
     heller Fläche — der Halte-Balken braucht im Hellmodus einen Rot-Schleier. */
  --hd-balken: rgba(220, 38, 38, .22);
  --hd-karte: var(--surface, #ffffff);
  --hd-rand: var(--line, #e2e2e8);
}

/* ---------- Teil 1 · Hold-Buttons ---------- */
@property --hd-p { syntax: '<percentage>'; inherits: false; initial-value: 0%; }

.hd-btn { position: relative;
  /* flex-shrink: 0 — benachbarte .input-Felder (width: 100%) quetschen den
     Knopf sonst zusammen und schneiden das Icon ab (Erbe des Alt-Systems). */
  flex-shrink: 0;
  /* Touch-Härtung: ohne touch-action übernimmt der Browser beim kleinsten
     Wackeln das Scrollen und feuert pointercancel — Halten bräche ständig ab. */
  touch-action: none; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.hd-trash { color: var(--hd-hell); }
.hd-btn.hd-icon {
  width: 32px; height: 32px; min-width: 32px; padding: 0; border-radius: 50%;
  background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .35);
  box-shadow: none; color: var(--hd-hell);
  display: inline-flex; align-items: center; justify-content: center; }
.hd-btn.hd-icon:hover { background: rgba(239, 68, 68, .2); filter: none; }
.hd-btn.hd-icon .hd-trash { width: 15px; height: 15px; }

/* Ring-Füllung: conic-gradient bis --hd-p, radiale Maske stanzt die Mitte aus —
   sichtbar bleibt ein 3 px dicker Außenring, der in 300 ms linear volläuft. */
.hd-ring { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(var(--hd-rot) var(--hd-p, 0%), rgba(239, 68, 68, .15) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  transition: opacity .12s; }
.hd-btn.hd-holding .hd-ring { opacity: 1; animation: hd-ring-fill .3s linear forwards; }
.hd-btn.hd-holding.hd-icon { box-shadow: 0 0 14px rgba(239, 68, 68, .55); }
@keyframes hd-ring-fill { from { --hd-p: 0%; } to { --hd-p: 100%; } }

/* Label-Buttons: Fortschritts-Balken von links statt Ring. */
.hd-btn.hd-label .hd-fill { position: absolute; inset: 0; border-radius: inherit;
  overflow: hidden; pointer-events: none; }
.hd-btn.hd-label .hd-fill::before { content: ''; position: absolute; inset: 0;
  background: var(--hd-balken); transform: scaleX(0); transform-origin: left; }
.hd-btn.hd-holding.hd-label .hd-fill::before { animation: hd-bar .3s linear forwards; }
@keyframes hd-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Auslöse-Blitz nach vollendetem Halten. */
.hd-btn.hd-fired { animation: hd-flash .4s ease; }
@keyframes hd-flash { 0% { filter: brightness(1.7); } 100% { filter: brightness(1); } }

/* Wirts-Zeile eines offenen Undo-Eintrags: sichtbar „wird gelöscht". */
.hd-geht { opacity: .45; transition: opacity .2s; }

/* ---------- Teil 3 · Undo-Toast unten rechts ---------- */
/* bottom 80px statt 18px: der Bug-Melde-Knopf (.bug-fab) sitzt fixed bei
   22/22 (46 px hoch) und darf nicht verdeckt werden. z-index 97: über
   Modals (80) und der Tour-Karte (96) — „Rückgängig" muss während der
   5 Sekunden IMMER erreichbar sein (Entscheidung 5). */
#undo-toasts { position: fixed; right: 18px; bottom: 80px; z-index: 97;
  display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none;
  max-width: 92vw; }

.ut-toast { pointer-events: auto; position: relative; overflow: hidden;
  min-width: 264px; max-width: 360px;
  background: var(--hd-karte); border: 1px solid var(--hd-rand);
  border-left: 3px solid var(--hd-rot);
  border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, .5); padding: 12px 14px 15px;
  display: flex; align-items: center; gap: 11px;
  animation: ut-rein .22s cubic-bezier(.3, 1.2, .5, 1); }
.ut-toast.out { animation: ut-raus .2s ease forwards; }
@keyframes ut-rein { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ut-raus { to { transform: translateX(120%); opacity: 0; } }

@media (max-width: 640px) {
  #undo-toasts { right: 10px; bottom: 78px; left: 10px; }
  .ut-toast { max-width: none; }
}

.ut-toast .ut-icon { color: var(--hd-hell); flex: 0 0 auto; display: flex; }
.ut-toast .ut-icon svg { width: 20px; height: 20px; }
.ut-toast .ut-text { flex: 1; min-width: 0; font-size: 13px; color: var(--hd-text); line-height: 1.35; }
.ut-toast .ut-text b { font-weight: 700; }
.ut-toast .ut-sub { display: block; font-size: 11px; color: var(--hd-text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ut-toast .ut-count { flex: 0 0 auto; width: 27px; height: 27px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--hd-zart);
  border: 2px solid rgba(239, 68, 68, .4); }
.ut-toast .ut-undo { flex: 0 0 auto; cursor: pointer; font-size: 12px; font-weight: 700; color: #fff;
  background: rgba(239, 68, 68, .92); border: none; border-radius: 8px; padding: 7px 11px;
  display: flex; align-items: center; gap: 5px; transition: background .15s; }
.ut-toast .ut-undo:hover { background: var(--hd-rot); }
.ut-toast .ut-undo svg { width: 14px; height: 14px; }
.ut-toast .ut-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--hd-rot); transform-origin: left; animation: ut-bar linear forwards; }
@keyframes ut-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Bewegung reduziert: Einflug mit Überschwinger, Ausflug und Blitz entfallen.
   Ring, Halte-Balken und Toast-Bar bleiben — sie SIND die Fortschritts- und
   Restzeit-Anzeige (essenzielle Bewegung, keine Zierde); ohne sie wüsste
   niemand, wie lange zu halten ist oder wie lange „Rückgängig" noch geht. */
@media (prefers-reduced-motion: reduce) {
  .ut-toast { animation: none; }
  .ut-toast.out { animation: none; opacity: 0; }
  .hd-btn.hd-fired { animation: none; }
}
