/* Bild-Werkzeuge – Logik in web/src/bild/ */
.bi-main { max-width: 1120px; }
#bi { margin-bottom: var(--sp-7); display: flex; flex-direction: column; gap: var(--sp-4); }
.bi-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tg-noscroll { overflow: hidden; }
.tg-modal { position: fixed; inset: 0; background: rgba(10, 12, 25, .55); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .tg-modal { align-items: center; } }
.tg-sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 94vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 18px 22px; animation: biUp .28s cubic-bezier(.2, .9, .3, 1); }
.tg-modal.full .tg-sheet { max-width: 900px; }
@media (min-width: 700px) { .tg-sheet { border-radius: var(--r-l); } }
.tg-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.tg-sheet-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-x { border: 0; background: none; font-size: 1.2rem; padding: 4px 8px; color: var(--text); cursor: pointer; }
.tg-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #111827; color: #fff; padding: 10px 16px; border-radius: var(--r-m); opacity: 0; pointer-events: none; transition: .2s; z-index: 1100; max-width: calc(100% - 32px); text-align: center; }
.tg-toast.on { opacity: 1; transform: translate(-50%, 0); }
@keyframes biUp { from { transform: translateY(24px); opacity: 0; } }
@keyframes biPop { from { transform: scale(.85); opacity: 0; } }
.bi-checker { background: repeating-conic-gradient(#e5e7eb 0% 25%, #fff 0% 50%) 0 0 / 16px 16px; }

/* Start */
.bi-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 38px 20px 30px; border-radius: var(--r-l); cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--c2, #ea580c) 45%, var(--border)); background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--c1, #fbbf24) 16%, transparent), transparent 60%), var(--surface);
  transition: border-color .2s, box-shadow .2s; }
.bi-hero:hover { border-color: var(--c2, #ea580c); box-shadow: 0 20px 40px -26px var(--c2, #ea580c); }
.bi-hero > b { font-size: 1.25rem; }
.bi-hero-sub { color: var(--muted); font-size: var(--fs-s); }
.bi-hero-art { display: flex; align-items: center; gap: 14px; font-size: 2.8rem; margin-bottom: 6px; }
.bi-hero-art span:nth-child(2) { font-size: 1.6rem; color: var(--muted); animation: biNudge 1.6s ease-in-out infinite; }
.bi-hero-art span:nth-child(3) { animation: biTwinkle 2s ease-in-out infinite; }
@keyframes biNudge { 50% { transform: translateX(6px); } }
@keyframes biTwinkle { 50% { transform: scale(1.15) rotate(12deg); } }
.bi-private { margin-top: 6px; font-size: var(--fs-xs, .8rem); color: var(--muted); background: color-mix(in srgb, #22c55e 12%, transparent); padding: 5px 12px; border-radius: 999px; }
.bi-feats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bi-feat { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: var(--fs-s); }
body.bi-dropping::after { content: "📥  Loslassen zum Hinzufügen"; position: fixed; inset: 10px; z-index: 900; display: flex; align-items: center; justify-content: center; border: 3px dashed var(--c2, #ea580c); border-radius: 22px; background: color-mix(in srgb, var(--surface) 82%, transparent); font: 700 1.4rem/1 var(--font); pointer-events: none; }

/* Einstellungen */
.bi-set { display: flex; flex-direction: column; gap: 12px; }
.bi-set-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: center; }
@media (max-width: 640px) { .bi-set-row { grid-template-columns: 1fr; gap: 6px; } }
.bi-set-l { font-weight: 700; font-size: var(--fs-s); }
.bi-set .h-chips { flex-wrap: wrap; }
@media (max-width: 640px) { .bi-sizes { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; } .bi-sizes .h-chip { flex: none; } }
.bi-mode { display: flex; flex-direction: column; gap: 8px; }
.bi-q { display: flex; align-items: center; gap: 10px; }
.bi-q input { flex: 1; accent-color: var(--c2, #ea580c); }
.bi-kb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bi-kb-own { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-s); }
.bi-kb-own input { width: 90px; }

/* Kacheln */
.bi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .bi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.bi-card { display: flex; flex-direction: column; border-radius: 14px; background: var(--surface); box-shadow: 0 1px 0 var(--border), 0 8px 20px -16px rgba(0, 0, 0, .4); animation: biPop .35s cubic-bezier(.34, 1.56, .64, 1); overflow: hidden; min-width: 0; }
.bi-card-img { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; padding: 8px; border: 0; cursor: pointer; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--border) 40%, transparent) 0 6px, transparent 6px 12px); }
.bi-thumb { max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.bi-card-img:hover .bi-thumb { transform: scale(1.04); }
.bi-thumb--wait { width: 70%; height: 70%; background: linear-gradient(100deg, #f1f5f9 30%, #fff 50%, #f1f5f9 70%) 0 0 / 300% 100%; animation: biShim 1.2s linear infinite; }
@keyframes biShim { to { background-position: -300% 0; } }
.bi-spin { position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .7); border-top-color: var(--c2, #ea580c); animation: biRot .8s linear infinite; box-shadow: 0 0 0 4px rgba(0, 0, 0, .08); }
@keyframes biRot { to { transform: rotate(360deg); } }
.bi-badge { position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 999px; font-size: .75rem; background: var(--surface); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.bi-badge--ki { left: auto; right: 8px; }
.bi-err { font-size: var(--fs-s); color: #b91c1c; padding: 10px; }
.bi-card-info { padding: 8px 10px 0; min-width: 0; }
.bi-card-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-s); }
.bi-card-info small { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.bi-card-info small b { color: var(--text); }
.bi-save { color: #16a34a; font-style: normal; font-weight: 700; }
.bi-card-acts { display: flex; justify-content: space-between; padding: 4px 6px 6px; }
.bi-mini { width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font-size: 1rem; cursor: pointer; transition: background .15s, transform .2s cubic-bezier(.34, 1.56, .64, 1); }
.bi-mini:hover:not(:disabled) { background: color-mix(in srgb, var(--c2, #ea580c) 14%, transparent); transform: scale(1.12); }
.bi-mini:disabled { opacity: .35; cursor: default; }
.bi-mini--x:hover:not(:disabled) { background: color-mix(in srgb, #ef4444 16%, transparent); color: #dc2626; }
.bi-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 200px; border: 2px dashed var(--border); border-radius: 14px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.bi-add span { font-size: 2rem; line-height: 1; }
.bi-add:hover { border-color: var(--c2, #ea580c); color: var(--text); }
.bi-out { display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: 10px; z-index: 15; box-shadow: 0 -10px 40px -26px rgba(0, 0, 0, .5); }
@media (max-width: 640px) { .bi-out { position: static; } }
.bi-out .h-hint { margin: 0; }
.bi-sum { font-size: 1.05rem; }
.bi-gps { color: var(--muted); font-size: var(--fs-s); }

/* Detail + Vergleich */
.bi-detail { display: flex; flex-direction: column; gap: 12px; }
.bi-cmp { position: relative; align-self: center; max-width: 100%; line-height: 0; border-radius: 10px; overflow: hidden; user-select: none; --p: 50%; }
.bi-cmp > img { display: block; max-width: 100%; max-height: 62vh; width: auto; }
.bi-cmp-top { position: absolute; inset: 0; }
.bi-cmp-top img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bi-cmp-line { position: absolute; top: 0; bottom: 0; left: var(--p); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 8px rgba(0, 0, 0, .5); pointer-events: none; }
.bi-cmp-line::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111; font: 700 16px/34px var(--font); text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.bi-cmp-range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.bi-cmp-l, .bi-cmp-r { position: absolute; bottom: 8px; padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font: 600 .75rem/1.3 var(--font); pointer-events: none; }
.bi-cmp-l { left: 8px; } .bi-cmp-r { right: 8px; }
.bi-detail-info { margin: 0; text-align: center; color: var(--muted); font-size: var(--fs-s); }
.bi-detail-info b { color: var(--text); }
.bi-cut-btn { align-self: center; }
.bi-bgs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.bi-bg { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1); }
.bi-bg[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--c2, #ea580c); transform: scale(1.1); }
.bi-bg--blur { background: radial-gradient(circle at 30% 30%, #93c5fd, #fda4af 60%, #fde68a); filter: blur(.5px); }
.bi-detail > .bi-row { justify-content: center; }

/* Zuschneiden */
.bi-crop { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.bi-ratios { justify-content: center; }
.bi-crop-stage { position: relative; line-height: 0; touch-action: none; user-select: none; }
.bi-crop-img { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; }
.bi-crop-box { position: absolute; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .55); outline: 2px solid #fff; cursor: move; touch-action: none;
  background-image: linear-gradient(rgba(255, 255, 255, .35) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .35) 1px, transparent 1px); background-size: 33.33% 33.33%; background-position: -1px -1px; }
.bi-crop-stage { overflow: hidden; }
.bi-crop-h { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; touch-action: none; }
.bi-crop-nw { left: -4px; top: -4px; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.bi-crop-ne { right: -4px; top: -4px; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.bi-crop-sw { left: -4px; bottom: -4px; border-right: 0; border-top: 0; cursor: nesw-resize; }
.bi-crop-se { right: -4px; bottom: -4px; border-left: 0; border-top: 0; cursor: nwse-resize; }
.bi-crop-info { font-size: var(--fs-s); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .bi-hero-art span { animation: none; } }
button.bi-feat { font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
button.bi-feat:hover { border-color: var(--accent); transform: translateY(-1px); }
.bi-feats-h { margin: 0 0 8px; font-weight: 700; }
.bi-feats + .bi-hero { margin-top: 14px; }
