:root {
  --bg: #060b12;
  --panel: #0f1724;
  --panel-border: #243247;
  --text: #d8e3f5;
  --accent: #59f2c3;
  --danger: #ff6c8a;
  --muted: #94a7c2;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #132035 0%, #060b12 40%, #03060a 100%);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.combat-fx-line {
  position: fixed;
  height: 3px;
  transform-origin: left center;
  border-radius: 999px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  animation: combatFxLine 460ms ease-out forwards;
}

.combat-fx-line .combat-fx-bolt {
  display: block;
  position: absolute;
  left: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  box-shadow: 0 0 12px currentColor;
  animation: combatFxBolt 460ms ease-out forwards;
}

.combat-fx-line.projectile {
  height: 2px;
  background: transparent;
  box-shadow: none;
}

.combat-fx-line .combat-fx-trail {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 999px;
  opacity: 0.45;
  filter: blur(0.3px);
}

.combat-fx-line .combat-fx-projectile {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor, 0 0 20px color-mix(in srgb, currentColor 55%, transparent);
}

.combat-fx-line.outgoing {
  color: #5ac8ff;
}

.combat-fx-line.crit-out {
  color: #ffbc56;
}

.combat-fx-line.incoming {
  color: #ffffff;
}

.combat-fx-line.pvp-out {
  color: #71b5ff;
}

.combat-fx-line.pvp-in {
  color: #ffffff;
}

.combat-fx-line.tone-ion .combat-fx-trail {
  background: linear-gradient(90deg, rgba(90, 200, 255, 0.95), rgba(90, 200, 255, 0));
}

.combat-fx-line.tone-ion .combat-fx-projectile {
  background: radial-gradient(circle at 35% 35%, #dff8ff, #5ac8ff 45%, #147fd5 78%);
  color: #5ac8ff;
}

.combat-fx-line.tone-plasma .combat-fx-trail {
  background: linear-gradient(90deg, rgba(255, 122, 214, 0.95), rgba(169, 105, 255, 0.78), rgba(169, 105, 255, 0));
}

.combat-fx-line.tone-plasma .combat-fx-projectile {
  background: radial-gradient(circle at 35% 35%, #ffe4fa, #ff7ad6 42%, #8f5fff 78%);
  color: #ff7ad6;
}

.combat-fx-line.tone-antimatter .combat-fx-trail {
  background: linear-gradient(90deg, rgba(188, 108, 255, 0.95), rgba(88, 42, 160, 0));
}

.combat-fx-line.tone-antimatter .combat-fx-projectile {
  background: radial-gradient(circle at 35% 35%, #f3deff, #bc6cff 38%, #4e2389 80%);
  color: #bc6cff;
}

.combat-fx-line.tone-void .combat-fx-trail {
  background: linear-gradient(90deg, rgba(224, 203, 255, 0.95), rgba(76, 52, 128, 0.55), rgba(76, 52, 128, 0));
}

.combat-fx-line.tone-void .combat-fx-projectile {
  background: radial-gradient(circle at 35% 35%, #ffffff, #d6b7ff 36%, #3c246f 82%);
  color: #efe1ff;
}

.combat-fx-line.crit-out .combat-fx-trail {
  background: linear-gradient(90deg, rgba(255, 188, 86, 1), rgba(255, 188, 86, 0));
  height: 3px;
}

.combat-fx-line.crit-out .combat-fx-projectile {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 35% 35%, #fff6d8, #ffbc56 40%, #d67116 82%);
  color: #ffbc56;
}

.combat-fx-line.incoming .combat-fx-trail,
.combat-fx-line.pvp-in .combat-fx-trail {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 157, 196, 0.66), rgba(255, 157, 196, 0));
}

.combat-fx-line.incoming .combat-fx-projectile,
.combat-fx-line.pvp-in .combat-fx-projectile {
  background: radial-gradient(circle at 35% 35%, #ffffff, #ffd7ea 40%, #ff8fc0 78%);
  color: #fff7fb;
}

@keyframes combatFxLine {
  0% {
    opacity: 0;
    filter: blur(1px);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    filter: blur(0);
  }
}

@keyframes combatFxBolt {
  0% {
    left: 0%;
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.8);
  }
  70% {
    opacity: 1;
  }
  100% {
    left: 100%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

.combat-impact-flash {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  animation: combatImpactFlash 280ms ease-out forwards;
}

.combat-impact-flash::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0;
  animation: combatImpactPulse 280ms ease-out forwards;
}

.combat-impact-flash.outgoing,
.combat-impact-flash.pvp-out {
  box-shadow: 0 0 0 1px rgba(90, 200, 255, 0.65) inset, 0 0 24px rgba(90, 200, 255, 0.35);
  background: radial-gradient(circle at 50% 50%, rgba(90, 200, 255, 0.16), rgba(90, 200, 255, 0) 72%);
}

.combat-impact-flash.outgoing::before,
.combat-impact-flash.pvp-out::before {
  box-shadow: 0 0 0 2px rgba(90, 200, 255, 0.55) inset, 0 0 20px rgba(90, 200, 255, 0.4);
  background: radial-gradient(circle at 50% 50%, rgba(160, 232, 255, 0.28), rgba(90, 200, 255, 0) 72%);
}

.combat-impact-flash.crit-out {
  box-shadow: 0 0 0 1px rgba(255, 188, 86, 0.75) inset, 0 0 28px rgba(255, 188, 86, 0.45);
  background: radial-gradient(circle at 50% 50%, rgba(255, 188, 86, 0.22), rgba(255, 188, 86, 0) 72%);
}

.combat-impact-flash.crit-out::before {
  box-shadow: 0 0 0 2px rgba(255, 188, 86, 0.65) inset, 0 0 22px rgba(255, 188, 86, 0.5);
  background: radial-gradient(circle at 50% 50%, rgba(255, 233, 180, 0.35), rgba(255, 188, 86, 0) 72%);
}

.combat-impact-flash.incoming,
.combat-impact-flash.pvp-in {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 0 24px rgba(255, 145, 186, 0.34);
  background: radial-gradient(circle at 50% 50%, rgba(255, 145, 186, 0.18), rgba(255, 145, 186, 0) 72%);
}

.combat-impact-flash.incoming::before,
.combat-impact-flash.pvp-in::before {
  box-shadow: 0 0 0 2px rgba(255, 200, 227, 0.55) inset, 0 0 20px rgba(255, 145, 186, 0.4);
  background: radial-gradient(circle at 50% 50%, rgba(255, 230, 243, 0.28), rgba(255, 145, 186, 0) 72%);
}

@keyframes combatImpactFlash {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  25% {
    opacity: 1;
    transform: scale(1.01);
  }
  100% {
    opacity: 0;
    transform: scale(1.015);
  }
}

@keyframes combatImpactPulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.4);
  }
}

