:root {
  --bg: #02040a;
  --metal-hi: #2b3444;
  --metal: #161c27;
  --metal-lo: #0a0e15;
  --edge: #3d4a5e;
  --edge-lo: #05070b;
  --amber: #f0b44c;
  --amber-lo: #a8742a;
  --cyan: #6fd3ff;
  --text: #cfdbec;
  --muted: #7d8ca3;
  --hp: #37d86b;
  --sh: #36a9ff;
  --warn: #ffb14d;
  --bad: #ff4d4d;
  --good: #8dff9f;
  --cr: #ffd34d;
  --uri: #c07bff;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
  user-select: none;
  -webkit-user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }

button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* --- Metallische Knöpfe --- */
button {
  background: linear-gradient(180deg, #2c3646 0%, #1a212d 48%, #121821 52%, #19202b 100%);
  border: 1px solid #0a0d12;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 -1px 0 rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .04);
  border-radius: 3px;
  padding: 5px 12px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 12px;
  font-weight: 600;
  color: #c4d2e6;
}
button:hover { color: var(--amber); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), inset 0 0 12px rgba(240, 180, 76, .15); }
button:active { background: linear-gradient(180deg, #121821, #1c2430); }
button:disabled { opacity: .4; cursor: not-allowed; color: #8190a5; }
button.primary {
  background: linear-gradient(180deg, #f6c264 0%, #d8952f 48%, #b8771c 52%, #cf8c2a 100%);
  color: #1b1206; border-color: #5a3a0c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 16px rgba(240, 180, 76, .25);
}
button.primary:hover { color: #000; filter: brightness(1.08); }
button.active { color: var(--amber); border-color: var(--amber-lo); box-shadow: inset 0 0 10px rgba(240, 180, 76, .3); }

/* --- Fenster --- */
.win {
  background: linear-gradient(180deg, rgba(26, 33, 45, .94), rgba(11, 15, 22, .94));
  border: 1px solid var(--edge-lo);
  outline: 1px solid rgba(90, 108, 135, .35);
  outline-offset: -2px;
  border-radius: 4px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
  min-width: 190px;
}
.win-title {
  display: flex; align-items: center; justify-content: space-between;
  height: 24px; padding: 0 4px 0 10px;
  background: linear-gradient(180deg, #313c4f 0%, #1c2433 50%, #141a25 51%, #1a2130 100%);
  border-bottom: 1px solid #06080c;
  border-radius: 3px 3px 0 0;
  color: var(--amber);
  font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  text-shadow: 0 0 8px rgba(240, 180, 76, .35), 0 1px 0 #000;
  cursor: move;
}
.win-title::before {
  content: ""; width: 6px; height: 6px; margin-right: 8px; transform: rotate(45deg);
  background: var(--amber); box-shadow: 0 0 6px var(--amber);
}
.win-title span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-min { width: 18px; height: 16px; padding: 0; line-height: 1; font-size: 13px; }
.win-body { padding: 8px 10px 10px; }
.win-body.nopad { padding: 4px; }
.win.min .win-body { display: none; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 3px 0; color: var(--muted); }
.row b { color: var(--cyan); font-variant-numeric: tabular-nums; font-weight: 600; }
.row.small { font-size: 12px; margin-top: 5px; }
.gem { display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); margin-right: 7px; vertical-align: 1px; }
.gem.cr { background: var(--cr); box-shadow: 0 0 6px var(--cr); }
.gem.uri { background: var(--uri); box-shadow: 0 0 6px var(--uri); }

.bar {
  position: relative; height: 9px;
  background: linear-gradient(180deg, #05070a, #10151d);
  border: 1px solid #000; outline: 1px solid rgba(80, 96, 120, .35);
  overflow: hidden;
}
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; transition: width .12s linear; }
.bar i::after { content: ""; position: absolute; inset: 0 0 50% 0; background: rgba(255, 255, 255, .22); }
.bar.hp i { background: linear-gradient(90deg, #127a3a, var(--hp)); }
.bar.sh i { background: linear-gradient(90deg, #104f9a, var(--sh)); }
.bar.exp { height: 12px; margin: 4px 0 6px; }
.bar.exp i { background: linear-gradient(90deg, #6436c9, #b27bff); }
.bar.exp em { position: absolute; inset: 0; font: 600 9px/12px var(--mono); font-style: normal; text-align: center; color: #fff; text-shadow: 0 1px 2px #000; }

.admin-link {
  display: block; margin-top: 8px; padding: 4px; text-align: center; text-decoration: none;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #1b1206;
  background: linear-gradient(180deg, #f6c264, #b8771c); border: 1px solid #5a3a0c; border-radius: 3px;
}
.god-flag { margin-top: 6px; text-align: center; font-size: 11px; font-weight: 700; color: var(--amber); letter-spacing: .1em; text-transform: uppercase; }
#announce {
  position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); max-width: 80vw;
  padding: 12px 32px; text-align: center; font-size: 22px; font-weight: 800; letter-spacing: .06em; color: #ffe2a3;
  text-shadow: 0 0 16px rgba(240, 180, 76, .8), 0 2px 2px #000; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .75), transparent);
  border-top: 1px solid rgba(240, 180, 76, .5); border-bottom: 1px solid rgba(240, 180, 76, .5);
}
#chat-lines .adm { color: var(--amber); font-weight: 800; }
.logout { width: 100%; margin-top: 8px; padding: 4px; font-size: 11px; }
.pilot { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 4px; color: #fff; }
.f-ico { width: 18px; height: 18px; display: inline-block; }
.f-ico svg { width: 100%; height: 100%; }

/* --- Login --- */
#auth {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 120%, rgba(240, 150, 60, .18), transparent 60%),
              radial-gradient(ellipse at center, rgba(8, 14, 30, .2), rgba(0, 0, 0, .75));
}
.auth-wrap { width: 100%; max-width: 420px; margin: auto; }
.logo { text-align: center; margin-bottom: 18px; }
.logo-main {
  font: 900 52px/1 var(--font); letter-spacing: .12em;
  background: linear-gradient(180deg, #ffffff 0%, #c9d6e8 45%, #6f7f96 52%, #dfe8f5 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #000) drop-shadow(0 0 18px rgba(111, 211, 255, .35));
}
.logo-main span {
  background: linear-gradient(180deg, #ffe2a3 0%, #f0b44c 45%, #a8621a 52%, #ffcf73 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-sub { color: var(--amber); letter-spacing: .35em; text-transform: uppercase; font-size: 11px; margin-top: 8px; text-shadow: 0 0 8px rgba(240, 180, 76, .5); }
.auth-win { margin-bottom: 12px; }
.auth-win .win-title { cursor: default; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 12px; }
#auth-form label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  background: #06090e; border: 1px solid #000; outline: 1px solid rgba(80, 96, 120, .45);
  border-radius: 2px; color: #fff; text-transform: none; letter-spacing: normal;
  user-select: text; -webkit-user-select: text;
}
input:focus { outline-color: var(--amber); }
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.factions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 10px; }
.factions button {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px; text-transform: none;
  color: var(--fc);
}
.factions button svg { width: 34px; height: 34px; filter: drop-shadow(0 0 6px var(--fc)); }
.factions button b { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.factions button small { color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: 0; }
.factions button.active { box-shadow: inset 0 0 18px color-mix(in srgb, var(--fc) 35%, transparent), 0 0 0 1px var(--fc); color: var(--fc); }
#auth-submit { width: 100%; padding: 10px; margin-top: 4px; font-size: 14px; }
.error { color: var(--bad); min-height: 1.2em; margin: 4px 0; font-size: 12px; }
#top-list table { width: 100%; border-collapse: collapse; font-size: 12px; }
#top-list td { padding: 3px 4px; border-bottom: 1px solid rgba(255, 255, 255, .04); }
#top-list td:first-child { color: var(--amber); width: 24px; }
#top-list td:last-child { text-align: right; color: var(--muted); }

/* --- HUD --- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud .win, #actionbar, #hud .overlay { pointer-events: auto; }
#hud > .win { position: absolute; }

#win-user { width: 220px; }
#win-ship { width: 220px; }
#win-map { width: 260px; }
#win-chat { width: 340px; }

#minimap { display: block; width: 100%; height: 158px; cursor: pointer; background: radial-gradient(ellipse at center, rgba(40, 70, 120, .25), rgba(0, 0, 0, .6)); border: 1px solid #000; }
.coords { font: 11px var(--mono); color: var(--muted); text-align: right; padding: 3px 4px 0; }

#chat-lines { height: 130px; overflow-y: auto; font-size: 12px; margin-bottom: 6px; user-select: text; -webkit-user-select: text; }
#chat-lines .sys { color: var(--amber); opacity: .8; }
#chat-lines b { font-weight: 600; }
#chat-input { margin-top: 0; padding: 6px 8px; }

#target {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 260px;
  padding: 6px 12px 8px; text-align: center; pointer-events: none;
  background: linear-gradient(180deg, rgba(40, 10, 10, .75), rgba(15, 5, 5, .75));
  border: 1px solid #000; outline: 1px solid rgba(255, 77, 77, .35); outline-offset: -2px;
}
.t-name { color: #ff6b6b; font-weight: 700; letter-spacing: .08em; margin-bottom: 4px; text-shadow: 0 0 8px rgba(255, 77, 77, .5); }
#target .bar { margin-bottom: 3px; height: 7px; }
.t-dist { color: var(--muted); font: 11px var(--mono); margin-top: 3px; }

#log {
  position: absolute; left: 50%; top: 96px; transform: translateX(-50%); width: min(520px, 90vw);
  display: flex; flex-direction: column; gap: 3px; align-items: center; pointer-events: none;
}
#log div {
  padding: 3px 14px; font-size: 13px; font-weight: 600; color: #e7f0ff;
  text-shadow: 0 1px 2px #000, 0 0 10px rgba(0, 0, 0, .8);
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .55), transparent);
  transition: opacity .6s, transform .6s;
}
#log .good { color: var(--good); }
#log .warn { color: var(--warn); }
#log .fade { opacity: 0; transform: translateY(-6px); }

#hint {
  position: absolute; bottom: 104px; left: 50%; transform: translateX(-50%);
  padding: 5px 16px; color: var(--amber); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .7), transparent);
  text-shadow: 0 0 10px rgba(240, 180, 76, .6); pointer-events: none;
}

#actionbar {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px 8px;
  background: linear-gradient(180deg, rgba(34, 42, 56, .95), rgba(10, 13, 19, .95));
  border: 1px solid #000; outline: 1px solid rgba(90, 108, 135, .4); outline-offset: -2px; border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
}
#actionbar .sep { width: 2px; margin: 4px 4px; background: linear-gradient(180deg, transparent, #3d4a5e, transparent); }
.slot {
  position: relative; width: 62px; height: 70px; padding: 16px 0 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: radial-gradient(ellipse at 50% 40%, #1d2533, #07090d);
  border: 1px solid #000; box-shadow: inset 0 0 0 1px rgba(90, 108, 135, .35), inset 0 -8px 14px rgba(0, 0, 0, .5);
  text-transform: none; letter-spacing: 0;
}
.slot kbd {
  position: absolute; top: 3px; left: 4px; font: 700 10px var(--mono); color: var(--amber); background: none; border: 0; padding: 0;
}
.slot svg { width: 28px; height: 28px; }
.slot span { font-size: 10px; color: var(--muted); font-weight: 600; }
.slot.active, .slot.on { box-shadow: inset 0 0 0 1px var(--amber), inset 0 0 16px rgba(240, 180, 76, .35), 0 0 10px rgba(240, 180, 76, .25); }
.slot.active span, .slot.on span { color: var(--amber); }
#b-attack.on { box-shadow: inset 0 0 0 1px var(--bad), inset 0 0 18px rgba(255, 77, 77, .45), 0 0 12px rgba(255, 77, 77, .35); }
#b-attack.on span { color: #ff8a8a; }

#help { position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%); width: 380px; }
#help ul { margin: 0; padding-left: 16px; }
#help li { margin: 4px 0; color: var(--muted); }
kbd { background: #06090e; border: 1px solid #2c3646; border-radius: 3px; padding: 0 5px; font: 11px/1.6 var(--mono); color: var(--amber); }

.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); padding: 16px;
}
.shop-win { width: 100%; max-width: 480px; }
.shop-win .win-title, .dead-win .win-title { cursor: default; }
#shop-note { color: var(--muted); margin: 0 0 8px; font-size: 12px; }
.shop-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .06); }
.shop-item .name { font-weight: 700; color: #fff; letter-spacing: .04em; }
.shop-item .desc { color: var(--muted); font-size: 11px; }
.shop-item .pips { display: flex; gap: 3px; margin-top: 5px; }
.shop-item .pips i { width: 16px; height: 6px; background: #06090e; border: 1px solid #000; outline: 1px solid rgba(80, 96, 120, .35); }
.shop-item .pips i.on { background: linear-gradient(180deg, #ffd27a, var(--amber)); box-shadow: 0 0 6px rgba(240, 180, 76, .5); }
.shop-item button { min-width: 128px; }
.shop-item button .gem { margin-right: 6px; }
#shop-stats { color: var(--muted); font-size: 11px; margin-top: 10px; font-family: var(--mono); }

.dead-win { max-width: 360px; text-align: center; }
.dead-win .win-title { color: var(--bad); text-shadow: 0 0 8px rgba(255, 77, 77, .5); }
.dead-win .win-title::before { background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.dead-win p { color: var(--muted); margin: 6px 0 14px; }

#conn { z-index: 30; }
#conn .win-body { padding: 14px 22px; }

@media (max-width: 900px) {
  #win-chat { width: 240px; }
  #chat-lines { height: 70px; }
  #win-map { width: 190px; }
  #minimap { height: 112px; }
  #win-ship { display: none; }
  .slot { width: 50px; height: 58px; padding-top: 14px; }
  .slot svg { width: 22px; height: 22px; }
  #hint { bottom: 86px; }
  #help { bottom: 80px; width: min(380px, 92vw); }
}

@media (max-width: 600px) {
  #win-chat { display: none; }
  #win-user { width: 170px; }
  #win-user .row:nth-of-type(4) { display: none; }
  .logo-main { font-size: 40px; }
  #target { top: auto; bottom: 90px; width: 200px; }
  #log { top: 64px; }
}

/* --- Fähigkeit --- */
.slot .cd { position: absolute; inset: 0; background: rgba(0, 0, 0, .65); transform-origin: bottom; transform: scaleY(0); pointer-events: none; }
.slot.cooling span { color: #6d7a8d; }

/* --- Hangar --- */
#hangar { z-index: 25; padding: 12px; }
.hangar-win { width: min(1180px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; }
.hangar-win .win-title { cursor: default; height: 30px; font-size: 12px; }
.hg-res { display: flex; align-items: center; gap: 4px; margin-right: 12px; font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--text); }
.hg-res b { margin-right: 10px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.hg-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid #000; background: rgba(0, 0, 0, .25); flex-wrap: wrap; }
.hg-tabs button { border-radius: 3px 3px 0 0; border-bottom: 0; padding: 7px 14px; }
.hg-tabs button.active { color: var(--amber); background: linear-gradient(180deg, #2b3446, #161c27); box-shadow: inset 0 2px 0 var(--amber); }
#hg-body { flex: 1; overflow: auto; padding: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 10px; }
.hg-sec { color: var(--amber); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin: 14px 0 6px; }
.hg-sec:first-child { margin-top: 0; }

.hg-equip { display: grid; grid-template-columns: 300px 1fr 300px; gap: 12px; min-height: 100%; }
.hg-preview { display: flex; flex-direction: column; gap: 8px; }
.hg-3d { width: 100%; height: 260px; display: block; border: 1px solid #000; outline: 1px solid rgba(90, 108, 135, .35);
  background: radial-gradient(ellipse at 50% 70%, rgba(240, 180, 76, .10), transparent 60%), radial-gradient(ellipse at center, #141c2b, #05070b); }
.hg-shipinfo h3, .hg-cardinfo h3 { margin: 0; font-size: 18px; letter-spacing: .08em; color: #fff; }
.hg-shipinfo .size { color: var(--muted); font-size: 12px; margin-bottom: 6px; text-transform: capitalize; }
.ability { margin-top: 8px; padding: 8px; background: rgba(178, 123, 255, .08); border-left: 2px solid #b27bff; font-size: 12px; }
.ability b { display: block; color: #d6b8ff; }
.ability span { color: var(--muted); }

.hg-slots { display: flex; flex-direction: column; gap: 10px; }
.hg-target { padding: 8px; border: 1px solid #000; outline: 1px solid rgba(90, 108, 135, .3); background: rgba(0, 0, 0, .2); cursor: pointer; }
.hg-target.sel { outline: 1px solid var(--amber); box-shadow: inset 0 0 18px rgba(240, 180, 76, .12); }
.hg-target.locked { opacity: .5; cursor: default; }
.hg-target h4 { margin: 0 0 6px; font-size: 11px; color: var(--amber); letter-spacing: .1em; text-transform: uppercase; }
.hg-target small { display: block; color: var(--muted); font-size: 10px; margin: -4px 0 6px; }
.hg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin-bottom: 8px; }
.hg-drones { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.hg-drones .hg-target h4 { font-size: 10px; }

.hg-item {
  display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center;
  width: 100%; min-height: 44px; padding: 5px 7px; text-align: left; text-transform: none; letter-spacing: 0;
  border-left: 3px solid #6b7686;
}
.hg-item svg { grid-row: span 2; width: 22px; height: 22px; }
.hg-item .n { font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hg-item .v { font-size: 10px; color: var(--muted); font-weight: 500; }
.hg-item.empty { display: flex; align-items: center; justify-content: center; color: #56627a; font-size: 11px; border: 1px dashed #2b3444; border-left: 1px dashed #2b3444; background: rgba(0, 0, 0, .25); }
.tier1 { border-left-color: #8d98a8 !important; }
.tier2 { border-left-color: #4fd17a !important; }
.tier3 { border-left-color: #4da3ff !important; }
.tier4 { border-left-color: #b27bff !important; }
.tier5 { border-left-color: #ffa24d !important; }

.hg-inv h4 { margin: 0 0 4px; font-size: 11px; color: var(--amber); letter-spacing: .1em; text-transform: uppercase; }
.hg-invlist { display: flex; flex-direction: column; gap: 5px; }
.hg-invrow { display: grid; grid-template-columns: 1fr auto; gap: 5px; }
.hg-invrow .sell { padding: 3px 8px; font-size: 10px; }

.hg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.hg-card { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 10px; border: 1px solid #000; outline: 1px solid rgba(90, 108, 135, .3); background: rgba(0, 0, 0, .22); }
.hg-card.active { outline-color: var(--amber); }
.hg-thumb { width: 130px; height: 130px; background: radial-gradient(ellipse at center, #182234, #05070b); border: 1px solid #000; }
.hg-cardinfo .badge.size { display: inline-block; margin: 2px 0 4px; padding: 1px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--amber); border: 1px solid rgba(240, 180, 76, .4); }
.hg-cardinfo .desc { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.hg-cardinfo .row { font-size: 12px; margin: 2px 0; }
.hg-cardinfo button { width: 100%; margin-top: 8px; }

.hg-shop { display: flex; flex-direction: column; gap: 5px; }
.hg-shoprow { display: grid; grid-template-columns: 26px 1fr auto auto auto; gap: 12px; align-items: center; padding: 7px 10px; background: rgba(0, 0, 0, .22); border-left: 3px solid; }
.hg-shoprow svg { width: 24px; height: 24px; }
.hg-shoprow .n b { display: block; color: #fff; }
.hg-shoprow .n span, .hg-shoprow .own { color: var(--muted); font-size: 11px; }
.hg-shoprow .p { font-variant-numeric: tabular-nums; color: var(--cyan); white-space: nowrap; }

.hg-dronebuy { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.hg-dcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; background: rgba(0, 0, 0, .22); border: 1px solid #000; outline: 1px solid rgba(90, 108, 135, .3); text-align: center; }
.hg-dcard svg { width: 34px; height: 34px; }
.hg-dcard small { color: var(--muted); font-size: 11px; }
.hg-dcard.owned { outline-color: rgba(79, 209, 122, .6); }
.hg-dcard .ok { color: var(--hp); font-size: 11px; font-weight: 700; }
.hg-dcard .lock { color: #56627a; font-size: 11px; }
.hg-dcard button { font-size: 11px; padding: 5px 8px; }
.hg-pet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px; background: rgba(0, 0, 0, .22); }
.hg-pet svg { width: 40px; height: 40px; }

@media (max-width: 1000px) {
  .hg-equip { grid-template-columns: 1fr; }
  .hg-3d { height: 200px; }
  .hg-drones { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
@media (max-width: 600px) {
  .hg-card { grid-template-columns: 90px 1fr; }
  .hg-thumb { width: 90px; height: 90px; }
  .hg-shoprow { grid-template-columns: 24px 1fr auto; }
  .hg-shoprow .own, .hg-shoprow .p { grid-column: 2; }
}

/* --- Handy / Touch --- */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, .slot { touch-action: manipulation; }
#hud { inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#touchpad { display: none; }

body.touch #touchpad {
  display: grid; position: absolute; right: 14px; bottom: 16px; z-index: 6; pointer-events: auto;
  grid-template-columns: auto auto; grid-template-rows: auto auto; gap: 10px; align-items: end; justify-items: end;
}
.tp-btn {
  position: relative; overflow: hidden; border-radius: 50%; padding: 0; display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 6px 18px rgba(0, 0, 0, .6);
  border: 2px solid rgba(90, 108, 135, .6);
}
.tp-btn.fire { width: 84px; height: 84px; grid-column: 2; grid-row: 2; color: #ff6a4d; background: radial-gradient(circle at 50% 35%, #3a2020, #140a0a); }
.tp-btn.fire svg { width: 42px; height: 42px; }
.tp-btn.fire.on { border-color: #ff4d4d; box-shadow: 0 0 22px rgba(255, 77, 77, .6), inset 0 0 18px rgba(255, 77, 77, .4); color: #fff; }
.tp-btn.fire.noTarget { opacity: .55; }
.tp-btn.ab { width: 60px; height: 60px; grid-column: 1; grid-row: 2; font-size: 20px; font-weight: 800; color: #d6b8ff; background: radial-gradient(circle at 50% 35%, #2c2240, #0f0a18); }
.tp-btn .cd { position: absolute; inset: 0; background: rgba(0, 0, 0, .65); transform-origin: bottom; transform: scaleY(0); pointer-events: none; }
.tp-small { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 17px; }
#t-full { grid-column: 2; grid-row: 1; }
#t-chat { grid-column: 1; grid-row: 1; }

body.touch #actionbar { left: 12px; transform: none; bottom: 12px; padding: 4px; gap: 3px; }
body.touch .slot { width: 46px; height: 50px; padding-top: 13px; }
body.touch .slot svg { width: 20px; height: 20px; }
body.touch .slot span { font-size: 9px; }
body.touch #b-attack, body.touch #b-ability, body.touch #help-toggle, body.touch #actionbar .sep { display: none; }
body.touch .win { min-width: 0; }
body.touch #win-user { width: 170px; }
body.touch #win-user .win-body { padding: 6px 8px; font-size: 12px; }
body.touch #win-map { width: 180px; }
body.touch #minimap { height: 108px; }
body.touch #win-chat { width: min(300px, 50vw); }
body.touch #win-chat.min { display: none; }
body.touch #win-chat { left: 12px !important; top: auto !important; bottom: 74px; }
body.touch #chat-lines { height: 90px; }
body.touch #win-ship { display: block; }
body.touch #hint { bottom: 76px; font-size: 11px; }
body.touch #log { top: 70px; width: min(420px, 60vw); }
body.touch #log div { font-size: 12px; }
body.touch #target { width: 210px; }
body.touch #help { width: min(380px, 92vw); }
body.touch .hangar-win { height: 100%; }
body.touch #hangar { padding: 0; }
body.touch #hg-body { padding: 8px; }

/* Querformat auf dem Handy: wenig Höhe, also alles kompakter */
@media (pointer: coarse) and (max-height: 500px) {
  #win-user .row:has(#h-kills), #win-user .bar.exp { display: none; }
  #win-ship { display: none !important; }
  #target { top: 8px; padding: 4px 10px 6px; }
  .tp-btn.fire { width: 74px; height: 74px; }
  .tp-btn.ab { width: 54px; height: 54px; }
  .hg-3d { height: 160px; }
}

#rotate { z-index: 40; background: rgba(0, 0, 0, .8); }
.rotate-win { max-width: 320px; text-align: center; }
.rot-ico { width: 72px; height: 72px; margin: 6px auto 4px; display: block; animation: rot 2.4s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
.rotate-win p { color: var(--text); margin: 8px 0 14px; }
@media (prefers-reduced-motion: reduce) { .rot-ico { animation: none; } }

/* --- Lobby (Verbinden / Update) --- */
#lobby { z-index: 35; background: radial-gradient(ellipse at center, rgba(8, 14, 30, .55), rgba(0, 0, 0, .88)); }
.lobby-wrap { width: 100%; max-width: 420px; }
.lobby-win { text-align: center; }
.lobby-win .win-title { cursor: default; }
.lobby-win h2 { margin: 6px 0 4px; font-size: 18px; letter-spacing: .08em; color: #fff; }
.lobby-win p { color: var(--muted); margin: 4px 0 10px; }
.lobby-pilot { color: var(--cyan) !important; font-size: 12px; }
#lobby-logout { margin-top: 6px; font-size: 11px; padding: 4px 12px; opacity: .8; }
.lobby-orbit { position: relative; width: 84px; height: 84px; margin: 6px auto; }
.lobby-orbit i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--amber); animation: spin 1.4s linear infinite; }
.lobby-orbit i:nth-child(2) { inset: 12px; border-top-color: var(--cyan); animation-duration: 2.1s; animation-direction: reverse; }
.lobby-orbit i:nth-child(3) { inset: 30px; background: radial-gradient(circle, #7fb2ff, #1b2a4a); border: 0; animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lobby-orbit i { animation: none; } }

/* --- Werkstatt --- */
.hg-work { display: flex; flex-direction: column; gap: 5px; }
.hg-workrow { display: grid; grid-template-columns: 26px 1fr auto auto auto; gap: 12px; align-items: center; padding: 7px 10px; background: rgba(0, 0, 0, .22); border-left: 3px solid #6b7686; }
.hg-work > .hg-workrow:not([class*="tier"]) { grid-template-columns: 1fr auto auto auto; border-left-color: var(--amber); }
.hg-workrow svg { width: 24px; height: 24px; }
.hg-workrow .n b { display: block; color: #fff; }
.hg-workrow .n span { color: var(--muted); font-size: 11px; }
.hg-workrow .p { color: var(--cyan); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lvbar { display: flex; gap: 2px; }
.lvbar i { width: 6px; height: 10px; background: #06090e; border: 1px solid #000; }
.lvbar i.on { background: linear-gradient(180deg, #ffd27a, var(--amber)); }
@media (max-width: 700px) {
  .hg-workrow, .hg-work > .hg-workrow:not([class*="tier"]) { grid-template-columns: 1fr auto; }
  .hg-workrow svg, .lvbar { display: none; }
}

/* Kontext-Knopf (Portal / Hangar) und antippbarer Hinweis */
#hud > #hint.tap { pointer-events: auto; cursor: pointer; }
body.touch #hint.tap { padding: 10px 22px; border: 1px solid rgba(240, 180, 76, .6); background: rgba(10, 14, 22, .85); border-radius: 4px; }
.tp-ctx {
  grid-column: 1 / span 2; grid-row: 1; justify-self: stretch; height: 46px; border-radius: 23px; font-size: 14px; letter-spacing: .06em;
  color: #1b1206; border-color: #5a3a0c; background: linear-gradient(180deg, #f6c264, #b8771c);
  box-shadow: 0 0 18px rgba(240, 180, 76, .55); animation: ctxPulse 1.6s ease-in-out infinite;
}
@keyframes ctxPulse { 50% { box-shadow: 0 0 28px rgba(240, 180, 76, .85); } }
@media (prefers-reduced-motion: reduce) { .tp-ctx { animation: none; } }
body.touch #touchpad:has(#t-ctx:not([hidden])) #t-full, body.touch #touchpad:has(#t-ctx:not([hidden])) #t-chat { display: none; }
