/* ===== Minigames: Bedienelemente je Mechanik (js/minigame-ui.js buildControls) ===== */
.mg-action { flex: none; display: flex; align-items: center; justify-content: center; min-width: 82px; }

/* Großer runder Knopf (PUMP / BLAST / PULSE) mit Abklingring */
.mg-big { position: relative; }
.mg-big .mg-cd { position: absolute; inset: -4px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(rgba(10,20,30,.62) calc(var(--cd, 0) * 360deg), transparent 0); transition: opacity .15s; }
.mg-big.cooling .mg-cd { opacity: 1; }
#mg-hud[data-mech="coal"] #mg-pump { background: radial-gradient(circle at 50% 35%, #ffb36b, #d4561c 70%); box-shadow: 0 6px 0 #8c3410, 0 10px 18px rgba(0,0,0,.35); }
#mg-hud[data-mech="hack"] #mg-pump { background: radial-gradient(circle at 50% 35%, #7fffd4, #13a37f 70%); box-shadow: 0 6px 0 #0c6b53, 0 10px 18px rgba(0,0,0,.35); }

/* Anzeige umgekehrt (Batterie, Kohle): voll = grün, leer = rot */
.mg-fill.invert { background: linear-gradient(90deg, #ff2a1a 0%, #ff6a2a 18%, #ffd23a 40%, #4fdc6a 75%, #2fbf5a 100%); background-size: 620px 100%; }

/* Kurbel: im Kreis ziehen */
.mg-crank { position: relative; width: 84px; height: 84px; margin: -26px 0 -4px; border-radius: 50%; border: 4px solid #fff; touch-action: none;
  background: radial-gradient(circle, #3b424b 0 18%, #6d7680 19% 62%, #4a5058 63%); box-shadow: 0 6px 0 #2a2f35, 0 10px 18px rgba(0,0,0,.35);
  display: grid; place-items: center; cursor: grab; user-select: none; }
.mg-crank span { position: absolute; bottom: -18px; font-size: 10px; font-weight: 900; letter-spacing: .08em; color: #ffd23a; }
.mg-crank-arm { position: absolute; left: 50%; top: 50%; width: 6px; height: 38px; margin: -38px 0 0 -3px; transform-origin: 50% 100%;
  background: linear-gradient(#c8743a, #8c4a20); border-radius: 3px; }
.mg-crank-arm b { position: absolute; top: -10px; left: -7px; width: 20px; height: 20px; border-radius: 50%; background: #7a5233; border: 2px solid #fff; }
#mg-hud.hot .mg-crank { animation: mg-pump-call .45s ease-in-out infinite alternate; }

/* Hochwasser: ein Knopf je undichter Halle */
.mg-leaks { display: grid; grid-template-columns: repeat(3, 40px); gap: 5px; }
.mg-leaks button { width: 40px; height: 34px; border: 2px solid #fff; border-radius: 10px; padding: 0; cursor: pointer; touch-action: manipulation;
  background: linear-gradient(180deg, #4fb4ff, #1a6fc4); color: #fff; font-size: 13px; font-weight: 900; box-shadow: 0 3px 0 #0f4a85;
  animation: mg-leak .5s ease-in-out infinite alternate; }
.mg-leaks button b { font-size: 12px; margin-left: 1px; }
.mg-leaks-ok { grid-column: 1 / -1; font-size: 12px; font-weight: 800; color: #6fdc8a; text-align: center; }
@keyframes mg-leak { to { transform: translateY(-2px); filter: brightness(1.2); } }

/* Gewitter: Hallen-Raster im Grundriss des Levels */
.mg-grid { display: grid; grid-template-columns: repeat(var(--cols), 22px); grid-template-rows: repeat(var(--rows), 22px); gap: 3px; }
.mg-grid button { position: relative; padding: 0; border: 2px solid rgba(255,255,255,.75); border-radius: 6px; cursor: pointer; overflow: hidden;
  background: #3a4552; touch-action: manipulation; }
.mg-grid button:disabled { opacity: .25; cursor: default; }
.mg-grid button i { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--k, 0) * 100%); background: linear-gradient(0deg, #ffd23a, #fff3a8); }
.mg-grid button.charging { border-color: #ffd23a; animation: mg-leak .25s ease-in-out infinite alternate; }
.mg-grid button.rod::after { content: "⚡"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; z-index: 1; }
.mg-grid button.rod { background: #1a86d6; border-color: #fff; }

/* Black Friday: Last-Anzeige mit grünem Band um die Kapazität + Regler */
.mg-load { position: relative; height: 26px; margin-top: 6px; border-radius: 8px; background: #2a3442; }
.mg-band { position: absolute; top: 0; bottom: 0; background: rgba(79,220,106,.45); border-radius: 6px; }
.mg-traffic { position: absolute; top: -3px; bottom: -3px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; box-shadow: 0 0 8px #fff; }
.mg-load input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; touch-action: none; }
.mg-load input::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: #2fbf5a; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.mg-load input::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #2fbf5a; border: 3px solid #fff; }
#mg-hud.hot .mg-load input::-webkit-slider-thumb { background: #ff3b30; }
.mg-income { display: grid; justify-items: center; color: #6fdc8a; }
.mg-income b { font-size: 22px; font-weight: 900; }
.mg-income small { font-size: 10px; font-weight: 800; color: #8d9aab; text-transform: uppercase; }
.mg-income.low { color: #ffb15c; }


/* Leeres Bedienfeld (Meltdown: nur Blasebalg auf der Karte) nimmt keinen Platz weg */
.mg-action:empty { display: none; }

/* Floodgate: Sandsack am Finger und Pfeile zu überlaufenden Stellen außerhalb des Bildes */
.mg-drag-bag { position: absolute; left: 0; top: 0; z-index: 150; width: 64px; height: 64px; margin: -40px 0 0 -32px; pointer-events: none;
  filter: drop-shadow(0 8px 6px rgba(0,0,0,.4)); transition: filter .1s; }
.mg-drag-bag img { width: 100%; height: 100%; object-fit: contain; animation: mg-bag-wobble .5s ease-in-out infinite alternate; }
.mg-drag-bag.on-target { filter: drop-shadow(0 0 10px rgba(120,255,160,.95)) drop-shadow(0 8px 6px rgba(0,0,0,.4)); }
@keyframes mg-bag-wobble { from { transform: rotate(-6deg); } to { transform: rotate(6deg) translateY(-3px); } }
.mg-edge-arrow { position: absolute; z-index: 130; width: 48px; height: 48px; margin: -24px 0 0 -24px; padding: 0; border: 3px solid #fff; border-radius: 50%;
  background: #1a86d6; color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.mg-edge-arrow[hidden] { display: none; }
.mg-edge-arrow i { position: absolute; inset: 0; }
.mg-edge-arrow i::after { content: ''; position: absolute; right: -11px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-left: 10px solid #fff; }
.mg-edge-arrow b { font-size: 11px; font-weight: 900; font-variant-numeric: tabular-nums; }
.mg-edge-arrow.hot { background: #e2412f; animation: mg-arrow-pulse .5s ease-in-out infinite alternate; }
@keyframes mg-arrow-pulse { to { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .mg-drag-bag img, .mg-edge-arrow.hot { animation: none; } }

/* Firewall: Hacker-Terminal über der Leiste (Halle antippen -> Code eintippen) */
.mg-term { position: absolute; z-index: 141; left: calc(10px + var(--sal)); right: calc(10px + var(--sar)); bottom: calc(118px + var(--sab));
  max-width: 420px; margin: 0 auto; padding: 10px 12px 12px; border-radius: 16px; color: #d9fbff;
  background: linear-gradient(180deg, rgba(6,18,30,.96), rgba(4,10,20,.97)); border: 2px solid #38e1ff;
  box-shadow: 0 0 0 3px rgba(56,225,255,.15), 0 0 22px rgba(56,225,255,.35), 0 10px 26px rgba(0,0,0,.45);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; animation: mg-term-in .18s ease-out; }
.mg-term[hidden] { display: none; }
.mg-term::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(56,225,255,.05) 0 2px, transparent 2px 4px); }
.mg-term.hot { border-color: #ff3b4f; box-shadow: 0 0 0 3px rgba(255,59,79,.2), 0 0 22px rgba(255,59,79,.45), 0 10px 26px rgba(0,0,0,.45); }
.mg-term.shake { animation: mg-term-shake .3s linear; }
@keyframes mg-term-in { from { transform: translateY(10px); opacity: 0; } }
@keyframes mg-term-shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.mg-term-head { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .1em; }
.mg-term-head b { color: #fff; padding: 2px 7px; border-radius: 6px; background: #ff3b4f; font-size: 11px; }
.mg-term-head span { flex: 1; color: #7fe9ff; }
.mg-term-x { width: 28px; height: 28px; border: 0; border-radius: 8px; background: rgba(255,255,255,.08); color: #9fb7c9; font-size: 13px; cursor: pointer; }
.mg-term-code { display: flex; justify-content: center; gap: 6px; margin: 10px 0 8px; }
.mg-term-code i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 2px solid rgba(127,233,255,.25); background: rgba(255,255,255,.04); }
.mg-term-code i svg { width: 22px; height: 22px; }
.mg-term-code i.done { border-color: #5dff8f; background: rgba(93,255,143,.15); }
.mg-term-code i.done svg { opacity: .35; }
.mg-term-code i.next { border-color: #fff; box-shadow: 0 0 10px rgba(127,233,255,.8); animation: mg-hint-bob .6s ease-in-out infinite; }
.mg-term-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; margin-bottom: 10px; }
.mg-term-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff9a2e, #ff3b4f); transition: width .2s linear; }
.mg-term-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mg-term-keys button { height: 54px; border-radius: 12px; border: 2px solid rgba(127,233,255,.3); background: linear-gradient(180deg, #13263a, #0b1826);
  display: grid; place-items: center; cursor: pointer; touch-action: manipulation; box-shadow: 0 3px 0 #050c14; }
.mg-term-keys button svg { width: 30px; height: 30px; filter: drop-shadow(0 0 6px currentColor); }
.mg-term-keys button:active { transform: translateY(2px); box-shadow: none; border-color: #fff; }
@media (prefers-reduced-motion: reduce) { .mg-term, .mg-term.shake, .mg-term-code i.next { animation: none; } }