.npc,
.arena-player-target-card,
.arena-ship-card {
  position: relative;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  background: rgba(15, 23, 36, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head h2 {
  margin: 0;
}

.panel-toggle-btn {
  background: #101826;
  border-color: #2a3d59;
  padding: 6px 10px;
  font-size: 13px;
}

.mobile-nav-toggle {
  display: none;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 30px;
  color: var(--accent);
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.connection-status {
  margin: -2px 0 12px;
  border: 1px solid var(--panel-border);
  background: rgba(15, 23, 36, 0.9);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}

.connection-status.hidden {
  display: none;
}

.connection-status.warn {
  border-color: rgba(255, 126, 167, 0.35);
  background: rgba(58, 18, 31, 0.35);
  color: #ffd0dd;
}

.connection-status.info {
  border-color: rgba(90, 200, 255, 0.3);
  background: rgba(10, 36, 61, 0.28);
  color: #cceeff;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.login-install-row {
  margin-top: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.login-install-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

input,
select,
textarea {
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  padding: 10px 12px;
  font-size: 16px;
}

input,
select {
  background: #0a1220;
  color: var(--text);
  width: 100%;
}

button {
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  padding: 10px 12px;
  font-size: 15px;
  background: #17335c;
  color: #eff7ff;
  cursor: pointer;
}

button:hover {
  background: #204577;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.actions {
  margin-top: 12px;
  flex-wrap: wrap;
}

.panel h3 {
  margin: 14px 0 8px;
  font-size: 16px;
  color: var(--muted);
}

.loadout-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 10px;
  align-items: center;
}

.loadout-grid label {
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

#craftingBlueprintsBox,
#craftingUpgradesBox {
  display: grid;
  gap: 10px;
}

.craft-item {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  background: #0a1220;
}

.craft-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.craft-meta,
.craft-cost {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.craft-btn {
  margin-top: 8px;
}

.craft-status {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.craft-status.owned {
  background: rgba(123, 243, 200, 0.18);
  color: #9ff9dc;
}

.craft-status.craftable {
  background: rgba(111, 160, 255, 0.22);
  color: #bed7ff;
}

.craft-status.missing {
  background: rgba(255, 108, 138, 0.2);
  color: #ffb6c5;
}

.arena-jump-controls {
  margin-top: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.arena-controls {
  margin-top: 12px;
  justify-content: center;
}

.arena-controls button {
  min-width: 130px;
}

.cooldown-wrap {
  margin-top: 10px;
}

.cooldown-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #1c2a3f;
}

.cooldown-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #4bc1ff, #7bf3c8);
}

.cooldown-wrap #attackCooldownText {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ship-panel {
  grid-column: span 1;
}

.arena-panel {
  grid-column: span 1;
}

#arenaShipCard {
  margin-bottom: 10px;
}

.arena-ship-card {
  border: 1px solid #2a3d59;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(18, 33, 52, 0.9), rgba(10, 18, 32, 0.95));
}

.arena-ship-card.hp-only {
  padding: 8px 10px;
}

.arena-ship-card.in-combat {
  border-color: #d85a75;
  box-shadow: 0 0 0 1px rgba(216, 90, 117, 0.35), inset 0 0 0 999px rgba(216, 90, 117, 0.06);
}

.arena-ship-card.standby {
  border-color: #2a4f86;
  box-shadow: 0 0 0 1px rgba(79, 120, 179, 0.25), inset 0 0 0 999px rgba(79, 120, 179, 0.04);
}

.arena-ship-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.arena-ship-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.arena-ship-header span {
  color: var(--muted);
  font-size: 12px;
}

.arena-ship-transport {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid #335177;
  background: rgba(70, 108, 165, 0.12);
  color: #cfe2ff;
}

.arena-ship-transport.net-polling {
  border-color: rgba(89, 242, 195, 0.35);
  background: rgba(89, 242, 195, 0.08);
  color: #bfffe8;
}

.arena-ship-transport.net-websocket {
  border-color: rgba(255, 108, 138, 0.4);
  background: rgba(255, 108, 138, 0.08);
  color: #ffd0db;
}

.arena-ship-state {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.arena-ship-state-line {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.arena-ship-hpbar-only {
  margin-top: 0;
}

.arena-ship-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.arena-ship-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.arena-sector-players {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.arena-chip.arena-pvp-toggle {
  cursor: pointer;
}

.arena-chip.arena-pvp-toggle.pvp-on {
  border-color: rgba(255, 78, 116, 0.5);
  background: rgba(255, 78, 116, 0.14);
  color: #ffb6c5;
}

.arena-chip.arena-pvp-toggle.pvp-off {
  border-color: rgba(89, 242, 195, 0.45);
  background: rgba(89, 242, 195, 0.08);
  color: #bffce6;
}

.arena-chip-ok {
  border-color: rgba(89, 242, 195, 0.4);
  color: #bffce6;
}

.arena-chip-warn {
  border-color: rgba(255, 208, 109, 0.4);
  color: #ffe3a8;
}

.arena-sector-players-names {
  color: var(--muted);
  font-size: 12px;
}

.arena-ammo-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.arena-currency-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.arena-currency-card {
  border: 1px solid #29405f;
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(14, 23, 38, 0.72);
  display: grid;
  gap: 2px;
}

.arena-currency-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.arena-currency-card strong {
  font-size: 16px;
  color: #eaf3ff;
}

.arena-ship-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.action-bar-wrap {
  margin-bottom: 10px;
}

.action-bar-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.action-bar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.action-slot {
  border: 1px solid #273d5a;
  border-radius: 10px;
  background: rgba(12, 20, 34, 0.8);
  padding: 6px;
  min-width: 0;
}

.action-slot.empty {
  opacity: 0.75;
}

.action-slot.active {
  border-color: rgba(255, 210, 107, 0.45);
  background: rgba(255, 210, 107, 0.08);
}

.action-slot.cooldown {
  border-color: rgba(111, 160, 255, 0.35);
}

.action-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}

.action-slot-label {
  font-size: 11px;
  color: #a9bfdd;
  font-weight: 700;
}

.action-slot-clear {
  border-radius: 6px;
  padding: 1px 6px;
  min-height: auto;
  line-height: 1.1;
  font-size: 11px;
  background: rgba(255, 95, 127, 0.08);
  border-color: rgba(255, 95, 127, 0.3);
  color: #ffbfd0;
}

.action-slot-btn {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.15;
}

.action-slot-btn.active {
  border-color: rgba(255, 210, 107, 0.5);
  background: rgba(255, 210, 107, 0.14);
  color: #ffe3a8;
}

.action-slot-btn.cooldown {
  border-color: rgba(111, 160, 255, 0.45);
}

.action-slot-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #9fb6d5;
  text-align: center;
  min-height: 14px;
}

.arena-ammo-warning {
  margin-bottom: 10px;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 13px;
}

.arena-ammo-warning.danger {
  color: #ffd3dc;
  border: 1px solid rgba(255, 108, 138, 0.7);
  background: rgba(255, 108, 138, 0.14);
}

.arena-ammo-warning.warn {
  color: #ffe1a5;
  border: 1px solid rgba(255, 208, 109, 0.65);
  background: rgba(255, 208, 109, 0.12);
}

.arena-ammo-btn {
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid #2b4366;
  background: #11213a;
  color: #d8e3f5;
  font-size: 12px;
}

.arena-ammo-btn.active {
  border-color: #59f2c3;
  background: rgba(89, 242, 195, 0.2);
  color: #bfffe8;
}

.arena-chip {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  background: rgba(111, 160, 255, 0.18);
  color: #bed7ff;
}

.arena-ship-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px;
  align-items: center;
}

.arena-ship-svg {
  width: 100%;
  max-width: 170px;
  height: auto;
  display: block;
}

.arena-ship-meta {
  display: grid;
  gap: 4px;
  font-size: 14px;
}

.arena-ship-hp {
  font-size: 15px;
}

.shieldbar {
  width: 100%;
  background: #1d2234;
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}

.shieldbar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6da6ff, #9f7dff);
}

.log-panel {
  grid-column: span 2;
}

.grid.ship-collapsed .ship-panel,
.grid.arena-collapsed .arena-panel,
.grid.log-collapsed .log-panel {
  grid-column: span 2;
}

.grid.ship-collapsed .arena-panel {
  grid-column: span 2;
}

.ship-panel.collapsed,
.arena-panel.collapsed,
.log-panel.collapsed {
  padding-bottom: 12px;
}

.ship-panel.collapsed > :not(.ship-head),
.arena-panel.collapsed > :not(.panel-head),
.log-panel.collapsed > :not(.panel-head) {
  display: none !important;
}

.ship-panel.collapsed .ship-head,
.arena-panel.collapsed .panel-head,
.log-panel.collapsed .panel-head {
  margin-bottom: 0;
}

.ship-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ship-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ship-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.ship-tabs button {
  background: #101826;
  border-color: #2a3d59;
}

.ship-tabs button.active {
  background: #204577;
  border-color: #4f78b3;
}

.ship-subtabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.ship-subtabs button {
  background: #0f1724;
  border-color: #273a56;
}

.ship-subtabs button.active {
  background: #1b3a64;
  border-color: #4f78b3;
}

.ship-tab {
  display: none;
}

.ship-tab.active {
  display: block;
}

.ship-subtab-panel {
  display: none;
}

.ship-subtab-panel.active {
  display: block;
}

#shipStatsBox {
  overflow-x: auto;
}

