/* Bot-Zentrale · Live-Ansicht wie im Spiel, Steuern über die Webseite, Inventar mit 3D-Figur (js/bot-3d.js, js/bot-mc.js, bots.js renderBotLiveWorld/renderBotLiveInventory).
   Lädt nach bot-zentrale.css. Bühne = #botLive3d.b3-stage, Zustände: .is-ctl (wird gesteuert), .is-locked (Maus gesperrt), .is-chat, .is-touch, .is-maxi (Vollbild-Ersatz), [data-cam=follow|eyes]. */

#botsModal .lv-grid.is-3d { grid-template-columns: minmax(0, 1fr); container: lvgrid / inline-size; }
/* Inventar so groß wie im Spiel (nicht über die ganze Breite), offenes Menü daneben */
#botsModal .lv-grid.is-3d :is(.lv-inv, .lv-open) { width: 100%; max-width: 600px; }
@container lvgrid (min-width: 900px) {
  #botsModal .lv-grid.is-3d .lv-inv-card { display: grid; grid-template-columns: minmax(0, 600px) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 16px; align-items: start; }
  #botsModal .lv-grid.is-3d .lv-inv-card > header { grid-column: 1 / -1; }
  #botsModal .lv-grid.is-3d .lv-inv-card > .lv-inv { grid-column: 1; grid-row: 2 / span 2; }
  #botsModal .lv-grid.is-3d .lv-inv-card > .lv-totals { grid-column: 2; grid-row: 2; margin-top: 0; }
  #botsModal .lv-grid.is-3d .lv-inv-card > .lv-open { grid-column: 2; grid-row: 3; margin-top: 12px; }
}
#botsModal .lv-3d[hidden], #botsModal .lv-map-wrap[hidden], #botsModal .lv-legend[hidden], #botsModal .lv-tools[hidden] { display: none !important; }
#botsModal .lv-map-card .spw-card-head { flex-wrap: wrap; gap: 8px; }
#botsModal .lv-modebar { margin-left: auto; }
#botsModal .lv-modebar + .lv-tools { margin-left: 0; }

