/* nutzbare Höhe: sichtbarer Bereich (iOS-Safari: --vh wird per JS gesetzt) minus Notch/Home-Indikator */
:root { --H: calc(var(--vh, 1vh) * 100 - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
/* Heist SolarWars – Pixel-Look */
:root {
  --bg: #070516; --panel: #14103a; --panel2: #1d1654; --b: #3b2f7a; --b2: #5b4fd0;
  --text: #e8e6ff; --muted: #8c86c8; --cyan: #5ee7ff; --gold: #ffd23f; --good: #7be26b; --bad: #ff5a5f;
  --mag: #ff4fd8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Courier New", Courier, monospace; font-size: 14px; overflow: hidden; }
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; image-rendering: pixelated; }
#app { position: relative; z-index: 1; height: calc(var(--vh, 1vh) * 100); }
.screen { height: var(--H); overflow: auto; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
h1, h2, h3, h4 { margin: 0 0 8px; letter-spacing: 1px; text-transform: uppercase; }
h2 { font-size: 18px; color: var(--cyan); } h3 { font-size: 14px; color: var(--gold); } h4 { font-size: 12px; color: var(--muted); margin-top: 14px; }
p { margin: 6px 0; line-height: 1.4; }
hr { border: 0; border-top: 2px dashed var(--b); margin: 12px 0; }
b { color: #fff; }
.muted { color: var(--muted); } .small { font-size: 12px; } .good { color: var(--good); } .bad { color: var(--bad); } .gold { color: var(--gold); }
.warn { color: var(--gold); background: rgba(255, 210, 63, .08); padding: 8px; border-left: 4px solid var(--gold); }
.spacer { flex: 1; }
.wide { width: 100%; }
[hidden] { display: none !important; }

/* ---------- Pixel-Rahmen */
.px { position: relative; background: var(--panel); margin: 3px;
  box-shadow: 0 -3px 0 0 var(--b), 0 3px 0 0 var(--b), -3px 0 0 0 var(--b), 3px 0 0 0 var(--b), 0 8px 24px rgba(0, 0, 0, .5); }
.panel { padding: 14px; }
.col { display: flex; flex-direction: column; gap: 6px; min-height: 0; }

/* ---------- Buttons & Formulare */
.btn { position: relative; background: #2c2370; color: #fff; border: 0; padding: 8px 14px; margin: 3px; cursor: pointer;
  font: bold 13px "Courier New", monospace; letter-spacing: .5px;
  box-shadow: 0 -3px 0 0 var(--b2), 0 3px 0 0 #120d3a, -3px 0 0 0 var(--b2), 3px 0 0 0 #120d3a; }
.btn:hover:not(:disabled) { background: #3a2f94; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #0c7896; box-shadow: 0 -3px 0 0 var(--cyan), 0 3px 0 0 #053a4a, -3px 0 0 0 var(--cyan), 3px 0 0 0 #053a4a; }
.btn.primary:hover:not(:disabled) { background: #1294b8; }
.btn.bad { background: #7a1f2b; box-shadow: 0 -3px 0 0 var(--bad), 0 3px 0 0 #3a0c12, -3px 0 0 0 var(--bad), 3px 0 0 0 #3a0c12; color: #fff; }
.btn.good { background: #1f6a2a; box-shadow: 0 -3px 0 0 var(--good), 0 3px 0 0 #0c3a12, -3px 0 0 0 var(--good), 3px 0 0 0 #0c3a12; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.big { padding: 14px 22px; font-size: 16px; }
.btn.big small { display: block; font-weight: normal; color: #cfe9ff; margin-top: 4px; }
.btn.wide { display: block; width: calc(100% - 6px); text-align: center; }
.btn-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.btn-col { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
input, select { font: inherit; color: var(--text); background: #0b0828; border: 0; padding: 8px 10px; width: 100%;
  box-shadow: 0 -2px 0 0 var(--b), 0 2px 0 0 var(--b), -2px 0 0 0 var(--b), 2px 0 0 0 var(--b); margin: 2px; outline: none; }
input:focus, select:focus { box-shadow: 0 -2px 0 0 var(--cyan), 0 2px 0 0 var(--cyan), -2px 0 0 0 var(--cyan), 2px 0 0 0 var(--cyan); }
select { cursor: pointer; }
label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 8px 0 2px; }
label input, label select { text-transform: none; letter-spacing: 0; margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; text-transform: none; color: var(--text); }
label.check input { width: auto; }
.err { color: var(--bad); min-height: 18px; margin: 6px 0; }

/* ---------- Logo / Auth */
.logo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo.small { flex-direction: row; gap: 10px; align-items: flex-end; }
.pixel-text { image-rendering: pixelated; }
.auth-wrap { min-height: var(--H); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
.auth-card { width: min(380px, 92vw); }
.motd { color: var(--muted); max-width: 520px; text-align: center; }
.foot { color: var(--muted); font-size: 11px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tab { flex: 1; background: transparent; border: 0; color: var(--muted); padding: 8px; cursor: pointer; font: bold 13px "Courier New", monospace;
  border-bottom: 3px solid var(--b); }
.tab.on { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ---------- Hauptmenü */
.menu-top { display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.menu-top .who { display: flex; align-items: center; gap: 8px; }
.menu-grid { display: grid; grid-template-columns: 300px 1fr 300px; gap: 18px; padding: 8px 18px 24px; align-items: start; }
.center { align-items: center; }
.avatar-box { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.avatar-frame { background: radial-gradient(circle at 50% 40%, #2a2270, #0d0a2c); padding: 6px; box-shadow: 0 0 0 3px var(--b); }
.avatar-frame.big { padding: 10px; }
.avatar { display: block; }
.pname { font-size: 18px; font-weight: bold; color: #fff; }
.factions { display: flex; flex-direction: column; gap: 8px; }
.faction { display: flex; gap: 10px; align-items: center; text-align: left; background: #100c30; color: var(--text); border: 0; padding: 8px; cursor: pointer;
  font: inherit; box-shadow: 0 0 0 3px #261d5c; }
.faction:hover { background: #1a1445; }
.faction.on { box-shadow: 0 0 0 3px var(--fc); background: #1b1650; }
.faction .emb { width: 40px; height: 40px; image-rendering: pixelated; flex: none; }
.faction small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.play-btn { width: 280px; height: 280px; border: 0; padding: 0; cursor: pointer; margin: 12px 0 4px; background: none; position: relative;
  filter: drop-shadow(0 0 24px rgba(94, 231, 255, .5)); animation: pulse 2.4s ease-in-out infinite; }
.play-inner { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  background: linear-gradient(160deg, #1fb8e0, #0b6e94 55%, #07445f);
  clip-path: polygon(0 24px, 8px 24px, 8px 16px, 16px 16px, 16px 8px, 24px 8px, 24px 0, calc(100% - 24px) 0, calc(100% - 24px) 8px, calc(100% - 16px) 8px, calc(100% - 16px) 16px, calc(100% - 8px) 16px, calc(100% - 8px) 24px, 100% 24px, 100% calc(100% - 24px), calc(100% - 8px) calc(100% - 24px), calc(100% - 8px) calc(100% - 16px), calc(100% - 16px) calc(100% - 16px), calc(100% - 16px) calc(100% - 8px), calc(100% - 24px) calc(100% - 8px), calc(100% - 24px) 100%, 24px 100%, 24px calc(100% - 8px), 16px calc(100% - 8px), 16px calc(100% - 16px), 8px calc(100% - 16px), 8px calc(100% - 24px), 0 calc(100% - 24px));
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, .08); }
.play-btn:hover { filter: drop-shadow(0 0 34px rgba(255, 210, 63, .8)); transform: scale(1.03); }
.play-btn:active { transform: scale(.98); }
@keyframes pulse { 50% { filter: drop-shadow(0 0 40px rgba(94, 231, 255, .85)); } }
.play-hint { color: var(--muted); margin-bottom: 14px; }
.stats { display: flex; gap: 14px; margin-bottom: 14px; }
.stat { background: var(--panel); padding: 10px 22px; text-align: center; box-shadow: 0 0 0 3px var(--b); }
.stat b { display: block; font-size: 26px; } .stat small { color: var(--muted); }
.stat.good b { color: var(--good); } .stat.bad b { color: var(--bad); }
.hist-panel { width: 100%; max-height: 42vh; overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; padding: 6px 8px; border-bottom: 2px solid var(--b); }
.tbl td { padding: 7px 8px; border-bottom: 1px solid #241b58; vertical-align: middle; }
.tbl tr.dead { opacity: .5; }
.tbl .acts { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.wide-td { width: 220px; }
.frow { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-bottom: 1px solid #241b58; }
.frow .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; background: #4a4470; display: inline-block; flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }
.addfriend { display: flex; gap: 4px; align-items: center; margin-bottom: 8px; }
.tag { background: #2c2370; color: var(--cyan); font-size: 10px; padding: 1px 5px; margin-left: 5px; text-transform: uppercase; }
.tag.war { background: #5a1520; color: #ff9aa0; } .tag.ally { background: #14502a; color: #9affb0; } .tag.neutral { background: #2c2a50; color: #cfcbff; }
.swatch { display: inline-block; width: 22px; height: 22px; vertical-align: middle; box-shadow: 0 0 0 2px #0b0828; }
.swatch.sm { width: 12px; height: 12px; }

/* ---------- Ressourcen-Chips */
.ico { width: 16px; height: 16px; image-rendering: pixelated; vertical-align: middle; flex: none; }
.ico.big { width: 32px; height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #0b0828; padding: 2px 6px; font-size: 12px; white-space: nowrap; }
.chip.lack { color: var(--bad); }
.cost { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }

/* ---------- Modal / Toast */
.modal-back { position: fixed; inset: 0; background: rgba(3, 2, 14, .7); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { padding: 20px 24px; max-width: min(520px, 94vw); max-height: 92vh; overflow: auto; background: var(--panel2); width: 100%; }
.modal.wide { max-width: min(760px, 96vw); }
.modal h2 { margin-bottom: 14px; }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none; align-items: center; }
.toast { background: var(--panel2); padding: 10px 14px; max-width: 340px; box-shadow: 0 0 0 3px var(--b2); animation: slidein .2s; }
.toast.good { box-shadow: 0 0 0 3px var(--good); } .toast.bad { box-shadow: 0 0 0 3px var(--bad); }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
#invites { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 10px; }
.invite { display: flex; gap: 14px; align-items: center; padding: 10px 16px; background: var(--panel2); }
.spinner { display: flex; gap: 6px; justify-content: center; margin: 14px 0; }
.spinner i { width: 14px; height: 14px; background: var(--cyan); animation: bounce 1s infinite; }
.spinner i:nth-child(2) { animation-delay: .15s; } .spinner i:nth-child(3) { animation-delay: .3s; } .spinner i:nth-child(4) { animation-delay: .45s; }
@keyframes bounce { 50% { transform: translateY(-12px); background: var(--gold); } }
.queue-info { text-align: center; margin-bottom: 10px; }
.join-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.code-in { width: 110px; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.modal > .btn.big { margin-bottom: 10px; }
.av-edit { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.av-rows { flex: 1; min-width: 230px; }
.av-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.av-row .lbl { width: 110px; color: var(--muted); font-size: 12px; }
.av-row .val, .av-row .swatch { flex: 1; text-align: center; }
.av-row .swatch { height: 22px; }

/* ---------- Lobby */
.lobby-wrap { min-height: var(--H); display: flex; flex-direction: column; }
.lobby-grid { display: grid; grid-template-columns: 300px 1fr 300px; gap: 18px; padding: 8px 18px; flex: 1; align-items: start; }
.codebox { display: flex; align-items: center; gap: 10px; background: #0b0828; padding: 8px 10px; }
.codebox b { font-size: 24px; letter-spacing: 5px; color: var(--gold); flex: 1; }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.pcard { display: flex; gap: 12px; align-items: center; background: #0f0b30; padding: 10px; box-shadow: 0 0 0 3px var(--pc, var(--b)); }
.pcard.empty { justify-content: center; color: var(--muted); box-shadow: 0 0 0 3px #261d5c; min-height: 84px; border: 0; }
.pcard .pinfo { display: flex; flex-direction: column; gap: 6px; }
.crown { color: var(--gold); }
.lobby-foot { display: flex; gap: 12px; padding: 14px 18px; align-items: center; }
.setting { display: block; }

/* ---------- Planetenwahl */
.pick-wrap { height: var(--H); display: flex; flex-direction: column; padding: 14px 18px; gap: 10px; }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pick-timer { font-size: 22px; font-weight: bold; color: var(--cyan); }
.pick-timer.hurry { color: var(--bad); animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.pick-main { flex: 1; display: grid; grid-template-columns: 1fr 330px; gap: 14px; min-height: 0; }
.solar-box { position: relative; width: 100%; height: 100%; min-height: 300px; }
.solar-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pick-side { overflow: auto; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dotted #2d2468; font-size: 13px; }
.kv span { color: var(--muted); }

/* ---------- Spiel */
.game { display: flex; flex-direction: column; height: var(--H); }
.game .game-body { flex: 1; min-height: 0; }
.hud { display: flex; gap: 8px; align-items: center; padding: 6px 12px; margin: 6px; flex-wrap: wrap; }
.hud-res { display: flex; gap: 8px; }
.rchip { display: flex; align-items: center; gap: 6px; background: #0b0828; padding: 4px 8px; min-width: 108px; }
.rchip .ico { width: 22px; height: 22px; }
.rtxt b { font-size: 15px; } .rtxt b.full { color: var(--gold); } .rtxt small { color: var(--muted); } .rtxt em { display: block; font-style: normal; color: var(--good); font-size: 11px; }
.hud-mid { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.hud-mid .victory { color: var(--gold); }
.hud-tabs { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
.tabbtn { position: relative; background: transparent; border: 0; color: var(--muted); padding: 8px 7px; font-size: 12px; cursor: pointer; font: bold 13px "Courier New", monospace;
  border-bottom: 3px solid transparent; }
.tabbtn:hover { color: #fff; } .tabbtn.on { color: var(--cyan); border-bottom-color: var(--cyan); background: rgba(94, 231, 255, .06); }
.badge { background: var(--bad); color: #fff; font-style: normal; font-size: 10px; padding: 0 5px; margin-left: 5px; }
.banner { background: #5a1520; padding: 8px 14px; margin: 0 6px; text-align: center; }
.game-body { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 10px; padding: 0 10px 10px; min-height: 0; }
.game-body[data-tab="fleet"], .game-body[data-tab="diplo"], .game-body[data-tab="log"], .game-body[data-tab="progress"] { grid-template-columns: minmax(0, 1fr); }
.game-body[data-tab="fleet"] .side, .game-body[data-tab="diplo"] .side, .game-body[data-tab="log"] .side, .game-body[data-tab="progress"] .side { display: none; }
.sec { position: relative; min-height: 0; overflow: auto; }
.sec-map, .sec-solar { overflow: hidden; background: #040210; box-shadow: 0 0 0 3px var(--b); margin: 3px; }
.sec-fleet, .sec-diplo, .sec-log { padding: 16px 20px; }
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; touch-action: none; }
.map-tools { position: absolute; top: 8px; left: 8px; display: flex; gap: 2px; align-items: center; background: rgba(7, 5, 22, .8); padding: 2px 4px; }
.map-tools select { width: 150px; padding: 5px 8px; }
.hoverinfo { position: absolute; left: 8px; bottom: 8px; background: rgba(7, 5, 22, .85); padding: 4px 10px; font-size: 12px; pointer-events: none; }
.map-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; color: var(--muted); font-size: 16px; }
.side { overflow-y: auto; padding: 14px; min-height: 0; }
.side h2 { display: flex; align-items: center; gap: 8px; }
.lvl { color: var(--gold); font-size: 12px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px; margin: 6px 0; background: #0f0b30; }
.opt.locked { opacity: .55; }
.opt .otxt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt small { color: var(--muted); font-size: 11px; }
.qbtns { display: flex; flex-direction: column; gap: 2px; }
.bar { position: relative; height: 12px; background: #0b0828; box-shadow: 0 0 0 2px #261d5c; margin: 6px 2px; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #0c7896, var(--cyan)); }
.bar.big { height: 20px; } .bar.sm { height: 8px; flex: 1; margin: 0 2px; }
.bar .t { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 20px; color: #fff; text-shadow: 1px 1px 0 #000; }
.bar:not(.big) .t { line-height: 12px; }
.hpbar { height: 8px; }
.qrow { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.help { margin-top: 18px; padding: 10px; background: rgba(94, 231, 255, .06); border-left: 4px solid var(--cyan); font-size: 12px; color: #cfd0ff; }
.legend p { font-size: 12px; color: var(--muted); }

/* ---------- Diplomatie / Log / Senden */
.control-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.control-grid .cell { background: #0f0b30; padding: 6px 8px; border-left: 4px solid; display: flex; flex-direction: column; }
.log-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.loglist { max-height: calc(var(--H) - 260px); overflow: auto; background: #0b0828; padding: 8px; min-height: 120px; }
.logrow { padding: 3px 0; border-bottom: 1px solid #1b1548; font-size: 13px; }
.logrow.good { color: var(--good); } .logrow.bad { color: #ff9aa0; } .logrow small { color: var(--muted); }
.chatform { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.send-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.send-list { display: flex; flex-direction: column; gap: 6px; }
.srow { display: flex; align-items: center; gap: 10px; background: #0f0b30; padding: 6px 8px; }
.srow small { flex: 1; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 2px; } .stepper b { min-width: 28px; text-align: center; }
.send-sum { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; padding: 8px 10px; background: #0b0828; }
.big-p { font-size: 16px; text-align: center; margin: 14px 0; }
.modal > canvas.pixel-text { display: block; margin: 0 auto; max-width: 100%; }

@media (max-width: 1050px) {
  .menu-grid, .lobby-grid { grid-template-columns: 1fr; }
  .pick-main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .game-body { grid-template-columns: 1fr; grid-template-rows: minmax(240px, 1fr) clamp(140px, 30vh, 260px); }
  .log-cols, .send-grid { grid-template-columns: 1fr; }
  .play-btn { width: 220px; height: 220px; }
  .screen { overflow: auto; }
}
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: #0b0828; } ::-webkit-scrollbar-thumb { background: var(--b2); }

/* ---------- Spielmodi / Formationen */
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.mode-grid .btn { margin: 3px 3px 8px; margin-bottom: 8px; }
.formation { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; margin: 4px 0; background: #0f0b30;
  border-left: 4px solid; cursor: pointer; }
.formation:hover { background: #1a1445; }
.formation small { width: 100%; color: var(--muted); font-size: 11px; }
.game, .pick-wrap, .solar-box { user-select: none; -webkit-user-select: none; }
.game input, .game .loglist { user-select: text; }
.place-msg { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: rgba(12,120,150,.92); padding: 6px 14px; font-weight: bold; pointer-events: none; box-shadow: 0 0 0 2px var(--cyan); }
.tbl tr.clickable { cursor: pointer; } .tbl tr.clickable:hover td { background: #1a1445; }
.prog .acts { white-space: nowrap; }
.srow .otxt { display: flex; flex-direction: column; flex: 1; gap: 2px; min-width: 0; }
.srow .otxt small { color: var(--muted); font-size: 11px; flex: none; }
.stance-row { display: flex; gap: 4px; flex-wrap: wrap; }
.solar-zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 2px; z-index: 2; }
.tbl.mini { font-size: 12px; margin: 6px 0; } .tbl.mini td, .tbl.mini th { padding: 4px 4px; }
.games-panel { width: 100%; }
.grow { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid #241b58; }
.grow .ginfo { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sec-map::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(4,2,16,.5) 100%); }

/* ---------- Innenansicht von Weltraumhangar / Kreuzer */
.interior h2 { display: flex; align-items: center; gap: 8px; }
.interior .hull { background: linear-gradient(#161b30, #0d1124); border: 3px solid #3d4764; padding: 10px 12px; margin: 8px 0; }
.interior .hull h4 { margin: 0 0 6px; display: flex; justify-content: space-between; }
.interior .seats { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.interior .seat { aspect-ratio: 1; background: #1d2540; border: 1px solid #3d4764; display: flex; align-items: center; justify-content: center; }
.interior .seat.empty { border-style: dashed; border-color: #2a3358; background: #121830; }
.interior .seat img { width: 80%; image-rendering: pixelated; }
.interior .bays { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.interior .bay { background: #121830; border: 1px solid #3d4764; padding: 2px; }
.interior .bay.empty { border-style: dashed; opacity: .55; }
.interior .bay img { width: 100%; display: block; image-rendering: pixelated; }
.interior .urow { display: flex; align-items: center; gap: 8px; background: #0f0b30; padding: 6px 8px; margin: 4px 0; }
.interior .urow .nm { flex: 1; display: flex; flex-direction: column; }
.interior .urow small { color: var(--muted); }
.interior .urow .grp { display: flex; align-items: center; gap: 3px; }
.interior .urow b.cnt { min-width: 34px; text-align: center; }
.tbl tr.dbl { cursor: pointer; } .tbl tr.dbl:hover td { background: #1a1450; }

.reqs { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.reqs small.good { color: var(--good); } .reqs small.bad, .otxt small.bad { color: #ff9aa0; }

/* ---------- Kleine Fenster / niedrige Auflösungen */
@media (max-width: 720px) {
  .hud-res { flex-wrap: wrap; }
  .rchip { min-width: 0; flex: 1 1 38%; }
  .menu-top { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
}
@media (max-height: 640px) {
  .hud { padding: 3px 8px; margin: 3px; }
  .rchip { padding: 2px 6px; }
}


/* ---------- Touch / Handy / Tablet / iPhone (Safari) */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
.map-canvas, .solar-canvas, .solar-box canvas { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; image-rendering: pixelated; }
#app { box-sizing: border-box; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.modal-back { padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.modal { max-height: calc(var(--vh, 1vh) * 92); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.side, .sec, .screen, .loglist { -webkit-overflow-scrolling: touch; }
@media (pointer: coarse) {
  .btn { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
  .btn.sm { min-height: 36px; padding-left: 12px; padding-right: 12px; }
  .hud-tabs button, .hud-tabs .tab { min-height: 38px; }
  input, select, textarea { font-size: 16px; min-height: 40px; }   /* verhindert das automatische Hineinzoomen von iOS-Safari */
  .stepper .btn { min-width: 38px; }
  .interior .urow .btn { min-width: 40px; }
  .solar-zoom .btn { min-width: 44px; min-height: 44px; font-size: 20px; }
  .opt .btn, .urow .btn { min-height: 38px; }
}
@media (max-width: 700px) {
  .game-body { padding: 0 6px 6px; gap: 6px; }
  .modal { padding: 14px; }
  .hud { margin: 3px; }
}

/* ---------- Kompaktes Spiel-HUD auf Handys (Hoch- und Querformat) */
@media (max-width: 760px), (max-height: 520px) {
  .hud { gap: 4px 6px; padding: 4px 6px; margin: 3px; align-items: center; }
  .hud-res { order: 1; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .hud-res::-webkit-scrollbar { display: none; }
  .rchip { flex: 0 0 auto; min-width: 0; padding: 2px 7px; gap: 5px; }
  .rchip .ico { width: 18px; height: 18px; }
  .rtxt b { font-size: 13px; } .rtxt small { display: none; } .rtxt em { font-size: 10px; }
  .hud-tabs { order: 3; flex: 1 1 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; gap: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .hud-tabs::-webkit-scrollbar { display: none; }
  .tabbtn { flex: 0 0 auto; white-space: nowrap; padding: 6px 10px; font-size: 12px; }
  .hud-mid { order: 2; flex: 1 1 auto; flex-direction: row; flex-wrap: wrap; gap: 2px 10px; font-size: 11px; }
  .hud > .btn { order: 2; }
  .map-tools { gap: 4px; }
  .map-tools .bodysel { max-width: 40vw; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .game-body { grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: none; }
  .side { padding: 8px; }
}
@media (max-width: 760px), (max-height: 520px) {
  .hud > .btn { min-height: 32px; padding: 4px 9px; font-size: 11px; }
}
@media (max-height: 520px) {
  .hud-res { flex: 1 1 0; min-width: 0; }
  .hud-tabs { flex: 1 1 100%; }
  .hud-mid { flex: 0 0 auto; flex-direction: column; font-size: 10px; }
  .tabbtn { padding: 4px 9px; }
  .map-tools .btn, .map-tools select { min-height: 30px; padding-top: 3px; padding-bottom: 3px; }
  .map-tools .bodysel { max-width: 24vw; }
  .rchip { padding: 1px 6px; }
}

/* Reiter immer in EINER Reihe unter der Ressourcenanzeige, sobald es eng wird (waagerecht scrollbar statt umzubrechen) */
@media (max-width: 1600px) {
  .hud-res { order: 1; flex: 1 1 0; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .hud-res::-webkit-scrollbar { display: none; }
  .rchip { flex: 0 0 auto; }
  .hud-mid { order: 2; flex: 0 0 auto; }
  .hud > .btn { order: 2; }
  .hud-tabs { order: 3; flex: 1 1 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .hud-tabs::-webkit-scrollbar { display: none; }
  .tabbtn { flex: 0 0 auto; white-space: nowrap; }
}

/* ---------- Level / Shop */
.lvlbox { display: flex; flex-direction: column; gap: 2px; min-width: 130px; }
.lvlbox .lvl { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.lvlbox .lvl b { color: var(--gold); }
.lvlbox .bar.sm { height: 6px; }
.lvlbox small { color: var(--muted); font-size: 11px; } .lvlbox small.gold { color: var(--gold); }
.shop .opt .otxt small.gold { color: var(--gold); }
.tag { margin-left: 6px; }
.gold { color: var(--gold); }
.xpbox { margin: 10px 0; padding: 8px 12px; background: #0b0828; border-left: 4px solid var(--gold); } .xpbox h4 { color: var(--gold); margin: 0 0 6px; }

/* Handel unter Verbündeten */
.trade { margin: 14px 0; }
.trade-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 8px 0; }
.trade-form label { display: flex; flex-direction: column; gap: 4px; }
.trade-form label select, .trade-form label input { width: auto; min-width: 110px; }
.trade .srow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; }
.trade h4 { margin: 10px 0 4px; }

/* Ansichten der Karte: full (Standard) / nopanel (ohne Infotafel) / map (nur Karte) */
.view-btn { position: absolute; top: 8px; right: 8px; z-index: 3; background: rgba(7, 5, 22, .8); min-width: 32px; }
.game[data-view="nopanel"] .game-body[data-tab="map"], .game[data-view="map"] .game-body[data-tab="map"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.game[data-view="nopanel"] .game-body[data-tab="map"] .side, .game[data-view="map"] .game-body[data-tab="map"] .side { display: none; }
.game[data-view="map"] .hud { display: none; }
.game[data-view="map"] .game-body { padding: 0; }
.map-tools { max-width: calc(100% - 60px); flex-wrap: wrap; }
@media (max-width: 520px) { .map-tools .bodysel { max-width: 26vw; } }
.npc-head { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0; } .npc-head p { margin: 0; }

/* Shop: Avatar-Skins */
.shop .tabs { display: flex; gap: 6px; margin: 8px 0; }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.skin-card { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 8px; background: rgba(94, 231, 255, .05); border: 2px solid #3b2f7a; }
.skin-card.own { border-color: #7be26b; }
.skin-prev { background: #0a0820; padding: 4px; line-height: 0; }
.skin-prev canvas { image-rendering: pixelated; width: 96px; height: 96px; }
.skin-card small { min-height: 28px; font-size: 11px; }
.price { color: #5ee7ff; }
.av-row .val.skin { color: #ffd23f; }
.pay { text-align: center; }
.repairbar { margin: 8px 0; padding: 8px 10px; background: rgba(255, 210, 63, .08); border-left: 4px solid #ffd23f; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