#sessionEconomyBox {
  margin-bottom: 8px;
}

.session-econ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.session-econ-item {
  border: 1px solid #223348;
  border-radius: 8px;
  background: #0b1321;
  padding: 8px;
  display: grid;
  gap: 3px;
}

.session-econ-item span {
  color: var(--muted);
  font-size: 12px;
}

.session-econ-panels {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.session-econ-panel {
  border: 1px solid #223348;
  border-radius: 10px;
  background: #0b1321;
  padding: 10px;
}

.session-econ-panel h4 {
  margin: 0 0 8px;
  color: #bed7ff;
  font-size: 0.95rem;
}

.session-mini-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(39, 56, 79, 0.55);
}

.session-mini-row:last-child {
  border-bottom: 0;
}

.session-mini-row span {
  color: #a9bfdd;
}

.session-mini-row strong {
  color: #e8f3ff;
  text-align: right;
}

.session-empty-hint {
  color: #8fa8c8;
  font-size: 0.9rem;
}

#shipVisualBox {
  margin: 4px 0 10px;
}

.ship-visual-wrap {
  border: 1px solid #23364c;
  border-radius: 12px;
  padding: 10px;
  background: radial-gradient(circle at 50% 10%, #132034, #0a1220 66%);
}

.ship-visual-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.ship-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.ship-hull {
  fill: #304968;
  stroke: #89a9d3;
  stroke-width: 2;
}

.ship-cockpit {
  fill: #6fb7ff;
  opacity: 0.92;
}

.ship-shield-ring {
  fill: none;
  stroke: rgba(111, 160, 255, 0.35);
  stroke-width: 6;
}

.ship-engine-core {
  fill: #3a5a82;
}

.ship-engine-glow {
  fill: rgba(83, 203, 255, 0.2);
}

.ship-weapon-left,
.ship-weapon-right {
  fill: #4772a8;
}

.tier-1 {
  filter: saturate(0.85);
}

.tier-2 {
  filter: saturate(1);
}

.tier-3 {
  filter: saturate(1.1) brightness(1.05);
}

.tier-4 {
  filter: saturate(1.2) brightness(1.08);
}

.tier-5 {
  filter: saturate(1.3) brightness(1.13);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #27384f;
}

.stats-table th {
  color: #e8f3ff;
  background: #111c2d;
}

.inv-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid #223348;
  border-radius: 8px;
  margin-bottom: 6px;
  background: #0b1321;
}