/* ------------------------------------------------------------- Bühne */
.b3-stage {
  --b3-ui: rgba(10, 16, 26, .72);
  --b3-line: rgba(255, 255, 255, .14);
  --b3-font: var(--bz-body, system-ui, sans-serif);
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; min-height: 320px; max-height: 74vh;
  overflow: hidden; border-radius: 12px; isolation: isolate; outline: none; container: b3 / inline-size;
  background: linear-gradient(180deg, #5f93f0 0%, #8fb8ff 46%, #c9defc 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 18px 40px -26px #000;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.b3-stage [hidden] { display: none !important; }
.b3-stage:focus-visible { box-shadow: 0 0 0 2px #7dd3fc, 0 18px 40px -26px #000; }
.b3-stage:fullscreen, .b3-stage.is-maxi { aspect-ratio: auto; width: 100vw; height: 100vh; min-height: 0; max-height: none; border-radius: 0; box-shadow: none; }
.b3-stage.is-maxi { position: fixed; inset: 0; z-index: 2147483000; height: 100dvh; }
html.b3-noscroll, html.b3-noscroll body { overflow: hidden !important; }
.b3-stage[data-online="false"] { background: linear-gradient(180deg, #273244, #151c27); }
.b3-canvas { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.b3-canvas:active { cursor: grabbing; }
.b3-stage[data-cam="eyes"]:not(.is-ctl) .b3-canvas { cursor: default; }
.b3-stage.is-ctl .b3-canvas { touch-action: none; cursor: pointer; }
.b3-stage.is-locked .b3-canvas { cursor: none; }
/* HUD wie im Spiel (Fadenkreuz, Schnellleiste, Herzen, Chat, Titel, Bossleisten, Seitenleiste, Tab-Liste, F3) zeichnet js/bot-mc.js */
.b3-hudc { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; }
.b3-chatin {
  position: absolute; left: 0; bottom: 0; z-index: 9; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; opacity: 0;
  background: transparent; color: transparent; caret-color: transparent; font-size: 16px; pointer-events: none;
}

.b3-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--b3-line); border-radius: 9px; background: var(--b3-ui); color: #eef4ff;
  font: 700 12.5px var(--b3-font); white-space: nowrap; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background .15s, border-color .15s, transform .1s;
}
.b3-btn:hover { border-color: rgba(255, 255, 255, .32); }
.b3-btn:active { transform: translateY(1px); }
.b3-btn:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }
.b3-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.b3-btn[aria-pressed="true"] { background: rgba(56, 189, 248, .28); border-color: #7dd3fc; }
.b3-icon { min-width: 32px; padding: 0 8px; font-size: 15px; }
.b3-top {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  pointer-events: none; transition: opacity .2s;
}
.b3-top > * { pointer-events: auto; }
/* Beim Steuern mit gesperrter Maus nur das Spielbild – Esc holt Menü und Knöpfe zurück */
.b3-stage.is-locked .b3-top { opacity: 0; }
.b3-stage.is-locked .b3-top > * { pointer-events: none; }
.b3-seg { display: inline-flex; gap: 0; border-radius: 9px; overflow: hidden; }
.b3-seg .b3-btn { border-radius: 0; }
.b3-seg .b3-btn:first-child { border-radius: 9px 0 0 9px; }
.b3-seg .b3-btn:last-child { border-radius: 0 9px 9px 0; border-left: 0; }
.b3-tools { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; margin-left: auto; }
.b3-ctl { background: linear-gradient(180deg, #34d399, #059669); border-color: #6ee7b7; color: #04241a; text-shadow: none; }
.b3-ctl.is-on { background: linear-gradient(180deg, #fbbf24, #d97706); border-color: #fde68a; color: #2a1700; }
.b3-stage[data-online="false"] .b3-ctl { display: none; }
.b3-lock {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid var(--b3-line); border-radius: 999px;
  background: rgba(8, 12, 20, .62); color: #cbd5e1; font: 700 11.5px var(--b3-font); white-space: nowrap;
}
.b3-share[aria-pressed="true"] { background: rgba(52, 211, 153, .26); border-color: #6ee7b7; }

.b3-status {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%); max-width: calc(100% - 28px);
  padding: 9px 14px; border-radius: 10px; background: var(--b3-ui); color: #dbe6f5; font: 600 13px var(--b3-font);
  text-align: center; pointer-events: none;
}
.b3-status:empty { display: none; }
.b3-chip {
  position: absolute; top: calc(var(--b3-top, 46px) + 2px); left: 10px; z-index: 2; max-width: calc(100% - 20px); padding: 6px 10px; border-radius: 8px;
  background: rgba(120, 72, 6, .78); color: #ffe7b0; font: 700 12px var(--b3-font); pointer-events: none;
}
.b3-note {
  position: absolute; top: calc(var(--b3-top, 46px) + 2px); left: 50%; z-index: 5; transform: translateX(-50%); max-width: calc(100% - 28px);
  padding: 8px 14px; border-radius: 10px; background: rgba(8, 12, 20, .86); color: #fff; font: 700 13px var(--b3-font);
  box-shadow: 0 10px 30px -12px #000; pointer-events: none; text-align: center;
}
.b3-stage.is-locked .b3-note { top: 12px; }
.b3-resume {
  position: absolute; left: 50%; top: 50%; z-index: 5; transform: translate(-50%, -50%); min-height: 44px; padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; background: rgba(8, 12, 20, .74); color: #fff;
  font: 800 14px var(--b3-font); cursor: pointer; box-shadow: 0 14px 40px -18px #000;
}
.b3-resume:hover { background: rgba(20, 30, 46, .86); }

/* Knöpfe im Stil des Spiels (Spielmenü, Wiederbeleben) */
.b3-mbtn {
  display: block; width: 100%; min-height: 40px; padding: 0 14px; border: 2px solid #000; border-radius: 0;
  background: #6f6f6f; box-shadow: inset 2px 2px rgba(255, 255, 255, .32), inset -2px -3px rgba(0, 0, 0, .38);
  color: #fff; font: 700 14px var(--b3-font); text-shadow: 2px 2px 0 #3f3f3f; cursor: pointer;
}
.b3-mbtn:hover, .b3-mbtn:focus-visible { background: #7f89c2; border-color: #fff; outline: none; }
.b3-mbtn:active { background: #5d6699; }
.b3-death {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  padding: 16px; background: linear-gradient(rgba(80, 0, 0, .42), rgba(160, 0, 0, .6));
}
.b3-death h3 { margin: 0; color: #fff; font: 800 clamp(24px, 6cqi, 46px) var(--b3-font); text-align: center; text-shadow: 3px 3px 0 #3f1f1f; }
.b3-death .b3-mbtn { width: min(320px, 82%); }
.b3-menu {
  /* Flex + margin:auto statt place-items:center – ist der Inhalt höher als die Bühne, bleibt er von oben scrollbar */
  position: absolute; inset: 0; z-index: 8; display: flex; padding: 14px; overflow: auto;
  background: rgba(6, 8, 12, .62); overscroll-behavior: contain;
}
.b3-menu-box {
  display: grid; gap: 8px; width: min(440px, 100%); margin: auto; flex: none; padding: 16px 18px 18px; border: 2px solid #000;
  background: rgba(22, 24, 30, .9); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 24px 60px -24px #000; color: #e7ecf3;
}
.b3-menu-box h3 { margin: 0 0 4px; color: #fff; font: 800 16px var(--b3-font); text-align: center; text-shadow: 2px 2px 0 #3f3f3f; }
.b3-menu-box h4 { margin: 8px 0 0; color: #aab4c3; font: 800 11px var(--b3-font); letter-spacing: .06em; text-transform: uppercase; }
.b3-mrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.b3-mrow .b3-mbtn { font-size: 13px; }
.b3-mrange {
  display: grid; gap: 6px; padding: 8px 10px; border: 2px solid #000; background: rgba(0, 0, 0, .55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); color: #fff; font: 700 12.5px var(--b3-font); text-align: center;
}
.b3-mrange input { width: 100%; margin: 0; accent-color: #9aa7ff; cursor: pointer; }
.b3-mcheck { display: flex; align-items: center; gap: 8px; padding: 2px 2px 0; color: #dfe6f0; font: 600 12.5px var(--b3-font); cursor: pointer; }
.b3-mcheck input { width: 16px; height: 16px; margin: 0; accent-color: #9aa7ff; }
.b3-mkeys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; color: #c9d2de; font: 500 11.5px/1.35 var(--b3-font); }
.b3-mkeys > div { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.b3-mkeys kbd {
  flex: none; padding: 0 5px; border-radius: 4px; background: #2a3140; box-shadow: inset 0 -1px rgba(0, 0, 0, .45), 0 0 0 1px #3a4458;
  color: #fff; font: 800 10.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.b3-mwarn { margin: 4px 0 0; color: #fbbf24; font: 600 11px/1.4 var(--b3-font); }

/* Inventar/Menü im Bild (E) */
.b3-gui { position: absolute; inset: 0; z-index: 7; display: flex; padding: 12px; background: rgba(4, 7, 12, .55); overflow: auto; overscroll-behavior: contain; }
.b3-slot {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 2px; cursor: pointer;
  background: rgba(139, 139, 139, .35); box-shadow: inset 2px 2px rgba(0, 0, 0, .45), inset -2px -2px rgba(255, 255, 255, .18);
}
.b3-slot img { width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
.b3-slot b { position: absolute; right: 2px; bottom: 0; color: #fff; font: 800 12px var(--b3-font); text-shadow: 1px 1px 0 #3f3f3f; pointer-events: none; }
.b3-slot .b3-abbr { color: #dfe7f2; font: 800 9px var(--b3-font); }
.b3-slot:hover { background: rgba(255, 255, 255, .28); }
.b3-slot[data-label]::after { content: attr(data-label); color: #8f98a6; font: 700 8px var(--b3-font); }
.b3-gui-panel {
  display: grid; gap: 8px; margin: auto; flex: none; padding: 10px 12px 12px; border-radius: 6px; background: #c6c6c6; color: #3f3f3f;
  box-shadow: inset 2px 2px #fff, inset -2px -2px #555, 0 20px 50px -20px #000;
}
.b3-gui-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 800 13px var(--b3-font); }
.b3-gui-head .b3-btn { min-height: 26px; color: #fff; }
.b3-gui-grid { display: grid; grid-template-columns: repeat(var(--cols, 9), 36px); gap: 0; }
.b3-gui-grid.is-player { margin-top: 6px; }
.b3-gui-grid.is-hotbar { margin-top: 4px; }
.b3-gui-panel .b3-slot { width: 36px; height: 36px; border-radius: 0; background: #8b8b8b; box-shadow: inset 2px 2px #373737, inset -2px -2px #fff; }
.b3-gui-panel .b3-slot:hover { background: #a9a9a9; }
.b3-gui-panel .b3-slot img { width: 28px; height: 28px; }
.b3-gui-hint { margin: 2px 0 0; color: #555; font: 600 11px var(--b3-font); }

/* Touch: Stick links, Knöpfe rechts – nur beim Steuern */
.b3-touch { display: none; }
.b3-stage.is-ctl.is-touch .b3-touch { display: block; position: absolute; inset: auto 0 0 0; height: 0; z-index: 4; }
.b3-joy {
  position: absolute; left: 16px; bottom: 76px; width: 104px; height: 104px; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .12), rgba(255, 255, 255, .05)); border: 2px solid rgba(255, 255, 255, .28);
}
.b3-joy i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.b3-pads { position: absolute; right: 12px; bottom: 76px; display: grid; grid-template-columns: repeat(3, 48px); gap: 8px; }
.b3-pad {
  width: 48px; height: 48px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 12px; background: rgba(8, 12, 20, .62); color: #fff;
  font: 800 18px var(--b3-font); touch-action: none; -webkit-user-select: none; user-select: none;
}
.b3-pad:active, .b3-pad[aria-pressed="true"] { background: rgba(56, 189, 248, .45); }

@container b3 (max-width: 560px) {
  .b3-top { gap: 6px; }
  .b3-seg .b3-btn { padding: 0 9px; font-size: 12px; }
  .b3-tools { gap: 4px; }
  .b3-lock { font-size: 0; padding: 0 9px; }
  .b3-lock::before { content: '🔒 nur Toni'; font-size: 11px; }
  .b3-share { font-size: 0; gap: 0; }
  .b3-share::before { content: attr(data-short); font-size: 12px; }
  .b3-gui-grid { grid-template-columns: repeat(var(--cols, 9), 31px); }
  .b3-gui-panel .b3-slot { width: 31px; height: 31px; }
  .b3-gui-panel .b3-slot img { width: 24px; height: 24px; }
  .b3-mkeys, .b3-mrow { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .b3-stage { aspect-ratio: 4 / 5; min-height: 300px; max-height: 78vh; }
  .b3-stage.is-ctl { aspect-ratio: 3 / 4; }
}

/* ------------------------------------------------------------- Inventar-Karte: 3D-Figur, Rüstung als Spalte, Klick beim Steuern */
#botsModal .lv-inv-top { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); gap: 5px; }
#botsModal .lv-inv-top > .lv-equip { display: contents; }
#botsModal .lv-inv-top .lv-equip > .lv-slot:nth-child(-n+4) { grid-column: 4; }
#botsModal .lv-inv-top .lv-equip > .lv-slot:nth-child(1) { grid-row: 1; }
#botsModal .lv-inv-top .lv-equip > .lv-slot:nth-child(2) { grid-row: 2; }
#botsModal .lv-inv-top .lv-equip > .lv-slot:nth-child(3) { grid-row: 3; }
#botsModal .lv-inv-top .lv-equip > .lv-slot:nth-child(4) { grid-row: 4; }
#botsModal .lv-inv-top .lv-equip > .lv-slot:nth-child(5) { grid-column: 5; grid-row: 4; }
#botsModal .lv-doll {
  grid-column: 1 / span 3; grid-row: 1 / span 4; position: relative; min-height: 0; border-radius: 10px; overflow: hidden;
  background: radial-gradient(120% 70% at 50% 100%, rgba(56, 189, 248, .18), transparent 62%), #0b121b; box-shadow: inset 0 0 0 1px #2d3b4d;
}
#botsModal .lv-doll[hidden] { display: none; }
#botsModal .lv-doll canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; }
#botsModal .lv-inv-top:has(> .lv-doll[hidden]) .lv-equip > .lv-slot { grid-column: auto; grid-row: 1; }
#botsModal .lv-hand {
  grid-column: 6 / span 4; grid-row: 1 / span 4; display: grid; align-content: center; justify-items: center; gap: 4px; padding: 10px; min-width: 0;
  border-radius: 10px; background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0)); box-shadow: inset 0 0 0 1px #243142; text-align: center;
}
#botsModal .lv-hand[hidden] { display: none; }
#botsModal .lv-hand-icon { display: grid; place-items: center; width: clamp(44px, 42%, 84px); aspect-ratio: 1; border-radius: 10px; background: #1e2835; box-shadow: inset 0 0 0 1px #2d3b4d; }
#botsModal .lv-hand-icon img { width: 78%; height: 78%; object-fit: contain; image-rendering: pixelated; }
#botsModal .lv-hand-label { color: var(--bz-text-3, #8a97a8); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
#botsModal .lv-hand-name { max-width: 100%; overflow: hidden; color: var(--bz-text, #e8eef7); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
#botsModal .lv-hand-hp { color: #fca5a5; font-size: 11.5px; font-weight: 700; }
#botsModal .lv-slot.is-held { box-shadow: inset 0 0 0 1px #2d3b4d, 0 0 0 2px #f8fafc; z-index: 1; }
#botsModal .lv-inv-card.is-ctl .lv-slot.is-click { cursor: pointer; }
#botsModal .lv-inv-card.is-ctl .lv-slot.is-click:hover { background: #2f415a; box-shadow: inset 0 0 0 1px #7dd3fc; }
#botsModal .lv-slot img[data-kind="3d"] { width: 84%; height: 84%; }
#botsModal .lv-open { margin: 12px 0 0; padding: 12px; border-radius: 12px; background: #141c26; box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .35); color: inherit; font-size: inherit; }
#botsModal .lv-open-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 10px; }
#botsModal .lv-open-head strong { color: var(--bz-gold, #fbbf24); font-size: 13px; }
#botsModal .lv-open-grid { grid-template-columns: repeat(var(--cols, 9), minmax(0, 1fr)); }
#botsModal .lv-open-grid:empty { display: none; }

/* ------------------------------------------------------------- Konsole: Leseposition bleibt, Sprung zu den neuesten */
#botsModal .bz-log-wrap { position: relative; min-width: 0; }
#botsModal #activeBotChatContainer { overscroll-behavior: contain; overflow-anchor: none; }
#botsModal .bz-log-jump {
  position: absolute; left: 50%; bottom: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 14px;
  border: 0; border-radius: 999px; background: #243346; box-shadow: 0 0 0 1px #3b5068, 0 6px 18px rgba(0, 0, 0, .45); color: #dbe7f5;
  font: 700 12px/1.2 var(--bz-body, system-ui); cursor: pointer; transform: translateX(-50%);
}
#botsModal .bz-log-jump[hidden] { display: none; }
#botsModal .bz-log-jump:hover { background: #2d405a; }
#botsModal .bz-log-jump.has-new { background: #0e7490; box-shadow: 0 0 0 1px #22d3ee, 0 6px 18px rgba(0, 0, 0, .45); color: #fff; }
