/* =========================================================================
   Schwarzmarkt-Labor (lab.js): Kolben, Projektkarten, Material-Slots,
   Synthese-Einblendung.
   ========================================================================= */

.lb-meta-ready { color: var(--green); font-weight: 700; animation: lbBlink 1.6s ease-in-out infinite; }
@keyframes lbBlink { 50% { opacity: .55; } }

/* ---------- Kolben ---------- */
.lb-flask { --lc: #3ee68e; --lc2: #2fe0e4; position: relative; width: 70px; height: 82px; flex: none; }
.lb-flask.idle { --lc: #4a8dff; --lc2: #7c86ff; }
.lb-flask.done { --lc: #9aa7bd; --lc2: #6b7688; }
.lb-flask.busy { --lc: #2fe0e4; --lc2: #a855f7; }
.lb-flask.ready { --lc: #3ee68e; --lc2: #ffd27a; }
.lb-glass { position: absolute; inset: 0; overflow: hidden; border: 2px solid rgba(200, 225, 255, .35); background: rgba(255, 255, 255, .04);
            border-radius: 18px 18px 36px 36px / 14px 14px 44px 44px; box-shadow: inset 0 0 18px rgba(255, 255, 255, .06), 0 8px 20px -10px var(--lc); }
.lb-glass::before { content: ''; position: absolute; left: 12%; top: 10%; width: 14%; height: 55%; border-radius: 999px; background: linear-gradient(rgba(255,255,255,.35), transparent); z-index: 2; }
.lb-liquid { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--p) * 1%); transition: height 1s cubic-bezier(.2, .8, .2, 1);
             background: linear-gradient(0deg, var(--lc), color-mix(in srgb, var(--lc2) 70%, transparent)); box-shadow: 0 0 16px var(--lc); }
.lb-wave { position: absolute; left: -50%; top: -7px; width: 200%; height: 14px; border-radius: 40%; background: color-mix(in srgb, var(--lc2) 80%, transparent); animation: lbWave 3s linear infinite; }
.lb-wave.b { top: -5px; opacity: .55; animation-duration: 4.6s; animation-direction: reverse; }
@keyframes lbWave { to { transform: translateX(25%); } }
.lb-bub { position: absolute; bottom: 4px; width: 6px; height: 6px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .7); opacity: 0; }
.lb-bub:nth-child(2) { left: 28%; animation: lbBub 2.6s ease-in infinite .2s; }
.lb-bub:nth-child(3) { left: 55%; width: 4px; height: 4px; animation: lbBub 2.2s ease-in infinite 1.1s; }
.lb-bub:nth-child(4) { left: 72%; animation: lbBub 3s ease-in infinite .7s; }
.lb-flask.idle .lb-bub, .lb-flask.done .lb-bub { display: none; }
@keyframes lbBub { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-62px); opacity: 0; } }
.lb-icon { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); font-size: 1.9rem; z-index: 3; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.lb-flask.ready .lb-glass { border-color: rgba(62, 230, 142, .8); animation: lbReady 1.6s ease-in-out infinite; }
@keyframes lbReady { 50% { box-shadow: inset 0 0 18px rgba(255,255,255,.08), 0 0 26px var(--lc); } }
.lb-flask.big { width: 110px; height: 128px; }
.lb-flask.big .lb-icon { font-size: 3rem; }
.lb-flask.gulp .lb-glass { animation: lbGulp .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes lbGulp { 30% { transform: scale(1.08, .94); } 60% { transform: scale(.96, 1.05); } }

/* ---------- Projektkarten ---------- */
.lb-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lb-card { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "flask txt" "reqs reqs" "foot foot"; gap: 12px 14px; align-items: center;
           padding: 16px; border-radius: 18px; text-align: left; cursor: pointer; color: var(--text); font: inherit; overflow: hidden;
           background: radial-gradient(90% 70% at 0% 0%, rgba(62, 230, 142, .08), transparent 60%), var(--bg-panel); border: 1px solid var(--line);
           transition: transform .2s cubic-bezier(.2, 1.3, .4, 1), border-color .2s, box-shadow .2s; animation: lbIn .45s ease both; animation-delay: calc(min(var(--i), 12) * 40ms); }
@keyframes lbIn { from { opacity: 0; transform: translateY(14px); } }
.lb-card:hover { transform: translateY(-4px); border-color: rgba(62, 230, 142, .45); box-shadow: 0 16px 34px -20px rgba(62, 230, 142, .8); }
.lb-card:hover .lb-flask .lb-glass { transform: rotate(-4deg); transition: transform .3s; }
.lb-card .lb-flask { grid-area: flask; }
.lb-txt { grid-area: txt; min-width: 0; }
.lb-txt b { display: block; color: var(--text-bright); font-size: .98rem; line-height: 1.2; }
.lb-txt p { margin: 4px 0 0; font-size: .78rem; color: var(--text-dim); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lb-reqs { grid-area: reqs; display: flex; flex-wrap: wrap; gap: 6px; }
.lb-reqs span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); font-size: .9rem; }
.lb-reqs em { font-style: normal; font-size: .72rem; color: var(--text); font-variant-numeric: tabular-nums; }
.lb-foot { grid-area: foot; display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px dashed rgba(255, 255, 255, .07); font-size: .76rem; color: var(--text-dim); }
.lb-foot b { color: var(--gold); font-variant-numeric: tabular-nums; }
.lb-badge { position: absolute; top: 10px; right: 10px; font-size: .64rem; font-weight: 800; letter-spacing: .08em; padding: 3px 8px; border-radius: 999px; }
.lb-badge.ready { color: #071a10; background: var(--green); box-shadow: 0 0 14px rgba(62, 230, 142, .6); animation: lbBlink 1.4s ease-in-out infinite; }
.lb-badge.busy { color: var(--cyan); background: rgba(47, 224, 228, .12); border: 1px solid rgba(47, 224, 228, .4); }
.lb-badge.done { color: var(--text-dim); background: rgba(255, 255, 255, .06); }
.lb-card.st-ready { border-color: rgba(62, 230, 142, .55); box-shadow: 0 0 0 1px rgba(62, 230, 142, .25), 0 14px 30px -18px rgba(62, 230, 142, .9); }
.lb-card.st-done { opacity: .62; }
.lb-card.st-done:hover { opacity: 1; }
.lb-card.pet { background: radial-gradient(90% 70% at 0% 0%, rgba(255, 79, 216, .1), transparent 60%), var(--bg-panel); }
.lb-card.pet:hover { border-color: rgba(255, 79, 216, .45); box-shadow: 0 16px 34px -20px rgba(255, 79, 216, .8); }

/* ---------- Detailfenster ---------- */
.lb-detail { text-align: left; }
.lb-d-head { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-bottom: 14px; }
.lb-kicker { font-size: .64rem; letter-spacing: .22em; text-transform: uppercase; color: var(--green); }
.lb-d-head h2 { margin: 2px 0 4px; text-align: left; }
.lb-d-head .sub { text-align: left; margin: 0 0 8px; }
.lb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-chips span { font-size: .72rem; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--text); }
.lb-chips span.g { color: var(--green); border-color: rgba(62, 230, 142, .4); }
.lb-total { text-align: center; }
.lb-total b { display: block; font-family: var(--font-display); font-size: 2.2rem; line-height: 1; color: var(--green); text-shadow: 0 0 18px rgba(62, 230, 142, .5); }
.lb-total small { color: var(--text-dim); }
.lb-detail.st-busy .lb-total b, .lb-detail.st-idle .lb-total b { color: var(--cyan); text-shadow: 0 0 18px rgba(47, 224, 228, .5); }
.lb-lc { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(245, 166, 35, .06); border: 1px solid rgba(245, 166, 35, .25); margin-bottom: 10px; }
.lb-lc > span { font-size: 1.8rem; text-align: center; }
.lb-lc b { color: var(--text-bright); font-size: .9rem; }
.lb-lc small { display: block; font-size: .74rem; color: var(--text-dim); margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.lb-lc.ok { background: rgba(62, 230, 142, .07); border-color: rgba(62, 230, 142, .4); }
.lb-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.lb-bar i { display: block; height: 100%; width: var(--p); border-radius: inherit; background: linear-gradient(90deg, #f5a623, #ffd27a); box-shadow: 0 0 10px rgba(245, 166, 35, .6); animation: lbBar .9s cubic-bezier(.2, .8, .2, 1) both; }
.lb-lc.ok .lb-bar i { background: linear-gradient(90deg, #3ee68e, #a7ffcf); box-shadow: 0 0 10px rgba(62, 230, 142, .6); }
@keyframes lbBar { from { width: 0; } }
.lb-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 14px; }
.lb-slot { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); transition: border-color .3s; }
.lb-slot.ok { border-color: rgba(62, 230, 142, .45); background: rgba(62, 230, 142, .06); }
.lb-slot.up { animation: lbSlotUp .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes lbSlotUp { 40% { transform: scale(1.05); box-shadow: 0 0 20px rgba(62, 230, 142, .4); } }
.lb-ring { position: relative; width: 48px; height: 48px; }
.lb-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lb-ring circle { fill: none; stroke-width: 4; }
.lb-ring .t { stroke: rgba(255, 255, 255, .08); }
.lb-ring .v { stroke: var(--red); stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p)); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.lb-slot.ok .lb-ring .v { stroke: var(--green); filter: drop-shadow(0 0 4px var(--green)); }
.lb-slot:not(.ok) .lb-ring .v { stroke: #ff9a5a; }
.lb-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.3rem; }
.lb-slot-t b { display: block; font-size: .82rem; color: var(--text-bright); line-height: 1.2; }
.lb-slot-t small { display: block; font-size: .72rem; color: var(--text); font-variant-numeric: tabular-nums; }
.lb-slot-t small.inv { color: var(--text-dim); font-size: .66rem; }
.lb-ok { position: absolute; top: 6px; right: 8px; font-style: normal; font-weight: 900; color: var(--green); }
.lb-none { color: var(--text-dim); font-size: .85rem; }
.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-actions .btn { flex: 1 1 150px; }
.lb-build.go { color: #071a10; background: linear-gradient(135deg, #a7ffcf, #3ee68e); border-color: #a7ffcf; box-shadow: 0 0 22px rgba(62, 230, 142, .5); animation: lbGo 1.4s ease-in-out infinite; }
@keyframes lbGo { 50% { box-shadow: 0 0 0 6px rgba(62, 230, 142, .15), 0 0 30px rgba(62, 230, 142, .7); } }
.lb-close { display: flex; justify-content: flex-end; margin-top: 10px; }

/* Flug ins Projekt */
.lb-fly { position: fixed; z-index: 9500; font-size: 1.4rem; pointer-events: none; transform: translate(-50%, -50%); animation: lbFly .6s cubic-bezier(.5, 0, .7, 1) both; }
@keyframes lbFly { 0% { opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(.35); opacity: 0; } }

/* ---------- Synthese ---------- */
.lb-syn { position: fixed; inset: 0; z-index: 9000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; cursor: pointer;
          background: radial-gradient(circle at 50% 45%, rgba(20, 70, 50, .85), rgba(5, 7, 13, .95) 65%); backdrop-filter: blur(6px); animation: lbFade .3s ease both; }
.lb-syn.out { animation: lbFade .3s ease reverse both; }
@keyframes lbFade { from { opacity: 0; } }
.lb-syn-rays { position: absolute; left: 50%; top: 42%; width: 1200px; height: 1200px; margin: -600px 0 0 -600px; pointer-events: none; opacity: 0; transition: opacity .4s;
               background: repeating-conic-gradient(rgba(62, 230, 142, .5) 0 5deg, transparent 5deg 15deg); mask-image: radial-gradient(closest-side, #000, transparent); -webkit-mask-image: radial-gradient(closest-side, #000, transparent);
               animation: lbSpin 20s linear infinite; }
.lb-syn.pop .lb-syn-rays { opacity: .4; }
@keyframes lbSpin { to { transform: rotate(360deg); } }
.lb-syn-stage { position: relative; transform: scale(1.6); margin-bottom: 40px; }
.lb-syn .lb-flask.boil .lb-glass { animation: lbBoil .12s linear infinite; }
.lb-syn .lb-flask.boil .lb-bub { animation-duration: .8s; }
@keyframes lbBoil { 25% { transform: translate(-1.5px, 1px) rotate(-1deg); } 75% { transform: translate(1.5px, -1px) rotate(1deg); } }
.lb-syn-arc { position: absolute; inset: -30px; border-radius: 50%; border: 2px solid transparent; border-top-color: #2fe0e4; border-right-color: rgba(62, 230, 142, .6); animation: lbSpin 1s linear infinite; }
.lb-syn-arc.b { inset: -46px; border-top-color: rgba(168, 85, 247, .7); border-left-color: rgba(62, 230, 142, .5); animation-duration: 1.6s; animation-direction: reverse; }
.lb-syn-label { font: 700 .9rem var(--font-mono); letter-spacing: .3em; color: var(--green); animation: lbBlink .5s ease-in-out infinite; }
.lb-syn-result { display: none; flex-direction: column; align-items: center; gap: 4px; text-align: center; max-width: 420px; }
.lb-syn.pop .lb-syn-stage { animation: lbStageOut .4s ease forwards; }
@keyframes lbStageOut { to { transform: scale(2.4); opacity: 0; } }
.lb-syn.pop .lb-syn-label { display: none; }
.lb-syn.pop .lb-syn-result { display: flex; animation: lbResult .6s cubic-bezier(.2, 1.6, .4, 1) .15s both; }
@keyframes lbResult { from { transform: scale(.3); opacity: 0; } }
.lb-syn-icon { font-size: 5rem; filter: drop-shadow(0 0 30px rgba(62, 230, 142, .8)); animation: lbFloat 2.4s ease-in-out infinite; }
@keyframes lbFloat { 50% { transform: translateY(-8px); } }
.lb-syn-result b { font-family: var(--font-display); font-size: 1.6rem; color: #fff; }
.lb-syn-result small { font-size: .9rem; color: #a7ffcf; }
.lb-syn-tap { position: absolute; bottom: 8%; font-size: .72rem; letter-spacing: .25em; text-transform: uppercase; color: rgba(255, 255, 255, .5); opacity: 0; }
.lb-syn.pop .lb-syn-tap { opacity: 1; transition: opacity .4s 1s; }

@media (max-width: 600px) {
  .lb-d-head { grid-template-columns: auto 1fr; }
  .lb-total { display: none; }
  .lb-flask.big { width: 84px; height: 100px; }
  .lb-flask.big .lb-icon { font-size: 2.3rem; }
  .lb-actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-wave, .lb-bub, .lb-card, .lb-badge.ready, .lb-flask.ready .lb-glass, .lb-build.go, .lb-meta-ready, .lb-bar i { animation: none !important; }
}
.lb-flask.empty .lb-liquid { display: none; }