.ammo-row {
  align-items: center;
  flex-wrap: wrap;
}

.ammo-buy-amount {
  width: 86px;
}

.shop-credits {
  margin: 0 0 10px;
  color: #bed7ff;
  font-weight: 700;
  background: rgba(111, 160, 255, 0.14);
  border: 1px solid #2a4f86;
  border-radius: 8px;
  padding: 8px 10px;
}

.shop-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.shop-tabs button.active {
  background: #2a4f86;
  border-color: #4f78b3;
}

.shop-subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.shop-subtabs button.active {
  background: #2a4f86;
  border-color: #4f78b3;
}

.shop-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.shop-presets-label {
  color: #9fb6d5;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.shop-preset-btn {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.shop-preset-btn.active {
  background: #2a4f86;
  border-color: #4f78b3;
}

.shop-section {
  display: none;
}

.shop-section.active {
  display: block;
}

.shop-item-card {
  padding: 10px 12px;
  border-radius: 10px;
}

.shop-item-card.shop-afford {
  border-color: rgba(82, 148, 231, 0.42);
}

.shop-item-card.shop-nope {
  border-color: rgba(255, 95, 127, 0.35);
  background: linear-gradient(0deg, rgba(255, 95, 127, 0.05), rgba(255, 95, 127, 0.05)), #0b1321;
}

.shop-item-actions {
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.shop-price-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(111, 160, 255, 0.16);
  color: #cde2ff;
  border: 1px solid rgba(111, 160, 255, 0.28);
}

.shop-total-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(111, 160, 255, 0.2);
}

