:root {
  --panel: rgba(20, 24, 36, 0.72);
  --panel-solid: #1b2130;
  --border: rgba(255, 255, 255, 0.14);
  --text: #f4f6fb;
  --muted: #aab3c5;
  --accent: #4ade80;
  --accent-dark: #16a34a;
  --gold: #facc15;
  --red: #ef4444;
  --blue: #38bdf8;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1020; color: var(--text); font-family: var(--font); }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Login ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50;
  background: radial-gradient(ellipse at top, rgba(56, 189, 248, 0.35), transparent 60%), linear-gradient(180deg, #7cc6ff 0%, #3f8f3a 70%, #2f5e22 100%); }
.login-box { width: min(440px, calc(100vw - 32px)); background: var(--panel); border: 2px solid var(--border); border-radius: 14px;
  padding: 24px; backdrop-filter: blur(6px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); max-height: calc(100vh - 32px); overflow-y: auto; }
.logo { margin: 0; text-align: center; font-size: clamp(34px, 9vw, 52px); font-weight: 900; letter-spacing: 2px; color: #f3f4f6;
  text-shadow: 0 3px 0 #6b7280, 0 6px 0 #374151, 0 10px 18px rgba(0, 0, 0, 0.5); }
.logo span { display: block; font-size: 0.72em; letter-spacing: 10px; margin-top: -4px; color: #f97316;
  text-shadow: 0 3px 0 #9a3412, 0 6px 0 #431407, 0 10px 18px rgba(0, 0, 0, 0.5); }
.logo-sub { text-align: center; font-weight: 800; letter-spacing: 3px; font-size: 13px; color: #e5e7eb; margin: 6px 0 18px;
  text-shadow: 0 2px 0 #111; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tab { flex: 1; padding: 9px 4px; background: rgba(255, 255, 255, 0.06); color: var(--muted); border: 1px solid var(--border);
  border-radius: 8px; font-weight: 700; font-size: 13px; }
.tab.active { background: var(--accent-dark); color: #fff; border-color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.form input, .form select { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: rgba(0, 0, 0, 0.35);
  color: var(--text); font-size: 15px; outline: none; }
.form input:focus { border-color: var(--accent); }
.form label:has(input[type=checkbox]) { flex-direction: row; align-items: center; }
.btn { padding: 10px 16px; border-radius: 9px; border: none; background: linear-gradient(180deg, #4ade80, #16a34a); color: #fff;
  font-weight: 800; font-size: 15px; box-shadow: 0 4px 0 #0f5f2c; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0f5f2c; }
.btn.big { padding: 13px; font-size: 17px; width: 100%; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: rgba(255, 255, 255, 0.08); box-shadow: none; border: 1px solid var(--border); margin-top: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.hint { font-size: 12px; color: var(--muted); margin: 2px 0; }
.center { text-align: center; margin-top: 10px; }
.error { color: #fca5a5; font-size: 14px; min-height: 18px; margin-top: 10px; text-align: center; font-weight: 600; }
.controls-help { margin-top: 14px; font-size: 11px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--border); padding-top: 10px; }
#resume { text-align: center; }
.loading-text { font-size: 22px; font-weight: 800; text-shadow: 0 2px 0 #000; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; user-select: none; }
#hud button, #hud input, #chat { pointer-events: auto; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.panel.small { padding: 4px 10px; font-size: 13px; font-weight: 700; }

#playerCard { position: absolute; top: 12px; left: 12px; display: flex; gap: 10px; padding: 8px 12px 8px 8px; width: 270px; }
#avatar { width: 56px; height: 56px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, 0.3); image-rendering: pixelated; background: #333; }
.level { position: absolute; left: 12px; top: 60px; background: #111827; border: 1px solid var(--border); border-radius: 6px;
  font-size: 11px; font-weight: 800; padding: 1px 6px; }
.card-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.pname { font-weight: 800; font-size: 15px; text-shadow: 0 1px 0 #000; }
.bar { position: relative; height: 13px; background: rgba(0, 0, 0, 0.5); border-radius: 4px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.12); }
.bar > div { height: 100%; transition: width 0.2s; }
.bar.hp > div { background: linear-gradient(180deg, #4ade80, #16a34a); }
.bar.hp.low > div { background: linear-gradient(180deg, #f87171, #b91c1c); }
.bar.xp > div { background: linear-gradient(180deg, #fde047, #ca8a04); }
.bar span { position: absolute; inset: 0; font-size: 10px; line-height: 12px; text-align: center; font-weight: 800; text-shadow: 0 1px 1px #000; }
.money { display: flex; gap: 14px; font-size: 12px; }

#clock { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); }
#topButtons { position: absolute; top: 12px; right: 206px; display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; background: var(--panel); border: 1px solid var(--border); color: #fff; font-size: 18px; }
#mapBox { position: absolute; top: 10px; right: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#minimap { width: 180px; height: 180px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.55); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }

#crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 2px #000; }
#crosshair::before { left: 10px; top: 2px; width: 2px; height: 18px; }
#crosshair::after { top: 10px; left: 2px; height: 2px; width: 18px; }
#mineBar { position: absolute; left: 50%; top: calc(50% + 22px); width: 60px; height: 6px; transform: translateX(-50%); background: rgba(0, 0, 0, 0.5);
  border-radius: 3px; overflow: hidden; display: none; }
#mineFill { height: 100%; width: 0; background: #fff; }

#hotbar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; padding: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.slot { position: relative; width: 54px; height: 54px; background: rgba(0, 0, 0, 0.4); border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.slot img { width: 38px; height: 38px; image-rendering: pixelated; pointer-events: none; }
.slot .n { position: absolute; right: 4px; bottom: 1px; font-size: 12px; font-weight: 800; text-shadow: 0 1px 1px #000, 0 0 3px #000; }
.slot .k { position: absolute; left: 4px; top: 1px; font-size: 10px; color: var(--muted); font-weight: 700; }
.slot.sel { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), inset 0 0 12px rgba(255, 255, 255, 0.15); }
.slot.picked { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
#heldName { position: absolute; bottom: 84px; left: 50%; transform: translateX(-50%); font-weight: 800; font-size: 14px;
  text-shadow: 0 1px 2px #000; opacity: 0; transition: opacity 0.3s; }

#rightButtons { position: absolute; right: 12px; bottom: 14px; display: flex; gap: 8px; align-items: flex-end; }
.big-btn { width: 76px; height: 76px; border-radius: 12px; background: var(--panel); border: 2px solid rgba(255, 255, 255, 0.28); color: #fff;
  font-weight: 800; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.big-btn .ic { font-size: 26px; line-height: 1; }
.big-btn:hover { border-color: #fff; }
#btnLoot .ic { color: #a3e635; }
#lootValue { font-size: 13px; color: var(--gold); }

#chat { position: absolute; left: 12px; bottom: 14px; width: min(420px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 4px; }
#chatTabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ctab { padding: 3px 9px; font-size: 12px; font-weight: 700; border-radius: 6px; background: rgba(0, 0, 0, 0.45); color: var(--muted);
  border: 1px solid var(--border); }
.ctab.active { background: rgba(74, 222, 128, 0.25); color: #fff; border-color: var(--accent); }
.ctab .badge { background: var(--red); color: #fff; border-radius: 8px; padding: 0 5px; margin-left: 4px; font-size: 10px; }
.ctab .x { margin-left: 6px; opacity: 0.6; }
#chatLog { height: 190px; overflow-y: auto; background: rgba(0, 0, 0, 0.35); border-radius: 8px; padding: 6px 8px; font-size: 13px;
  line-height: 1.35; scrollbar-width: thin; }
#chat:not(.active) #chatLog { background: transparent; scrollbar-width: none; mask-image: linear-gradient(transparent, #000 30%); }
#chat:not(.active) #chatLog::-webkit-scrollbar { display: none; }
.msg { text-shadow: 0 1px 1px #000, 0 0 2px #000; word-wrap: break-word; white-space: pre-wrap; }
.msg .who { font-weight: 800; cursor: pointer; }
.msg .who:hover { text-decoration: underline; }
.msg.system { color: #fde68a; }
.msg.join { color: #9ca3af; font-style: italic; }
.msg.kill { color: #fca5a5; }
.msg.admin { color: #f472b6; }
.msg.broadcast { color: #fbbf24; font-weight: 800; }
.msg.reward { color: #86efac; font-weight: 700; }
.msg.pm { color: #c4b5fd; }
.role-admin { color: #f87171; }
.role-moderator { color: #60a5fa; }
#chatInput { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(0, 0, 0, 0.6); color: #fff;
  font-size: 14px; outline: none; opacity: 0.55; }
#chat.active #chatInput { opacity: 1; border-color: var(--accent); }

#toasts { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { background: rgba(0, 0, 0, 0.6); padding: 6px 14px; border-radius: 8px; font-weight: 800; color: var(--gold); animation: toast 2.6s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 10%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#hurt { position: absolute; inset: 0; box-shadow: inset 0 0 120px rgba(220, 0, 0, 0.8); opacity: 0; transition: opacity 0.4s; }
#hurt.on { opacity: 1; transition: none; }
#clickToPlay { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.6); padding: 10px 20px;
  border-radius: 10px; font-weight: 800; }
#safeZone { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: #86efac;
  background: rgba(0, 0, 0, 0.45); padding: 3px 10px; border-radius: 6px; }

/* ---------- Fenster ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; z-index: 30; }
.window { background: var(--panel-solid); border: 2px solid var(--border); border-radius: 14px; width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.window.wide { width: min(900px, calc(100vw - 32px)); }
.win-head { padding: 12px 16px; font-weight: 800; font-size: 17px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.win-head .close { margin-left: auto; background: none; border: none; color: #fff; font-size: 18px; }
.win-body { padding: 14px 16px; overflow-y: auto; overflow-x: hidden; }
.sub { font-weight: 800; font-size: 13px; color: var(--muted); margin: 8px 0 6px; }
.inv-layout { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; }
@media (max-width: 860px) { .inv-layout { grid-template-columns: minmax(0, 1fr); } }
.recipe .rname { min-width: 0; overflow-wrap: anywhere; }
.slot-grid { display: grid; grid-template-columns: repeat(8, 54px); gap: 5px; }
.slot-grid .slot { cursor: pointer; }
@media (max-width: 520px) { .slot-grid { grid-template-columns: repeat(6, 46px); } .slot-grid .slot { width: 46px; height: 46px; } }
.recipe { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); margin-bottom: 5px; }
.recipe img { width: 28px; height: 28px; image-rendering: pixelated; }
.recipe .rname { font-weight: 700; font-size: 13px; flex: 1; }
.recipe .need { font-size: 11px; color: var(--muted); }
.recipe .need .miss { color: #fca5a5; }
.recipe button { padding: 5px 10px; font-size: 12px; box-shadow: 0 3px 0 #0f5f2c; }
.shop-money { font-size: 14px; color: var(--gold); }
#shopGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.shop-item { background: rgba(255, 255, 255, 0.05); border: 2px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; }
.shop-item canvas { width: 96px; height: 120px; image-rendering: pixelated; }
.shop-item .iname { font-weight: 800; font-size: 14px; margin: 4px 0; }
.shop-item .rar { font-size: 11px; text-transform: uppercase; font-weight: 800; letter-spacing: 1px; }
.rar.common { color: #d1d5db; } .rar.uncommon { color: #4ade80; } .rar.rare { color: #60a5fa; } .rar.epic { color: #c084fc; } .rar.legendary { color: #fbbf24; }
.shop-item.legendary { border-color: #fbbf24; } .shop-item.epic { border-color: #c084fc; } .shop-item.rare { border-color: #60a5fa; }
.shop-item .btn { width: 100%; margin-top: 6px; font-size: 13px; padding: 7px; }
.shop-item.equipped { box-shadow: 0 0 0 2px var(--accent); }
#playersList .prow, #tabList .prow { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 6px; gap: 12px; }
#playersList .prow { cursor: pointer; }
#playersList .prow:hover { background: rgba(255, 255, 255, 0.08); }
#tabList { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 20; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px; min-width: 300px; max-height: 70vh; overflow-y: auto; pointer-events: none; }
#tabList h3 { margin: 0 0 6px; font-size: 14px; text-align: center; }
.death-box { text-align: center; background: rgba(60, 0, 0, 0.75); padding: 30px 40px; border-radius: 14px; border: 2px solid rgba(255, 100, 100, 0.4);
  max-width: calc(100vw - 32px); }
.death-box h2 { margin: 0 0 10px; font-size: 32px; color: #fca5a5; text-shadow: 0 3px 0 #000; }

@media (max-width: 760px) {
  #playerCard { width: 220px; transform: scale(0.9); transform-origin: top left; }
  #mapBox { transform: scale(0.7); transform-origin: top right; }
  #topButtons { right: 140px; }
  .slot { width: 40px; height: 40px; } .slot img { width: 28px; height: 28px; }
  #rightButtons { bottom: 80px; } .big-btn { width: 60px; height: 60px; }
  #chatLog { height: 120px; }
  #clock { top: 210px; }
}

/* ---------- Admin: Spieler-Profil ---------- */
.prof-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.prof-stats div { background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.prof-stats b { display: block; font-size: 15px; }
.prof-stats small { color: var(--muted); font-weight: 700; }
.prof-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.btn.danger { background: linear-gradient(180deg, #f87171, #b91c1c); box-shadow: 0 4px 0 #7f1d1d; }
.pbadge { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; margin-left: 4px; background: #374151; }
.pbadge.bot { background: #7c3aed; } .pbadge.guest { background: #6b7280; } .pbadge.admin { background: #b91c1c; }
.pbadge.dead { background: #111; } .pbadge.muted { background: #92400e; }
#profilePanel .slot.sel { border-color: var(--gold); }
#flyMode { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: #7dd3fc;
  background: rgba(0, 0, 0, 0.55); padding: 4px 12px; border-radius: 6px; }
.slot.drop { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.slot[draggable=true] { cursor: grab; }
.win-head { cursor: move; user-select: none; }
.win-head.dragging { cursor: grabbing; }
.win-head .close { cursor: pointer; }

/* ---------- Coins aufladen ---------- */
#coinGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 8px; }
.coin-card { position: relative; background: linear-gradient(180deg, rgba(250, 204, 21, 0.12), rgba(250, 204, 21, 0.03)); border: 2px solid rgba(250, 204, 21, 0.35);
  border-radius: 12px; padding: 12px 10px 10px; text-align: center; }
.coin-card .coin-ic { font-size: 30px; }
.coin-card .coin-n { font-weight: 900; font-size: 16px; color: var(--gold); }
.coin-card .coin-name { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.coin-card .btn { width: 100%; padding: 7px; font-size: 14px; }
.coin-badge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin: 4px 0 12px; line-height: 1.4; }
.consent input { margin-top: 2px; }
.pay-window { width: min(460px, calc(100vw - 24px)); height: min(760px, calc(100vh - 24px)); }
#payFrame { flex: 1; width: 100%; border: 0; background: #fff; border-radius: 0 0 4px 4px; }
.pay-foot { padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.pay-foot a { color: #7dd3fc; }

/* ---------- Shop-Tabs ---------- */
.shop-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.shop-tab-btn { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.06); color: var(--muted);
  font-weight: 800; font-size: 13px; }
.shop-tab-btn:hover { color: #fff; }
.shop-tab-btn.active { background: var(--accent-dark); border-color: var(--accent); color: #fff; }
#offerGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.offer-card { background: rgba(255, 255, 255, 0.05); border: 2px solid var(--border); border-radius: 12px; padding: 12px 10px; text-align: center; }
.offer-card img { width: 52px; height: 52px; image-rendering: pixelated; }
.offer-card .offer-name { font-weight: 800; font-size: 14px; margin-top: 4px; }
.offer-card .offer-amount { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.offer-card .btn { width: 100%; padding: 7px; font-size: 14px; }
.offer-card.gems { border-color: rgba(96, 200, 255, 0.45); }