.shop-total-badge.afford {
  color: #bfe1ff;
  background: rgba(111, 160, 255, 0.12);
  border-color: rgba(111, 160, 255, 0.28);
}

.shop-total-badge.nope {
  color: #ffb0bf;
  background: rgba(255, 95, 127, 0.12);
  border-color: rgba(255, 95, 127, 0.28);
}

.shop-role-chip {
  display: inline-block;
  margin-left: 8px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.shop-role-chip.role-combat {
  background: rgba(255, 136, 105, 0.16);
  color: #ffc3b0;
}

.shop-role-chip.role-defense {
  background: rgba(111, 160, 255, 0.16);
  color: #c4dcff;
}

.shop-role-chip.role-farming {
  background: rgba(123, 243, 200, 0.14);
  color: #aef8e3;
}

.shop-item-submeta {
  font-size: 0.88rem;
  color: #90b4db;
}

.consumable-buy-amount {
  width: 72px;
}

.consumable-row {
  align-items: center;
  flex-wrap: wrap;
}

.hint-inline {
  color: #9fb6d5;
  font-size: 12px;
  margin-left: 6px;
}

.inventory-item-row {
  align-items: center;
  gap: 12px;
}

.inventory-item-main {
  min-width: 0;
  flex: 1 1 auto;
}

.inventory-item-title {
  font-size: 1.05rem;
  line-height: 1.2;
}

.inventory-item-meta {
  margin-top: 4px;
  color: #a9bfdd;
  font-size: 0.95rem;
}

.consumable-pin-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.consumable-pin-label {
  font-size: 12px;
  color: #9fb6d5;
  font-weight: 700;
}

.consumable-pin-btn {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  min-height: auto;
  line-height: 1.1;
  border: 1px solid #2b4567;
  background: rgba(72, 104, 160, 0.12);
}

.consumable-pin-btn.active {
  border-color: rgba(89, 242, 195, 0.45);
  background: rgba(89, 242, 195, 0.16);
  color: #bfffe8;
}

.consumable-pin-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #91e5ca;
}

.inventory-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inv-stock-panel {
  min-width: 88px;
  border-radius: 10px;
  border: 1px solid #29456a;
  background: rgba(74, 123, 194, 0.12);
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
}

.inv-stock-panel span {
  color: #9fb6d5;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.inv-stock-panel strong {
  color: #e8f3ff;
  font-size: 1.2rem;
}

.inv-stock-panel.low {
  border-color: rgba(255, 210, 107, 0.4);
  background: rgba(255, 210, 107, 0.12);
}

.inv-stock-panel.low strong {
  color: #ffd88a;
}

.inv-stock-panel.zero {
  border-color: rgba(255, 95, 127, 0.45);
  background: rgba(255, 95, 127, 0.12);
}

.inv-stock-panel.zero strong {
  color: #ff9fb3;
}

.arena-consumable-effects {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 2px;
}

.arena-consumable-quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 4px;
}

.arena-consumable-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #2b4567;
  background: rgba(72, 104, 160, 0.14);
  color: #d5e7ff;
  font-size: 12px;
  font-weight: 700;
}

.arena-consumable-btn.active {
  border-color: rgba(255, 210, 107, 0.5);
  background: rgba(255, 210, 107, 0.14);
  color: #ffe4a8;
}

.arena-consumable-btn:disabled {
  opacity: 0.65;
}

.effect-chip {
  background: rgba(255, 210, 107, 0.16);
  color: #ffd88a;
  border: 1px solid rgba(255, 210, 107, 0.3);
}

.inv-module-group {
  margin-bottom: 10px;
}

.inv-module-group h4 {
  margin: 8px 0;
  color: #a9bfdd;
}

#equippedCardsBox {
  display: grid;
  gap: 10px;
}

.equip-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.equip-tabs button.active {
  background: #2a4f86;
  border-color: #4f78b3;
}

.equip-card {
  border: 1px solid #23364c;
  border-radius: 10px;
  padding: 12px;
  background: #0a1220;
  margin-bottom: 10px;
}

.equip-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.equip-chip {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  background: rgba(111, 160, 255, 0.18);
  color: #bed7ff;
}

.equip-card-stats {
  color: #a9bfdd;
  margin: 8px 0;
}

.equip-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.equip-card-actions label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.equip-amount-input {
  width: 90px;
}

@media (max-width: 720px) {
  .action-bar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#arenaBox .npc {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #0a1220;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

#arenaBox .npc:hover {
  border-color: #3a567c;
}

.npc-name-only {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #dbe9ff;
  line-height: 1.1;
}

#arenaBox .npc.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(89, 242, 195, 0.35);
}

#arenaBox .npc.hostile-engaged {
  border-color: #d85a75;
  box-shadow: 0 0 0 1px rgba(216, 90, 117, 0.35), inset 0 0 0 999px rgba(216, 90, 117, 0.06);
}

#arenaBox .npc.attacker-now {
  border-color: #ff4e74;
  box-shadow: 0 0 0 1px rgba(255, 78, 116, 0.5), 0 0 12px rgba(255, 78, 116, 0.4),
    inset 0 0 0 999px rgba(255, 78, 116, 0.08);
}

.npc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.npc-badge {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.npc-badge.type-passive {
  background: rgba(89, 242, 195, 0.18);
  color: #71ffd8;
}

.npc-badge.type-aggressive {
  background: rgba(255, 108, 138, 0.2);
  color: #ff8ca5;
}

.npc-badge.type-rare {
  background: rgba(255, 208, 109, 0.2);
  color: #ffd77c;
}

.npc-badge.type-combat {
  background: rgba(255, 78, 116, 0.18);
  color: #ffb6c5;
}

.npc-badge.type-stable {
  background: rgba(89, 242, 195, 0.16);
  color: #bffce6;
}

.npc-badge.type-dead {
  background: rgba(216, 90, 117, 0.18);
  color: #ffd3dc;
}

.arena-player-targets {
  margin-bottom: 10px;
}

.arena-subsection-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.arena-player-target-card {
  border: 1px solid rgba(85, 126, 194, 0.42);
  background: rgba(85, 126, 194, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 7px;
  cursor: pointer;
}

.arena-player-target-card.selected {
  border-color: #59f2c3;
  box-shadow: 0 0 0 1px rgba(89, 242, 195, 0.28), inset 0 0 0 999px rgba(89, 242, 195, 0.05);
}

.arena-player-target-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.arena-player-target-card.blocked {
  border-style: dashed;
}

.arena-player-target-flags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.arena-player-hpbar {
  margin-top: 5px;
  margin-bottom: 4px;
}

.arena-player-target-card.state-dead .arena-player-hpbar span {
  background: linear-gradient(90deg, #6e768f, #4f5568);
}

.npc-aggro-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #ffb7c5;
}

.npc-aggro-badge {
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: rgba(255, 78, 116, 0.18);
  color: #ffb6c5;
  border: 1px solid rgba(255, 78, 116, 0.35);
}

.float-layer {
  position: relative;
  height: 0;
  overflow: visible;
}

.float-text {
  position: absolute;
  right: 12px;
  bottom: 0;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(0, 0, 0, 0.6);
  -webkit-text-stroke: 0.35px rgba(0, 0, 0, 0.8);
  animation: floatUp 1800ms cubic-bezier(0.2, 0.78, 0.2, 1) forwards;
  pointer-events: none;
  z-index: 9999;
}

.float-text.world-float {
  position: fixed;
  right: auto;
  bottom: auto;
}

.float-text.dmg-out {
  color: #ff8ca5;
}

.float-text.crit-out {
  color: #ffd66e;
  font-size: 18px;
  text-shadow: 0 1px 0 #000, 0 0 10px rgba(255, 186, 72, 0.75);
  animation-duration: 2000ms;
}

.float-text.dmg-in {
  color: #ffbe7b;
}

.float-text.loot {
  color: #7bf3c8;
  font-size: 17px;
  animation-duration: 2300ms;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.98);
  }
  72% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translateY(-58px) scale(1.03);
  }
}

.hpbar {
  width: 100%;
  background: #1c2a3f;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
}

.hpbar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3fd27d, #c4ef59);
}

.arena-ship-xp-line {
  margin-top: 6px;
  color: #cfe0ff;
  font-size: 12px;
}

.xpbar {
  width: 100%;
  background: #1e233f;
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
  margin-top: 5px;
}

.xpbar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5aa8ff, #9f8cff);
}

#logList {
  margin: 0;
  padding-left: 18px;
  max-height: 240px;
  overflow: auto;
}

#logList li {
  margin-bottom: 6px;
  color: var(--muted);
}

.log-filters {
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.log-filters button {
  padding: 6px 10px;
  font-size: 13px;
}

.log-filters button.active {
  background: #2a4f86;
  border-color: #4f78b3;
}

.log-badge {
  display: inline-block;
  min-width: 56px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.log-badge.combat {
  background: rgba(255, 142, 121, 0.18);
  color: #ffb7a8;
}

.log-badge.reward {
  background: rgba(123, 243, 200, 0.18);
  color: #9ff9dc;
}

.log-badge.system {
  background: rgba(111, 160, 255, 0.18);
  color: #bed7ff;
}

.threat-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid rgba(216, 90, 117, 0.5);
  background: rgba(216, 90, 117, 0.12);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 7px;
}

.threat-name {
  font-weight: 700;
}

.threat-chip.top-priority {
  border-color: rgba(255, 197, 84, 0.75);
  background: rgba(255, 197, 84, 0.18);
}

.threat-priority {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(111, 160, 255, 0.22);
  color: #bed7ff;
}

.threat-live {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: rgba(255, 78, 116, 0.22);
  color: #ffb6c5;
}

.threat-type {
  font-size: 12px;
  color: #ff8ca5;
}

.threat-hp {
  margin-left: auto;
  font-size: 12px;
  color: #ffd2db;
}

.sector-player-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid rgba(85, 126, 194, 0.42);
  background: rgba(85, 126, 194, 0.1);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 7px;
}

.sector-player-chip.self {
  border-color: rgba(89, 242, 195, 0.55);
  background: rgba(89, 242, 195, 0.11);
}

.sector-player-name {
  font-weight: 700;
}

.sector-player-meta {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #bed7ff;
  background: rgba(111, 160, 255, 0.18);
}

.sector-player-state {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.sector-player-state.combat {
  color: #ffb6c5;
  background: rgba(255, 78, 116, 0.18);
  border: 1px solid rgba(255, 78, 116, 0.35);
}

.sector-player-state.dead {
  color: #ffd5de;
  background: rgba(216, 90, 117, 0.18);
  border: 1px solid rgba(216, 90, 117, 0.45);
}

.sector-player-state.stable {
  color: #bffce6;
  background: rgba(89, 242, 195, 0.12);
  border: 1px solid rgba(89, 242, 195, 0.35);
}

.hint {
  color: var(--muted);
  margin: 10px 0 0;
  font-size: 13px;
}

.combat-target-status {
  margin: 6px 0 6px;
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

#jumpInfo {
  color: var(--danger);
  font-size: 14px;
}

.arena-jump-controls,
.arena-controls {
  display: none !important;
}

#gamePanel {
  padding-bottom: 290px;
}

.hidden {
  display: none;
}

.mobile-combat-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(1080px, calc(100vw - 32px));
  bottom: 16px;
  z-index: 1200;
  border: 1px solid rgba(55, 82, 119, 0.95);
  border-radius: 18px;
  padding: 12px;
  background: rgba(7, 12, 20, 0.94);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
}

.mobile-combat-bar.hidden {
  display: none !important;
}

.mobile-combat-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #a9bfdd;
}

.mobile-combat-sector {
  font-weight: 700;
  color: #dbe9ff;
}

.mobile-combat-jumpinfo {
  text-align: right;
  color: var(--muted);
}

.mobile-combat-grid {
  display: grid;
  gap: 8px;
}

.mobile-combat-grid.primary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 8px;
}

.mobile-combat-grid.secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.mobile-combat-grid button {
  min-height: 44px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 6px;
}

.mobile-icon-btn {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
}

.mobile-btn-icon {
  width: 14px;
  height: 14px;
  display: block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  opacity: 0.95;
}

.mobile-btn-label {
  display: block;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.icon-attack {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23eaf3ff' d='M2 8l12-5-3 5 3 5z'/%3E%3C/svg%3E");
}

.icon-abort {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23eaf3ff' d='M3 3l10 10M13 3L3 13' stroke='%23eaf3ff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.icon-repair {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23eaf3ff' d='M6 2h4v4h4v4h-4v4H6v-4H2V6h4z'/%3E%3C/svg%3E");
}

.icon-revive {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23eaf3ff' d='M8 2a6 6 0 106 6h-2.2A3.8 3.8 0 118 4.2V7l4-3-4-3z'/%3E%3C/svg%3E");
}

.icon-up {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23eaf3ff' d='M8 2l5 6H9v6H7V8H3z'/%3E%3C/svg%3E");
}

.icon-jump {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23eaf3ff' d='M3 8l5-5v3h5v4H8v3z'/%3E%3C/svg%3E");
}

.icon-down {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23eaf3ff' d='M8 14l-5-6h4V2h2v6h4z'/%3E%3C/svg%3E");
}

.mobile-ammo-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(110px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.mobile-ammo-strip::-webkit-scrollbar {
  display: none;
}

.mobile-consumable-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(110px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.mobile-consumable-strip::-webkit-scrollbar {
  display: none;
}

.mobile-ammo-btn {
  min-height: 48px;
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  align-content: center;
  justify-items: start;
  background: rgba(18, 28, 43, 0.96);
  border-color: rgba(61, 91, 132, 0.9);
}

.mobile-ammo-btn.active {
  border-color: rgba(89, 242, 195, 0.65);
  background: rgba(89, 242, 195, 0.09);
}

.mobile-ammo-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.05;
}

.mobile-ammo-stock {
  font-size: 12px;
  color: var(--muted);
  line-height: 1;
}

.mobile-consumable-btn {
  min-height: 52px;
  border-radius: 10px;
  padding: 6px 8px;
  display: grid;
  gap: 2px;
  align-content: center;
  justify-items: start;
  background: rgba(18, 28, 43, 0.96);
  border-color: rgba(61, 91, 132, 0.9);
}

.mobile-consumable-btn.active {
  border-color: rgba(255, 208, 109, 0.55);
  background: rgba(255, 208, 109, 0.1);
}

.mobile-consumable-btn.cooldown {
  border-color: rgba(111, 160, 255, 0.5);
  background: rgba(111, 160, 255, 0.08);
}

.mobile-consumable-btn.empty,
.mobile-consumable-btn.missing {
  opacity: 0.7;
}

.mobile-consumable-slot {
  font-size: 10px;
  font-weight: 700;
  color: #a9bfdd;
  line-height: 1;
}

.mobile-consumable-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.05;
  text-align: left;
}

.mobile-consumable-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}

.mobile-nav-drawer.hidden {
  display: none !important;
}

@media (max-width: 800px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .mobile-combat-bar {
    opacity: 0;
    pointer-events: none;
  }

  .mobile-combat-bar {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .layout {
    padding: 12px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 14px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero p {
    font-size: 14px;
    line-height: 1.4;
  }

  .panel {
    padding: 14px;
    border-radius: 14px;
  }

  .panel-head,
  .ship-head,
  .arena-ship-header,
  .arena-ship-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head h2,
  .ship-head h2 {
    margin-bottom: 2px;
  }

  .panel-head-actions {
    width: 100%;
    justify-content: stretch;
  }

  .panel-toggle-btn {
    width: 100%;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }

  .row {
    flex-wrap: wrap;
  }

  #loginPanel .row,
  .ship-head-actions,
  .arena-jump-controls,
  .arena-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
  }

  #loginPanel .row > input,
  #loginPanel .row > button,
  .ship-head-actions > button,
  .arena-jump-controls > button,
  .arena-controls > button {
    width: 100%;
    min-height: 46px;
  }

  #loginPanel .row:first-of-type {
    grid-template-columns: 1fr;
  }

  #loginPanel .row:nth-of-type(2) input,
  #loginPanel .row:nth-of-type(2) button {
    grid-column: span 2;
  }

  .login-install-row {
    display: flex;
  }

  .ship-tabs,
  .ship-subtabs,
  .shop-tabs,
  .shop-subtabs,
  .equip-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .ship-tabs::-webkit-scrollbar,
  .ship-subtabs::-webkit-scrollbar,
  .shop-tabs::-webkit-scrollbar,
  .shop-subtabs::-webkit-scrollbar,
  .equip-tabs::-webkit-scrollbar {
    display: none;
  }

  .ship-tabs button,
  .ship-subtabs button,
  .shop-tabs button,
  .shop-subtabs button,
  .equip-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 42px;
  }

  .arena-ship-header-right {
    justify-content: flex-start;
  }

  #repairBtn,
  #reviveBtn {
    display: none !important;
  }

  .ship-head-actions {
    display: flex;
    justify-content: flex-end;
  }

  .arena-currency-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arena-ship-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .arena-ship-svg {
    max-width: 220px;
    margin: 0 auto;
  }

  .arena-ammo-switch,
  .action-bar-wrap,
  .arena-ship-actions {
    display: none !important;
  }

  .mobile-nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    align-items: start;
    padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px));
  }

  .mobile-nav-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 12, 0.72);
    backdrop-filter: blur(6px);
  }

  .mobile-nav-sheet {
    position: relative;
    width: 100%;
    max-width: none;
    max-height: min(540px, calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    overflow-y: auto;
    background: rgba(10, 18, 30, 0.98);
    border: 1px solid rgba(61, 91, 132, 0.9);
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
    padding: 14px;
    margin: 0;
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }

  .mobile-nav-head h3 {
    margin: 0;
    font-size: 18px;
  }

  .mobile-nav-close {
    width: auto;
    min-height: 38px;
    padding-inline: 12px;
  }

  .mobile-nav-section {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
  }

  .mobile-nav-section:last-child {
    margin-bottom: 0;
  }

  .mobile-nav-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8fb0d7;
    padding-left: 2px;
  }

  .mobile-nav-link {
    width: 100%;
    justify-content: flex-start;
    min-height: 46px;
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(17, 29, 45, 0.98);
    border-color: rgba(61, 91, 132, 0.92);
    font-weight: 700;
  }

  .log-panel {
    grid-column: span 1;
  }

  .grid.ship-collapsed .ship-panel,
  .grid.ship-collapsed .arena-panel,
  .grid.arena-collapsed .arena-panel,
  .grid.log-collapsed .log-panel {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .layout {
    padding: 10px;
  }

  .panel {
    padding: 12px;
  }

  .hero h1 {
    font-size: 22px;
  }

  .connection-status {
    padding: 10px 12px;
    font-size: 13px;
  }

  #loginPanel .row,
  .ship-head-actions,
  .arena-jump-controls,
  .arena-controls {
    grid-template-columns: 1fr;
  }

  #loginPanel .row:nth-of-type(2) input,
  #loginPanel .row:nth-of-type(2) button {
    grid-column: span 1;
  }

  .arena-currency-row,
  .session-econ-grid,
  .session-econ-panels {
    grid-template-columns: 1fr;
  }

  #gamePanel {
    padding-bottom: 340px;
  }

  .mobile-combat-bar {
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 8px;
  }

  .mobile-combat-meta {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .mobile-combat-jumpinfo {
    text-align: left;
  }

  .mobile-combat-grid.primary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mobile-ammo-strip {
    grid-auto-columns: minmax(84px, 1fr);
  }

  .mobile-consumable-strip {
    grid-auto-columns: minmax(84px, 1fr);
  }

  .arena-ammo-switch,
  .log-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .arena-ammo-switch button,
  .log-filters button {
    width: 100%;
    min-height: 42px;
  }

  .arena-player-target-card,
  #arenaBox .npc,
  .craft-item,
  .equip-card {
    padding: 12px;
  }

  .craft-head,
  .npc-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
